From 066118dd70d21a6fbeab723ef6dde5c8fe66e529 Mon Sep 17 00:00:00 2001 From: "jaesick.shin" Date: Mon, 8 Aug 2016 11:16:50 +0900 Subject: [PATCH] Add NSProviderConfig struct. this struct included policy, subscribeRequestCallback, syncInfoCallback, user information. next commit, i will modify startProvider API(NSProviderConfig). Change-Id: Iab6dc04083b20719259599e36ca903c90489b148 Signed-off-by: jaesick.shin Reviewed-on: https://gerrit.iotivity.org/gerrit/10107 Tested-by: jenkins-iotivity Reviewed-by: Madan Lanka --- service/notification/include/NSProviderInterface.h | 54 +++++++++++++++------- 1 file changed, 38 insertions(+), 16 deletions(-) diff --git a/service/notification/include/NSProviderInterface.h b/service/notification/include/NSProviderInterface.h index a85c521..6163d34 100644 --- a/service/notification/include/NSProviderInterface.h +++ b/service/notification/include/NSProviderInterface.h @@ -37,27 +37,43 @@ extern "C" #include /** - * Invoked the subscription request from consumer is received - * @param[in] consumer Consumer who subscribes the resource + * Provider uses this callback function to receive subscription request of consumer + * @param[in] consumer Consumer who subscribes the resource */ typedef void (*NSSubscribeRequestCallback)(NSConsumer *); /** - * Invoked when the synchronization data which has notification message - * read/delete event from consumer is received + * Provider use this callback function to receive the status of the message * synchronization - * @param[in] syncinfo Synchronization information of the notification message + * @param[in] sync Synchronization information of the notification message */ typedef void (*NSProviderSyncInfoCallback)(NSSyncInfo *); /** - * Initialize notification service for provider - * @param[in] policy Accepter - * @param[in] subscribeRequestCallback Callback function to register for receiving - * subscription request from consumer - * @param[in] syncCallback Callback function to register for receiving sync data + * Set provider service with the following configuration + */ +typedef struct +{ + /* Invoked when the subscription request from consumer is received */ + NSSubscribeRequestCallback subRequestCallback; + /* Invoked when the synchronization data, read and deleted, is sent by consumer is received */ + NSProviderSyncInfoCallback syncInfoCallback; + /* Set the policy for notification servcie refering to following + * if policy is true, provider decides to allow or deny for all the subscribing consumers. + * Otherwise(policy is false) consumer decides to request subscription to discovered providers. + */ + bool policy; + /* User Information */ + char * userInfo; + +} NSProviderConfig; + +/** + * Initialize notification service for provider service + * @param[in] config Refer to NSProviderConfig * @return ::NS_OK or result code of NSResult */ +//TODO next commit, change to NSProviderConfig .. NSResult NSStartProvider(bool policy, NSSubscribeRequestCallback subscribeRequestCb, NSProviderSyncInfoCallback syncCb); @@ -97,17 +113,23 @@ NSResult NSSendMessage(NSMessage *msg); NSResult NSAcceptSubscription(NSConsumer *consumer, bool accepted); /** - * Send sync type in order to synchronize notification status with other consumers, - * when provider consumes the notification such as READ, DELETE - * @param[in] messageId Notification message if to synchronize the status - * @param[in] type changed notification status from NSSyncType + * Get consumer list that is stored in the cache of notification service + * @param[in] list Consumer list + * @param[in] size the number of consumers stored in the cache * @return ::NS_OK or result code of NSResult */ -NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type); +//TODO will use Function. +// NSResult NSGetConsumerList(uint8_t *list, uint32_t size); +/** + * Send read-check to provider in order to synchronize notification status with other consumers + * @param[in] message Notification message to synchronize the status + * @return ::NS_OK or result code of NSResult + */ +NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type); /** - * Initialize NSMessage structure with message id and provider(device) id + * Initialize NSMessage struct, our service set message id and provider(device) id * @return ::NSMessage * */ NSMessage * NSCreateMessage(); -- 2.7.4