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 * Invoked when the provider state is changed
39 * @param[in] provider Provider which has the notification resource
40 * @param[in] state Response which has the provider state
42 typedef void (* NSProviderStateCallback)(NSProvider *, NSProviderState);
45 * Invoked when the notification message from provider is received
47 * @param[in] message Notification message
49 typedef void (* NSMessageReceivedCallback)(NSMessage *);
52 * Invoked when the synchronization data which has notification message
53 * read/delete event from provider/consumer is received
55 * @param[in] syncInfo Synchronization information of the notification message
57 typedef void (* NSSyncInfoReceivedCallback)(NSSyncInfo *);
61 NSProviderStateCallback changedCb;
62 NSMessageReceivedCallback messageCb;
63 NSSyncInfoReceivedCallback syncInfoCb;
68 * Initialize notification service for consumer
69 * @param[in] config NSConsumerconfig structure of callback functions
70 * @return ::NS_OK or result code of NSResult
72 NSResult NSStartConsumer(NSConsumerConfig config);
75 * Terminate notification service for consumer
76 * @return ::NS_OK or result code of NSResult
78 NSResult NSStopConsumer();
81 * Request to discover to remote address as parameter.
82 * @param[in] server address combined with IP address and port number using delimiter :
83 * @return ::NS_OK or result code of NSResult
85 NSResult NSConsumerEnableRemoteService(const char *serverAddress);
88 * Request discovery manually
89 * @return ::NS_OK or result code of NSResult
91 NSResult NSRescanProvider();
94 * Request to subscribe notification message resource of provider
95 * @param[in] providerId the Id of Provider who send the notification message
96 * @return ::NS_OK or result code of NSResult
98 NSResult NSSubscribe(const char * providerId);
101 * Send sync type to provider in order to synchronize notification status with other consumers
102 * when consumer consumes the notification such as READ, DELETE
103 * @param[in] providerId Provider id of the Notification message
104 * @param[in] messageId Notification message id to synchronize the status
105 * @param[in] type changed notification status from NSSyncType
106 * @return ::NS_OK or result code of NSResult
108 NSResult NSConsumerSendSyncInfo(
109 const char * providerId, uint64_t messageId, NSSyncType type);
112 * Request NSProvider that is matched by provider id
113 * @param[in] providerId the id of provider that user wants to get
116 NSProvider * NSConsumerGetProvider(const char * providerId);
119 * Request NSTopic list that is subscribed from provider
120 * @param[in] providerId the Id of provider that user wants to get
123 NSTopicLL * NSConsumerGetTopicList(const char * providerId);
126 * Select Topic list that is wanted to subscribe from provider
127 * @param[in] providerId the Id of provider that user wants to set
128 * @param[in] topics the topic list that user wants to set
131 NSResult NSConsumerUpdateTopicList(const char * providerId, NSTopicLL * topics);
135 #endif // __cplusplus
137 #endif // _NS_CONSUMER_INTERFACE_H_