#include "NSCommon.h"
/**
- * Consumer uses this callback function to receive the discovered providers
- * @param[in] provider Provider who has the notification resource
+ * Invoked when the discovered provider is received
+ * @param[in] provider Provider who has the notification resource
*/
typedef void (* NSProviderDiscoveredCallback)(NSProvider *);
+/**
+ * Invoked when the response of the subscription is received
+ * @param[in] provider Provider which has the notification resource
+ */
typedef void (* NSSubscriptionAcceptedCallback)(NSProvider *);
/**
- * Consumer use this callback function to receive notification message from provider
+ * Invoked when the notification message from provider is received
* synchronization
- * @param[in] provider Provider who sends notification message
- * @param[in] message Notification message
+ * @param[in] message Notification message
*/
typedef void (* NSMessageReceivedCallback)(NSMessage *);
/**
- * Provider and consumer use this callback function to receive the status of the message
+ * Invoked when the synchronization data which has notification message
+ * read/delete event from provider/consumer is received
* synchronization
- * @param[in] provider Provider who requests synchronization with the status
- * @param[in] sync Synchronization information of the notification message
+ * @param[in] syncInfo Synchronization information of the notification message
*/
typedef void (* NSSyncInfoReceivedCallback)(NSSyncInfo *);
/**
* Initialize notification service for consumer
- * @param[in] providerDiscoveredCallback Callback function to discover notification providers
- * @param[in] notificationReceivedCallback Callback function to receive notification messages
- * @param[in] syncCallback Callback function to receive synchronization status of notification
+ * @param[in] config NSConsumerconfig structure of callback functions
* @return ::NS_OK or result code of NSResult
*/
NSResult NSStartConsumer(NSConsumerConfig config);
*/
NSResult NSUnsubscribe(NSProvider *provider);
+/**
+ * Send sync type to provider in order to synchronize notification status with other consumers
+ * when consumer consumes the notification such as READ, DELETE
+ * @param[in] providerId Provider id of the Notification message
+ * @param[in] messageId Notification message id to synchronize the status
+ * @param[in] type changed notification status from NSSyncType
+ * @return ::NS_OK or result code of NSResult
+ */
NSResult NSConsumerSendSyncInfo(
const char * providerId, uint64_t messageId, NSSyncType type);
+/**
+ * Request NSProvider that is matched by provider id
+ * @param[in] providerId the id of provider that user wants to get
+ * @return NSProvider
+ */
NSProvider * NSConsumerGetProvider(const char * providerId);
+/**
+ * Request NSMessage that is matched by message id
+ * @param[in] messageId the id of message that user wants to get
+ * @return NSMessage
+ */
NSMessage * NSConsumerGetMessage(uint64_t messageId);
#ifdef __cplusplus
#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
+ * Invoked the subscription request from consumer is received\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
+ * Invoked when the synchronization data which has notification message \r
+ * read/delete event from consumer is received\r
* synchronization\r
- * @param[in] sync Synchronization information of the notification message\r
+ * @param[in] syncinfo Synchronization information of the notification message\r
*/\r
typedef void (*NSProviderSyncInfoCallback)(NSSyncInfo *);\r
\r
NSResult NSAcceptSubscription(NSConsumer *consumer, bool accepted);\r
\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
+ * 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
* @return ::NS_OK or result code of NSResult\r
*/\r
NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type);\r
\r
\r
/**\r
- * Initialize NSMessage struct, our service set message id and provider(device) id\r
+ * Initialize NSMessage structure with message id and provider(device) id\r
* @return ::NSMessage *\r
*/\r
NSMessage * NSCreateMessage();\r