replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / include / NSConsumerInterface.h
index c028820..a25675f 100644 (file)
@@ -35,33 +35,30 @@ extern "C"
 #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 provider state is changed
+ * @param[in] provider  Provider which has the notification resource
+ * @param[in] state  Response which has the provider state
  */
-typedef void (* NSProviderDiscoveredCallback)(NSProvider *);
-
-typedef void (* NSSubscriptionAcceptedCallback)(NSProvider *);
+typedef void (* NSProviderStateCallback)(NSProvider *, NSProviderState);
 
 /**
- * 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 *);
 
 typedef struct
 {
-    NSProviderDiscoveredCallback discoverCb;
-    NSSubscriptionAcceptedCallback acceptedCb;
+    NSProviderStateCallback changedCb;
     NSMessageReceivedCallback messageCb;
     NSSyncInfoReceivedCallback syncInfoCb;
 
@@ -69,9 +66,7 @@ typedef struct
 
 /**
  * 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);
@@ -83,6 +78,23 @@ NSResult NSStartConsumer(NSConsumerConfig config);
 NSResult NSStopConsumer();
 
 /**
+ * Request to discover to remote address as parameter.
+ * @param[in] server address combined with IP address and port number using delimiter :
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSConsumerEnableRemoteService(const char * serverAddress);
+
+#ifdef WITH_MQ
+/**
+ * Request to subscribe to remote MQ address as parameter.
+ * @param[in] server address combined with IP address and port number and MQ broker uri using delimiter :
+ * @param[in] topicName the interest MQ Topic name for subscription.
+ * @return ::NS_OK or result code of NSResult
+ */
+NSResult NSConsumerSubscribeMQService(const char * serverAddress, const char * topicName);
+#endif
+
+/**
  * Request discovery manually
  * @return ::NS_OK or result code of NSResult
  */
@@ -90,24 +102,50 @@ NSResult NSRescanProvider();
 
 /**
  * Request to subscribe notification message resource of provider
- * @param[in]  provider  Provider who send the notification message
+ * @param[in] providerId the Id of Provider who send the notification message
  * @return ::NS_OK or result code of NSResult
  */
-NSResult NSSubscribe(NSProvider *provider);
+NSResult NSSubscribe(const char * providerId);
 
 /**
  * Request to unsubscribe in order not to receive notification message from provider
- * @param[in]  provider  Provider who send the notification message
+ * @param[in]  providerId  the Id of Provider who send the notification message
  * @return ::NS_OK or result code of NSResult
  */
-NSResult NSUnsubscribe(NSProvider *provider);
+NSResult NSUnsubscribe(const char * providerId);
 
+/**
+ * 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);
 
-NSMessage * NSConsumerGetMessage(uint64_t messageId);
+/**
+ * Request NSTopic list that is subscribed from provider
+ * @param[in] providerId the Id of provider that user wants to get
+ * @return NSResult
+ */
+NSTopicLL * NSConsumerGetTopicList(const char * providerId);
+
+/**
+ * Select Topic list that is wanted to subscribe from provider
+ * @param[in] providerId the Id of provider that user wants to set
+ * @param[in] topics the topic list that user wants to set
+ * @return NSResult
+ */
+NSResult NSConsumerUpdateTopicList(const char * providerId, NSTopicLL * topics);
 
 #ifdef __cplusplus
 }