1 //******************************************************************
3 // Copyright 2015 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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
21 #ifndef COMMON_PRESENCESUBSCRIBER_H
22 #define COMMON_PRESENCESUBSCRIBER_H
34 typedef std::function< void(OCStackResult, const unsigned int, const std::string&) >
37 class PresenceSubscriber
42 PresenceSubscriber(PresenceSubscriber&&);
45 * @throw PlatformException
47 PresenceSubscriber(const std::string& host, OCConnectivityType connectivityType,
48 SubscribeCallback presenceHandler);
51 * @throw PlatformException
53 PresenceSubscriber(const std::string& host, const std::string& resourceType,
54 OCConnectivityType connectivityType, SubscribeCallback presenceHandler);
56 ~PresenceSubscriber();
58 PresenceSubscriber& operator=(PresenceSubscriber&&);
61 * @throw PlatformException
65 bool isSubscribing() const;
72 * @throw PlatformException
74 void subscribePresence(OCDoHandle& handle, const std::string& host,
75 OCConnectivityType connectivityType, SubscribeCallback presenceHandler);
78 * @throw PlatformException
80 void subscribePresence(OCDoHandle& handle, const std::string& host, const std::string& resourceType,
81 OCConnectivityType connectivityType, SubscribeCallback presenceHandler);
83 void unsubscribePresence(OCDoHandle handle);
88 #endif // COMMON_PRESENCESUBSCRIBER_H