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;
20 using Tizen.Applications;
22 internal static partial class Interop
24 internal static partial class AppControl
26 internal const int AppStartedStatus = 1;
28 internal delegate bool ExtraDataCallback(SafeAppControlHandle handle, string key, IntPtr userData);
29 internal delegate bool AppMatchedCallback(SafeAppControlHandle handle, string applicationId, IntPtr userData);
30 internal delegate void ReplyCallback(IntPtr request, IntPtr reply, int result, IntPtr userData);
32 internal enum ErrorCode
34 None = Tizen.Internals.Errors.ErrorCode.None,
35 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
36 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
37 AppNotFound = -0x01100000 | 0x21,
38 KeyNotFound = Tizen.Internals.Errors.ErrorCode.KeyNotAvailable,
39 KeyRejected = Tizen.Internals.Errors.ErrorCode.KeyRejected,
40 InvalidDataType = -0x01100000 | 0x22,
41 LaunchRejected = -0x01100000 | 0x23,
42 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
43 LaunchFailed = -0x01100000 | 0x24,
44 IoError = Tizen.Internals.Errors.ErrorCode.IoError,
45 TimedOut = Tizen.Internals.Errors.ErrorCode.TimedOut,
48 [DllImport(Libraries.AppControl, EntryPoint = "app_control_create")]
49 internal static extern ErrorCode Create(out SafeAppControlHandle handle);
51 [DllImport(Libraries.AppControl, EntryPoint = "app_control_clone")]
52 internal static extern ErrorCode DangerousClone(out SafeAppControlHandle clone, IntPtr handle);
54 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_app_id")]
55 internal static extern ErrorCode GetAppId(IntPtr app_control, out IntPtr app_id);
57 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_operation")]
58 internal static extern ErrorCode GetOperation(SafeAppControlHandle handle, out string operation);
60 [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_operation")]
61 internal static extern ErrorCode SetOperation(SafeAppControlHandle handle, string operation);
63 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_uri")]
64 internal static extern ErrorCode GetUri(SafeAppControlHandle handle, out string uri);
66 [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_uri")]
67 internal static extern ErrorCode SetUri(SafeAppControlHandle handle, string uri);
69 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_mime")]
70 internal static extern ErrorCode GetMime(SafeAppControlHandle handle, out string mime);
72 [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_mime")]
73 internal static extern ErrorCode SetMime(SafeAppControlHandle handle, string mime);
75 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_category")]
76 internal static extern ErrorCode GetCategory(SafeAppControlHandle handle, out string category);
78 [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_category")]
79 internal static extern ErrorCode SetCategory(SafeAppControlHandle handle, string category);
81 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_app_id")]
82 internal static extern ErrorCode GetAppId(SafeAppControlHandle handle, out string appId);
84 [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_app_id")]
85 internal static extern ErrorCode SetAppId(SafeAppControlHandle handle, string appId);
87 [DllImport(Libraries.AppControl, EntryPoint = "app_control_set_launch_mode")]
88 internal static extern ErrorCode SetLaunchMode(SafeAppControlHandle handle, int mode);
90 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_launch_mode")]
91 internal static extern ErrorCode GetLaunchMode(SafeAppControlHandle handle, out int mode);
93 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_caller")]
94 internal static extern ErrorCode GetCaller(SafeAppControlHandle handle, out string caller);
96 [DllImport(Libraries.AppControl, EntryPoint = "app_control_is_reply_requested")]
97 internal static extern ErrorCode IsReplyRequested(SafeAppControlHandle handle, out bool requested);
99 [DllImport(Libraries.AppControl, EntryPoint = "app_control_add_extra_data")]
100 internal static extern ErrorCode AddExtraData(SafeAppControlHandle handle, string key, string value);
102 [DllImport(Libraries.AppControl, EntryPoint = "app_control_remove_extra_data")]
103 internal static extern ErrorCode RemoveExtraData(SafeAppControlHandle handle, string key);
105 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_extra_data")]
106 internal static extern ErrorCode GetExtraData(SafeAppControlHandle handle, string key, out string value);
108 [DllImport(Libraries.AppControl, EntryPoint = "app_control_add_extra_data_array")]
109 internal static extern ErrorCode AddExtraDataArray(SafeAppControlHandle handle, string key, string[] value, int length);
111 [DllImport(Libraries.AppControl, EntryPoint = "app_control_get_extra_data_array")]
112 internal static extern ErrorCode GetExtraDataArray(SafeAppControlHandle handle, string key, out IntPtr value, out int length);
114 [DllImport(Libraries.AppControl, EntryPoint = "app_control_is_extra_data_array")]
115 internal static extern ErrorCode IsExtraDataArray(SafeAppControlHandle handle, string key, out bool array);
117 [DllImport(Libraries.AppControl, EntryPoint = "app_control_destroy")]
118 internal static extern ErrorCode DangerousDestroy(IntPtr handle);
120 [DllImport(Libraries.AppControl, EntryPoint = "app_control_foreach_extra_data")]
121 internal static extern ErrorCode ForeachExtraData(SafeAppControlHandle handle, ExtraDataCallback callback, IntPtr userData);
123 [DllImport(Libraries.AppControl, EntryPoint = "app_control_foreach_app_matched")]
124 internal static extern ErrorCode ForeachAppMatched(SafeAppControlHandle handle, AppMatchedCallback callback, IntPtr userData);
126 [DllImport(Libraries.AppControl, EntryPoint = "app_control_send_launch_request")]
127 internal static extern ErrorCode SendLaunchRequest(SafeAppControlHandle handle, ReplyCallback callback, IntPtr userData);
129 [DllImport(Libraries.Application, EntryPoint = "app_control_send_terminate_request")]
130 internal static extern ErrorCode SendTerminateRequest(SafeAppControlHandle handle);
132 [DllImport(Libraries.Application, EntryPoint = "app_control_reply_to_launch_request")]
133 internal static extern ErrorCode ReplyToLaunchRequest(SafeAppControlHandle reply, SafeAppControlHandle request, int result);
135 [DllImport(Libraries.Application, EntryPoint = "app_control_enable_app_started_result_event")]
136 internal static extern ErrorCode EnableAppStartedResultEvent(SafeAppControlHandle handle);