added cacheadapter interface and memorycache of notification.
[platform/upstream/iotivity.git] / service / notification / include / NSProviderInterface.h
1 //******************************************************************\r
2 //\r
3 // Copyright 2016 Samsung Electronics All Rights Reserved.\r
4 //\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
6 //\r
7 // Licensed under the Apache License, Version 2.0 (the "License");\r
8 // you may not use this file except in compliance with the License.\r
9 // You may obtain a copy of the License at\r
10 //\r
11 //      http://www.apache.org/licenses/LICENSE-2.0\r
12 //\r
13 // Unless required by applicable law or agreed to in writing, software\r
14 // distributed under the License is distributed on an "AS IS" BASIS,\r
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
16 // See the License for the specific language governing permissions and\r
17 // limitations under the License.\r
18 //\r
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=\r
20 \r
21 /**\r
22  * @file\r
23  *\r
24  * This file provides APIs of Notification Service for Provider.\r
25  */\r
26 \r
27 #ifndef _NS_PROVIDER_INTERFACE_H_\r
28 #define _NS_PROVIDER_INTERFACE_H_\r
29 \r
30 #ifdef __cplusplus\r
31 extern "C"\r
32 {\r
33 #endif // __cplusplus\r
34 \r
35 #include "NSCommon.h"\r
36 #include <stdbool.h>\r
37 #include <stdint.h>\r
38 \r
39 /**\r
40  * Provider uses this callback function to receive subscription request of consumer\r
41  * @param[in] consumer        Consumer who subscribes the resource\r
42  */\r
43 typedef void (*NSSubscribeRequestCallback)(NSConsumer *);\r
44 \r
45 /**\r
46  * Provider use this callback function to receive the status of the message\r
47  * synchronization\r
48  * @param[in] sync        Synchronization information of the notification message\r
49  */\r
50 typedef void (*NSSyncCallback)(NSSync *);\r
51 \r
52 /**\r
53  * Initialize notification service for provider\r
54  * @param[in]  policy   Accepter\r
55  * @param[in]  subscribeRequestCallback   Callback function to register for receiving\r
56  * subscription request from consumer\r
57  * @param[in]  syncCallback   Callback function to register for receiving  sync data\r
58  * @return ::NS_OK or result code of NSResult\r
59  */\r
60 NSResult NSStartProvider(NSAccessPolicy policy, NSSubscribeRequestCallback subscribeRequestCb,\r
61         NSSyncCallback syncCb);\r
62 \r
63 /**\r
64  * Terminate notification service for provider\r
65  * @return ::NS_OK or result code of NSResult\r
66  */\r
67 NSResult NSStopProvider();\r
68 \r
69 /**\r
70  * Send notification message to all subscribers\r
71  * @param[in]  message  Notification message including id, title, contentText\r
72  * @return ::NS_OK or result code of NSResult\r
73  */\r
74 NSResult NSSendNotification(NSMessage *msg);\r
75 \r
76 /**\r
77  * Send acceptance to consumer who subscribes the resource of notification message\r
78  * @param[in]  consumer  Consumer who subscribes the resource\r
79  * @param[in]  accepted  the result of acceptance; Allow or Deny\r
80  * @return ::NS_OK or result code of NSResult\r
81  */\r
82 NSResult NSAccept(NSConsumer *consumer, bool accepted);\r
83 \r
84 /**\r
85  * Get consumer list that is stored in the cache of notification service\r
86  * @param[in]  list  Consumer list\r
87  * @param[in]  size  the number of consumers stored in the cache\r
88  * @return ::NS_OK or result code of NSResult\r
89  */\r
90 // NSResult NSGetConsumerList(uint8_t *list, uint32_t size);\r
91 \r
92 /**\r
93  * Send read-check to provider in order to synchronize notification status with other consumers\r
94  * @param[in]  message  Notification message to synchronize the status\r
95  * @return ::NS_OK or result code of NSResult\r
96  */\r
97 NSResult NSProviderReadCheck(NSMessage *);\r
98 \r
99 #ifdef __cplusplus\r
100 }\r
101 #endif // __cplusplus\r
102 \r
103 #endif /* _NS_PROVIDER_INTERFACE_H_ */\r
104 \r