IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
OIC::Service::NSProviderService Class Reference

This class provides a set of C++APIs for Notification Provider. More...

Classes

struct  ProviderConfig
 Provider sets this following configuration for registering callbacks and configs Set the subControllability, for notification servcie refering to following if subControllability, is true, provider decides to allow or deny for all the subscribing consumers. More...
 

Public Types

typedef void(* ConsumerSubscribedCallback )(std::shared_ptr< NSConsumer >)
 Provider uses this callback function to receive subscription request of consumer. More...
 
typedef void(* MessageSynchronizedCallback )(NSSyncInfo)
 Provider use this callback function to receive the status of the message synchronization. More...
 

Public Member Functions

NSResult start (ProviderConfig config)
 Initialize notification service for provider. More...
 
NSResult stop ()
 Terminate notification service for provider. More...
 
NSResult enableRemoteService (const std::string &serverAddress)
 Request to publish resource to cloud server. More...
 
NSResult disableRemoteService (const std::string &serverAddress)
 Request to cancel remote service using cloud server. More...
 
NSResult subscribeMQService (const std::string &serverAddress, const std::string &topicName)
 Request to subscribe to remote MQ address as parameter. More...
 
NSResult sendMessage (const NSMessage &msg)
 Send notification message to all subscribers. More...
 
NSResult sendSyncInfo (uint64_t messageId, NSSyncInfo::NSSyncType type)
 Send read-check to provider in order to synchronize notification status with other consumers. More...
 
NSMessage createMessage ()
 Initialize NSMessage class, This function is valid only when subControllability is set true. More...
 
NSResult registerTopic (const std::string &topicName)
 Add topic to topic list which is located in provider service storage. More...
 
NSResult unregisterTopic (const std::string &topicName)
 Delete topic from topic list. More...
 
std::shared_ptr< NSTopicsListgetRegisteredTopicList ()
 Request topics list already registered by provider user. More...
 
ProviderConfig getProviderConfig ()
 get Provider config values More...
 
std::shared_ptr< NSConsumergetConsumer (const std::string &id)
 request to get NSConsumer pointer More...
 
NSAcceptedConsumersgetAcceptedConsumers ()
 get handle of Consumers accepted. More...
 

Static Public Member Functions

static NSProviderServicegetInstance ()
 API for starting the NS Provider. More...
 

Detailed Description

This class provides a set of C++APIs for Notification Provider.

Member Typedef Documentation

typedef void(* OIC::Service::NSProviderService::ConsumerSubscribedCallback)(std::shared_ptr< NSConsumer >)

Provider uses this callback function to receive subscription request of consumer.

Parameters
[in]consumerConsumer who subscribes the notification message resource
typedef void(* OIC::Service::NSProviderService::MessageSynchronizedCallback)(NSSyncInfo)

Provider use this callback function to receive the status of the message synchronization.

Parameters
[in]syncSynchronization information of the notification message

Member Function Documentation

NSMessage OIC::Service::NSProviderService::createMessage ( )

Initialize NSMessage class, This function is valid only when subControllability is set true.

Returns
NSMessage *
NSResult OIC::Service::NSProviderService::disableRemoteService ( const std::string &  serverAddress)

Request to cancel remote service using cloud server.

Parameters
[in]serverAddresscombined with IP address and port number using delimiter :
Returns
result code of Provider Service
NSResult OIC::Service::NSProviderService::enableRemoteService ( const std::string &  serverAddress)

Request to publish resource to cloud server.

Parameters
[in]serverAddresscombined with IP address and port number using delimiter :
Returns
result code of Provider Service
NSAcceptedConsumers* OIC::Service::NSProviderService::getAcceptedConsumers ( )

get handle of Consumers accepted.

Returns
m_acceptedConsumers -accepted Consumers
std::shared_ptr<NSConsumer> OIC::Service::NSProviderService::getConsumer ( const std::string &  id)

request to get NSConsumer pointer

Parameters
id-id as string
Returns
shared pointer to NSConsumer
static NSProviderService* OIC::Service::NSProviderService::getInstance ( )
static

API for starting the NS Provider.

Returns
NSProviderService Pointer to singleton instance created
ProviderConfig OIC::Service::NSProviderService::getProviderConfig ( )

get Provider config values

Returns
ProviderConfig callbaks set
std::shared_ptr<NSTopicsList> OIC::Service::NSProviderService::getRegisteredTopicList ( )

Request topics list already registered by provider user.

Returns
:: Topic list
NSResult OIC::Service::NSProviderService::registerTopic ( const std::string &  topicName)

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

Parameters
[in]topicNameTopic name to add
Returns
:: OK or result code of NSResult
NSResult OIC::Service::NSProviderService::sendMessage ( const NSMessage msg)

Send notification message to all subscribers.

Parameters
[in]msgNotification message including id, title, contentText
Returns
:: result code of Provider Service
NSResult OIC::Service::NSProviderService::sendSyncInfo ( uint64_t  messageId,
NSSyncInfo::NSSyncType  type 
)

Send read-check to provider in order to synchronize notification status with other consumers.

Parameters
[in]messageIdID of Notification message to synchronize the status
[in]typeNotificationSyncType of the SyncInfo message
Returns
:: OK or result code of NSResult
NSResult OIC::Service::NSProviderService::start ( ProviderConfig  config)

Initialize notification service for provider.

Parameters
[in]configProviderConfig Callback function pointers to onConsumerSubscribed, and onMessageSynchronized function listeners
Returns
:: result code of Provider Service
NSResult OIC::Service::NSProviderService::stop ( )

Terminate notification service for provider.

Returns
:: result code of Provider Service
NSResult OIC::Service::NSProviderService::subscribeMQService ( const std::string &  serverAddress,
const std::string &  topicName 
)

Request to subscribe to remote MQ address as parameter.

Parameters
[in]serverAddressserver address combined with IP address and port number and MQ broker uri using delimiter :
[in]topicNamethe interest Topic name for subscription.
Returns
NS_OK or result code of NSResult
NSResult OIC::Service::NSProviderService::unregisterTopic ( const std::string &  topicName)

Delete topic from topic list.

Parameters
[in]topicNameTopic name to delete
Returns
:: OK or result code of NSResult

The documentation for this class was generated from the following file: