Adding Null Check and Error Enum Updation
[platform/core/csapi/push.git] / Tizen.Messaging.Push / Interop / Interop.Push.cs
1 using System;
2 using System.Runtime.InteropServices;
3
4 internal static partial class Interop
5 {
6     internal static partial class Push
7     {
8         internal static string LogTag = "Tizen.Messaging.Push";
9
10         internal enum Result
11         {
12             Success = 0,
13             Timeout = 1,
14             ServerError = 2,
15             SystemError = 3
16         };
17
18         internal enum ServiceError
19         {
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
28         };
29
30         internal enum State
31         {
32             Registered,
33             Unregistered,
34             ProvisioningIPChange,
35             PingChange,
36             StateError
37         };
38
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);
45
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);
48
49         [DllImport(Libraries.Push, EntryPoint = "push_service_disconnect", CallingConvention = CallingConvention.Cdecl)]
50         internal static extern void ServiceDisconnect(IntPtr connection);
51
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);
54
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);
57
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);
60
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);
63
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);
66
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);
69
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);
72
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);
75
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);
78
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);
81
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);
84
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);
87
88         [DllImport(Libraries.Push, EntryPoint = "push_service_request_unread_notification", CallingConvention = CallingConvention.Cdecl)]
89         internal static extern Interop.Push.ServiceError RequestUnreadNotification(IntPtr connection);
90
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);
93
94         [DllImport(Libraries.Push, EntryPoint = "push_service_free_notification", CallingConvention = CallingConvention.Cdecl)]
95         internal static extern Interop.Push.ServiceError FreeNotification(IntPtr connection);
96     }
97 }