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
41 * @brief This class provides a set of Notification service Provider representation APIs.
\r
47 * Consumer use this callback function to receive notification message from provider
\r
49 * @param[in] message Notification message
\r
51 typedef void (*MessageReceivedCallback)(NSMessage *);
\r
54 * Provider and consumer use this callback function to receive the status of the message
\r
56 * @param[in] sync Synchronization information of the notification message
\r
58 typedef void (*SyncInfoReceivedCallback)(NSSyncInfo *);
\r
61 * Constructor of NSProvider.
\r
63 NSProvider(): m_messageCb(NULL), m_syncInfoCb(NULL) {}
\r
66 * Constructor of NSProvider.
\r
68 * @param providerId - providerId of the Notification.
\r
70 NSProvider(const std::string &providerId) : m_providerId(providerId),
\r
71 m_messageCb(NULL), m_syncInfoCb(NULL) {}
\r
74 * Constructor of NSProvider.
\r
76 * @param provider - of type NSProvider.
\r
78 NSProvider(::NSProvider *provider);
\r
82 * Destructor of NSProvider.
\r
84 ~NSProvider() = default;
\r
87 * This method is for getting ProviderId from the Notification service provider.
\r
89 * @return ProviderId as string.
\r
91 std::string getProviderId() const;
\r
94 * This method is for requesting subscription of Notification service.
\r
100 * This method is for requesting unsubscription of Notification service.
\r
103 void unSubscribe();
\r
106 * This method is for Sending SyncInfo of Notification service.
\r
108 * @param messageId - id of type message.
\r
109 * @param type - NSSyncType of Notification service.
\r
111 void SendSyncInfo(uint64_t messageId, NSSyncInfo::NSSyncType type);
\r
114 * This method is for registering for listeners of Notification .
\r
116 * @param messageHandle - MessageReceivedCallback callback.
\r
117 * @param syncHandle - SyncInfoReceivedCallback callback
\r
119 void setListener(MessageReceivedCallback messageHandle,
\r
120 SyncInfoReceivedCallback syncHandle);
\r
123 * This method is for getting the registered cb of Notification message received.
\r
125 * @return messageCb - MessageReceivedCallback .
\r
127 MessageReceivedCallback getMessageReceivedCb();
\r
130 * This method is for getting the registered cb of Notification SyncInfo received.
\r
132 * @return syncInfoCb - SyncInfoReceivedCallback .
\r
134 SyncInfoReceivedCallback getSyncInfoReceivedCb();
\r
137 ::NSProvider *getNSProvider();
\r
140 std::string m_providerId;
\r
141 MessageReceivedCallback m_messageCb;
\r
142 SyncInfoReceivedCallback m_syncInfoCb;
\r
147 #endif /* _NS_PROVIDER_H_ */
\r