Fixed build error
[platform/core/csapi/push.git] / Tizen.Messaging.Push / Tizen.Messaging.Push / PushImpl.cs
index 3db58f1..1c03110 100755 (executable)
@@ -19,7 +19,7 @@ namespace Tizen.Messaging.Push
                 {
                     if (_instance == null)
                     {
-                        Log.Info(Interop.Push.LogTag, "Creating New Instance");
+                        Log.Info(Interop.PushClient.LogTag, "Creating New Instance");
                         _instance = new PushImpl();
                     }
                 }
@@ -36,22 +36,22 @@ namespace Tizen.Messaging.Push
 
         internal void PushServiceConnect(string pushAppId)
         {
-            Interop.Push.VoidStateChangedCallback stateDelegate = (int state, string err, IntPtr userData) =>
+            Interop.PushClient.VoidStateChangedCallback stateDelegate = (int state, string err, IntPtr userData) =>
             {
                 if (err == null)
                 {
                     err = "";
                 }
                 PushConnectionStateEventArgs args = new PushConnectionStateEventArgs((PushConnectionStateEventArgs.PushState)state, err);
-                Push.StateChange(args);
+                PushClient.StateChange(args);
             };
-            Interop.Push.VoidNotifyCallback notifyDelegate = (IntPtr notification, IntPtr userData) =>
+            Interop.PushClient.VoidNotifyCallback notifyDelegate = (IntPtr notification, IntPtr userData) =>
             {
-                Interop.Push.ServiceError result;
+                Interop.PushClient.ServiceError result;
                 PushMessageEventArgs ob = new PushMessageEventArgs();
                 string data;
-                result = Interop.Push.GetNotificationData(notification, out data);
-                if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(data)))
+                result = Interop.PushClient.GetNotificationData(notification, out data);
+                if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(data)))
                 {
                     ob.AppData = data;
                 }
@@ -60,8 +60,8 @@ namespace Tizen.Messaging.Push
                     ob.AppData = "";
                 }
                 string message;
-                result = Interop.Push.GetNotificationMessage(notification, out message);
-                if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(message)))
+                result = Interop.PushClient.GetNotificationMessage(notification, out message);
+                if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(message)))
                 {
                     ob.Message = message;
                 }
@@ -70,8 +70,8 @@ namespace Tizen.Messaging.Push
                     ob.Message = "";
                 }
                 string sender;
-                result = Interop.Push.GetNotificationSender(notification, out sender);
-                if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(sender)))
+                result = Interop.PushClient.GetNotificationSender(notification, out sender);
+                if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(sender)))
                 {
                     ob.Sender = sender;
                 }
@@ -80,8 +80,8 @@ namespace Tizen.Messaging.Push
                     ob.Sender = "";
                 }
                 string sessioninfo;
-                result = Interop.Push.GetNotificationSessionInfo(notification, out sessioninfo);
-                if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(sessioninfo)))
+                result = Interop.PushClient.GetNotificationSessionInfo(notification, out sessioninfo);
+                if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(sessioninfo)))
                 {
                     ob.SessionInfo = sessioninfo;
                 }
@@ -90,8 +90,8 @@ namespace Tizen.Messaging.Push
                     ob.SessionInfo = "";
                 }
                 string requestid;
-                result = Interop.Push.GetNotificationRequestId(notification, out requestid);
-                if ((result == Interop.Push.ServiceError.None) && !(String.IsNullOrEmpty(requestid)))
+                result = Interop.PushClient.GetNotificationRequestId(notification, out requestid);
+                if ((result == Interop.PushClient.ServiceError.None) && !(String.IsNullOrEmpty(requestid)))
                 {
                     ob.RequestId = requestid;
                 }
@@ -100,50 +100,50 @@ namespace Tizen.Messaging.Push
                     ob.RequestId = "";
                 }
                 int time;
-                result = Interop.Push.GetNotificationTime(notification, out time);
+                result = Interop.PushClient.GetNotificationTime(notification, out time);
                 DateTime utc;
