IoTivity C++ SDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
NSMessage.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_MESSAGE_H_
28 #define _NS_MESSAGE_H_
29 
30 #include <string>
31 #include "NSMediaContents.h"
32 #include "OCRepresentation.h"
33 
34 namespace OIC
35 {
36  namespace Service
37  {
42  class NSMessage
43  {
44  public:
46  enum class NSMessageType
47  {
48  NS_MESSAGE_ALERT = 1,
50  NS_MESSAGE_EVENT = 3,
51  NS_MESSAGE_INFO = 4,
53  };
54 
58  NSMessage(): m_messageId(0), m_type(NSMessageType::NS_MESSAGE_ALERT), m_ttl(0),
59  m_mediaContents(new NSMediaContents), m_extraInfo(OC::OCRepresentation())
60  {
61  }
62 
68  NSMessage(::NSMessage *msg);
69 
75  NSMessage(const NSMessage &msg);
76 
83  NSMessage &operator=(const NSMessage &msg);
84 
88  ~NSMessage();
89 
95  uint64_t getMessageId() const;
96 
102  std::string getProviderId() const;
103 
109  NSMessageType getType() const;
110 
116  void setType(const NSMessageType &type);
117 
123  std::string getTime() const;
124 
130  void setTime(const std::string &time);
131 
137  uint64_t getTTL() const;
138 
144  void setTTL(const uint64_t &ttl);
145 
151  std::string getTitle() const;
152 
158  void setTitle(const std::string &title);
159 
165  std::string getContentText() const;
166 
172  void setContentText(const std::string &contextText);
173 
179  std::string getSourceName() const;
180 
186  void setSourceName(const std::string &sourceName);
187 
194 
200  void setMediaContents(NSMediaContents *mediaContents);
201 
207  std::string getTopic() const;
208 
214  void setTopic(const std::string &topic);
215 
222 
228  void setExtraInfo(const OC::OCRepresentation &extraInfo);
229 
230  private:
231  uint64_t m_messageId;
232  std::string m_providerId;
233 
234  NSMessageType m_type;
235  std::string m_time;
236  uint64_t m_ttl;
237  std::string m_title;
238  std::string m_contentText;
239  std::string m_sourceName;
240  NSMediaContents *m_mediaContents;
241  std::string m_topic;
242  OC::OCRepresentation m_extraInfo;
243 
244  };
245  }
246 }
247 #endif /* _NS_MESSAGE_H_ */
std::string getTopic() const
This method is for getting Topic from the Notification service Message.
std::string getContentText() const
This method is for getting contentText from the Notification service Message.
std::string getProviderId() const
This method is for getting Provider Id from the Notification service Message.
OC::OCRepresentation getExtraInfo() const
This method is for getting extraInfo from the Notification service Message.
NSMessage & operator=(const NSMessage &msg)
Copy assignment operator of NSMessage.
uint64_t getMessageId() const
This method is for getting Message Id from the Notification service Message.
This class provides a set of APIs for Notification service Message .
Definition: NSMessage.h:42
This file contains the declaration of classes and its members related to OCRepresentation.
std::string getSourceName() const
This method is for getting sourceName from the Notification service Message.
NSMessage()
Constructor of NSMessage.
Definition: NSMessage.h:58
NSMessageType getType() const
This method is for getting type from the Notification service Message.
uint64_t getTTL() const
This method is for getting time to live from the Notification service Message.
This class provides a set of APIs for Notification service Media Contents.
Definition: NSMediaContents.h:42
void setSourceName(const std::string &sourceName)
This method is for setting sourceName from the Notification service Message.
void setContentText(const std::string &contextText)
This method is for setting contentText from the Notification service Message.
void setTime(const std::string &time)
This method is for setting time from the Notification service Message.
NSMessageType
Notification Message Type Alert mean is High / critical Notice mean is low / critical Event mean is H...
Definition: NSCommon.h:78
std::string getTime() const
This method is for getting time from the Notification service Message.
NSMessageType
NSMessageType - enumeration for Notification service MessageType.
Definition: NSMessage.h:46
Definition: NSCommon.h:80
void setTitle(const std::string &title)
This method is for setting Title from the Notification service Message.
~NSMessage()
Destructor of NSMessage.
void setTopic(const std::string &topic)
This method is for setting Topic for the Notification service Message.
This file contains Notification service media contents representation.
void setMediaContents(NSMediaContents *mediaContents)
This method is for setting mediaContents from the Notification service Message.
std::string getTitle() const
This method is for getting Title from the Notification service Message.
void setType(const NSMessageType &type)
This method is for setting type from the Notification service Message.
Definition: OCRepresentation.h:84
NSMediaContents * getMediaContents() const
This method is for getting mediaContents from the Notification service Message.
void setExtraInfo(const OC::OCRepresentation &extraInfo)
This method is for setting extraInfo for the Notification service Message.
void setTTL(const uint64_t &ttl)
This method is for setting time to live from the Notification service Message.