added cacheadapter interface and memorycache of notification.
[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 <ocstack.h>
31
32 #define NS_ATTRIBUTE_POLICY "ACCEPTER"
33 #define NS_ATTRIBUTE_MESSAGE "MESSAGE_URI"
34 #define NS_ATTRIBUTE_SYNC "SYNC_URI"
35 #define NS_ATTRIBUTE_ACCPETANCE "ACCEPTANCE"
36 #define NS_ATTRIBUTE_ID "ID"
37 #define NS_ATTRIBUTE_TITLE "TITLE"
38 #define NS_ATTRIBUTE_TEXT "CONTENTTEXT"
39 #define NS_ATTRIBUTE_STATE "STATE"
40 #define NS_ATTRIBUTE_DEVICE "DEVICE"
41
42 /**
43  * Result code of notification service
44  */
45 typedef enum eResult
46 {
47     NS_OK = 100,
48     NS_ERROR = 200,
49     NS_SUCCESS = 300,
50     NS_FAIL = 400,
51     NS_ALLOW = 500,
52     NS_DENY = 600,
53
54 } NSResult;
55
56 /**
57  * Access policy exchanged between provider and consumer during subscription process
58  */
59 typedef enum eAccessPolicy
60 {
61     NS_ACCEPTER_PROVIDER = 0,
62     NS_ACCEPTER_CONSUMER = 1,
63
64 } NSAccessPolicy;
65
66 /**
67  * Notification message status to synchronize
68  */
69 typedef enum
70 {
71     Notification_Read,
72     Notification_Dismiss,
73 } NSSyncTypes;
74
75 /**
76  *  Device information
77  */
78 typedef struct
79 {
80     char * mId;
81     void * mUserData;
82 } NSDevice;
83
84 /**
85  *  Consumer information is same to device information
86  */
87 typedef NSDevice NSConsumer;
88
89 /**
90  *  Provider information
91  */
92 typedef struct
93 {
94     char * mId;
95     char * mUserData;
96     char * messageUri;
97     char * syncUri;
98     OCDoHandle messageHandle;
99     OCDoHandle syncHandle;
100 } NSProvider;
101
102 /**
103  *  Notification Message
104  */
105 typedef struct
106 {
107     char * mId;
108     char * mTitle;
109     char * mContentText;
110 } NSMessage;
111
112 /**
113  *  Synchronization information of the notification message
114  */
115 typedef struct
116 {
117     // Mandatory
118     char * mMessageId;
119     NSSyncTypes mState;
120
121     //Optional
122     NSDevice * mDevice;
123 } NSSync;
124
125 #endif /* _NS_COMMON_H_ */
126