replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / cpp-wrapper / provider / inc / NSConsumer.h
1 //******************************************************************\r
2 //\r
3 // Copyright 2016 Samsung Electronics All Rights Reserved.\r
4 //\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
6 //\r
7 // Licensed under the Apache License, Version 2.0 (the "License");\r
8 // you may not use this file except in compliance with the License.\r
9 // You may obtain a copy of the License at\r
10 //\r
11 //      http://www.apache.org/licenses/LICENSE-2.0\r
12 //\r
13 // Unless required by applicable law or agreed to in writing, software\r
14 // distributed under the License is distributed on an "AS IS" BASIS,\r
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 // See the License for the specific language governing permissions and\r
17 // limitations under the License.\r
18 //\r
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
20 \r
21 /**\r
22  * @file\r
23  *\r
24  * This file contains Notification service Consumer representation.\r
25  */\r
26 \r
27 #ifndef _NS_CONSUMER_H_\r
28 #define _NS_CONSUMER_H_\r
29 \r
30 \r
31 #include <string>\r
32 #include <memory>\r
33 #include "NSCommon.h"\r
34 #include "NSUtils.h"\r
35 #include "NSTopicsList.h"\r
36 \r
37 namespace OIC\r
38 {\r
39     namespace Service\r
40     {\r
41         /**\r
42          * @class   NSConsumer\r
43          * @brief   This class provides a set of Notification service Consumer representation APIs.\r
44          */\r
45         class NSConsumer\r
46         {\r
47             public:\r
48                 /**\r
49                       * Constructor of NSConsumer.\r
50                       */\r
51                 NSConsumer() = default;\r
52 \r
53                 /**\r
54                       * Constructor of NSConsumer.\r
55                       *\r
56                       * @param consumerId -consumerId of the Notification service Consumer.\r
57                       */\r
58                 NSConsumer(const std::string &consumerId)\r
59                     : m_consumerId(consumerId)\r
60                 {\r
61                 }\r
62 \r
63                 /**\r
64                       * Constructor of NSConsumer.\r
65                       *\r
66                       * @param consumer - NSConsumer struct to initialize.\r
67                       */\r
68                 NSConsumer(::NSConsumer *consumer);\r
69 \r
70                 /**\r
71                       * Destructor of NSConsumer.\r
72                       */\r
73                 ~NSConsumer() = default;\r
74 \r
75                 /**\r
76                       * This method is for getting ConsumerId from the Notification service Consumer.\r
77                       *\r
78                       * @return ConsumerId as string.\r
79                       */\r
80                 std::string getConsumerId() const;\r
81 \r
82                 /**\r
83                       * This method is for setting icon image for the Notification service media contents.\r
84                       * This function is valid only when subControllability is set true.\r
85                       * @param accepted - as bool.\r
86                       * @return :: OK or result code of NSResult\r
87                       */\r
88                 NSResult acceptSubscription(bool accepted);\r
89 \r
90                 /**\r
91                      * Select a topic name for a consumer\r
92                      * @param[in]  topicName Topic name to select\r
93                      * @return :: OK or result code of NSResult\r
94                      */\r
95                 NSResult setTopic(const std::string &topicName);\r
96 \r
97                 /**\r
98                      * Unselect a topic from the topic list for consumer\r
99                      * @param[in]  topicName Topic name to unselect\r
100                      * @return :: OK or result code of NSResult\r
101                      */\r
102                 NSResult unsetTopic(const std::string &topicName);\r
103 \r
104                 /**\r
105                      * Request topic list with selection state for the consumer\r
106                      * @return :: Topic list\r
107                      */\r
108                 std::shared_ptr<NSTopicsList> getConsumerTopicList();\r
109 \r
110             private:\r
111                 ::NSConsumer *getNSConsumer();\r
112                 bool isValid() const;\r
113 \r
114             private:\r
115                 std::string m_consumerId;\r
116         };\r
117     }\r
118 }\r
119 #endif /* _NS_CONSUMER_H_ */\r