//\r
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
\r
+/**\r
+ * @file\r
+ *\r
+ * This file provides APIs of Notification Service for Provider.\r
+ */\r
+\r
#ifndef _NS_PROVIDER_INTERFACE_H_\r
#define _NS_PROVIDER_INTERFACE_H_\r
\r
#ifdef __cplusplus\r
-extern "C" {\r
+extern "C"\r
+{\r
#endif // __cplusplus\r
\r
#include "NSCommon.h"\r
#include <stdbool.h>\r
#include <stdint.h>\r
\r
+/**\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
+ * Provider use this callback function to receive the status of the message\r
+ * synchronization\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
+ * @return ::NS_OK or result code of NSResult\r
+ */\r
NSResult NSStartProvider(NSAccessPolicy policy, NSSubscribeRequestCallback subscribeRequestCb,\r
- NSSyncCallback syncCb);\r
+ NSProviderSyncInfoCallback syncCb);\r
\r
+/**\r
+ * Terminate notification service for provider\r
+ * @return ::NS_OK or result code of NSResult\r
+ */\r
NSResult NSStopProvider();\r
\r
-NSResult NSSendNotification(NSMessage *msg);\r
+/**\r
+ * Request to publish resource to cloud server\r
+ * @param[in] server address combined with IP address and port number using delimiter :\r
+ * @return ::NS_OK or result code of NSResult\r
+ */\r
+NSResult NSProviderEnableRemoteService(char *serverAddress);\r
\r
-NSResult NSReadCheck(NSMessage *msg);\r
+/**\r
+ * Request to cancel remote service using cloud server\r
+ * @param[in] server address combined with IP address and port number using delimiter :\r
+ * @return ::NS_OK or result code of NSResult\r
+ */\r
+NSResult NSProviderDisableRemoteService(char *serverAddress);\r
\r
+/**\r
+ * Send notification message to all subscribers\r
+ * @param[in] message Notification message including id, title, contentText\r
+ * @return ::NS_OK or result code of NSResult\r
+ */\r
+NSResult NSSendMessage(NSMessage *msg);\r
+\r
+/**\r
+ * Send acceptance to consumer who subscribes the resource of notification message\r
+ * @param[in] consumer Consumer who subscribes the resource\r
+ * @param[in] accepted the result of acceptance; Allow or Deny\r
+ * @return ::NS_OK or result code of NSResult\r
+ */\r
NSResult NSAccept(NSConsumer *consumer, bool accepted);\r
\r
-NSResult NSGetConsumerList(uint8_t *list, uint32_t size);\r
+/**\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 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
-NSResult NSTestStartPresence();\r
\r
-NSResult NSTestStopPresence();\r
+/**\r
+ * Initialize NSMessage struct, our service set message id and provider(device) id\r
+ * @return ::NSMessage *\r
+ */\r
+NSMessage * NSCreateMessage();\r
\r
#ifdef __cplusplus\r
}\r