fce62d9681df0f0f540a92da5c267f68c25d4afd
[platform/core/csapi/tizenfx.git] / src / Tizen.Multimedia.Remoting / Interop / Interop.MediaControllerServer.cs
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd All Rights Reserved
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 using System;
18 using System.Runtime.InteropServices;
19 using Tizen.Applications;
20 using Tizen.Multimedia.Remoting;
21
22 internal static partial class Interop
23 {
24     internal static partial class MediaControllerServer
25     {
26         #region Callback delegate
27         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
28         internal delegate bool ActivatedClientCallback(string clientName, IntPtr userData);
29
30
31         // Received callbacks
32         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
33         internal delegate void PlaybackStateCommandReceivedCallback(string clientName,
34             MediaControllerNativePlaybackAction nativeAction, IntPtr userData);
35
36         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
37         internal delegate void PlaybackActionCommandReceivedCallback(string clientName,
38             string requestId, MediaControllerNativePlaybackAction nativeAction, IntPtr userData);
39
40         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
41         internal delegate void PlaybackPositionCommandReceivedCallback(string clientName,
42             string requestId, ulong playbackPosition, IntPtr userData);
43
44         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
45         internal delegate void PlaylistCommandReceivedCallback(string clientName,
46             string requestId, string playlistName, string index, MediaControllerNativePlaybackAction nativeAction,
47             ulong playbackPosition, IntPtr userData);
48
49         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
50         internal delegate void ShuffleModeCommandReceivedCallback(string clientName,
51             string requestId, MediaControllerNativeShuffleMode mode, IntPtr userData);
52
53         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
54         internal delegate void RepeatModeCommandReceivedCallback(string clientName,
55             string requestId, MediaControllerNativeRepeatMode mode, IntPtr userData);
56
57         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
58         internal delegate void DisplayModeCommandReceivedCallback(string clientName,
59             string requestId, MediaControlNativeDisplayMode mode, IntPtr userData);
60
61         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
62         internal delegate void DisplayRotationCommandReceivedCallback(string clientName,
63             string requestId, MediaControlNativeDisplayRotation rotation, IntPtr userData);
64
65         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
66         internal delegate void SimpleCommandReceivedCallback(string clientName,
67             string requestId, bool isEnabled, IntPtr userData);
68
69         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
70         internal delegate void CustomCommandReceivedCallback(string clientName,
71             string requestId, string customCommand, IntPtr bundleHandle, IntPtr userData);
72
73
74         // Command callbacks
75         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
76         internal delegate void CommandCompletedCallback(string clientName, string requestId, int result, IntPtr bundleHandle,
77             IntPtr userData = default(IntPtr));
78
79         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
80         internal delegate void SearchCommandReceivedCallback(string clientName, string requestId, IntPtr searchHandle,
81             IntPtr userData = default(IntPtr));
82
83
84         // Search callback
85         [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
86         internal delegate bool SearchItemCallback(MediaControlContentType type, MediaControlSearchCategory category,
87             string keyword, IntPtr bundleHandle, IntPtr userData = default(IntPtr));
88         #endregion Callback delegate
89
90
91         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_create")]
92         internal static extern MediaControllerError Create(out IntPtr handle);
93
94         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_destroy")]
95         internal static extern MediaControllerError Destroy(IntPtr handle);
96
97         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_foreach_client")]
98         internal static extern MediaControllerError ForeachActivatedClient(IntPtr handle, ActivatedClientCallback callback,
99             IntPtr userData = default(IntPtr));
100
101
102         #region Set information
103         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_state")]
104         internal static extern MediaControllerError SetPlaybackState(IntPtr handle,
105             MediaControllerNativePlaybackState state);
106
107         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_position")]
108         internal static extern MediaControllerError SetPlaybackPosition(IntPtr handle, ulong position);
109
110         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playback_info")]
111         internal static extern MediaControllerError UpdatePlayback(IntPtr handle);
112
113         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_metadata")]
114         internal static extern MediaControllerError SetMetadata(IntPtr handle,
115             MediaControllerNativeAttribute attribute, string value);
116
117         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_metadata")]
118         internal static extern MediaControllerError UpdateMetadata(IntPtr handle);
119
120         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_shuffle_mode")]
121         internal static extern MediaControllerError UpdateShuffleMode(IntPtr handle,
122             MediaControllerNativeShuffleMode mode);
123
124         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_repeat_mode")]
125         internal static extern MediaControllerError UpdateRepeatMode(IntPtr handle, MediaControllerNativeRepeatMode mode);
126
127         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_content_age_rating")]
128         internal static extern MediaControllerError SetAgeRating(IntPtr handle, int rating);
129
130         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_subtitles_enabled")]
131         internal static extern MediaControllerError UpdateSubtitleMode(IntPtr handle, bool isEnabled);
132
133         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_360_mode_enabled")]
134         internal static extern MediaControllerError UpdateMode360(IntPtr handle, bool isEnabled);
135
136         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_display_mode")]
137         internal static extern MediaControllerError UpdateDisplayMode(IntPtr handle, MediaControlNativeDisplayMode mode);
138
139         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_display_rotation")]
140         internal static extern MediaControllerError UpdateDisplayRotaton(IntPtr handle, MediaControlNativeDisplayRotation rotation);
141         #endregion Set information
142
143
144         #region Received callback
145         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_action_cmd_received_cb")]
146         internal static extern MediaControllerError SetPlaybackActionCommandReceivedCb(IntPtr handle,
147             PlaybackActionCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
148
149         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_playback_action_cmd_received_cb")]
150         internal static extern MediaControllerError UnsetPlaybackActionCommandReceivedCb(IntPtr handle);
151
152         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_position_cmd_received_cb")]
153         internal static extern MediaControllerError SetPlaybackPosotionCommandReceivedCb(IntPtr handle,
154             PlaybackPositionCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
155
156         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_playback_position_cmd_received_cb")]
157         internal static extern MediaControllerError UnsetPlaybackPositionCommandReceivedCb(IntPtr handle);
158
159         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playlist_cmd_received_cb")]
160         internal static extern MediaControllerError SetPlaylistCommandReceivedCb(IntPtr handle,
161             PlaylistCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
162
163         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_playlist_cmd_received_cb")]
164         internal static extern MediaControllerError UnsetPlaylistCommandReceivedCb(IntPtr handle);
165
166         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_shuffle_mode_cmd_received_cb")]
167         internal static extern MediaControllerError SetShuffleModeCommandReceivedCb(IntPtr handle,
168             ShuffleModeCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
169
170         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_shuffle_mode_cmd_received_cb")]
171         internal static extern MediaControllerError UnsetShuffleModeCommandReceivedCb(IntPtr handle);
172
173         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_repeat_mode_cmd_received_cb")]
174         internal static extern MediaControllerError SetRepeatModeCommandReceivedCb(IntPtr handle,
175             RepeatModeCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
176
177         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_repeat_mode_cmd_received_cb")]
178         internal static extern MediaControllerError UnsetRepeatModeCommandReceivedCb(IntPtr handle);
179
180         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_subtitles_cmd_received_cb")]
181         internal static extern MediaControllerError SetSubtitleModeCommandReceivedCb(IntPtr handle,
182             SimpleCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
183
184         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_360_mode_cmd_received_cb")]
185         internal static extern MediaControllerError SetMode360CommandReceivedCb(IntPtr handle,
186             SimpleCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
187
188         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_display_mode_cmd_received_cb")]
189         internal static extern MediaControllerError SetDisplayModeCommandReceivedCb(IntPtr handle,
190             DisplayModeCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
191
192         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_display_rotation_cmd_received_cb")]
193         internal static extern MediaControllerError SetDisplayRotationCommandReceivedCb(IntPtr handle,
194             DisplayRotationCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
195
196         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_custom_cmd_received_cb")]
197         internal static extern MediaControllerError SetCustomCommandReceivedCb(IntPtr handle,
198             CustomCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
199
200         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_custom_cmd_received_cb")]
201         internal static extern MediaControllerError UnsetCustomCommandReceivedCb(IntPtr handle);
202
203         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_search_cmd_received_cb")]
204         internal static extern MediaControllerError SetSearchCommandReceivedCb(IntPtr handle,
205             SearchCommandReceivedCallback callback, IntPtr userData = default(IntPtr));
206
207         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_search_cmd_received_cb")]
208         internal static extern MediaControllerError UnsetSearchCommandReceivedCb(IntPtr handle);
209         #endregion Received callback
210
211
212         #region Database
213         [DllImport(Libraries.MediaController, EntryPoint = "mc_db_connect")]
214         internal static extern MediaControllerError ConnectDb(out IntPtr dbHandle);
215
216         [DllImport(Libraries.MediaController, EntryPoint = "mc_db_disconnect")]
217         internal static extern MediaControllerError DisconnectDb(IntPtr dbHandle);
218
219         [DllImport(Libraries.MediaController, EntryPoint = "mc_db_check_server_table_exist")]
220         internal static extern MediaControllerError CheckServerExist(IntPtr dbHandle, string appId, out bool value);
221         #endregion Database
222
223
224         #region Playlist
225         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_create_playlist")]
226         internal static extern MediaControllerError CreatePlaylist(IntPtr handle, string name, out IntPtr playlist);
227
228         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_delete_playlist")]
229         internal static extern MediaControllerError DeletePlaylist(IntPtr handle, IntPtr playlist);
230
231         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playlist_item_index")]
232         internal static extern MediaControllerError SetIndexOfCurrentPlayingMedia(IntPtr handle, string index);
233
234         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playlist_item_info")]
235         internal static extern MediaControllerError SetInfoOfCurrentPlayingMedia(IntPtr handle, string name, string index);
236
237         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_add_item_to_playlist")]
238         internal static extern MediaControllerError AddItemToPlaylist(IntPtr handle,
239             IntPtr playlist, string index, MediaControllerNativeAttribute attribute, string value);
240
241         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playlist_done")]
242         internal static extern MediaControllerError SavePlaylist(IntPtr handle, IntPtr playlist);
243         #endregion Playlist
244
245
246         #region Capability
247         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_content_type")]
248         internal static extern MediaControllerError SetPlaybackContentType(IntPtr serverHandle,
249             MediaControlContentType type);
250
251         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_icon")]
252         internal static extern MediaControllerError SetIconPath(IntPtr serverHandle, string uri);
253
254         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_playback_ability")]
255         internal static extern MediaControllerError SetPlaybackCapability(IntPtr serverHandle,
256             MediaControllerNativePlaybackAction action, MediaControlCapabilitySupport support);
257
258         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_update_playback_ability")]
259         internal static extern MediaControllerError SaveAndNotifyPlaybackCapabilityUpdated(IntPtr serverHandle);
260
261         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_display_mode_ability")]
262         internal static extern MediaControllerError SetDisplayModeCapability(IntPtr serverHandle,
263             uint modes, MediaControlCapabilitySupport support);
264
265         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_display_rotation_ability")]
266         internal static extern MediaControllerError SetDisplayRotationCapability(IntPtr serverHandle,
267             uint rotations, MediaControlCapabilitySupport support);
268
269         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_ability_support")]
270         internal static extern MediaControllerError SetSimpleCapability(IntPtr serverHandle,
271             MediaControlNativeCapabilityCategory category, MediaControlCapabilitySupport support);
272         #endregion Capability
273
274
275         #region Search
276         [DllImport(Libraries.MediaController, EntryPoint = "mc_search_foreach_condition")]
277         internal static extern MediaControllerError ForeachSearchCondition(IntPtr serverHandle,
278             SearchItemCallback callback, IntPtr userData = default(IntPtr));
279
280         [DllImport(Libraries.MediaController, EntryPoint = "mc_search_clone")]
281         internal static extern MediaControllerError CloneSearchHandle(IntPtr srcHandle, out IntPtr dstHandle);
282
283         [DllImport(Libraries.MediaController, EntryPoint = "mc_search_destroy")]
284         internal static extern MediaControllerError DestroySearchHandle(IntPtr searchHandle);
285
286         #endregion Search
287
288
289         #region Command
290         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_cmd_reply")]
291         internal static extern MediaControllerError SendCommandReplyBundle(IntPtr handle,
292             string appId, string requestID, int result, SafeBundleHandle bundleHandle);
293
294         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_cmd_reply")]
295         internal static extern MediaControllerError SendCommandReply(IntPtr handle,
296             string appId, string requestID, int result, IntPtr bundleHandle);
297         #endregion Command
298
299
300         #region Event
301         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_custom_event")]
302         internal static extern MediaControllerError SendCustomEvent(IntPtr handle, string appId, string customEvent,
303             IntPtr bundle, out string requestId);
304
305         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_send_custom_event")]
306         internal static extern MediaControllerError SendCustomEventBundle(IntPtr handle, string appId, string customEvent,
307             SafeBundleHandle bundle, out string requestId);
308
309         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_set_event_reply_received_cb")]
310         internal static extern MediaControllerError SetEventReceivedCb(IntPtr handle, CommandCompletedCallback callback,
311             IntPtr userData = default(IntPtr));
312
313         [DllImport(Libraries.MediaController, EntryPoint = "mc_server_unset_event_reply_received_cb")]
314         internal static extern MediaControllerError UnsetEventReceivedCb(IntPtr handle);
315         #endregion Event
316     }
317 }