1 //******************************************************************
\r
3 // Copyright 2016 Samsung Electronics All Rights Reserved.
\r
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\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
11 // http://www.apache.org/licenses/LICENSE-2.0
\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
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
\r
24 * This file contains Notification service Provider representation.
\r
27 #ifndef _NS_PROVIDER_H_
\r
28 #define _NS_PROVIDER_H_
\r
32 #include "NSSyncInfo.h"
\r
33 #include "NSMessage.h"
\r
34 #include "NSUtils.h"
\r
35 #include "NSTopicsList.h"
\r
43 * @brief This class provides a set of Notification service Provider representation APIs.
\r
49 * Consumer use this callback function to receive notification message from provider
\r
51 * @param[in] message Notification message
\r
53 typedef void (*MessageReceivedCallback)(NSMessage *);
\r
56 * Provider and consumer use this callback function to receive the status of the message
\r
58 * @param[in] sync Synchronization information of the notification message
\r
60 typedef void (*SyncInfoReceivedCallback)(NSSyncInfo *);
\r
63 * Constructor of NSProvider.
\r
65 NSProvider(): m_topicList(new NSTopicsList()), m_messageCb(NULL), m_syncInfoCb(NULL) {}
\r
68 * Constructor of NSProvider.
\r
70 * @param providerId - providerId of the Notification.
\r
72 NSProvider(const std::string &providerId) : m_providerId(providerId),
\r
73 m_topicList(new NSTopicsList()), m_messageCb(NULL), m_syncInfoCb(NULL) {}
\r
76 * Constructor of NSProvider.
\r
78 * @param providerId - providerId of the Notification.
\r
79 * @param topicList - NSTopicsList of interested Topics.
\r
81 NSProvider(const std::string &providerId, NSTopicsList *topicList) : m_providerId(
\r
82 providerId), m_topicList(topicList), m_messageCb(NULL), m_syncInfoCb(NULL) {}
\r
85 * Constructor of NSProvider.
\r
87 * @param provider - of type NSProvider.
\r
89 NSProvider(::NSProvider *provider);
\r
93 * Destructor of NSProvider.
\r
98 * This method is for getting ProviderId from the Notification service provider.
\r
100 * @return ProviderId as string.
\r
102 std::string getProviderId() const;
\r
105 * This method is for getting NSTopic List from the Notification service provider.
\r
107 * @return NSTopicsList as pointer.
\r
109 NSTopicsList *getTopicList() const;
\r
112 * This method is for requesting subscription of Notification service.
\r
118 * This method is for requesting unsubscription of Notification service.
\r
121 void unSubscribe();
\r
124 * This method is for Sending SyncInfo of Notification service.
\r
126 * @param messageId - id of type message.
\r
127 * @param type - NSSyncType of Notification service.
\r
129 void SendSyncInfo(uint64_t messageId, NSSyncInfo::NSSyncType type);
\r
132 * This method is for registering for listeners of Notification .
\r
134 * @param messageHandle - MessageReceivedCallback callback.
\r
135 * @param syncHandle - SyncInfoReceivedCallback callback
\r
137 void setListener(MessageReceivedCallback messageHandle,
\r
138 SyncInfoReceivedCallback syncHandle);
\r
141 * Select Topic list that is wanted to subscribe from provider
\r
143 * @param topicList - NSTopicsList of interested Topics.
\r
146 NSResult selectInterestTopics(NSTopicsList *topicList);
\r
149 * This method is for getting the registered cb of Notification message received.
\r
151 * @return messageCb - MessageReceivedCallback .
\r
153 MessageReceivedCallback getMessageReceivedCb();
\r
156 * This method is for getting the registered cb of Notification SyncInfo received.
\r
158 * @return syncInfoCb - SyncInfoReceivedCallback .
\r
160 SyncInfoReceivedCallback getSyncInfoReceivedCb();
\r
163 ::NSProvider *getNSProvider();
\r
166 std::string m_providerId;
\r
167 NSTopicsList *m_topicList;
\r
168 MessageReceivedCallback m_messageCb;
\r
169 SyncInfoReceivedCallback m_syncInfoCb;
\r
174 #endif /* _NS_PROVIDER_H_ */
\r