X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=service%2Fnotification%2Finclude%2FNSProviderInterface.h;h=260c554e3c9df4e6d908ff393bcc70e4fa9b7353;hb=7f00f942c39b7bc27c7eeecf213a239c3fe4173c;hp=ebe6091918c2ee1aa7f0db177e5040beb6655118;hpb=7b017138673175a8a5891b242efca8ed44227349;p=platform%2Fupstream%2Fiotivity.git diff --git a/service/notification/include/NSProviderInterface.h b/service/notification/include/NSProviderInterface.h index ebe6091..260c554 100644 --- a/service/notification/include/NSProviderInterface.h +++ b/service/notification/include/NSProviderInterface.h @@ -35,87 +35,153 @@ extern "C" #include "NSCommon.h" #include #include - /** - * Provider uses this callback function to receive subscription request of consumer - * @param[in] consumer Consumer who subscribes the resource + * Invoked when provider receives the subscription request of consumer. + * @param[in] consumer Consumer who subscribes the notification message resource */ typedef void (*NSSubscribeRequestCallback)(NSConsumer *); /** - * Provider use this callback function to receive the status of the message - * synchronization - * @param[in] sync Synchronization information of the notification message + * Invoked when synchronization data which has notification message + * read/deleted event from consumer is received. + * @param[in] sync Synchronization information of the notification message */ typedef void (*NSProviderSyncInfoCallback)(NSSyncInfo *); /** + * 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 which checks whether provider is capable of + * denying the subscription of notification message from consumer + * and getting controllabliity to set consumer topic list. + * If true, provider is able to control subscription request and consumer topic list. + * Otherwise(policy is false), consumer can do the same. + */ + bool subControllability; + /* User defined information such as device friendly name */ + char * userInfo; + /* Set on/off for secure resource channel setting */ + bool resourceSecurity; + +} NSProviderConfig; + +/** * 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 - * @return ::NS_OK or result code of NSResult + * @param[in] config Refer to NSProviderConfig + * @return ::NS_OK if the action is requested succesfully */ -NSResult NSStartProvider(NSAccessPolicy policy, NSSubscribeRequestCallback subscribeRequestCb, - NSProviderSyncInfoCallback syncCb); +NSResult NSStartProvider(NSProviderConfig config); /** * Terminate notification service for provider - * @return ::NS_OK or result code of NSResult + * @return ::NS_OK if the action is requested succesfully */ NSResult NSStopProvider(); /** - * Request to publish resource to cloud server + * Request to publish resource using remote relay server * @param[in] server address combined with IP address and port number using delimiter : - * @return ::NS_OK or result code of NSResult + * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set. */ -NSResult NSProviderEnableRemoteService(char *serverAddress); +NSResult NSProviderEnableRemoteService(char * serverAddress); /** - * Request to cancel remote service using cloud server + * Request to terminate remote service from relay server * @param[in] server address combined with IP address and port number using delimiter : + * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set. + */ +NSResult NSProviderDisableRemoteService(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 Topic name for subscription. * @return ::NS_OK or result code of NSResult */ -NSResult NSProviderDisableRemoteService(char *serverAddress); +NSResult NSProviderSubscribeMQService(const char * serverAddress, const char * topicName); +#endif /** * Send notification message to all subscribers * @param[in] message Notification message including id, title, contentText - * @return ::NS_OK or result code of NSResult + * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set. */ -NSResult NSSendMessage(NSMessage *msg); +NSResult NSSendMessage(NSMessage * msg); /** * Send acceptance to consumer who subscribes the resource of notification message + * This function is valid only when subControllability is set true. * @param[in] consumer Consumer who subscribes the resource - * @param[in] accepted the result of acceptance; Allow or Deny - * @return ::NS_OK or result code of NSResult + * @param[in] accepted the result of acceptance; ALLOW or DENY + * @return ::NS_OK if this function is requested succesfully + * or NS_FAIL if subContollability is false. */ -NSResult NSAccept(NSConsumer *consumer, bool accepted); +NSResult NSAcceptSubscription(const char * consumerId, bool accepted); /** - * 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 + * Send synchronizad state of notificaion message to consumers + * @param[in] messageiId ID of notification message + * @param[in] type SyncType of the syncInfo message + * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set. */ -// NSResult NSGetConsumerList(uint8_t *list, uint32_t size); +NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type); /** - * 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 + * Initialize NSMessage struct. + * Service sets mandatory fields which message id and provider(device) id are filled with. + * @return ::NSMessage * */ -NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type); +NSMessage * NSCreateMessage(); +/** + * Add topic to topic list which is located in provider service storage + * @param[in] topicName Topic name to add + * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set. + */ +NSResult NSProviderRegisterTopic(const char * topicName); /** - * Initialize NSMessage struct, our service set message id and provider(device) id - * @return ::NSMessage * + * Delete topic from topic list + * @param[in] topicName Topic name to delete + * @return ::NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set. */ -NSMessage * NSCreateMessage(); +NSResult NSProviderUnregisterTopic(const char * topicName); + +/** + * Select a topic name for a consumer + * @param[in] consumerId consumer id for which the user on provider selects a topic + * @param[in] topicName Topic name to select + * @return ::NS_OK if the action is requested succesfully or NS_FAIL if subContollability is false + */ +NSResult NSProviderSetConsumerTopic(const char * consumerId, const char * topicName); + +/** + * Unselect a topic from the topic list for consumer + * @param[in] consumerId consumer id for which the user on provider unselects a topic + * @param[in] topicName Topic name to unselect + * @return ::NS_OK if the action is requested succesfully or NS_FAIL if subContollability is false + */ +NSResult NSProviderUnsetConsumerTopic(const char * consumerId, const char * topicName); + +/** + * Request topic list with selection state for the consumer + * @param[in] consumerid the id of consumer which topic list is subscribed for + * @return :: Topic list + */ +NSTopicLL * NSProviderGetConsumerTopics(const char * consumerId); + +/** + * Request topics list already registered by provider user + * @return :: Topic list + */ +NSTopicLL * NSProviderGetTopics(); #ifdef __cplusplus }