Modify Callback function in cpp wrapper for Notification Service.
authorabitha.s <abitha.s@samsung.com>
Wed, 10 Aug 2016 13:34:24 +0000 (19:04 +0530)
committerMadan Lanka <lanka.madan@samsung.com>
Thu, 11 Aug 2016 03:45:31 +0000 (03:45 +0000)
1) changed Subscribe Accepted CB to Provider Changed CB.
2) Provider Changed CB is invoked when Provider status is changed.
3) enabled c++ wrapper

Change-Id: If07c8c71d764bd87d57f2aa519a09525bd5ef286
Signed-off-by: abitha.s <abitha.s@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10233
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Chihyun Cho <ch79.cho@samsung.com>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/notification/SConscript
service/notification/android/notification-service/src/main/jni/consumer/JniNotificationConsumer.cpp
service/notification/android/notification-service/src/main/jni/provider/JniNotificationProvider.cpp
service/notification/cpp-wrapper/common/NSUtils.h [moved from service/notification/cpp-wrapper/common/NSErrorCode.h with 71% similarity]
service/notification/cpp-wrapper/consumer/inc/NSConsumerService.h
service/notification/cpp-wrapper/consumer/src/NSConsumerService.cpp
service/notification/cpp-wrapper/examples/linux/notificationserviceconsumer.cpp
service/notification/cpp-wrapper/provider/inc/NSProviderService.h
service/notification/cpp-wrapper/provider/src/NSProviderService.cpp

index 3879098..1553295 100755 (executable)
@@ -121,4 +121,4 @@ if target_os == 'android':
     SConscript('android/SConscript')
 
 # Go to build c++ wrapper
-#SConscript('cpp-wrapper/SConscript')
+SConscript('cpp-wrapper/SConscript')
index 4d91aac..e4b5c1e 100755 (executable)
@@ -133,7 +133,7 @@ void onDiscoverProvider(OIC::Service::NSProvider *provider)
     return ;\r
 }\r
 \r
-void onSubscriptionAccepted(OIC::Service::NSProvider *provider)\r
+void onProviderChanged(OIC::Service::NSProvider *provider,OIC::Service::NSResponse response)\r
 {\r
     LOGD ("ConsumerService_onSubscriptionAccepted");\r
 \r
@@ -187,6 +187,7 @@ void onSubscriptionAccepted(OIC::Service::NSProvider *provider)
         if (JNI_EDETACHED == envRet) g_jvm->DetachCurrentThread();\r
         return ;\r
     }\r
