2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 using System.Runtime.InteropServices;
19 using Tizen.Applications;
21 internal static partial class Interop
23 internal static partial class WidgetService
25 internal enum ErrorCode : int
27 None = Tizen.Internals.Errors.ErrorCode.None,
28 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
29 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
30 ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy,
31 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
32 Canceled = Tizen.Internals.Errors.ErrorCode.Canceled,
33 IoError = Tizen.Internals.Errors.ErrorCode.IoError,
34 TimedOut = Tizen.Internals.Errors.ErrorCode.TimedOut,
35 NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported,
36 FileNoSpaceOnDevice = Tizen.Internals.Errors.ErrorCode.FileNoSpaceOnDevice,
37 Fault = -0x02F40000 | 0x0001,
38 AlreadyExist = -0x02F40000 | 0x0002,
39 AlreadyStarted = -0x02F40000 | 0x0004,
40 NotExist = -0x02F40000 | 0x0008,
41 Disabled = -0x02F40000 | 0x0010,
42 MaxExceeded = -0x02F40000 | 0x0011,
45 internal enum LifecycleEvent : int
55 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
56 internal delegate void InstanceCallback(string widgetId, string instanceId, IntPtr userData);
58 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
59 internal delegate int LifecycleCallback(string widgetId, LifecycleEvent e, string instanceId, IntPtr userData);
61 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
62 internal delegate void WidgetListCallback(string widgetId, int isPrime, IntPtr userData);
64 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_icon")]
65 internal static extern string GetIcon(string pkgId, string lang);
67 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_name")]
68 internal static extern string GetName(string widgetId, string lang);
70 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_nodisplay")]
71 internal static extern int GetNoDisplay(string widgetId);
73 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_widget_instance_list")]
74 internal static extern ErrorCode GetInstances(string widgetId, InstanceCallback callback, IntPtr userData);
76 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_set_lifecycle_event_cb")]
77 internal static extern ErrorCode SetLifecycleEvent(string widgetId, LifecycleCallback callback, IntPtr userData);
79 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_unset_lifecycle_event_cb")]
80 internal static extern ErrorCode UnsetLifecycleEvent(string widgetId, IntPtr userData);
82 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_trigger_update")]
83 internal static extern ErrorCode UpdateContent(string widgetId, string instanceId, SafeBundleHandle bundle, int force);
85 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_change_period")]
86 internal static extern ErrorCode ChangePeriod(string widgetId, string instanceId, double period);
88 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_content_of_widget_instance")]
89 internal static extern ErrorCode GetContent(string widgetId, string instanceId, out IntPtr bundle);
91 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_package_id")]
92 internal static extern string GetPkgId(string widgetId);
94 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_supported_sizes")]
95 internal static extern ErrorCode GetSupportedSizes(string widgetId, ref int cnt, out IntPtr w, out IntPtr h);
97 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_supported_size_types")]
98 internal static extern ErrorCode GetSupportedSizeTypes(string widgetId, ref int cnt, out IntPtr types);
100 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_preview_image_path")]
101 internal static extern string GetPreviewImagePath(string widgetId, int sizeType);
103 [DllImport(Libraries.WidgetService, EntryPoint = "widget_service_get_widget_list_by_pkgid")]
104 internal static extern ErrorCode GetWidgetListByPkgId(string pkgId, WidgetListCallback callback, IntPtr userData);