1 //******************************************************************
\r
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\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
11 // http://www.apache.org/licenses/LICENSE-2.0
\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
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
24 * This file contains Notification service Message representation.
\r
27 #ifndef _NS_MESSAGE_H_
\r
28 #define _NS_MESSAGE_H_
\r
31 #include "NSMediaContents.h"
\r
32 #include "OCRepresentation.h"
\r
40 * @brief This class provides a set of APIs for Notification service Message .
\r
45 /** NSMessageType - enumeration for Notification service MessageType*/
\r
46 enum class NSMessageType
\r
48 NS_MESSAGE_ALERT = 0,
\r
49 NS_MESSAGE_NOTICE = 1,
\r
50 NS_MESSAGE_EVENT = 2,
\r
51 NS_MESSAGE_INFO = 3,
\r
55 * Constructor of NSMessage.
\r
57 NSMessage(): m_messageId(0), m_type(NSMessageType::NS_MESSAGE_ALERT), m_ttl(0),
\r
58 m_mediaContents(new NSMediaContents), m_extraInfo(OC::OCRepresentation())
\r
63 * Constructor of NSMessage.
\r
65 * @param msg - pointer to NSMessage struct to initialize.
\r
67 NSMessage(::NSMessage *msg);
\r
70 * Copy Constructor of NSMessage.
\r
72 * @param msg - NSMessage to initialize.
\r
74 NSMessage(const NSMessage &msg);
\r
77 * Copy assignment operator of NSMessage.
\r
79 * @param msg - NSMessage to initialize.
\r
80 * @return NSMessage object reference
\r
82 NSMessage &operator=(const NSMessage &msg);
\r
85 * Destructor of NSMessage.
\r
90 * This method is for getting Message Id from the Notification service Message.
\r
92 * @return Id as uint64_t.
\r
94 uint64_t getMessageId() const;
\r
97 * This method is for getting Provider Id from the Notification service Message.
\r
99 * @return Id as string.
\r
101 std::string getProviderId() const;
\r
104 * This method is for getting type from the Notification service Message.
\r
106 * @return type as NSMessageType.
\r
108 NSMessageType getType() const;
\r
111 * This method is for setting type from the Notification service Message.
\r
113 * @param type as NSMessageType.
\r
115 void setType(const NSMessageType &type);
\r
118 * This method is for getting time from the Notification service Message.
\r
120 * @return time as string.
\r
122 std::string getTime() const;
\r
125 * This method is for setting time from the Notification service Message.
\r
127 * @param time as string.
\r
129 void setTime(const std::string &time);
\r
132 * This method is for getting time to live from the Notification service Message.
\r
134 * @return ttl as uint64_t.
\r
136 uint64_t getTTL() const;
\r
139 * This method is for setting time to live from the Notification service Message.
\r
141 * @param ttl as uint64_t.
\r
143 void setTTL(const uint64_t &ttl);
\r
146 * This method is for getting Title from the Notification service Message.
\r
148 * @return Title as string.
\r
150 std::string getTitle() const;
\r
153 * This method is for setting Title from the Notification service Message.
\r
155 * @param title as string.
\r
157 void setTitle(const std::string &title);
\r
160 * This method is for getting contentText from the Notification service Message.
\r
162 * @return contentText as string.
\r
164 std::string getContentText() const;
\r
167 * This method is for setting contentText from the Notification service Message.
\r
169 * @param contextText as string.
\r
171 void setContentText(const std::string &contextText);
\r
174 * This method is for getting sourceName from the Notification service Message.
\r
176 * @return sourceName as string.
\r
178 std::string getSourceName() const;
\r
181 * This method is for setting sourceName from the Notification service Message.
\r
183 * @param sourceName as string.
\r
185 void setSourceName(const std::string &sourceName);
\r
188 * This method is for getting mediaContents from the Notification service Message.
\r
190 * @return mediaContents as NSMediaContents pointer.
\r
192 NSMediaContents *getMediaContents() const;
\r
195 * This method is for setting mediaContents from the Notification service Message.
\r
197 * @param mediaContents as NSMediaContents pointer.
\r
199 void setMediaContents(NSMediaContents *mediaContents);
\r
202 * This method is for getting Topic from the Notification service Message.
\r
204 * @return Topic as string.
\r
206 std::string getTopic() const;
\r
209 * This method is for setting Topic for the Notification service Message.
\r
211 * @return Topic as string.
\r
213 void setTopic(const std::string &topic);
\r
216 * This method is for getting extraInfo from the Notification service Message.
\r
218 * @return extraInfo as OCRepresentation.
\r
220 OC::OCRepresentation getExtraInfo() const;
\r
223 * This method is for setting extraInfo for the Notification service Message.
\r
225 * @return extraInfo as OCRepresentation.
\r
227 void setExtraInfo(const OC::OCRepresentation &extraInfo);
\r
230 uint64_t m_messageId;
\r
231 std::string m_providerId;
\r
233 NSMessageType m_type;
\r
234 std::string m_time;
\r
236 std::string m_title;
\r
237 std::string m_contentText;
\r
238 std::string m_sourceName;
\r
239 NSMediaContents *m_mediaContents;
\r
240 std::string m_topic;
\r
241 OC::OCRepresentation m_extraInfo;
\r
246 #endif /* _NS_MESSAGE_H_ */
\r