2 * Copyright (c) 2017 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;
20 using Tizen.Applications.Shortcut;
22 internal static partial class Interop
24 internal static partial class Shortcut
26 internal delegate int AddCallback(string appId, string shortcutName, int type, string contentInfo, string iconPath, int processId, double period, bool isAllowDuplicate, IntPtr data);
28 internal delegate int DeleteCallback(string appId, string shortcutName, int processId, IntPtr data);
30 internal delegate int ResultCallback(int ret, IntPtr data);
32 internal delegate int ListCallback(string package_name, string icon, string name, string extra_key, string extra_data, IntPtr user_data);
35 /// Enumeration for values of shortcut response types.
37 internal enum ErrorCode : int
42 None = Tizen.Internals.Errors.ErrorCode.None,
45 /// Invalid function parameter
47 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
52 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
57 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
62 IoError = Tizen.Internals.Errors.ErrorCode.IoError,
67 NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported,
70 /// Device or resource busy
72 ResourceBusy = Tizen.Internals.Errors.ErrorCode.ResourceBusy,
75 /// There is no space to add a new shortcut
77 NoSpace = -0x01160000 | 0x01,
80 /// Shortcut is already added
82 Exist = -0x01160000 | 0x02,
85 /// Unrecoverable error
87 Fault = -0x01160000 | 0x04,
90 /// Not exist shortcut
92 NotExist = -0x01160000 | 0x08,
95 /// Connection not established or communication problem
97 COMM = -0x01160000 | 0x40
100 [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_add_to_home")]
101 internal static extern ErrorCode AddToHome(string name, int type, string uri, string icon, int dubplicate, ResultCallback result, IntPtr data);
103 [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_add_to_home_widget")]
104 internal static extern ErrorCode AddToWidget(string name, ShortcutWidgetSize size, string widgetId, string icon, double period, int dubplicate, ResultCallback result, IntPtr data);
106 [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_remove_from_home")]
107 internal static extern ErrorCode Delete(string name, ResultCallback result, IntPtr data);
109 [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_get_list")]
110 internal static extern ErrorCode GetList(string name, ListCallback list, IntPtr data);
112 [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_set_request_cb")]
113 internal static extern ErrorCode SetShortcutAddCallback(AddCallback cb, IntPtr data);
115 [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_unset_request_cb")]
116 internal static extern ErrorCode UnsetShortcutAddCallback();
118 [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_set_remove_cb")]
119 internal static extern ErrorCode SetShortcutDeleteCallback(DeleteCallback cb, IntPtr data);
121 [DllImport(Libraries.Shortcut, EntryPoint = "shortcut_unset_remove_cb")]
122 internal static extern ErrorCode UnsetShortcutDeleteCallback();