2 * Copyright (c) 2021 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 Tizen.Applications;
23 /// Represents the Frame Data.
25 internal class FrameData
27 private const string logTag = "NUI";
28 private readonly IntPtr frame;
30 private uint size = 0;
32 internal FrameData(IntPtr frame)
38 /// Checks whether the direction of the frame is forward or not.
40 internal bool DirectionForward
44 Interop.FrameBroker.FrameDirection direction = Interop.FrameBroker.FrameDirection.Backward + 1;
45 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetDirection(frame, out direction);
46 if (err != Interop.FrameBroker.ErrorCode.None)
48 Log.Error(logTag, "Failed to get direction");
50 return (direction == Interop.FrameBroker.FrameDirection.Forward);
55 /// Gets the extra data.
61 SafeBundleHandle safeBundle;
62 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetExtraData(frame, out safeBundle);
63 if (err != Interop.FrameBroker.ErrorCode.None)
65 Log.Error(logTag, "Failed to get extra data");
68 return new Bundle(safeBundle);
73 /// Enumeration for the frame type.
75 internal enum FrameType
78 /// The tbm surface of the remote surface.
80 RemoteSurfaceTbmSurface,
83 /// The image file of the remote surface.
85 RemoteSurfaceImageFile,
88 /// The image of the splash screen.
93 /// The edje of the splash screen.
99 /// Enumeration for the direction of the frame.
101 internal enum FrameDirection
104 /// The direction that is from the caller to the other application.
109 /// The direction that is from the other application to the caller.
115 /// Gets the tbm surface of the remote surface.
118 /// The TbmSurface type is tbm_surface_h.
120 internal IntPtr TbmSurface
124 IntPtr tbmSurface = IntPtr.Zero;
125 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetTbmSurface(frame, out tbmSurface);
127 if (err != Interop.FrameBroker.ErrorCode.None)
129 Log.Error(logTag, "Failed to get tbm surface");
136 /// Gets the file descriptor of the image file of the remote surface.
145 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetImageFile(frame, out fd, out size);
146 if (err != Interop.FrameBroker.ErrorCode.None)
148 Log.Error(logTag, "Failed to get fd of image file");
155 /// Gets the size of the image file of the remote surface.
164 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetImageFile(frame, out fd, out size);
165 if (err != Interop.FrameBroker.ErrorCode.None)
167 Log.Error(logTag, "Failed to get size of image file");
174 /// Gets the file path.
176 internal string FilePath
180 string filePath = string.Empty;
181 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetFilePath(frame, out filePath);
182 if (err != Interop.FrameBroker.ErrorCode.None)
184 Log.Error(logTag, "Failed to get file path");
191 /// Gets the file group.
193 internal string FileGroup
197 string fileGroup = string.Empty;
198 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetFileGroup(frame, out fileGroup);
199 if (err != Interop.FrameBroker.ErrorCode.None)
201 Log.Error(logTag, "Failed to get file group");
208 /// Gets the type of the frame.
210 internal FrameType Type
214 Interop.FrameBroker.FrameType type = Interop.FrameBroker.FrameType.SplashScreenImage + 1;
215 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetType(frame, out type);
216 if (err != Interop.FrameBroker.ErrorCode.None)
218 Log.Error(logTag, "Failed to get frame type");
220 return (FrameType)type;
225 /// Gets the position X.
227 internal int PositionX
232 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetPositionX(frame, out x);
233 if (err != Interop.FrameBroker.ErrorCode.None)
235 Log.Error(logTag, "Failed to get position X");
242 /// Gets the position Y.
244 internal int PositionY
249 Interop.FrameBroker.ErrorCode err = Interop.FrameBroker.GetPositionY(frame, out y);
250 if (err != Interop.FrameBroker.ErrorCode.None)
252 Log.Error(logTag, "Failed to get position Y");