replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / examples / linux / notificationprovider.c
index c864669..11c1c36 100644 (file)
@@ -22,7 +22,6 @@
 #include <stdbool.h>
 #include <stdlib.h>
 #include <unistd.h>
-#include <ctype.h>
 
 #include "NSProviderInterface.h"
 #include "NSCommon.h"
@@ -46,6 +45,11 @@ char UID[50] = {'\0',};
 char ACCESS_TOKEN[50] = {'\0',};
 #endif
 
+#ifdef WITH_MQ
+char CLOUD_ADDRESS[100] = "10.113.64.52:5686";
+char CLOUD_TOPIC[100] = "/oic/ps/notification";
+#endif
+
 char mainConsumer[37] = {'\0',};
 
 extern char *strdup(const char *s);
@@ -181,7 +185,8 @@ int main()
         printf("8.  NSProviderUnselectTopic(); \n");
         printf("9.  NSProviderGetConsumerTopics(); \n");
         printf("10. NSProviderGetTopics(); \n");
-        printf("11. NSStopProvider() \n");
+        printf("11. NSProviderSubscribeMQService() \n");
+        printf("0. NSStopProvider() \n");
 #ifdef WITH_CLOUD
         printf("21. NSProviderEnableRemoteService (after login) \n");
         printf("22. NSProviderDisableRemoteService (after login) \n");
@@ -194,7 +199,7 @@ int main()
 
         printf("input : ");
 
-        if(scanf("%d", &num) > 0 && isdigit(num) == 0)
+        if(scanf("%d", &num) > 0)
         {
             if(scanf("%c", &dummy) > 0)
             {
@@ -249,6 +254,7 @@ int main()
                 input(body);
 
                 printf("topic : ");
+
                 input(topic);
 
                 printf("app - mTitle : %s \n", title);
@@ -321,9 +327,20 @@ int main()
                 }
                 break;
 
+#if WITH_MQ
             case 11:
-                NSStopProvider();
+                printf("11. Subscribe MQ Service\n");
+
+                printf("Remote Server Address: ");
+                //input(CLOUD_ADDRESS);
+
+                printf("Topic[notificationtest]: ");
+                //input(CLOUD_TOPIC);
+
+                NSProviderSubscribeMQService(CLOUD_ADDRESS, CLOUD_TOPIC);
                 break;
+#endif
+
 #ifdef WITH_CLOUD
             case 21:
                 printf("Enable Remote Service\n");