+    //TODO: Modify to call ProviderChanged Cb adding topic in Java\r
     jmethodID mid = env->GetMethodID(\r
                         cls,\r
                         "onSubscriptionAccepted",\r
@@ -499,7 +500,7 @@ JNIEXPORT void JNICALL Java_org_iotivity_service_ns_consumer_ConsumerService_nat
 \r
     OIC::Service::NSConsumerService::ConsumerConfig cfg;\r
     cfg.m_discoverCb = onDiscoverProvider;\r
-    cfg.m_acceptedCb = onSubscriptionAccepted;\r
+    cfg.m_changedCb = onProviderChanged;\r
 \r
     OIC::Service::NSConsumerService::getInstance()->Start(cfg);\r
 \r
@@ -529,10 +530,10 @@ Java_org_iotivity_service_ns_consumer_ConsumerService_nativeEnableRemoteService
     if (!jServerAddress)\r
     {\r
         ThrowNSException(NS_ERROR, "EnableRemoteService server address NULL");\r
-        return (jint) OIC::Service::Result::ERROR;\r
+        return (jint) OIC::Service::NSResult::ERROR;\r
     }\r
     const char *serverAddress = env->GetStringUTFChars(jServerAddress, 0);\r
-    OIC::Service::Result res =\r
+    OIC::Service::NSResult res =\r
         OIC::Service::NSConsumerService::getInstance()->EnableRemoteService(std::string(serverAddress));\r
     env->ReleaseStringUTFChars(jServerAddress, serverAddress);\r
     return (jint) res;\r
index 595a0d9..6aa0977 100644 (file)
@@ -435,7 +435,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
     {
         LOGE("Fail to set listeners");
         ThrowNSException(NS_ERROR, "Listener cannot be null");
-        return (jint) OIC::Service::Result::ERROR;
+        return (jint) OIC::Service::NSResult::ERROR;
     }
 
     if (g_obj_subscriptionListener != NULL)
@@ -457,8 +457,8 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
     cfg.m_syncInfoCb =  onSyncInfoListenerCb;
     cfg.policy = (bool) jPolicy;
 
-    OIC::Service::Result result = OIC::Service::NSProviderService::getInstance()->Start(cfg);
-    if (result != OIC::Service::Result::OK)
+    OIC::Service::NSResult result = OIC::Service::NSProviderService::getInstance()->Start(cfg);
+    if (result != OIC::Service::NSResult::OK)
     {
         LOGE("Fail to start NSProviderService");
 
@@ -473,8 +473,8 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
 {
     LOGI("JNIProviderService: nativeStop - IN");
 
-    OIC::Service::Result result = OIC::Service::NSProviderService::getInstance()->Stop();
-    if (result !=  OIC::Service::Result::OK)
+    OIC::Service::NSResult result = OIC::Service::NSProviderService::getInstance()->Stop();
+    if (result !=  OIC::Service::NSResult::OK)
     {
         LOGI("Fail to stop NSProvider service");
         return (jint) result;
@@ -497,17 +497,17 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_ProviderService_nat
     {
         LOGI("Fail to send notification - Message is null");
         ThrowNSException(NS_ERROR, "Message cannot be null");
-        return (jint) OIC::Service::Result::ERROR;
+        return (jint) OIC::Service::NSResult::ERROR;
     }
     OIC::Service::NSMessage *nsMsg = getMessage(env, jMsg);
     if (nsMsg == nullptr)
     {
         ThrowNSException(NS_ERROR, "Message didn't have a field ID ");
-        return (jint) OIC::Service::Result::ERROR;
+        return (jint) OIC::Service::NSResult::ERROR;
     }
 
-    OIC::Service::Result result = OIC::Service::NSProviderService::getInstance()->SendMessage(nsMsg);
-    if (result !=  OIC::Service::Result::OK)
+    OIC::Service::NSResult result = OIC::Service::NSProviderService::getInstance()->SendMessage(nsMsg);
+    if (result !=  OIC::Service::NSResult::OK)
     {
         LOGI("Fail to send NSProvider Message");
     }
@@ -533,14 +533,14 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeEnableRemoteService(
     if (!jstr)
     {
         ThrowNSException(NS_ERROR, "Server Address Can't be NULL");
-        return (jint) OIC::Service::Result::ERROR;
+        return (jint) OIC::Service::NSResult::ERROR;
     }
 
     const char *address = env->GetStringUTFChars( jstr, NULL);
     std::string servAddress(address);
-    OIC::Service::Result result  = OIC::Service::NSProviderService::getInstance()->EnableRemoteService(
+    OIC::Service::NSResult result  = OIC::Service::NSProviderService::getInstance()->EnableRemoteService(
                                        servAddress);
-    if (result !=  OIC::Service::Result::OK)
+    if (result !=  OIC::Service::NSResult::OK)
     {
         LOGE("Fail to Enable Remote Service");
     }
@@ -557,14 +557,14 @@ Java_org_iotivity_service_ns_provider_ProviderService_nativeDisableRemoteService
     if (!jstr)
     {
         ThrowNSException(NS_ERROR, "Server Address Can't be NULL");
-        return (jint) OIC::Service::Result::ERROR;
+        return (jint) OIC::Service::NSResult::ERROR;
     }
 
     const char *address = env->GetStringUTFChars( jstr, NULL);
     std::string servAddress(address);
-    OIC::Service::Result result  = OIC::Service::NSProviderService::getInstance()->DisableRemoteService(
+    OIC::Service::NSResult result  = OIC::Service::NSProviderService::getInstance()->DisableRemoteService(
                                        servAddress);
-    if (result !=  OIC::Service::Result::OK)
+    if (result !=  OIC::Service::NSResult::OK)
     {
         LOGE("Fail to Disable Remote Service");
     }
@@ -583,7 +583,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeAcce
     if (!consumerClass)
     {
         ThrowNSException(NS_ERROR, "Failed to Get ObjectClass for Consumer");
-        return (jint) OIC::Service::Result::ERROR;
+        return (jint) OIC::Service::NSResult::ERROR;
     }
 
     // Consumer ID
@@ -592,7 +592,7 @@ JNIEXPORT jint JNICALL Java_org_iotivity_service_ns_provider_Consumer_nativeAcce
     {
         LOGE("Error: jfieldID for mConsumerId  is null");
         ThrowNSException(NS_ERROR, "ConsumerId not found");
-        return (jint) OIC::Service::Result::ERROR;
+        return (jint) OIC::Service::NSResult::ERROR;
     }
 
     jstring jconId = (jstring)env->GetObjectField( jConsumer, fid_id);
@@ -1,47 +1,55 @@
-//******************************************************************\r
-//\r
-// Copyright 2016 Samsung Electronics All Rights Reserved.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-//\r
-// Licensed under the Apache License, Version 2.0 (the "License");\r
-// you may not use this file except in compliance with the License.\r
-// You may obtain a copy of the License at\r
-//\r
-//      http://www.apache.org/licenses/LICENSE-2.0\r
-//\r
-// Unless required by applicable law or agreed to in writing, software\r
-// distributed under the License is distributed on an "AS IS" BASIS,\r
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-// See the License for the specific language governing permissions and\r
-// limitations under the License.\r
-//\r
-//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
-\r
-/**\r
- * @file\r
- *\r
- * This file contains Notification service Error Codes.\r
- */\r
-\r
-#ifndef _NS_ERROR_CODE_H_\r
-#define _NS_ERROR_CODE_H_\r
-\r
-\r
-namespace OIC\r
-{\r
-    namespace Service\r
-    {\r
-        /** Result - enumeration for NS service Result*/\r
-        enum class Result\r
-        {\r
-            OK = 100,\r
-            ERROR = 200,\r
-            SUCCESS = 300,\r
-            FAIL = 400,\r
-            ALLOW = 500,\r
-            DENY = 600,\r
-        };\r
-    }\r
-}\r
-#endif /* _NS_ERROR_CODE_H_ */\r
+//******************************************************************
+//
+// Copyright 2016 Samsung Electronics All Rights Reserved.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
+
+/**
+ * @file
+ *
+ * This file contains Notification service Utils.
+ */
+
+#ifndef _NS_UTILS_H_
+#define _NS_UTILS_H_
+
+
+namespace OIC
+{
+    namespace Service
+    {
+        /** NSResult - enumeration for NS service Result*/
+        enum class NSResult
+        {
+            OK = 100,
+            ERROR = 200,
+            SUCCESS = 300,
+            FAIL = 400,
+        };
+        
+        /**
+             * NSResponse code of notification service
+             */
+        enum class NSResponse
+        {
+            ALLOW = 1,
+            DENY = 2,
+            TOPIC = 3,
+        };
+    }
+}
+#endif /* _NS_UTILS_H_ */
index e34fd69..2f6aa89 100755 (executable)
@@ -31,7 +31,7 @@
 #include <list>\r
 #include <algorithm>\r
 #include "NSProvider.h"\r
-#include "NSErrorCode.h"\r
+#include "NSUtils.h"\r
 \r
 \r
 namespace OIC\r
@@ -53,10 +53,11 @@ namespace OIC
                 typedef void (*ProviderDiscoveredCallback)(NSProvider *);\r
 \r
                 /**\r
-                     * Consumer uses this callback function on subscription accepted by provider\r
-                     * @param[in] provider        Provider who has the notification resource\r
+                     * Invoked when the provider state is changed\r
+                     * @param[in] provider  Provider which has the notification resource\r
+                     * @param[in] response  Response which has the provider state\r
                      */\r
-                typedef void (* AcceptedCallback)(NSProvider *);\r
+                typedef void (* ProviderChangedCallback)(NSProvider *, NSResponse);\r
 \r
                 /**\r
                      * @struct   ConsumerConfig\r
@@ -67,8 +68,8 @@ namespace OIC
                 {\r
                     /** m_discoverCb - ProviderDiscoveredCallback callback listener.*/\r
                     ProviderDiscoveredCallback m_discoverCb;\r
-                    /** m_acceptedCb - AcceptedCallback callback listener.*/\r
-                    AcceptedCallback m_acceptedCb;\r
+                    /** m_changedCb - ProviderChangedCallback callback listener.*/\r
+                    ProviderChangedCallback m_changedCb;\r
                 } ConsumerConfig;\r
 \r
                 /**\r
@@ -93,9 +94,9 @@ namespace OIC
                 /**\r
                      * Request to discover to remote address as parameter.\r
                      * @param[in]  server address combined with IP address and port number using delimiter :\r
-                     * @return  result code of Consumer Service\r
+                     * @return  NSResult code of Consumer Service\r
                      */\r
-                Result EnableRemoteService(const std::string &serverAddress);\r
+                NSResult EnableRemoteService(const std::string &serverAddress);\r
 \r
                 /**\r
                       * Request discovery manually\r
index 341fb92..5be4b61 100755 (executable)
@@ -40,15 +40,25 @@ namespace OIC
             NS_LOG(DEBUG, "onNSProviderDiscovered - OUT");\r
         }\r
 \r
-        void onNSAccepted(::NSProvider *provider)\r
+        void onNSProviderChanged(::NSProvider *provider, ::NSResponse response)\r
         {\r
-            NS_LOG(DEBUG, "onNSAccepted - IN");\r
+            NS_LOG(DEBUG, "onNSProviderChanged - IN");\r
+            NS_LOG_V(DEBUG, "provider Id : %s",provider->providerId);\r
+            NS_LOG_V(DEBUG, "response : %d",(int)response);\r
+            \r
             NSProvider *nsProvider = new NSProvider(provider);\r
-            NSConsumerService::getInstance()->getAcceptedProviders().push_back(nsProvider);\r
-\r
-            if (NSConsumerService::getInstance()->getConsumerConfig().m_acceptedCb != NULL)\r
-                NSConsumerService::getInstance()->getConsumerConfig().m_acceptedCb(nsProvider);\r
-            NS_LOG(DEBUG, "onNSAccepted - OUT");\r
+            if(response == NS_ALLOW)\r
+            {\r
+                NSConsumerService::getInstance()->getAcceptedProviders().push_back(nsProvider);\r
+            }\r
+            else if(response == NS_DENY)\r
+            {\r
+                NSConsumerService::getInstance()->getAcceptedProviders().remove(nsProvider);\r
+            }\r
+            if (NSConsumerService::getInstance()->getConsumerConfig().m_changedCb != NULL)\r
+                NSConsumerService::getInstance()->getConsumerConfig().m_changedCb(\r
+                                                            nsProvider, (NSResponse) response);\r
+            NS_LOG(DEBUG, "onNSProviderChanged - OUT");\r
         }\r
 \r
         void onNSMessageReceived(::NSMessage *message)\r
@@ -94,7 +104,7 @@ namespace OIC
         NSConsumerService::NSConsumerService()\r
         {\r
             m_config.m_discoverCb = NULL;\r
-            m_config.m_acceptedCb = NULL;\r
+            m_config.m_changedCb = NULL;\r
         }\r
 \r
         NSConsumerService::~NSConsumerService()\r
@@ -117,7 +127,7 @@ namespace OIC
             m_config = config;\r
             NSConsumerConfig nsConfig;\r
             nsConfig.discoverCb = onNSProviderDiscovered;\r
-            nsConfig.acceptedCb = onNSAccepted;\r
+            nsConfig.changedCb= onNSProviderChanged;\r
             nsConfig.messageCb = onNSMessageReceived;\r
             nsConfig.syncInfoCb = onNSSyncInfoReceived;\r
 \r
@@ -134,12 +144,12 @@ namespace OIC
             return;\r
         }\r
 \r
-        Result NSConsumerService::EnableRemoteService(const std::string &serverAddress)\r
+        NSResult NSConsumerService::EnableRemoteService(const std::string &serverAddress)\r
         {\r
             NS_LOG(DEBUG, "EnableRemoteService - IN");\r
-            Result result = Result::ERROR;\r
+            NSResult result = NSResult::ERROR;\r
 #ifdef WITH_CLOUD\r
-            result = (Result) NSConsumerEnableRemoteService(OICStrdup(serverAddress.c_str()));\r
+            result = (NSResult) NSConsumerEnableRemoteService(OICStrdup(serverAddress.c_str()));\r
 #else\r
             NS_LOG(ERROR, "Remote Services feature is not enabled in the Build");\r
 #endif\r
index c2f8fea..fe2af59 100755 (executable)
@@ -54,11 +54,12 @@ void onDiscoverNotificationCb(OIC::Service::NSProvider *provider)
     std::cout << "startSubscribing" << std::endl;\r
 }\r
 \r
-void onSubscriptionAcceptedCb(OIC::Service::NSProvider *provider)\r
+void onProviderChangedCb(OIC::Service::NSProvider *provider,OIC::Service::NSResponse response)\r
 {\r
     std::cout << "Subscription accepted" << std::endl;\r
     std::cout << "subscribed provider Id : " << provider->getProviderId() << std::endl;\r
-    provider->setListener(onNotificationPostedCb, onNotificationSyncCb);\r
+    if(response == OIC::Service::NSResponse::ALLOW)\r
+        provider->setListener(onNotificationPostedCb, onNotificationSyncCb);\r
 }\r
 \r
 void *OCProcessThread(void *ptr)\r
@@ -91,7 +92,7 @@ int main(void)
 \r
     NSConsumerService::ConsumerConfig cfg;\r
     cfg.m_discoverCb = onDiscoverNotificationCb;\r
-    cfg.m_acceptedCb = onSubscriptionAcceptedCb;\r
+    cfg.m_changedCb = onProviderChangedCb;\r
 \r
     pthread_create(&OCThread, NULL, OCProcessThread, NULL);\r
 \r
index 9b64ec6..deed41f 100755 (executable)
@@ -31,7 +31,7 @@
 #include "NSConsumer.h"\r
 #include "NSSyncInfo.h"\r
 #include "NSMessage.h"\r
-#include "NSErrorCode.h"\r
+#include "NSUtils.h"\r
 \r
 namespace OIC\r
 {\r
@@ -103,34 +103,34 @@ namespace OIC
                       * and onMessageSynchronized function listeners\r
                       * @return :: result code of Provider Service\r
                       */\r
-                Result Start(ProviderConfig config);\r
+                NSResult Start(ProviderConfig config);\r
 \r
                 /**\r
                       * Terminate notification service for provider\r
                       * @return :: result code of Provider Service\r
                       */\r
-                Result Stop();\r
+                NSResult Stop();\r
 \r
                 /**\r
                       * Request to publish resource to cloud server\r
                       * @param[in]  server address combined with IP address and port number using delimiter :\r
                       * @return  result code of Provider Service\r
                       */\r
-                Result EnableRemoteService(const std::string &serverAddress);\r
+                NSResult EnableRemoteService(const std::string &serverAddress);\r
 \r
                 /**\r
                       * Request to cancel remote service using cloud server\r
                       * @param[in]  server address combined with IP address and port number using delimiter :\r
                       * @return  result code of Provider Service\r
                       */\r
-                Result DisableRemoteService(const std::string &serverAddress);\r
+                NSResult DisableRemoteService(const std::string &serverAddress);\r
 \r
                 /**\r
                       * Send notification message to all subscribers\r
                       * @param[in]  msg  Notification message including id, title, contentText\r
                       * @return :: result code of Provider Service\r
                       */\r
-                Result SendMessage(NSMessage *msg);\r
+                NSResult SendMessage(NSMessage *msg);\r
 \r
 \r
                 /**\r
index e4335a7..68ac038 100755 (executable)
@@ -78,7 +78,7 @@ namespace OIC
             return &s_instance;\r
         }\r
 \r
-        Result NSProviderService::Start(NSProviderService::ProviderConfig config)\r
+        NSResult NSProviderService::Start(NSProviderService::ProviderConfig config)\r
         {\r
             NS_LOG(DEBUG, "Start - IN");\r
 \r
@@ -89,25 +89,25 @@ namespace OIC
             nsConfig.policy = config.policy;\r
             nsConfig.userInfo = OICStrdup(config.userInfo.c_str());\r
 \r
-            Result result = (Result) NSStartProvider(nsConfig);\r
+            NSResult result = (NSResult) NSStartProvider(nsConfig);\r
             NS_LOG(DEBUG, "Start - OUT");\r
             return result;\r
         }\r
 \r
-        Result NSProviderService::Stop()\r
+        NSResult NSProviderService::Stop()\r
         {\r
             NS_LOG(DEBUG, "Stop - IN");\r
-            Result result = (Result) NSStopProvider();\r
+            NSResult result = (NSResult) NSStopProvider();\r
             NS_LOG(DEBUG, "Stop - OUT");\r
             return result;\r
         }\r
 \r
-        Result NSProviderService::EnableRemoteService(const std::string &serverAddress)\r
+        NSResult NSProviderService::EnableRemoteService(const std::string &serverAddress)\r
         {\r
             NS_LOG(DEBUG, "EnableRemoteService - IN");\r
-            Result result = Result::ERROR;\r
+            NSResult result = NSResult::ERROR;\r
 #ifdef WITH_CLOUD\r
-            result = (Result) NSProviderEnableRemoteService(OICStrdup(serverAddress.c_str()));\r
+            result = (NSResult) NSProviderEnableRemoteService(OICStrdup(serverAddress.c_str()));\r
 #else\r
             NS_LOG(ERROR, "Remote Services feature is not enabled in the Build");\r
 #endif\r
@@ -115,12 +115,12 @@ namespace OIC
             return result;\r
         }\r
 \r
-        Result NSProviderService::DisableRemoteService(const std::string &serverAddress)\r
+        NSResult NSProviderService::DisableRemoteService(const std::string &serverAddress)\r
         {\r
             NS_LOG(DEBUG, "DisableRemoteService - IN");\r
-            Result result = Result::ERROR;\r
+            NSResult result = NSResult::ERROR;\r
 #ifdef WITH_CLOUD\r
-            result = (Result) NSProviderDisableRemoteService(OICStrdup(serverAddress.c_str()));\r
+            result = (NSResult) NSProviderDisableRemoteService(OICStrdup(serverAddress.c_str()));\r
 #else\r
             NS_LOG(ERROR, "Remote Services feature is not enabled in the Build");\r
 #endif\r
@@ -128,12 +128,12 @@ namespace OIC
             return result;\r
         }\r
 \r
-        Result NSProviderService::SendMessage(NSMessage *msg)\r
+        NSResult NSProviderService::SendMessage(NSMessage *msg)\r
         {\r
             NS_LOG(DEBUG, "SendMessage - IN");\r
-            Result result = Result::ERROR;\r
+            NSResult result = NSResult::ERROR;\r
             if (msg != nullptr)\r
-                result = (Result) NSSendMessage(getNSMessage(msg));\r
+                result = (NSResult) NSSendMessage(getNSMessage(msg));\r
             else\r
                 NS_LOG(DEBUG, "Empty Message");\r
             NS_LOG(DEBUG, "SendMessage - OUT");\r