1 /* *****************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
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 _PM_UTILITY_H_
22 #define _PM_UTILITY_H_
33 #define DEFAULT_SECURE_PORT 5684
35 #define COAPS_PREFIX "coaps://"
36 #define COAP_PREFIX "coap://"
37 #define COAPS_QUERY "coaps://%s:%d%s"
38 #define COAP_QUERY "coap://%s:%d%s"
41 * Discover owned/unowned devices in the same IP subnet. .
43 * @param[in] waittime Timeout in seconds.
44 * @param[in] isOwned bool flag for owned / unowned discovery
45 * @param[in] ppList List of OCProvisionDev_t.
47 * @return OC_STACK_OK on success otherwise error.
49 OCStackResult PMDeviceDiscovery(unsigned short waittime, bool isOwned, OCProvisionDev_t **ppList);
52 * This function deletes list of provision target devices
54 * @param[in] pList List of OCProvisionDev_t.
56 void DeleteDeviceList(OCProvisionDev_t *pList);
60 * Function to generate qurey for coap/coaps request.
62 * @param[in] isSeucre Choose whether to encrypt the payload.
63 * @param[in] address Network address of remote device
64 * @param[in] port Port number
65 * @param[in] connType Connectivity type of remote device
66 * @param[in,out] buffer A buffer to save the query.
67 * @param[in] bufferSize Size of buffer
68 * @param[in] uri The resource URI
70 * @return true on success
72 bool PMGenerateQuery(bool isSecure,
73 const char* address, uint16_t port,
74 OCConnectivityType connType,
75 char* buffer, size_t bufferSize, const char* uri);
80 #endif //_PM_UTILITY_H_