replace : iotivity -> iotivity-sec
[platform/upstream/iotivity.git] / service / notification / cpp-wrapper / common / NSMessage.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 Message representation.\r
25  */\r
26 \r
27 #ifndef _NS_MESSAGE_H_\r
28 #define _NS_MESSAGE_H_\r
29 \r
30 #include <string>\r
31 #include "NSMediaContents.h"\r
32 #include "OCRepresentation.h"\r
33 \r
34 namespace OIC\r
35 {\r
36     namespace Service\r
37     {\r
38         /**\r
39          * @class   NSMessage\r
40          * @brief   This class provides a set of APIs for Notification service Message .\r
41          */\r
42         class NSMessage\r
43         {\r
44             public:\r
45                 /** NSMessageType - enumeration for Notification service MessageType*/\r
46                 enum class NSMessageType\r
47                 {\r
48                     NS_MESSAGE_ALERT = 1,\r
49                     NS_MESSAGE_NOTICE = 2,\r
50                     NS_MESSAGE_EVENT = 3,\r
51                     NS_MESSAGE_INFO = 4,\r
52                     NS_MESSAGE_WARNING = 5,\r
53                 };\r
54 \r
55                 /**\r
56                         * Constructor of NSMessage.\r
57                         */\r
58                 NSMessage(): m_messageId(0), m_type(NSMessageType::NS_MESSAGE_ALERT), m_ttl(0),\r
59                     m_mediaContents(new NSMediaContents), m_extraInfo(OC::OCRepresentation())\r
60                 {\r
61                 }\r
62 \r
63                 /**\r
64                         * Constructor of NSMessage.\r
65                         *\r
66                         * @param msg - pointer to NSMessage struct to initialize.\r
67                         */\r
68                 NSMessage(::NSMessage *msg);\r
69 \r
70                 /**\r
71                      * Copy Constructor of NSMessage.\r
72                      *\r
73                      * @param msg - NSMessage to initialize.\r
74                      */\r
75                 NSMessage(const NSMessage &msg);\r
76 \r
77                 /**\r
78                      * Copy assignment operator of NSMessage.\r
79                      *\r
80                      * @param msg -  NSMessage to initialize.\r
81                      * @return NSMessage object reference\r
82                      */\r
83                 NSMessage &operator=(const NSMessage &msg);\r
84 \r
85                 /**\r
86                         * Destructor of NSMessage.\r
87                         */\r
88                 ~NSMessage();\r
89 \r
90                 /**\r
91                      * This method is for getting Message Id from the Notification service Message.\r
92                      *\r
93                      * @return Id as uint64_t.\r
94                      */\r
95                 uint64_t getMessageId() const;\r
96 \r
97                 /**\r
98                      * This method is for getting Provider Id from the Notification service Message.\r
99                      *\r
100                      * @return Id as string.\r
101                      */\r
102                 std::string getProviderId() const;\r
103 \r
104                 /**\r
105                      * This method is for getting type from the Notification service Message.\r
106                      *\r
107                      * @return type as NSMessageType.\r
108                      */\r
109                 NSMessageType getType() const;\r
110 \r
111                 /**\r
112                      * This method is for setting type from the Notification service Message.\r
113                      *\r
114                      * @param type as NSMessageType.\r
115                      */\r
116                 void setType(const NSMessageType &type);\r
117 \r
118                 /**\r
119                      * This method is for getting time from the Notification service Message.\r
120                      *\r
121                      * @return time as string.\r
122                      */\r
123                 std::string getTime() const;\r
124 \r
125                 /**\r
126                      * This method is for setting time from the Notification service Message.\r
127                      *\r
128                      * @param time as string.\r
129                      */\r
130                 void setTime(const std::string &time);\r
131 \r
132                 /**\r
133                      * This method is for getting time to live from the Notification service Message.\r
134                      *\r
135                      * @return ttl as uint64_t.\r
136                      */\r
137                 uint64_t getTTL() const;\r
138 \r
139                 /**\r
140                      * This method is for setting time to live from the Notification service Message.\r
141                      *\r
142                      * @param ttl as uint64_t.\r
143                      */\r
144                 void setTTL(const uint64_t &ttl);\r
145 \r
146                 /**\r
147                      * This method is for getting Title from the Notification service Message.\r
148                      *\r
149                      * @return Title as string.\r
150                      */\r
151                 std::string getTitle() const;\r
152 \r
153                 /**\r
154                      * This method is for setting Title from the Notification service Message.\r
155                      *\r
156                      * @param title as string.\r
157                      */\r
158                 void setTitle(const std::string &title);\r
159 \r
160                 /**\r
161                      * This method is for getting contentText from the Notification service Message.\r
162                      *\r
163                      * @return contentText as string.\r
164                      */\r
165                 std::string getContentText() const;\r
166 \r
167                 /**\r
168                      * This method is for setting contentText from the Notification service Message.\r
169                      *\r
170                      * @param contextText as string.\r
171                      */\r
172                 void setContentText(const std::string &contextText);\r
173 \r
174                 /**\r
175                      * This method is for getting sourceName from the Notification service Message.\r
176                      *\r
177                      * @return sourceName as string.\r
178                      */\r
179                 std::string getSourceName() const;\r
180 \r
181                 /**\r
182                      * This method is for setting sourceName from the Notification service Message.\r
183                      *\r
184                      * @param sourceName as string.\r
185                      */\r
186                 void setSourceName(const std::string &sourceName);\r
187 \r
188                 /**\r
189                      * This method is for getting mediaContents from the Notification service Message.\r
190                      *\r
191                      * @return mediaContents as NSMediaContents pointer.\r
192                      */\r
193                 NSMediaContents *getMediaContents() const;\r
194 \r
195                 /**\r
196                      * This method is for setting mediaContents from the Notification service Message.\r
197                      *\r
198                      * @param mediaContents as NSMediaContents pointer.\r
199                      */\r
200                 void setMediaContents(NSMediaContents *mediaContents);\r
201 \r
202                 /**\r
203                      * This method is for getting Topic from the Notification service Message.\r
204                      *\r
205                      * @return Topic as string.\r
206                      */\r
207                 std::string getTopic() const;\r
208 \r
209                 /**\r
210                      * This method is for setting Topic for the Notification service Message.\r
211                      *\r
212                      * @return Topic as string.\r
213                      */\r
214                 void setTopic(const std::string &topic);\r
215 \r
216                 /**\r
217                      * This method is for getting extraInfo from the Notification service Message.\r
218                      *\r
219                      * @return extraInfo as OCRepresentation.\r
220                      */\r
221                 OC::OCRepresentation getExtraInfo() const;\r
222 \r
223                 /**\r
224                      * This method is for setting extraInfo for the Notification service Message.\r
225                      *\r
226                      * @return extraInfo as OCRepresentation.\r
227                      */\r
228                 void setExtraInfo(const OC::OCRepresentation &extraInfo);\r
229 \r
230             private:\r
231                 uint64_t m_messageId;\r
232                 std::string m_providerId;\r
233 \r
234                 NSMessageType m_type;\r
235                 std::string m_time;\r
236                 uint64_t m_ttl;\r
237                 std::string m_title;\r
238                 std::string m_contentText;\r
239                 std::string m_sourceName;\r
240                 NSMediaContents *m_mediaContents;\r
241                 std::string m_topic;\r
242                 OC::OCRepresentation m_extraInfo;\r
243 \r
244         };\r
245     }\r
246 }\r
247 #endif /* _NS_MESSAGE_H_ */\r