IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NSProviderInterface.h File Reference

This file provides APIs of Notification Service for Provider. More...

Go to the source code of this file.

Classes

struct  NSProviderConfig
 Set provider service with the following configuration. More...
 

Typedefs

typedef void(* NSSubscribeRequestCallback )(NSConsumer *)
 Invoked when provider receives the subscription request of consumer. More...
 
typedef void(* NSProviderSyncInfoCallback )(NSSyncInfo *)
 Invoked when synchronization data which has notification message read/deleted event from consumer is received. More...
 

Functions

NSResult NSStartProvider (NSProviderConfig config)
 Initialize notification service for provider. More...
 
NSResult NSStopProvider ()
 Terminate notification service for provider. More...
 
NSResult NSProviderEnableRemoteService (char *serverAddress)
 Request to publish resource using remote relay server. More...
 
NSResult NSProviderDisableRemoteService (char *serverAddress)
 Request to terminate remote service from relay server. More...
 
NSResult NSSendMessage (NSMessage *msg)
 Send notification message to all subscribers. More...
 
NSResult NSAcceptSubscription (const char *consumerId, bool accepted)
 Send acceptance to consumer who subscribes the resource of notification message This function is valid only when subControllability is set true. More...
 
NSResult NSProviderSendSyncInfo (uint64_t messageId, NSSyncType type)
 Send synchronizad state of notificaion message to consumers. More...
 
NSMessageNSCreateMessage ()
 Initialize NSMessage struct. More...
 
NSResult NSProviderRegisterTopic (const char *topicName)
 Add topic to topic list which is located in provider service storage. More...
 
NSResult NSProviderUnregisterTopic (const char *topicName)
 Delete topic from topic list. More...
 
NSResult NSProviderSetConsumerTopic (const char *consumerId, const char *topicName)
 Select a topic name for a consumer. More...
 
NSResult NSProviderUnsetConsumerTopic (const char *consumerId, const char *topicName)
 Unselect a topic from the topic list for consumer. More...
 
NSTopicLLNSProviderGetConsumerTopics (const char *consumerId)
 Request topic list with selection state for the consumer. More...
 
NSTopicLLNSProviderGetTopics ()
 Request topics list already registered by provider user. More...
 

Detailed Description

This file provides APIs of Notification Service for Provider.

Typedef Documentation

typedef void(* NSProviderSyncInfoCallback)(NSSyncInfo *)

Invoked when synchronization data which has notification message read/deleted event from consumer is received.

Parameters
[in]syncSynchronization information of the notification message
typedef void(* NSSubscribeRequestCallback)(NSConsumer *)

Invoked when provider receives the subscription request of consumer.

Parameters
[in]consumerConsumer who subscribes the notification message resource

Function Documentation

NSResult NSAcceptSubscription ( const char *  consumerId,
bool  accepted 
)

Send acceptance to consumer who subscribes the resource of notification message This function is valid only when subControllability is set true.

Parameters
[in]consumerIdConsumer who subscribes the resource
[in]acceptedthe result of acceptance; ALLOW or DENY
Returns
NS_OK if this function is requested succesfully or NS_FAIL if subContollability is false.
NSMessage* NSCreateMessage ( )

Initialize NSMessage struct.

Service sets mandatory fields which message id and provider(device) id are filled with.

Returns
NSMessage *
NSResult NSProviderDisableRemoteService ( char *  serverAddress)

Request to terminate remote service from relay server.

Parameters
[in]serverAddressserver address combined with IP address and port number using delimiter :
Returns
NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.
NSResult NSProviderEnableRemoteService ( char *  serverAddress)

Request to publish resource using remote relay server.

Parameters
[in]serverAddressserver address combined with IP address and port number using delimiter :
Returns
NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.
NSTopicLL* NSProviderGetConsumerTopics ( const char *  consumerId)

Request topic list with selection state for the consumer.

Parameters
[in]consumerIdthe id of consumer which topic list is subscribed for
Returns
:: Topic list
NSTopicLL* NSProviderGetTopics ( )

Request topics list already registered by provider user.

Returns
:: Topic list
NSResult NSProviderRegisterTopic ( const char *  topicName)

Add topic to topic list which is located in provider service storage.

Parameters
[in]topicNameTopic name to add
Returns
NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.
NSResult NSProviderSendSyncInfo ( uint64_t  messageId,
NSSyncType  type 
)

Send synchronizad state of notificaion message to consumers.

Parameters
[in]messageIdID of notification message
[in]typeSyncType of the syncInfo message
Returns
NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.
NSResult NSProviderSetConsumerTopic ( const char *  consumerId,
const char *  topicName 
)

Select a topic name for a consumer.

Parameters
[in]consumerIdconsumer id for which the user on provider selects a topic
[in]topicNameTopic name to select
Returns
NS_OK if the action is requested succesfully or NS_FAIL if subContollability is false
NSResult NSProviderUnregisterTopic ( const char *  topicName)

Delete topic from topic list.

Parameters
[in]topicNameTopic name to delete
Returns
NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.
NSResult NSProviderUnsetConsumerTopic ( const char *  consumerId,
const char *  topicName 
)

Unselect a topic from the topic list for consumer.

Parameters
[in]consumerIdconsumer id for which the user on provider unselects a topic
[in]topicNameTopic name to unselect
Returns
NS_OK if the action is requested succesfully or NS_FAIL if subContollability is false
NSResult NSSendMessage ( NSMessage msg)

Send notification message to all subscribers.

Parameters
[in]msgNotification message including id, title, contentText
Returns
NS_OK if the action is requested succesfully or NS_FAIL if wrong parameter is set.
NSResult NSStartProvider ( NSProviderConfig  config)

Initialize notification service for provider.

Parameters
[in]configRefer to NSProviderConfig
Returns
NS_OK if the action is requested succesfully
NSResult NSStopProvider ( )

Terminate notification service for provider.

Returns
NS_OK if the action is requested succesfully