Fix bug for select topic.
authorKIM JungYong <jyong2.kim@samsung.com>
Fri, 9 Sep 2016 07:24:29 +0000 (16:24 +0900)
committerUze Choi <uzchoi@samsung.com>
Mon, 12 Sep 2016 01:49:58 +0000 (01:49 +0000)
When consumer service get topic to provider, consumer id is excepted.
Consumer id is added on request get topic.
linux sample app is updated for print topic.

Change-Id: I383c2032856e034e80241cc49b1601fece04d230
Signed-off-by: KIM JungYong <jyong2.kim@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/11625
Reviewed-by: Uze Choi <uzchoi@samsung.com>
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Hun-je Yeon <hunje.yeon@samsung.com>
service/notification/examples/linux/notificationconsumer.c
service/notification/src/consumer/NSConsumerCommunication.c

index 5a77ea0..26a49ed 100644 (file)
@@ -186,6 +186,7 @@ int main(void)
                 if(g_provider)
                 {
                     g_topicLL = NSConsumerGetTopicList(g_provider->providerId);
+                    printProviderTopicList(g_topicLL);
                 }
                 break;
             case 4:
@@ -198,10 +199,17 @@ int main(void)
                     while (iter)
                     {
                         iter->state = (i++)%2;
-                        printf("Topic Name: %s\t Topic State: %d\n", iter->topicName, iter->state);
                         iter = iter->next;
                     }
-                    NSConsumerUpdateTopicList(g_provider->providerId, g_topicLL);
+                    NSResult ret = NSConsumerUpdateTopicList(g_provider->providerId, g_topicLL);
+                    if (ret == NS_OK)
+                    {
+                        printProviderTopicList(g_topicLL);
+                    }
+                    else
+                    {
+                        printf("Update fail\n");
+                    }
                 }
                 break;
             case 5:
index 5ca27f5..6dc82ec 100644 (file)
@@ -466,15 +466,8 @@ void NSConsumerCommunicationTaskProcessing(NSTask * task)
         }
 
         NS_LOG(DEBUG, "get topic query");
-        char * query = NULL;
-        if (task->taskType == TASK_CONSUMER_REQ_TOPIC_LIST)
-        {
-            query = OICStrdup(topicUri);
-        }
-        else if (task->taskType == TASK_CONSUMER_GET_TOPIC_LIST)
-        {
-            query = NSMakeRequestUriWithConsumerId(topicUri);
-        }
+        char * query = NSMakeRequestUriWithConsumerId(topicUri);
+
         NS_VERIFY_NOT_NULL_V(query);
         NS_LOG_V(DEBUG, "topic query : %s", query);