Add more provisioning status and error code in provisioning resource
[platform/upstream/iotivity.git] / resource / csdk / resource-directory / include / rd_client.h
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics 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 _RESOURCE_DIRECTORY_CLIENT_H_
22 #define _RESOURCE_DIRECTORY_CLIENT_H_
23
24 // Iotivity Base CAPI
25 #include "ocstack.h"
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif // __cplusplus
30
31 #define OIC_RD_PUBLISH_TTL 86400
32
33 #define OIC_RD_DEFAULT_RESOURCE 2
34
35 #define DEFAULT_MESSAGE_TYPE "application/json"
36
37 /**
38  * Discover Local RD across the network.
39  *
40  * @param connectivityType Type of connectivity indicating the interface.
41  * @param cbBiasFactor Asynchronous callback function that is invoked by the stack when
42  *                     response is received. The callback is generated for each response
43  *                     received.
44  * @param qos Quality of service.
45  *
46  * @return ::OC_STACK_OK on success, some other value upon failure.
47  */
48 OCStackResult OCRDDiscover(OCConnectivityType connectivityType, OCCallbackData *cbBiasFactor,
49                            OCQualityOfService qos);
50
51 /**
52  * Publish RD resource to Resource Directory.
53  *
54  * @param host The address of the RD.
55  * @param connectivityType Type of connectivity indicating the interface.
56  * @param resourceHandles This is the resource handle which we need to register to RD.
57  * @param nHandles The counts of resource handle.
58  * @param cbData Asynchronous callback function that is invoked by the stack when
59  *               response is received. The callback is generated for each response
60  *               received.
61  * @param qos Quality of service.
62  *
63  * @return ::OC_STACK_OK on success, some other value upon failure.
64  */
65 OCStackResult OCRDPublish(const char *host, OCConnectivityType connectivityType,
66                           OCResourceHandle *resourceHandles, uint8_t nHandles,
67                           OCCallbackData *cbData, OCQualityOfService qos);
68
69 /**
70  * Publish RD resource to Resource Directory with a specific id.
71  *
72  * @param host The address of the RD.
73  * @param id An unique identifier of publishing device.
74  * @param connectivityType Type of connectivity indicating the interface.
75  * @param resourceHandles This is the resource handle which we need to register to RD.
76  * @param nHandles The counts of resource handle.
77  * @param cbData Asynchronous callback function that is invoked by the stack when
78  *               response is received. The callback is generated for each response
79  *               received.
80  * @param qos Quality of service.
81  *
82  * @return ::OC_STACK_OK on success, some other value upon failure.
83  */
84 OCStackResult OCRDPublishWithDeviceId(const char *host, const unsigned char *id,
85                                       OCConnectivityType connectivityType,
86                                       OCResourceHandle *resourceHandles, uint8_t nHandles,
87                                       OCCallbackData *cbData, OCQualityOfService qos);
88
89 /**
90  * Delete RD resource from Resource Directory.
91  *
92  * @param host The address of the RD.
93  * @param connectivityType Type of connectivity indicating the interface.
94  * @param resourceHandles This is the resource handle which we need to delete to RD.
95  * @param nHandles The counts of resource handle.
96  * @param cbData Asynchronous callback function that is invoked by the stack when
97  *               response is received. The callback is generated for each response
98  *               received.
99  * @param qos Quality of service.
100  *
101  * @return ::OC_STACK_OK on success, some other value upon failure.
102  */
103 OCStackResult OCRDDelete(const char *host, OCConnectivityType connectivityType,
104                          OCResourceHandle *resourceHandles, uint8_t nHandles,
105                          OCCallbackData *cbData, OCQualityOfService qos);
106
107 /**
108  * Delete RD resource from Resource Directory.
109  *
110  * @param host The address of the RD.
111  * @param id An unique identifier of publishing device.
112  * @param connectivityType Type of connectivity indicating the interface.
113  * @param resourceHandles This is the resource handle which we need to delete to RD.
114  * @param nHandles The counts of resource handle.
115  * @param cbData Asynchronous callback function that is invoked by the stack when
116  *               response is received. The callback is generated for each response
117  *               received.
118  * @param qos Quality of service.
119  *
120  * @return ::OC_STACK_OK on success, some other value upon failure.
121  */
122 OCStackResult OCRDDeleteWithDeviceId(const char *host, const unsigned char *id,
123                                      OCConnectivityType connectivityType,
124                                      OCResourceHandle *resourceHandles, uint8_t nHandles,
125                                      OCCallbackData *cbData, OCQualityOfService qos);
126
127 #ifdef __cplusplus
128 }
129 #endif // __cplusplus
130
131 #endif //_RESOURCE_DIRECTORY_CLIENT_H_