Update API comments
[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  * Invoked the subscription request from consumer is received\r
41  * @param[in] consumer  Consumer who subscribes the resource\r
42  */\r
43 typedef void (*NSSubscribeRequestCallback)(NSConsumer *);\r
44 \r
45 /**\r
46  * Invoked when the synchronization data which has notification message \r
47  * read/delete event from consumer is received\r
48  * synchronization\r
49  * @param[in] syncinfo  Synchronization information of the notification message\r
50  */\r
51 typedef void (*NSProviderSyncInfoCallback)(NSSyncInfo *);\r
52 \r
53 /**\r
54  * Initialize notification service for provider\r
55  * @param[in]  policy   Accepter\r
56  * @param[in]  subscribeRequestCallback   Callback function to register for receiving\r
57  * subscription request from consumer\r
58  * @param[in]  syncCallback   Callback function to register for receiving  sync data\r
59  * @return ::NS_OK or result code of NSResult\r
60  */\r
61 NSResult NSStartProvider(bool policy, NSSubscribeRequestCallback subscribeRequestCb,\r
62         NSProviderSyncInfoCallback syncCb);\r
63 \r
64 /**\r
65  * Terminate notification service for provider\r
66  * @return ::NS_OK or result code of NSResult\r
67  */\r
68 NSResult NSStopProvider();\r
69 \r
70 /**\r
71  * Request to publish resource to cloud server\r
72  * @param[in]  server address combined with IP address and port number using delimiter :\r
73  * @return ::NS_OK or result code of NSResult\r
74  */\r
75 NSResult NSProviderEnableRemoteService(char *serverAddress);\r
76 \r
77 /**\r
78  * Request to cancel remote service using cloud server\r
79  * @param[in]  server address combined with IP address and port number using delimiter :\r
80  * @return ::NS_OK or result code of NSResult\r
81  */\r
82 NSResult NSProviderDisableRemoteService(char *serverAddress);\r
83 \r
84 /**\r
85  * Send notification message to all subscribers\r
86  * @param[in]  message  Notification message including id, title, contentText\r
87  * @return ::NS_OK or result code of NSResult\r
88  */\r
89 NSResult NSSendMessage(NSMessage *msg);\r
90 \r
91 /**\r
92  * Send acceptance to consumer who subscribes the resource of notification message\r
93  * @param[in]  consumer  Consumer who subscribes the resource\r
94  * @param[in]  accepted  the result of acceptance; Allow or Deny\r
95  * @return ::NS_OK or result code of NSResult\r
96  */\r
97 NSResult NSAcceptSubscription(NSConsumer *consumer, bool accepted);\r
98 \r
99 /**\r
100  * Send sync type in order to synchronize notification status with other consumers,\r
101  * when provider consumes the notification such as READ, DELETE\r
102  * @param[in]  messageId  Notification message if to synchronize the status\r
103  * @param[in]  type  changed notification status from NSSyncType\r
104  * @return ::NS_OK or result code of NSResult\r
105  */\r
106 NSResult NSProviderSendSyncInfo(uint64_t messageId, NSSyncType type);\r
107 \r
108 \r
109 /**\r
110  * Initialize NSMessage structure with message id and provider(device) id\r
111  * @return ::NSMessage *\r
112  */\r
113 NSMessage * NSCreateMessage();\r
114 \r
115 #ifdef __cplusplus\r
116 }\r
117 #endif // __cplusplus\r
118 \r
119 #endif /* _NS_PROVIDER_INTERFACE_H_ */\r
120 \r