1 //******************************************************************
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 package org.iotivity.service.ns.common;
23 import android.util.Log;
24 import org.iotivity.base.OcRepresentation;
28 * This class provides implementation of Notification Message object.
31 public class Message {
33 private static final String LOG_TAG = "NotificationService_Message";
36 * This enum is used to represent different types of notification messages
38 public enum MessageType {
47 private MessageType(int type) {
51 public int getMessageType() {
56 private long mMessageId = 0;
57 private String mProviderId = null;
59 private String mSourceName = null;
60 private MessageType mType = MessageType.ALERT;
61 private String mTime = null;
62 private long mTTL = 0;
63 private String mTitle = null;
64 private String mContentText = null;
65 private MediaContents mMediaContents = null;
66 private String mTopic = null;
67 private OcRepresentation mExtraInfo = null;
69 public Message(String title, String contentText, String sourceName) {
70 Log.i(LOG_TAG, "Message()");
73 mContentText = contentText;
74 mSourceName = sourceName;
77 public long getMessageId() {
81 public String getProviderId() {
85 public String getSourceName() {
89 public MessageType getType() {
93 public String getTime() {
97 public long getTTL() {
101 public String getTitle() {
105 public String getContentText() {
109 public MediaContents getMediaContents() {
110 return mMediaContents;
113 public String getTopic() {
117 public OcRepresentation getExtraInfo() {
121 public void setSourceName(String sourceName) {
122 mSourceName = sourceName;
125 public void setType(MessageType type) {
129 public void setTime(String time) {
133 public void setTTL(long ttl) {
137 public void setTitle(String title) {
141 public void setContentText(String contextText) {
142 mContentText = contextText;
145 public void setMediaContents(MediaContents mediaContents) {
146 mMediaContents = mediaContents;
149 public void setTopic(String topic) {
153 public void setExtraInfo(OcRepresentation extraInfo) {
154 mExtraInfo = extraInfo;