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 OCCLIENT_BASICOPS_H_
22 #define OCCLIENT_BASICOPS_H_
26 //-----------------------------------------------------------------------------
28 //-----------------------------------------------------------------------------
31 * List of methods that can be inititated from the client
34 TEST_DISCOVER_REQ = 1,
40 //-----------------------------------------------------------------------------
42 //-----------------------------------------------------------------------------
44 /* Get the IP address of the server */
45 std::string getIPAddrTBServer(OCClientResponse * clientResponse);
47 /* Get the port number the server is listening on */
48 std::string getPortTBServer(OCClientResponse * clientResponse);
50 /* Returns the query string for GET and PUT operations */
51 std::string getQueryStrForGetPut(OCClientResponse * clientResponse);
53 /* Following are initialization functions for GET, PUT
54 * POST & Discovery operations
56 int InitPutRequest(OCQualityOfService qos);
57 int InitGetRequest(OCQualityOfService qos);
58 int InitPostRequest(OCQualityOfService qos);
61 /* Function to retrieve ip address, port no. of the server
62 * and query for the operations to be performed.
64 int parseClientResponse(OCClientResponse * clientResponse);
66 /* This method calls OCDoResource() which in turn makes calls
69 OCStackResult InvokeOCDoResource(std::ostringstream &query,
70 OCMethod method, OCQualityOfService qos,
71 OCClientResponseHandler cb, OCHeaderOption * options, uint8_t numOptions);
73 //-----------------------------------------------------------------------------
75 //-----------------------------------------------------------------------------
77 /* Following are callback functions for the GET, PUT
78 * POST & Discovery operations
81 OCStackApplicationResult putReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse);
83 OCStackApplicationResult postReqCB(void *ctx, OCDoHandle handle, OCClientResponse *clientResponse);
85 OCStackApplicationResult getReqCB(void* ctx, OCDoHandle handle, OCClientResponse * clientResponse);
87 OCStackApplicationResult discoveryReqCB(void* ctx, OCDoHandle handle,
88 OCClientResponse * clientResponse);