-                if ((result == Interop.Push.ServiceError.None) && (time != 0))
+                if ((result == Interop.PushClient.ServiceError.None) && (time != 0))
                 {
-                    Log.Info(Interop.Push.LogTag, "Ticks received: " + time);
+                    Log.Info(Interop.PushClient.LogTag, "Ticks received: " + time);
                     utc = DateTime.SpecifyKind(new DateTime(1970, 1, 1).AddSeconds(time), DateTimeKind.Utc);
                     ob.ReceivedAt = utc.ToLocalTime();
                 }
                 else
                 {
-                    Log.Info(Interop.Push.LogTag, "No Date received");
+                    Log.Info(Interop.PushClient.LogTag, "No Date received");
                     ob.ReceivedAt = DateTime.Now;
                 }
                 int type = -1;
-                result = Interop.Push.GetNotificationType(notification, out type);
-                if (result == Interop.Push.ServiceError.None)
+                result = Interop.PushClient.GetNotificationType(notification, out type);
+                if (result == Interop.PushClient.ServiceError.None)
                 {
                     ob.Type = type;
                 }
-                Push.Notify(ob);
-                //Interop.Push.FreeNotification(notification);
-                Log.Info(Interop.Push.LogTag, "Free Notification Done");
+                PushClient.Notify(ob);
+                //Interop.PushClient.FreeNotification(notification);
+                Log.Info(Interop.PushClient.LogTag, "Free Notification Done");
             };
