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