IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Go to the documentation of this file.
1 //******************************************************************
2 //
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
30 #include <string>
31 #include "NSConsumer.h"
32 #include "NSSyncInfo.h"
33 #include "NSMessage.h"
34 #include "NSUtils.h"
35 #include "NSTopicsList.h"
37 namespace OIC
38 {
39  namespace Service
40  {
41  class NSAcceptedConsumers;
47  {
48  public:
53  typedef void (*ConsumerSubscribedCallback)(std::shared_ptr<NSConsumer> );
70  typedef struct
71  {
80  std::string userInfo;
81  /* Set on/off for secure resource channel setting */
104  NSResult stop();
111  NSResult enableRemoteService(const std::string &serverAddress);
118  NSResult disableRemoteService(const std::string &serverAddress);
126  NSResult subscribeMQService(const std::string &serverAddress, const std::string &topicName);
133  NSResult sendMessage(const NSMessage &msg);
142  NSResult sendSyncInfo(uint64_t messageId, NSSyncInfo::NSSyncType type);
155  NSResult registerTopic(const std::string &topicName);
162  NSResult unregisterTopic(const std::string &topicName);
168  std::shared_ptr<NSTopicsList> getRegisteredTopicList();
182  std::shared_ptr<NSConsumer> getConsumer(const std::string &id);
190  private :
191  ProviderConfig m_config;
192  NSAcceptedConsumers *m_acceptedConsumers;
194  private:
197  NSProviderService(const NSProviderService &) = delete;
198  NSProviderService &operator=(const NSProviderService &) = delete;
199  NSProviderService(const NSProviderService &&) = delete;
200  NSProviderService &operator=(const NSProviderService && ) = delete;
202  ::NSMessage *getNSMessage(const NSMessage &msg);
203  static void onConsumerSubscribedCallback(::NSConsumer *consumer);
204  static void onMessageSynchronizedCallback(::NSSyncInfo *syncInfo);
205  };
206  }
207 }
208 #endif /* _NS_PROVIDER_SERVICE_H_ */
bool resourceSecurity
Definition: NSProviderService.h:82
This class provides a set of C++APIs for Notification Provider.
Definition: NSProviderService.h:46
NSResult sendMessage(const NSMessage &msg)
Send notification message to all subscribers.
NSSyncType - enumeration for Notification service SyncType.
Definition: NSSyncInfo.h:45
This file contains Notification service Utils.
std::shared_ptr< NSTopicsList > getRegisteredTopicList()
Request topics list already registered by provider user.
void(* ConsumerSubscribedCallback)(std::shared_ptr< NSConsumer >)
Provider uses this callback function to receive subscription request of consumer. ...
Definition: NSProviderService.h:53
This file contains Notification service SyncInfo representation.
NSResult - enumeration for NS service Result.
Definition: NSUtils.h:38
static NSProviderService * getInstance()
API for starting the NS Provider.
NSResult start(ProviderConfig config)
Initialize notification service for provider.
This class provides a set of APIs for Notification service Message .
Definition: NSMessage.h:42
ConsumerSubscribedCallback m_subscribeRequestCb
m_subscribeRequestCb - ConsumerSubscribedCallback callback listener.
Definition: NSProviderService.h:73
NSResult sendSyncInfo(uint64_t messageId, NSSyncInfo::NSSyncType type)
Send read-check to provider in order to synchronize notification status with other consumers...
Provider sets this following configuration for registering callbacks and configs Set the subControlla...
Definition: NSProviderService.h:70
NSAcceptedConsumers * getAcceptedConsumers()
get handle of Consumers accepted.
This file contains Notification service topics linked list representation.
NSResult subscribeMQService(const std::string &serverAddress, const std::string &topicName)
Request to subscribe to remote MQ address as parameter.
This file contains Notification service Consumer representation.
MessageSynchronizedCallback m_syncInfoCb
m_syncInfoCb - MessageSynchronizedCallback callback listener.
Definition: NSProviderService.h:75
NSResult stop()
Terminate notification service for provider.
This class provides a set of APIs for Notification service SyncInfo .
Definition: NSSyncInfo.h:41
std::string userInfo
userInfo - user defined information such as device friendly name
Definition: NSProviderService.h:80
ProviderConfig getProviderConfig()
get Provider config values
This class provides a set of Notification service Consumer representation APIs.
Definition: NSConsumer.h:45
NSMessage createMessage()
Initialize NSMessage class, This function is valid only when subControllability is set true...
NSResult enableRemoteService(const std::string &serverAddress)
Request to publish resource to cloud server.
NSResult registerTopic(const std::string &topicName)
Add topic to topic list which is located in provider service storage.
This file contains Notification service Message representation.
NSResult unregisterTopic(const std::string &topicName)
Delete topic from topic list.
This class provides a set of C++APIs for managing accepted Consumers.
Definition: NSAcceptedConsumers.h:44
std::shared_ptr< NSConsumer > getConsumer(const std::string &id)
request to get NSConsumer pointer
bool subControllability
subControllability - for setting the subscription controllability for Consumer
Definition: NSProviderService.h:78
void(* MessageSynchronizedCallback)(NSSyncInfo)
Provider use this callback function to receive the status of the message synchronization.
Definition: NSProviderService.h:60
NSResult disableRemoteService(const std::string &serverAddress)
Request to cancel remote service using cloud server.