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

This class provides a set of Notification service Provider representation APIs. More...

Public Types

typedef void(* ProviderStateCallback )(NSProviderState)
 Invoked when the provider state is changed. More...
 
typedef void(* MessageReceivedCallback )(NSMessage)
 Consumer use this callback function to receive notification message from provider synchronization. More...
 
typedef void(* SyncInfoReceivedCallback )(NSSyncInfo)
 Provider and consumer use this callback function to receive the status of the message synchronization. More...
 

Public Member Functions

 NSProvider ()
 Constructor of NSProvider. More...
 
 NSProvider (const std::string &providerId)
 Constructor of NSProvider. More...
 
 NSProvider (const std::string &providerId, std::shared_ptr< NSTopicsList > topicList)
 Constructor of NSProvider. More...
 
 NSProvider (::NSProvider *provider)
 Constructor of NSProvider. More...
 
 NSProvider (const NSProvider &provider)
 Copy Constructor of NSProvider. More...
 
NSProvideroperator= (const NSProvider &provider)
 Copy assignment operator of NSProvider. More...
 
 ~NSProvider ()=default
 Destructor of NSProvider. More...
 
std::string getProviderId () const
 This method is for getting ProviderId from the Notification service provider. More...
 
std::shared_ptr< NSTopicsListgetTopicList () const throw (NSException)
 This method is for getting NSTopic List from the Notification service provider. More...
 
NSResult updateTopicList (std::shared_ptr< NSTopicsList > topicList) throw (NSException)
 Update Topic list that is wanted to be subscribed from provider. More...
 
NSProviderState getProviderState () const
 This method is for getting ProviderState from the Notification service provider. More...
 
NSProviderSubscribedState getProviderSubscribedState () const throw (NSException)
 This method is for getting SubscribedState from the Notification service provider. More...
 
NSResult subscribe () throw (NSException)
 This method is for requesting subscription of Notification service. More...
 
NSResult unsubscribe () throw (NSException)
 Request to unsubscribe in order not to receive notification message from provider. More...
 
bool isSubscribed () throw (NSException)
 This method is for requesting subscription status from Provider of Notification service. More...
 
NSResult sendSyncInfo (uint64_t messageId, NSSyncInfo::NSSyncType type) throw (NSException)
 This method is for Sending SyncInfo of Notification service. More...
 
void setListener (ProviderStateCallback stateHandle, MessageReceivedCallback messageHandle, SyncInfoReceivedCallback syncHandle)
 This method is for registering for listeners of Notification . More...
 
ProviderStateCallback getProviderStateReceivedCb () const
 This method is for getting the registered cb of Provider State received. More...
 
MessageReceivedCallback getMessageReceivedCb () const
 This method is for getting the registered cb of Notification message received. More...
 
SyncInfoReceivedCallback getSyncInfoReceivedCb () const
 This method is for getting the registered cb of Notification SyncInfo received. More...
 
void setTopicList (std::shared_ptr< NSTopicsList > topicsList)
 This method is for setting NSTopic List for the Notification service provider. More...
 
void setProviderState (const NSProviderState &providerState)
 This method is for setting ProviderState for the Notification service provider. More...
 
void setProviderSubscribedState (const NSProviderSubscribedState &subscribedState)
 This method is for setting subscribedState for the Notification service provider. More...
 

Detailed Description

This class provides a set of Notification service Provider representation APIs.

Member Typedef Documentation

typedef void(* OIC::Service::NSProvider::MessageReceivedCallback)(NSMessage)

Consumer use this callback function to receive notification message from provider synchronization.

Parameters
[in]messageNotification message
typedef void(* OIC::Service::NSProvider::ProviderStateCallback)(NSProviderState)

Invoked when the provider state is changed.

Parameters
[in]providerStateNSProviderState of the notification resource
typedef void(* OIC::Service::NSProvider::SyncInfoReceivedCallback)(NSSyncInfo)

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

Parameters
[in]syncSynchronization information of the notification message

Constructor & Destructor Documentation

OIC::Service::NSProvider::NSProvider ( )
inline

Constructor of NSProvider.

OIC::Service::NSProvider::NSProvider ( const std::string &  providerId)
inline

Constructor of NSProvider.

Parameters
providerId- providerId of the Notification.
OIC::Service::NSProvider::NSProvider ( const std::string &  providerId,
std::shared_ptr< NSTopicsList topicList 
)
inline

Constructor of NSProvider.

Parameters
providerId- providerId of the Notification.
topicList- NSTopicsList of interested Topics.
OIC::Service::NSProvider::NSProvider ( ::NSProvider provider)

