NSConsumerPushEvent(task);
}
}
-
-///////////////////////////////////////////////////////////////////////////////////////////////////
-// TODO move to other modules
-///////////////////////////////////////////////////////////////////////////////////////////////////
-//NSDiscoveredProvider * NSCreateDiscoveredProviderInfo(OCClientResponse *);
-//
-//OCStackResult NSSubscribeNotification(NSDiscoveredProvider * handle);
-//
-//NSObject * NSBuildOICNotification(OCClientResponse * clientResponse);
-//
-//
-//OCStackApplicationResult NSNotificationListener(
-// void * ctx, OCDoHandle handle, OCClientResponse * clientResponse)
-//{
-// if (!g_isStartedConsumer)
-// {
-// return OC_STACK_DELETE_TRANSACTION;
-// }
-//
-// (void) ctx;
-// (void) handle;
-// if (!clientResponse)
-// {
-// return OC_STACK_KEEP_TRANSACTION;
-// }
-//
-// if (clientResponse->result != OC_STACK_OK)
-// {
-// // TODO error handle.
-// return OC_STACK_KEEP_TRANSACTION;
-// }
-//
-// NSObject * notification = NSBuildOICNotification(clientResponse);
-// if (!notification)
-// {
-// // TODO error handle.
-// return OC_STACK_KEEP_TRANSACTION;
-// }
-//
-// g_NotificationPostedCB(notification);
-//
-// return OC_STACK_KEEP_TRANSACTION;
-//}
-//
-//OCStackResult NSSubscribeNotification(NSDiscoveredProvider * handle)
-//{
-// // TODO add provider list.
-//
-// OCDevAddr * addr = ((NSDiscoveredProvider *)handle)->addr;
-//
-// return NSRequestToResourceIntrospection(
-// ((NSDiscoveredProvider *)handle)->observeHandle,
-// OC_REST_OBSERVE, addr, NS_OBSERVE_QUERY,
-// NSNotificationListener, (void *)DEFAULT_CONTEXT_VALUE, NS_QOS);
-//}
-//
-//NSDiscoveredProvider * NSCreateDiscoveredProviderInfo(OCClientResponse * client)
-//{
-// NSDiscoveredProvider * discoveredProvider
-// = (NSDiscoveredProvider * )OICMalloc(sizeof(NSDiscoveredProvider));
-//
-// if (!discoveredProvider)
-// {
-// return NULL;
-// }
-//
-// discoveredProvider->addr = (OCDevAddr *)OICMalloc(sizeof(OCDevAddr));
-// memcpy(discoveredProvider->addr, client->addr,sizeof(OCDevAddr));
-//
-// return discoveredProvider;
-//}
#include "oic_string.h"
#include "ocpayload.h"
+const char NS_MESSAGE_ACCEPTANCE[] = "0000-0000-0000-0000";
+
NSMessage_consumer * NSBuildOICNotification(OCClientResponse * clientResponse);
NSSync * NSBuildOICNotificationSync(OCClientResponse * clientResponse);
return OC_STACK_KEEP_TRANSACTION;
}
+ if (!strcmp(newNoti->mId, NS_MESSAGE_ACCEPTANCE))
+ {
+ NS_LOG(DEBUG, "Receive Subscribe confirm");
+ OICFree(provider->mUserData);
+ OICFree(provider);
+ NSRemoveMessage(newNoti);
+ return OC_STACK_KEEP_TRANSACTION;
+ }
+
NSTaskType taskType = TASK_CONSUMER_RECV_NOTIFICATION;
NS_LOG(DEBUG, "newNoti->type == Notification");