-            Interop.Push.ServiceError connectResult = Interop.Push.ServiceConnect(pushAppId, stateDelegate, notifyDelegate, IntPtr.Zero, out _connection);
-            if (connectResult != Interop.Push.ServiceError.None)
+            Interop.PushClient.ServiceError connectResult = Interop.PushClient.ServiceConnect(pushAppId, stateDelegate, notifyDelegate, IntPtr.Zero, out _connection);
+            if (connectResult != Interop.PushClient.ServiceError.None)
             {
-                Log.Error(Interop.Push.LogTag, "Connect failed with " + connectResult);
+                Log.Error(Interop.PushClient.LogTag, "Connect failed with " + connectResult);
                 throw PushExceptionFactory.CreateResponseException(connectResult);
             }
         }
 
         internal void PushServiceDisconnect()
         {
-            Interop.Push.ServiceDisconnect(_connection);
-            Log.Info(Interop.Push.LogTag, "PushServiceDisconnect Completed");
+            Interop.PushClient.ServiceDisconnect(_connection);
+            Log.Info(Interop.PushClient.LogTag, "PushServiceDisconnect Completed");
         }
 
         internal async Task<ServerResponse> PushServerRegister()
         {
-            Log.Info(Interop.Push.LogTag, "Register Called");
+            Log.Info(Interop.PushClient.LogTag, "Register Called");
             var task = new TaskCompletionSource<ServerResponse>();
-            Interop.Push.VoidResultCallback registerResult = (Interop.Push.Result regResult, IntPtr msgPtr, IntPtr userData) =>
+            Interop.PushClient.VoidResultCallback registerResult = (Interop.PushClient.Result regResult, IntPtr msgPtr, IntPtr userData) =>
             {
-                Log.Info(Interop.Push.LogTag, "Register Callback Called");
+                Log.Info(Interop.PushClient.LogTag, "Register Callback Called");
                 string msg = "";
                 if (msgPtr != IntPtr.Zero)
                 {
@@ -154,14 +154,14 @@ namespace Tizen.Messaging.Push
                 response.ServerMessage = msg;
                 if (task.TrySetResult(response) == false)
                 {
-                    Log.Error(Interop.Push.LogTag, "Unable to set the Result for register");
+                    Log.Error(Interop.PushClient.LogTag, "Unable to set the Result for register");
                 }
             };
-            Interop.Push.ServiceError result = Interop.Push.ServiceRegister(_connection, registerResult, IntPtr.Zero);
-            Log.Info(Interop.Push.LogTag, "Interop.Push.ServiceRegister Completed");
-            if (result != Interop.Push.ServiceError.None)
+            Interop.PushClient.ServiceError result = Interop.PushClient.ServiceRegister(_connection, registerResult, IntPtr.Zero);
+            Log.Info(Interop.PushClient.LogTag, "Interop.PushClient.ServiceRegister Completed");
+            if (result != Interop.PushClient.ServiceError.None)
             {
-                Log.Error(Interop.Push.LogTag, "Register failed with " + result);
+                Log.Error(Interop.PushClient.LogTag, "Register failed with " + result);
                 task.SetException(PushExceptionFactory.CreateResponseException(result));
             }
             return await task.Task;
@@ -170,9 +170,9 @@ namespace Tizen.Messaging.Push
         internal async Task<ServerResponse> PushServerUnregister()
         {
             var task = new TaskCompletionSource<ServerResponse>();
-            Interop.Push.VoidResultCallback registerResult = (Interop.Push.Result regResult, IntPtr msgPtr, IntPtr userData) =>
+            Interop.PushClient.VoidResultCallback registerResult = (Interop.PushClient.Result regResult, IntPtr msgPtr, IntPtr userData) =>
             {
-                Log.Info(Interop.Push.LogTag, "Unregister Callback Called");
+                Log.Info(Interop.PushClient.LogTag, "Unregister Callback Called");
                 string msg = "";
                 if (msgPtr != IntPtr.Zero)
                 {
@@ -183,11 +183,11 @@ namespace Tizen.Messaging.Push
                 response.ServerMessage = msg;
                 if (task.TrySetResult(response) == false)
                 {
-                    Log.Error(Interop.Push.LogTag, "Unable to set the Result for Unregister");
+                    Log.Error(Interop.PushClient.LogTag, "Unable to set the Result for Unregister");
                 }
             };
-            Interop.Push.ServiceError result = Interop.Push.ServiceDeregister(_connection, registerResult, IntPtr.Zero);
-            if (result != Interop.Push.ServiceError.None)
+            Interop.PushClient.ServiceError result = Interop.PushClient.ServiceDeregister(_connection, registerResult, IntPtr.Zero);
+            if (result != Interop.PushClient.ServiceError.None)
             {
                 task.SetException(PushExceptionFactory.CreateResponseException(result));
             }
@@ -197,19 +197,19 @@ namespace Tizen.Messaging.Push
         internal string GetRegistrationId()
         {
             string regID = "";
-            Interop.Push.ServiceError result = Interop.Push.GetRegistrationId(_connection, out regID);
-            if (result != Interop.Push.ServiceError.None)
+            Interop.PushClient.ServiceError result = Interop.PushClient.GetRegistrationId(_connection, out regID);
+            if (result != Interop.PushClient.ServiceError.None)
             {
                 throw PushExceptionFactory.CreateResponseException(result);
             }
-            Log.Info(Interop.Push.LogTag, "Returning Reg Id: " + regID);
+            Log.Info(Interop.PushClient.LogTag, "Returning Reg Id: " + regID);
             return regID;
         }
 
         internal void GetUnreadNotifications()
         {
-            Interop.Push.ServiceError result = Interop.Push.RequestUnreadNotification(_connection);
-            if (result != Interop.Push.ServiceError.None)
+            Interop.PushClient.ServiceError result = Interop.PushClient.RequestUnreadNotification(_connection);
+            if (result != Interop.PushClient.ServiceError.None)
             {
                 throw PushExceptionFactory.CreateResponseException(result);
             }
@@ -219,7 +219,7 @@ namespace Tizen.Messaging.Push
         {
             lock (_lock)
             {
-                Log.Info(Interop.Push.LogTag, "Making _instance as null");
+                Log.Info(Interop.PushClient.LogTag, "Making _instance as null");
                 _instance = null;
             }
         }