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
\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