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 internal static partial class Interop
22 internal static partial class PushClient
24 internal static string LogTag = "Tizen.Messaging.Push";
34 internal enum ServiceError
36 None = Tizen.Internals.Errors.ErrorCode.None,
37 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
38 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
39 NotConnected = Tizen.Internals.Errors.ErrorCode.EndpointNotConnected,
40 NoData = Tizen.Internals.Errors.ErrorCode.NoData,
41 OpearationFailed = Tizen.Internals.Errors.ErrorCode.Unknown,
42 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
43 NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported
55 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
56 internal delegate void VoidStateChangedCallback(int state, string err, IntPtr userData);
57 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
58 internal delegate void VoidNotifyCallback(IntPtr notification, IntPtr userData);
59 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
60 internal delegate void VoidResultCallback(Result result, IntPtr msg, IntPtr userData);
62 [DllImport(Libraries.Push, EntryPoint = "push_service_connect", CallingConvention = CallingConvention.Cdecl)]
63 internal static extern Interop.PushClient.ServiceError ServiceConnect(string pushAppID, VoidStateChangedCallback stateCallback, VoidNotifyCallback notifyCallback, IntPtr userData, out IntPtr connection);
65 [DllImport(Libraries.Push, EntryPoint = "push_service_disconnect", CallingConvention = CallingConvention.Cdecl)]
66 internal static extern void ServiceDisconnect(IntPtr connection);
68 [DllImport(Libraries.Push, EntryPoint = "push_service_register", CallingConvention = CallingConvention.Cdecl)]
69 internal static extern Interop.PushClient.ServiceError ServiceRegister(IntPtr connection, VoidResultCallback callback, IntPtr UserData);
71 [DllImport(Libraries.Push, EntryPoint = "push_service_deregister", CallingConvention = CallingConvention.Cdecl)]
72 internal static extern Interop.PushClient.ServiceError ServiceDeregister(IntPtr connection, VoidResultCallback callback, IntPtr UserData);
74 [DllImport(Libraries.Push, EntryPoint = "push_service_app_control_to_noti_data", CallingConvention = CallingConvention.Cdecl)]
75 internal static extern string AppControlToNotiData(IntPtr appControl, string operation);
77 [DllImport(Libraries.Push, EntryPoint = "push_service_app_control_to_notification", CallingConvention = CallingConvention.Cdecl)]
78 internal static extern Interop.PushClient.ServiceError AppControlToNotification(IntPtr appControl, string operation, out IntPtr noti);
80 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_data", CallingConvention = CallingConvention.Cdecl)]
81 internal static extern Interop.PushClient.ServiceError GetNotificationData(IntPtr notification, out string data);
83 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_message", CallingConvention = CallingConvention.Cdecl)]
84 internal static extern Interop.PushClient.ServiceError GetNotificationMessage(IntPtr notification, out string data);
86 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_time", CallingConvention = CallingConvention.Cdecl)]
87 internal static extern Interop.PushClient.ServiceError GetNotificationTime(IntPtr notification, out int receivedTime);
89 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_sender", CallingConvention = CallingConvention.Cdecl)]
90 internal static extern Interop.PushClient.ServiceError GetNotificationSender(IntPtr notification, out string sender);
92 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_session_info", CallingConvention = CallingConvention.Cdecl)]
93 internal static extern Interop.PushClient.ServiceError GetNotificationSessionInfo(IntPtr notification, out string sessionInfo);
95 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_request_id", CallingConvention = CallingConvention.Cdecl)]
96 internal static extern Interop.PushClient.ServiceError GetNotificationRequestId(IntPtr notification, out string requestID);
98 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_type", CallingConvention = CallingConvention.Cdecl)]
99 internal static extern Interop.PushClient.ServiceError GetNotificationType(IntPtr notification, out int type);
101 [DllImport(Libraries.Push, EntryPoint = "push_service_get_unread_notification", CallingConvention = CallingConvention.Cdecl)]
102 internal static extern Interop.PushClient.ServiceError GetUnreadNotification(IntPtr connection, out IntPtr noti);
104 [DllImport(Libraries.Push, EntryPoint = "push_service_request_unread_notification", CallingConvention = CallingConvention.Cdecl)]
105 internal static extern Interop.PushClient.ServiceError RequestUnreadNotification(IntPtr connection);
107 [DllImport(Libraries.Push, EntryPoint = "push_service_get_registration_id", CallingConvention = CallingConvention.Cdecl)]
108 internal static extern Interop.PushClient.ServiceError GetRegistrationId(IntPtr connection, out string regID);
110 [DllImport(Libraries.Push, EntryPoint = "push_service_free_notification", CallingConvention = CallingConvention.Cdecl)]
111 internal static extern Interop.PushClient.ServiceError FreeNotification(IntPtr connection);