Constructor of NSProvider.

Parameters
provider- of type NSProvider.
OIC::Service::NSProvider::NSProvider ( const NSProvider provider)

Copy Constructor of NSProvider.

Parameters
provider- NSProvider to initialize.
OIC::Service::NSProvider::~NSProvider ( )
default

Destructor of NSProvider.

Member Function Documentation

MessageReceivedCallback OIC::Service::NSProvider::getMessageReceivedCb ( ) const

This method is for getting the registered cb of Notification message received.

Returns
messageCb - MessageReceivedCallback .
std::string OIC::Service::NSProvider::getProviderId ( ) const

This method is for getting ProviderId from the Notification service provider.

Returns
ProviderId as string.
NSProviderState OIC::Service::NSProvider::getProviderState ( ) const

This method is for getting ProviderState from the Notification service provider.

Returns
ProviderState as NSProviderState.
ProviderStateCallback OIC::Service::NSProvider::getProviderStateReceivedCb ( ) const

This method is for getting the registered cb of Provider State received.

Returns
stateCb - ProviderStateCallback .
NSProviderSubscribedState OIC::Service::NSProvider::getProviderSubscribedState ( ) const
throw (NSException
)

This method is for getting SubscribedState from the Notification service provider.

Returns
subscribedState as NSProviderSubscribedState.
SyncInfoReceivedCallback OIC::Service::NSProvider::getSyncInfoReceivedCb ( ) const

This method is for getting the registered cb of Notification SyncInfo received.

Returns
syncInfoCb - SyncInfoReceivedCallback .
std::shared_ptr<NSTopicsList> OIC::Service::NSProvider::getTopicList ( ) const
throw (NSException
)

This method is for getting NSTopic List from the Notification service provider.

Returns
NSTopicsList as pointer.
bool OIC::Service::NSProvider::isSubscribed ( )
throw (NSException
)

This method is for requesting subscription status from Provider of Notification service.

NSProvider& OIC::Service::NSProvider::operator= ( const NSProvider provider)

Copy assignment operator of NSProvider.

Parameters
provider- NSProvider to initialize.
Returns
NSProvider object reference
NSResult OIC::Service::NSProvider::sendSyncInfo ( uint64_t  messageId,
NSSyncInfo::NSSyncType  type 
)
throw (NSException
)

This method is for Sending SyncInfo of Notification service.

Parameters
messageId- id of type message.
type- NSSyncType of Notification service.
Returns
NS_OK or result code of NSResult
void OIC::Service::NSProvider::setListener ( ProviderStateCallback  stateHandle,
MessageReceivedCallback  messageHandle,
SyncInfoReceivedCallback  syncHandle 
)

This method is for registering for listeners of Notification .

Parameters
stateHandle- ProviderStateCallback callback.
messageHandle- MessageReceivedCallback callback.
syncHandle- SyncInfoReceivedCallback callback
void OIC::Service::NSProvider::setProviderState ( const NSProviderState providerState)

This method is for setting ProviderState for the Notification service provider.

Parameters
providerStateas NSProviderState.
void OIC::Service::NSProvider::setProviderSubscribedState ( const NSProviderSubscribedState subscribedState)

This method is for setting subscribedState for the Notification service provider.

Parameters
subscribedStateas NSProviderSubscribedState.
void OIC::Service::NSProvider::setTopicList ( std::shared_ptr< NSTopicsList topicsList)

This method is for setting NSTopic List for the Notification service provider.

Parameters
topicsListas NSTopicsList pointer.
NSResult OIC::Service::NSProvider::subscribe ( )
throw (NSException
)

This method is for requesting subscription of Notification service.

This API should be called with a valid Provider object obtained from Discovery callback. The API should not be called when the Provider is in STOPPED state.

Discovery APIs to discover Providers are as below. Start/rescanProvider for D2D, enableRemoteService for D2S,

Returns
NS_OK or result code of NSResult
NSResult OIC::Service::NSProvider::unsubscribe ( )
throw (NSException
)

Request to unsubscribe in order not to receive notification message from provider.

This API should be called with a valid Provider object obtained from Discovery callback. The API should not be called when the Provider is in STOPPED state.

Returns
NS_OK or result code of NSResult
NSResult OIC::Service::NSProvider::updateTopicList ( std::shared_ptr< NSTopicsList topicList)
throw (NSException
)

Update Topic list that is wanted to be subscribed from provider.

Parameters
topicList- NSTopicsList of interested Topics.
Returns
NSResult

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