1 //******************************************************************
3 // Copyright 2014 Intel Mobile Communications GmbH 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 _I_CLIENT_WRAPPER_H_
22 #define _I_CLIENT_WRAPPER_H_
31 class OCPlatform_impl;
33 class IClientWrapper : public std::enable_shared_from_this<IClientWrapper>
36 OCPlatform_impl& m_owner;
39 typedef std::shared_ptr<IClientWrapper> Ptr;
41 IClientWrapper(OCPlatform_impl& owner)
45 virtual OCStackResult ListenForResource(const std::string& serviceUrl,
46 const std::string& resourceType, FindCallback& callback,
47 QualityOfService QoS) = 0;
49 virtual OCStackResult GetResourceRepresentation(const std::string& host,
50 const std::string& uri, const QueryParamsMap& queryParams,
51 const HeaderOptions& headerOptions,
52 GetCallback& callback, QualityOfService QoS)=0;
54 virtual OCStackResult PutResourceRepresentation(const std::string& host,
55 const std::string& uri, const OCRepresentation& rep,
56 const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
57 PutCallback& callback, QualityOfService QoS) = 0;
59 virtual OCStackResult PostResourceRepresentation(const std::string& host,
60 const std::string& uri, const OCRepresentation& rep,
61 const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
62 PostCallback& callback, QualityOfService QoS) = 0;
64 virtual OCStackResult DeleteResource(const std::string& host, const std::string& uri,
65 const HeaderOptions& headerOptions, DeleteCallback& callback,
66 QualityOfService QoS) = 0;
68 virtual OCStackResult ObserveResource(ObserveType observeType, OCDoHandle* handle,
69 const std::string& host, const std::string& uri,
70 const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
71 ObserveCallback& callback, QualityOfService QoS)=0;
73 virtual OCStackResult CancelObserveResource(OCDoHandle handle, const std::string& host,
74 const std::string& uri, const HeaderOptions& headerOptions, QualityOfService QoS)=0;
76 virtual OCStackResult SubscribePresence(OCDoHandle* handle, const std::string& host,
77 SubscribeCallback& presenceHandler)=0;
79 virtual OCStackResult UnsubscribePresence(OCDoHandle handle) =0;
81 virtual OCStackResult GetDefaultQos(QualityOfService& qos) = 0;
83 virtual ~IClientWrapper(){}
86 // Note: this should never be called by anyone but the handler for the listen command.
87 // It is public becuase that needs to be a non-instance callback
88 virtual std::shared_ptr<OCResource> parseOCResource(IClientWrapper::Ptr clientWrapper,
89 const std::string& host, const boost::property_tree::ptree resourceNode)=0;