Add logic for extra Information.
[platform/upstream/iotivity.git] / service / notification / include / NSCommon.h
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
21 /**
22  * @file
23  *
24  * This file provides APIs of Notification Service for common functions.
25  */
26
27 #ifndef _NS_COMMON_H_
28 #define _NS_COMMON_H_
29
30 #include <stdint.h>
31 #include <octypes.h>
32
33 #define NS_UUID_STRING_SIZE 37
34
35 /**
36  * Result code of notification service
37  */
38 typedef enum eResult
39 {
40     NS_OK = 100,
41     NS_ERROR = 200,
42     NS_SUCCESS = 300,
43     NS_FAIL = 400,
44
45 } NSResult;
46
47 /**
48  * Provider state of notification consumer service
49  */
50 typedef enum
51 {
52     NS_ALLOW = 1,
53     NS_DENY = 2,
54     NS_TOPIC = 3,
55     NS_DISCOVERED = 11,
56     NS_STOPPED = 12
57 } NSProviderState;
58
59 /**
60  * Notification message status to synchronize
61  */
62 typedef enum
63 {
64     NS_SYNC_UNREAD = 0,
65     NS_SYNC_READ = 1,
66     NS_SYNC_DELETED = 2,
67
68 } NSSyncType;
69
70 /**
71  * Notification Message Type
72  * Alert mean is High / critical
73  * Notice mean is low / critical
74  * Event mean is High / Normal
75  * Information mean is Low / Normal
76  */
77 typedef enum
78 {
79     NS_MESSAGE_ALERT = 1,
80     NS_MESSAGE_NOTICE = 2,
81     NS_MESSAGE_EVENT = 3,
82     NS_MESSAGE_INFO = 4,
83
84 } NSMessageType;
85
86 /**
87  *  Notification topic state
88  */
89 typedef enum
90 {
91     NS_TOPIC_UNSUBSCRIBED = 0,
92     NS_TOPIC_SUBSCRIBED = 1,
93
94 } NSTopicState;
95
96 /**
97  * Topic linked list
98  */
99 typedef struct _nsTopic
100 {
101     char * topicName;
102     NSTopicState state;
103     struct _nsTopic * next;
104
105 } NSTopicLL;
106
107 /**
108  *  Consumer information
109  */
110 typedef struct
111 {
112     char consumerId[NS_UUID_STRING_SIZE];
113
114 } NSConsumer;
115
116 /**
117  *  Provider information
118  */
119 typedef struct
120 {
121     char providerId[NS_UUID_STRING_SIZE];
122
123 } NSProvider;
124
125 /**
126  *  Media Contents of Notification Message (Optional)
127  */
128 typedef struct
129 {
130     char * iconImage;
131
132 } NSMediaContents;
133
134 /**
135  *  Notification Message
136  */
137 typedef struct
138 {
139     //Mandatory
140     uint64_t messageId;
141     char providerId[NS_UUID_STRING_SIZE];
142
143     //optional
144     NSMessageType type;
145     char * dateTime;
146     uint64_t ttl;
147     char * title;
148     char * contentText;
149     char * sourceName;
150     NSMediaContents * mediaContents;
151     char * topic;
152     OCRepPayload * extraInfo;
153
154 } NSMessage;
155
156 /**
157  *  Synchronization information of the notification message
158  */
159 typedef struct
160 {
161     uint64_t messageId;
162     char providerId[NS_UUID_STRING_SIZE];
163     NSSyncType state;
164
165 } NSSyncInfo;
166
167 #endif /* _NS_COMMON_H_ */
168