From 6975806a2f5e2b32e82f1392e14f5d16b6e68c7d Mon Sep 17 00:00:00 2001 From: KIM JungYong Date: Fri, 9 Sep 2016 16:24:29 +0900 Subject: [PATCH] Fix bug for select topic. 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 Reviewed-on: https://gerrit.iotivity.org/gerrit/11625 Reviewed-by: Uze Choi Tested-by: jenkins-iotivity Reviewed-by: Hun-je Yeon --- service/notification/examples/linux/notificationconsumer.c | 12 ++++++++++-- service/notification/src/consumer/NSConsumerCommunication.c | 11 ++--------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/service/notification/examples/linux/notificationconsumer.c b/service/notification/examples/linux/notificationconsumer.c index 5a77ea0..26a49ed 100644 --- a/service/notification/examples/linux/notificationconsumer.c +++ b/service/notification/examples/linux/notificationconsumer.c @@ -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: diff --git a/service/notification/src/consumer/NSConsumerCommunication.c b/service/notification/src/consumer/NSConsumerCommunication.c index 5ca27f5..6dc82ec 100644 --- a/service/notification/src/consumer/NSConsumerCommunication.c +++ b/service/notification/src/consumer/NSConsumerCommunication.c @@ -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); -- 2.7.4