Merge branch 'master' into notification-service
[platform/upstream/iotivity.git] / service / notification / include / NSConsumerInterface.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 Consumer.
25  */
26
27 #ifndef _NS_CONSUMER_INTERFACE_H_
28 #define _NS_CONSUMER_INTERFACE_H_
29
30 #ifdef __cplusplus
31 extern "C"
32 {
33 #endif // __cplusplus
34
35 #include "NSCommon.h"
36
37 /**
38  * Provider and consumer use this callback function to receive the status of the message
39  * synchronization
40  * @param[in] provider    Provider who requests synchronization with the status
41  * @param[in] sync        Synchronization information of the notification message
42  */
43 typedef void (*NSSyncCallback)(NSProvider *, NSSyncInfo *);
44
45 /**
46  * Consumer uses this callback function to receive the discovered providers
47  * @param[in] provider        Provider who has the notification resource
48  */
49 typedef void (*NSProviderDiscoveredCallback)(NSProvider *);
50
51 /**
52  * Consumer use this callback function to receive notification message from provider
53  * synchronization
54  * @param[in] provider    Provider who sends notification message
55  * @param[in] message     Notification message
56  */
57 typedef void (*NSNotificationReceivedCallback)(NSProvider *, NSMessage *);
58
59 /**
60  * Initialize notification service for consumer
61  * @param[in]  providerDiscoveredCallback   Callback function to discover notification providers
62  * @param[in]  notificationReceivedCallback   Callback function to receive notification messages
63  * @param[in]  syncCallback   Callback function to receive synchronization status of notification
64  * @return ::NS_OK or result code of NSResult
65  */
66 NSResult NSStartConsumer(NSProviderDiscoveredCallback discoverCb,
67         NSNotificationReceivedCallback postCb, NSSyncCallback syncCb);
68
69 /**
70  * Terminate notification service for consumer
71  * @return ::NS_OK or result code of NSResult
72  */
73 NSResult NSStopConsumer();
74
75 /**
76  * Request discovery manually
77  * @return ::NS_OK or result code of NSResult
78  */
79 NSResult NSRescanProvider();
80
81 /**
82  * Request to subscribe notification message resource of provider
83  * @param[in]  provider  Provider who send the notification message
84  * @return ::NS_OK or result code of NSResult
85  */
86 NSResult NSSubscribe(NSProvider *provider);
87
88 /**
89  * Request to unsubscribe in order not to receive notification message from provider
90  * @param[in]  provider  Provider who send the notification message
91  * @return ::NS_OK or result code of NSResult
92  */
93 NSResult NSUnsubscribe(NSProvider *provider);
94
95 NSResult NSConsumerReadCheck(NSMessage *);
96
97 NSResult NSConsumerDismissCheck(NSMessage *);
98
99 //** Remove below functions **//
100 NSResult NSDropNSObject(NSMessage *);
101 //** end of functions to be removed **//
102
103 #ifdef __cplusplus
104 }
105 #endif // __cplusplus
106
107 #endif // _NS_CONSUMER_INTERFACE_H_