Add NSProviderConfig struct.
authorjaesick.shin <jaesick.shin@samsung.com>
Mon, 8 Aug 2016 02:16:50 +0000 (11:16 +0900)
committerMadan Lanka <lanka.madan@samsung.com>
Mon, 8 Aug 2016 05:08:21 +0000 (05:08 +0000)
this struct included
policy, subscribeRequestCallback, syncInfoCallback, user information.
next commit, i will modify startProvider API(NSProviderConfig).

Change-Id: Iab6dc04083b20719259599e36ca903c90489b148
Signed-off-by: jaesick.shin <jaesick.shin@samsung.com>
Reviewed-on: https://gerrit.iotivity.org/gerrit/10107
Tested-by: jenkins-iotivity <jenkins-iotivity@opendaylight.org>
Reviewed-by: Madan Lanka <lanka.madan@samsung.com>
service/notification/include/NSProviderInterface.h

index a85c521..6163d34 100644 (file)
@@ -37,27 +37,43 @@ extern "C"
 #include <stdint.h>\r
 \r
 /**\r
- * Invoked the subscription request from consumer is received\r
- * @param[in] consumer  Consumer who subscribes the resource\r
+ * Provider uses this callback function to receive subscription request of consumer\r
+ * @param[in] consumer        Consumer who subscribes the resource\r
  */\r
 typedef void (*NSSubscribeRequestCallback)(NSConsumer *);\r
 \r
 /**\r
- * Invoked when the synchronization data which has notification message \r
- * read/delete event from consumer is received\r
+ * Provider use this callback function to receive the status of the message\r
  * synchronization\r
- * @param[in] syncinfo  Synchronization information of the notification message\r
+ * @param[in] sync        Synchronization information of the notification message\r
  */\r
 typedef void (*NSProviderSyncInfoCallback)(NSSyncInfo *);\r
 \r
 /**\r
- * Initialize notification service for provider\r
- * @param[in]  policy   Accepter\r
- * @param[in]  subscribeRequestCallback   Callback function to register for receiving\r
- * subscription request from consumer\r
- * @param[in]  syncCallback   Callback function to register for receiving  sync data\r
+ *  Set provider service with the following configuration\r
+ */\r
+typedef struct\r
+{\r
+    /* Invoked when the subscription request from consumer is received */\r
+    NSSubscribeRequestCallback subRequestCallback;\r
+    /* Invoked when the synchronization data, read and deleted, is sent by consumer is received */\r
+    NSProviderSyncInfoCallback syncInfoCallback;\r
+    /* Set the policy for notification servcie refering to following\r
+     * if policy is true, provider decides to allow or deny for all the subscribing consumers.\r
+     * Otherwise(policy is false) consumer decides to request subscription to discovered providers.\r
+     */\r
+    bool policy;\r
+    /* User Information */\r
+    char * userInfo;\r
+\r
+} NSProviderConfig;\r
+\r
+/**\r
+ * Initialize notification service for provider service\r
+ * @param[in]  config   Refer to NSProviderConfig\r
  * @return ::NS_OK or result code of NSResult\r
  */\r
+//TODO next commit, change to NSProviderConfig ..\r
 NSResult NSStartProvider(bool policy, NSSubscribeRequestCallback subscribeRequestCb,\r
         NSProviderSyncInfoCallback syncCb);\r
 \r
@@ -97,17 +113,23 @@ NSResult NSSendMessage(NSMessage *msg);
 NSResult NSAcceptSubscription(NSConsumer *consumer, bool accepted);\r
 \r
 /**\r
- * Send sync type in order to synchronize notification status with other consumers,\r
- * when provider consumes the notification such as READ, DELETE\r
- * @param[in]  messageId  Notification message if to synchronize the status\r
- * @param[in]  type  changed notification status from NSSyncType\r
+ * Get consumer list that is stored in the cache of notification service\r
+ * @param[in]  list  Consumer list\r
+ * @param[in]  size  the number of consumers stored in the cache\r
  * @return ::NS_OK or result code of NSResult\r
  */\r
-NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type);\r
+//TODO will use Function.\r
+// NSResult NSGetConsumerList(uint8_t *list, uint32_t size);\r
 \r
+/**\r
+ * Send read-check to provider in order to synchronize notification status with other consumers\r
+ * @param[in]  message  Notification message to synchronize the status\r
+ * @return ::NS_OK or result code of NSResult\r
+ */\r
+NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type);\r
 \r
 /**\r
- * Initialize NSMessage structure with message id and provider(device) id\r
+ * Initialize NSMessage struct, our service set message id and provider(device) id\r
  * @return ::NSMessage *\r
  */\r
 NSMessage * NSCreateMessage();\r