Merge branch 'notification-service'
[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                         OCConnectivityType connectivityType,
67                         GetCallback& callback, QualityOfService QoS)=0;
68
69         virtual OCStackResult PutResourceRepresentation(
70                         const OCDevAddr& devAddr,
71                         const std::string& uri,
72                         const OCRepresentation& rep, const QueryParamsMap& queryParams,
73                         const HeaderOptions& headerOptions,
74                         PutCallback& callback, QualityOfService QoS) = 0;
75
76         virtual OCStackResult PostResourceRepresentation(
77                         const OCDevAddr& devAddr,
78                         const std::string& uri,
79                         const OCRepresentation& rep, const QueryParamsMap& queryParams,
80                         const HeaderOptions& headerOptions,
81                         OCConnectivityType connectivityType,
82                         PostCallback& callback, QualityOfService QoS) = 0;
83
84         virtual OCStackResult DeleteResource(
85                         const OCDevAddr& devAddr,
86                         const std::string& uri,
87                         const HeaderOptions& headerOptions,
88                         OCConnectivityType connectivityType,
89                         DeleteCallback& callback, QualityOfService QoS) = 0;
90
91         virtual OCStackResult ObserveResource(
92                         ObserveType observeType, OCDoHandle* handle,
93                         const OCDevAddr& devAddr,
94                         const std::string& uri,
95                         const QueryParamsMap& queryParams,
96                         const HeaderOptions& headerOptions, ObserveCallback& callback,
97                         QualityOfService QoS)=0;
98
99         virtual OCStackResult CancelObserveResource(
100                         OCDoHandle handle,
101                         const std::string& host,
102                         const std::string& uri,
103                         const HeaderOptions& headerOptions,
104                         QualityOfService QoS)=0;
105
106         virtual OCStackResult SubscribePresence(OCDoHandle* handle,
107                         const std::string& host,
108                         const std::string& resourceType,
109                         OCConnectivityType connectivityType,
110                         SubscribeCallback& presenceHandler)=0;
111
112         virtual OCStackResult UnsubscribePresence(OCDoHandle handle) =0;
113
114 #ifdef WITH_CLOUD
115         virtual OCStackResult SubscribeDevicePresence(OCDoHandle* handle,
116                                                       const std::string& host,
117                                                       const std::vector<std::string>& di,
118                                                       OCConnectivityType connectivityType,
119                                                       ObserveCallback& callback) = 0;
120 #endif
121
122         virtual OCStackResult GetDefaultQos(QualityOfService& qos) = 0;
123
124         virtual OCStackResult FindDirectPairingDevices(unsigned short waittime,
125                         GetDirectPairedCallback& callback) = 0;
126
127         virtual OCStackResult GetDirectPairedDevices(GetDirectPairedCallback& callback) = 0;
128
129         virtual OCStackResult DoDirectPairing(std::shared_ptr< OCDirectPairing > peer,
130                                               const OCPrm_t& pmSel, const std::string& pinNumber,
131                                               DirectPairingCallback& resultCallback) = 0;
132
133 #ifdef WITH_MQ
134         virtual OCStackResult ListenForMQTopic(
135             const OCDevAddr& devAddr,
136             const std::string& resourceUri,
137             const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
138             FindCallback& callback, QualityOfService QoS) = 0;
139
140         virtual OCStackResult PutMQTopicRepresentation(
141             const OCDevAddr& devAddr,
142             const std::string& uri,
143             const OCRepresentation& rep,
144             const QueryParamsMap& queryParams, const HeaderOptions& headerOptions,
145             MQCreateTopicCallback& callback, QualityOfService QoS) = 0;
146 #endif
147         virtual ~IClientWrapper(){}
148     };
149 }
150
151 #endif
152