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);
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");
if(scanf("%d", &num) > 0)
{
- fflush(stdin);
if(scanf("%c", &dummy) > 0)
{
fflush(stdin);
printf("\n");
}
}
+ else
+ {
+ printf("invalid input \n");
+ num = 0;
+ }
switch (num)
{
input(body);
printf("topic : ");
+
input(topic);
printf("app - mTitle : %s \n", title);
printf("app - topic : %s \n", topic);
NSMessage * msg = NSCreateMessage();
+ if(msg)
+ {
- msg->title = OICStrdup(title);
- msg->contentText = OICStrdup(body);
- msg->sourceName = OICStrdup("OCF");
+ msg->title = OICStrdup(title);
+ msg->contentText = OICStrdup(body);
+ msg->sourceName = OICStrdup("OCF");
- if(topic[0] != '\0')
- {
- msg->topic = OICStrdup(topic);
- }
+ if(topic[0] != '\0')
+ {
+ msg->topic = OICStrdup(topic);
+ }
- NSSendMessage(msg);
+ NSSendMessage(msg);
+ }
}
break;
break;
case 10:
- printf("NSProviderGetConsumerTopics\n");
+ printf("NSProviderGetTopics\n");
{
NSTopicLL * topics = NSProviderGetTopics();
printTopics(topics);
}
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");