Merge "Merge branch 'master' into cloud-interface" into cloud-interface
[platform/upstream/iotivity.git] / resource / include / IClientWrapper.h
1 //******************************************************************
2 //
3 // Copyright 2014 Intel Mobile Communications GmbH All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
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
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
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.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #ifndef OC_I_CLIENT_WRAPPER_H_
22 #define OC_I_CLIENT_WRAPPER_H_
23
24 #include <memory>
25 #include <string>
26 #include <OCApi.h>
27
28 namespace OC
29 {
30     class OCPlatform_impl;
31
32     class IClientWrapper : public std::enable_shared_from_this<IClientWrapper>
33     {
34     protected:
35
36     public:
37         typedef std::shared_ptr<IClientWrapper> Ptr;
38
39         IClientWrapper()
40         {}
41
42         virtual OCStackResult ListenForResource(const std::string& serviceUrl,
43                         const std::string& resourceType,
44                         OCConnectivityType connectivityType,
45                         FindCallback& callback,
46                         QualityOfService QoS) = 0;
47
48         virtual OCStackResult ListenErrorForResource(const std::string& serviceUrl,
49                         const std::string& resourceType,
50                         OCConnectivityType connectivityType,
51                         FindCallback& callback,
52                         FindErrorCallback& errorCallback,
53                         QualityOfService QoS) = 0;
54
55         virtual OCStackResult ListenForDevice(const std::string& serviceUrl,
56                         const std::string& deviceURI,
57                         OCConnectivityType connectivityType,
58                         FindDeviceCallback& callback,
59                         QualityOfService QoS) = 0;
60
61         virtual OCStackResult GetResourceRepresentation(
62                         const OCDevAddr& devAddr,
63                         const std::string& uri,
64                         const QueryParamsMap& queryParams,
65                         const HeaderOptions& headerOptions,
66                         GetCallback& callback, QualityOfService QoS)=0;
67
68         virtual OCStackResult PutResourceRepresentation(
69                         const OCDevAddr& devAddr,
70                         const std::string& uri,
71                         const OCRepresentation& rep, const QueryParamsMap& queryParams,
72                         const HeaderOptions& headerOptions,
73                         PutCallback& callback, QualityOfService QoS) = 0;
74
75         virtual OCStackResult PostResourceRepresentation(
76                         const OCDevAddr& devAddr,
77                         const std::string& uri,
78                         const OCRepresentation& rep, const QueryParamsMap& queryParams,
79                         const HeaderOptions& headerOptions,
80                         PostCallback& callback, QualityOfService QoS) = 0;
81
82         virtual OCStackResult DeleteResource(
83                         const OCDevAddr& devAddr,
84                         const std::string& uri,
85                         const HeaderOptions& headerOptions,
86                         DeleteCallback& callback, QualityOfService QoS) = 0;
87
88         virtual OCStackResult ObserveResource(
89                         ObserveType observeType, OCDoHandle* handle,
90                         const OCDevAddr& devAddr,
91                         const std::string& uri,
92                         const QueryParamsMap& queryParams,
93                         const HeaderOptions& headerOptions, ObserveCallback& callback,
94                         QualityOfService QoS)=0;
95
96         virtual OCStackResult CancelObserveResource(
97                         OCDoHandle handle,
98                         const std::string& host,
99                         const std::string& uri,
100                         const HeaderOptions& headerOptions,
101                         QualityOfService QoS)=0;
102
103         virtual OCStackResult SubscribePresence(OCDoHandle* handle,
104                         const std::string& host,
105                         const std::string& resourceType,
106                         OCConnectivityType connectivityType,
107                         SubscribeCallback& presenceHandler)=0;
108
109         virtual OCStackResult UnsubscribePresence(OCDoHandle handle) =0;
110
111         virtual OCStackResult GetDefaultQos(QualityOfService& qos) = 0;
112
113         virtual OCStackResult FindDirectPairingDevices(unsigned short waittime,
114                         GetDirectPairedCallback& callback) = 0;
115
116         virtual OCStackResult GetDirectPairedDevices(GetDirectPairedCallback& callback) = 0;
117
118         virtual OCStackResult DoDirectPairing(std::shared_ptr<OCDirectPairing> peer, const OCPrm_t& pmSel,
119                 const std::string& pinNumber, DirectPairingCallback& resultCallback) = 0;
120
121         virtual ~IClientWrapper(){}
122     };
123 }
124
125 #endif
126