2 using System.Runtime.InteropServices;
4 internal static partial class Interop
6 internal static partial class Push
8 internal static string LogTag = "Tizen.Messaging.Push";
18 internal enum ServiceError
20 None = Tizen.Internals.Errors.ErrorCode.None,
21 OutOfMemory = Tizen.Internals.Errors.ErrorCode.OutOfMemory,
22 InvalidParameter = Tizen.Internals.Errors.ErrorCode.InvalidParameter,
23 NotConnected = Tizen.Internals.Errors.ErrorCode.EndpointNotConnected,
24 NoData = Tizen.Internals.Errors.ErrorCode.NoData,
25 OpearationFailed = Tizen.Internals.Errors.ErrorCode.Unknown,
26 PermissionDenied = Tizen.Internals.Errors.ErrorCode.PermissionDenied,
27 NotSupported = Tizen.Internals.Errors.ErrorCode.NotSupported
39 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
40 internal delegate void VoidStateChangedCallback(int state, string err, IntPtr userData);
41 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
42 internal delegate void VoidNotifyCallback(IntPtr notification, IntPtr userData);
43 [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
44 internal delegate void VoidResultCallback(Result result, IntPtr msg, IntPtr userData);
46 [DllImport(Libraries.Push, EntryPoint = "push_service_connect", CallingConvention = CallingConvention.Cdecl)]
47 internal static extern Interop.Push.ServiceError ServiceConnect(string pushAppID, VoidStateChangedCallback stateCallback, VoidNotifyCallback notifyCallback, IntPtr userData, out IntPtr connection);
49 [DllImport(Libraries.Push, EntryPoint = "push_service_disconnect", CallingConvention = CallingConvention.Cdecl)]
50 internal static extern void ServiceDisconnect(IntPtr connection);
52 [DllImport(Libraries.Push, EntryPoint = "push_service_register", CallingConvention = CallingConvention.Cdecl)]
53 internal static extern Interop.Push.ServiceError ServiceRegister(IntPtr connection, VoidResultCallback callback, IntPtr UserData);
55 [DllImport(Libraries.Push, EntryPoint = "push_service_deregister", CallingConvention = CallingConvention.Cdecl)]
56 internal static extern Interop.Push.ServiceError ServiceDeregister(IntPtr connection, VoidResultCallback callback, IntPtr UserData);
58 [DllImport(Libraries.Push, EntryPoint = "push_service_app_control_to_noti_data", CallingConvention = CallingConvention.Cdecl)]
59 internal static extern string AppControlToNotiData(IntPtr appControl, string operation);
61 [DllImport(Libraries.Push, EntryPoint = "push_service_app_control_to_notification", CallingConvention = CallingConvention.Cdecl)]
62 internal static extern Interop.Push.ServiceError AppControlToNotification(IntPtr appControl, string operation, out IntPtr noti);
64 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_data", CallingConvention = CallingConvention.Cdecl)]
65 internal static extern Interop.Push.ServiceError GetNotificationData(IntPtr notification, out string data);
67 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_message", CallingConvention = CallingConvention.Cdecl)]
68 internal static extern Interop.Push.ServiceError GetNotificationMessage(IntPtr notification, out string data);
70 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_time", CallingConvention = CallingConvention.Cdecl)]
71 internal static extern Interop.Push.ServiceError GetNotificationTime(IntPtr notification, out int receivedTime);
73 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_sender", CallingConvention = CallingConvention.Cdecl)]
74 internal static extern Interop.Push.ServiceError GetNotificationSender(IntPtr notification, out string sender);
76 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_session_info", CallingConvention = CallingConvention.Cdecl)]
77 internal static extern Interop.Push.ServiceError GetNotificationSessionInfo(IntPtr notification, out string sessionInfo);
79 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_request_id", CallingConvention = CallingConvention.Cdecl)]
80 internal static extern Interop.Push.ServiceError GetNotificationRequestId(IntPtr notification, out string requestID);
82 [DllImport(Libraries.Push, EntryPoint = "push_service_get_notification_type", CallingConvention = CallingConvention.Cdecl)]
83 internal static extern Interop.Push.ServiceError GetNotificationType(IntPtr notification, out int type);
85 [DllImport(Libraries.Push, EntryPoint = "push_service_get_unread_notification", CallingConvention = CallingConvention.Cdecl)]
86 internal static extern Interop.Push.ServiceError GetUnreadNotification(IntPtr connection, out IntPtr noti);
88 [DllImport(Libraries.Push, EntryPoint = "push_service_request_unread_notification", CallingConvention = CallingConvention.Cdecl)]
89 internal static extern Interop.Push.ServiceError RequestUnreadNotification(IntPtr connection);
91 [DllImport(Libraries.Push, EntryPoint = "push_service_get_registration_id", CallingConvention = CallingConvention.Cdecl)]
92 internal static extern Interop.Push.ServiceError GetRegistrationId(IntPtr connection, out string regID);
94 [DllImport(Libraries.Push, EntryPoint = "push_service_free_notification", CallingConvention = CallingConvention.Cdecl)]
95 internal static extern Interop.Push.ServiceError FreeNotification(IntPtr connection);