1 //******************************************************************
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
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
11 // http://www.apache.org/licenses/LICENSE-2.0
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.
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
24 * This file provides APIs of Notification Service for Consumer.
27 #ifndef _NS_CONSUMER_INTERFACE_H_
28 #define _NS_CONSUMER_INTERFACE_H_
38 * Consumer uses this callback function to receive the discovered providers
39 * @param[in] provider Provider who has the notification resource
41 typedef void (* NSProviderDiscoveredCallback)(NSProvider *);
43 typedef void (* NSSubscriptionAcceptedCallback)(NSProvider *);
46 * Consumer use this callback function to receive notification message from provider
48 * @param[in] provider Provider who sends notification message
49 * @param[in] message Notification message
51 typedef void (* NSMessageReceivedCallback)(NSMessage *);
54 * Provider and consumer use this callback function to receive the status of the message
56 * @param[in] provider Provider who requests synchronization with the status
57 * @param[in] sync Synchronization information of the notification message
59 typedef void (* NSSyncInfoReceivedCallback)(NSSyncInfo *);
63 NSProviderDiscoveredCallback discoverCb;
64 NSSubscriptionAcceptedCallback acceptedCb;
65 NSMessageReceivedCallback messageCb;
66 NSSyncInfoReceivedCallback syncInfoCb;
71 * Initialize notification service for consumer
72 * @param[in] providerDiscoveredCallback Callback function to discover notification providers
73 * @param[in] notificationReceivedCallback Callback function to receive notification messages
74 * @param[in] syncCallback Callback function to receive synchronization status of notification
75 * @return ::NS_OK or result code of NSResult
77 NSResult NSStartConsumer(NSConsumerConfig config);
80 * Terminate notification service for consumer
81 * @return ::NS_OK or result code of NSResult
83 NSResult NSStopConsumer();
86 * Request discovery manually
87 * @return ::NS_OK or result code of NSResult
89 NSResult NSRescanProvider();
92 * Request to subscribe notification message resource of provider
93 * @param[in] provider Provider who send the notification message
94 * @return ::NS_OK or result code of NSResult
96 NSResult NSSubscribe(NSProvider *provider);
99 * Request to unsubscribe in order not to receive notification message from provider
100 * @param[in] provider Provider who send the notification message
101 * @return ::NS_OK or result code of NSResult
103 NSResult NSUnsubscribe(NSProvider *provider);
105 NSResult NSConsumerSendSyncInfo(
106 const char * providerId, uint64_t messageId, NSSyncType type);
108 NSProvider * NSConsumerGetProvider(const char * providerId);
110 NSMessage * NSConsumerGetMessage(uint64_t messageId);
114 #endif // __cplusplus
116 #endif // _NS_CONSUMER_INTERFACE_H_