Merge branch 'master' into notification-service
[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 #ifndef _NS_COMMON_H_
22 #define _NS_COMMON_H_
23
24 #define NS_ATTRIBUTE_POLICY "ACCEPTER"
25 #define NS_ATTRIBUTE_MESSAGE "MESSAGE_URI"
26 #define NS_ATTRIBUTE_SYNC "SYNC_URI"
27 #define NS_ATTRIBUTE_ACCPETANCE "ACCEPTANCE"
28 #define NS_ATTRIBUTE_ID "ID"
29 #define NS_ATTRIBUTE_TITLE "TITLE"
30 #define NS_ATTRIBUTE_TEXT "CONTENTTEXT"
31 #define NS_ATTRIBUTE_STATE "STATE"
32 #define NS_ATTRIBUTE_DEVICE "DEVICE"
33
34 typedef enum eResult
35 {
36     NS_OK = 100,
37     NS_ERROR = 200,
38     NS_SUCCESS = 300,
39     NS_FAIL = 400,
40     NS_ALLOW = 500,
41     NS_DENY = 600,
42
43 } NSResult;
44
45 typedef enum eAccessPolicy
46 {
47     NS_ACCEPTER_PROVIDER = 0,
48     NS_ACCEPTER_CONSUMER = 1,
49
50 } NSAccessPolicy;
51
52 typedef struct
53 {
54     char * mId;
55     void * mUserData;
56 } NSDevice;
57
58 typedef NSDevice NSConsumer;
59
60 typedef struct
61 {
62     char * mId;
63     char * mUserData;
64     char * messageUri;
65     char * syncUri;
66 } NSProvider;
67
68 typedef struct
69 {
70     // Mandatory
71     char * mId;
72     char * mTitle;
73
74     //Optional
75     char * mContentText;
76
77 } NSMessage;
78
79 typedef enum
80 {
81     Notification_Read,
82     Notification_Dismiss,
83 } NSSyncTypes;
84
85 typedef struct
86 {
87     // Mandatory
88     char * mMessageId;
89     NSSyncTypes mState;
90
91     //Optional
92     NSDevice * mDevice;
93
94 } NSSync;
95
96 typedef void (* NSSubscribeRequestCallback)(NSConsumer *);
97 typedef void (* NSSyncCallback)(NSProvider *, NSSync *);
98
99 typedef void (* NSProviderDiscoveredCallback)(NSProvider *);
100 // NSMessage should deleted as user.
101 typedef void (* NSNotificationReceivedCallback)(NSProvider *, NSMessage *);
102
103 #endif /* _NS_COMMON_H_ */
104