2 * Copyright (c) 2020 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;
24 internal static partial class Interop
26 internal static partial class FrameBroker
28 internal enum ErrorCode
30 None = Tizen.Internals.Errors.ErrorCode.None,
31 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
32 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
33 AppNotFound = AppControlResult.AppNotFound,
34 LaunchRejected = AppControlResult.LaunchRejected,
35 IoError = Tizen.Internals.Errors.ErrorCode.IoError,
36 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
39 internal enum FrameContextErrorCode
46 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
47 internal delegate void AppControlResultCallback(IntPtr request, int result, IntPtr userData);
49 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
50 internal delegate void AppControlReplyCallback(IntPtr request, IntPtr reply, int result, IntPtr userData);
52 internal delegate void FrameContextCreateCallback(IntPtr context, IntPtr userData);
54 internal delegate void FrameContextResumeCallback(IntPtr context, IntPtr frame, IntPtr userData);
56 internal delegate void FrameContextPauseCallback(IntPtr context, IntPtr userData);
58 internal delegate void FrameContextDestroyCallback(IntPtr context, IntPtr userData);
60 internal delegate void FrameContextErrorCallback(IntPtr context, int error, IntPtr userData);
62 internal delegate void FrameContextUpdateCallback(IntPtr context, IntPtr frame, IntPtr userData);
64 [StructLayout(LayoutKind.Sequential)]
65 internal struct FrameContextLifecycleCallbacks
67 public FrameContextCreateCallback OnCreate;
68 public FrameContextResumeCallback OnResume;
69 public FrameContextPauseCallback OnPause;
70 public FrameContextDestroyCallback OnDestroy;
71 public FrameContextUpdateCallback OnUpdate;
72 public FrameContextErrorCallback OnError;
75 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_context_start_animation")]
76 internal static extern ErrorCode StartAnimation(IntPtr handle);
78 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_context_finish_animation")]
79 internal static extern ErrorCode FinishAnimation(IntPtr handle);
82 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_broker_create")]
83 internal static extern ErrorCode Create(IntPtr wl2Win, ref FrameContextLifecycleCallbacks callbacks, IntPtr userData, out SafeFrameBrokerHandle handle);
85 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_broker_destroy")]
86 internal static extern ErrorCode DangerousDestroy(IntPtr handle);
88 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_broker_send_launch_request")]
89 internal static extern ErrorCode SendLaunchRequest(SafeFrameBrokerHandle handle, SafeAppControlHandle safeAppControlHandle, AppControlResultCallback resultCallback, AppControlReplyCallback replyCallback, IntPtr userData);
91 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_broker_send_launch_request_to_provider")]
92 internal static extern ErrorCode SendLaunchRequestToProvider(SafeFrameBrokerHandle handle, SafeAppControlHandle safeAppControlHandle, AppControlResultCallback resultCallback, AppControlReplyCallback replyCallback, IntPtr userData);
95 internal enum FrameType
97 RemoteSurfaceTbmSurface = 0,
98 RemoteSurfaceImageFile = 1,
99 SplashScreenImage = 2,
100 SplashScreenEdje = 3,
103 internal enum FrameDirection
109 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_tbm_surface")]
110 internal static extern ErrorCode GetTbmSurface(IntPtr handle, out IntPtr tbmSurface);
112 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_image_file")]
113 internal static extern ErrorCode GetImageFile(IntPtr handle, out Int32 fd, out UInt32 size);
115 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_file_path")]
116 internal static extern ErrorCode GetFilePath(IntPtr handle, out string filePath);
118 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_file_group")]
119 internal static extern ErrorCode GetFileGroup(IntPtr handle, out string fileGroup);
121 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_type")]
122 internal static extern ErrorCode GetType(IntPtr handle, out FrameType type);
124 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_direction")]
125 internal static extern ErrorCode GetDirection(IntPtr handle, out FrameDirection direction);
127 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_position_x")]
128 internal static extern ErrorCode GetPositionX(IntPtr handle, out Int32 x);
130 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_position_y")]
131 internal static extern ErrorCode GetPositionY(IntPtr handle, out Int32 y);
133 [DllImport(Libraries.FrameBroker, EntryPoint = "frame_get_extra_data")]
134 internal static extern ErrorCode GetExtraData(IntPtr handle, out SafeBundleHandle safeBundleHandle);