IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NSConsumer.h
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 // http://www.apache.org/licenses/LICENSE-2.0
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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20 
27 #ifndef _NS_CONSUMER_H_
28 #define _NS_CONSUMER_H_
29 
30 
31 #include <string>
32 #include <memory>
33 #include "NSCommon.h"
34 #include "NSUtils.h"
35 #include "NSTopicsList.h"
36 
37 namespace OIC
38 {
39  namespace Service
40  {
45  class NSConsumer
46  {
47  public:
51  NSConsumer() = default;
52 
58  NSConsumer(const std::string &consumerId)
59  : m_consumerId(consumerId)
60  {
61  }
62 
68  NSConsumer(::NSConsumer *consumer);
69 
73  ~NSConsumer() = default;
74 
80  std::string getConsumerId() const;
81 
88  NSResult acceptSubscription(bool accepted);
89 
95  NSResult setTopic(const std::string &topicName);
96 
102  NSResult unsetTopic(const std::string &topicName);
103 
108  std::shared_ptr<NSTopicsList> getConsumerTopicList();
109 
110  private:
111  ::NSConsumer *getNSConsumer();
112  bool isValid() const;
113 
114  private:
115  std::string m_consumerId;
116  };
117  }
118 }
119 #endif /* _NS_CONSUMER_H_ */
This file contains Notification service Utils.
std::string getConsumerId() const
This method is for getting ConsumerId from the Notification service Consumer.
NSResult unsetTopic(const std::string &topicName)
Unselect a topic from the topic list for consumer.
NSResult acceptSubscription(bool accepted)
This method is for setting icon image for the Notification service media contents.
NSResult
NSResult - enumeration for NS service Result.
Definition: NSUtils.h:38
This file contains Notification service topics linked list representation.
NSConsumer(const std::string &consumerId)
Constructor of NSConsumer.
Definition: NSConsumer.h:58
NSConsumer()=default
Constructor of NSConsumer.
std::shared_ptr< NSTopicsList > getConsumerTopicList()
Request topic list with selection state for the consumer.
This class provides a set of Notification service Consumer representation APIs.
Definition: NSConsumer.h:45
~NSConsumer()=default
Destructor of NSConsumer.
NSResult setTopic(const std::string &topicName)
Select a topic name for a consumer.
This file provides APIs of Notification Service for common functions.