1 //******************************************************************
3 // Copyright 2015 Samsung Electronics 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 _RESOURCE_DIRECTORY_CLIENT_H_
22 #define _RESOURCE_DIRECTORY_CLIENT_H_
33 #define OIC_RD_PUBLISH_TTL 86400
35 #define OIC_RD_DEFAULT_RESOURCE 2
37 #define DEFAULT_MESSAGE_TYPE "application/json"
39 /** Platform Model Number.*/
40 #define OC_DATA_MODEL_NUMBER "x.model"
43 * Discover Local RD across the network.
45 * @param handle To refer to the request sent out on behalf of
46 * calling this API. This handle can be used to cancel this operation
47 * via the OCCancel API.
48 * @note: This reference is handled internally, and should not be free'd by
49 * the consumer. A NULL handle is permitted in the event where the caller
50 * has no use for the return value.
51 * @param connectivityType Type of connectivity indicating the interface.
52 * @param cbBiasFactor Asynchronous callback function that is invoked by the stack when
53 * response is received. The callback is generated for each response
55 * @param qos Quality of service.
57 * @return ::OC_STACK_OK on success, some other value upon failure.
59 OCStackResult OCRDDiscover(OCDoHandle *handle, OCConnectivityType connectivityType,
60 OCCallbackData *cbBiasFactor, OCQualityOfService qos);
63 * Publish RD resource to Resource Directory.
65 * @param handle To refer to the request sent out on behalf of
66 * calling this API. This handle can be used to cancel this operation
67 * via the OCCancel API.
68 * @note: This reference is handled internally, and should not be free'd by
69 * the consumer. A NULL handle is permitted in the event where the caller
70 * has no use for the return value.
71 * @param host The address of the RD.
72 * @param connectivityType Type of connectivity indicating the interface.
73 * @param resourceHandles This is the resource handle which we need to register to RD.
74 * @param nHandles The counts of resource handle.
75 * @param cbData Asynchronous callback function that is invoked by the stack when
76 * response is received. The callback is generated for each response
78 * @param qos Quality of service.
80 * @return ::OC_STACK_OK on success, some other value upon failure.
82 OCStackResult OCRDPublish(OCDoHandle *handle, const char *host,
83 OCConnectivityType connectivityType,
84 OCResourceHandle *resourceHandles, uint8_t nHandles,
85 OCCallbackData *cbData, OCQualityOfService qos);
88 * Publish RD resource to Resource Directory with a specific id.
90 * @param handle To refer to the request sent out on behalf of
91 * calling this API. This handle can be used to cancel this operation
92 * via the OCCancel API.
93 * @note: This reference is handled internally, and should not be free'd by
94 * the consumer. A NULL handle is permitted in the event where the caller
95 * has no use for the return value.
96 * @param host The address of the RD.
97 * @param id An unique identifier of publishing device.
98 * @param connectivityType Type of connectivity indicating the interface.
99 * @param resourceHandles This is the resource handle which we need to register to RD.
100 * @param nHandles The counts of resource handle.
101 * @param cbData Asynchronous callback function that is invoked by the stack when
102 * response is received. The callback is generated for each response
104 * @param qos Quality of service.
106 * @return ::OC_STACK_OK on success, some other value upon failure.
108 OCStackResult OCRDPublishWithDeviceId(OCDoHandle *handle, const char *host,
109 const unsigned char *id,
110 OCConnectivityType connectivityType,
111 OCResourceHandle *resourceHandles, uint8_t nHandles,
112 OCCallbackData *cbData, OCQualityOfService qos);
115 * Delete RD resource from Resource Directory.
117 * @param handle To refer to the request sent out on behalf of
118 * calling this API. This handle can be used to cancel this operation
119 * via the OCCancel API.
120 * @note: This reference is handled internally, and should not be free'd by
121 * the consumer. A NULL handle is permitted in the event where the caller
122 * has no use for the return value.
123 * @param host The address of the RD.
124 * @param connectivityType Type of connectivity indicating the interface.
125 * @param resourceHandles This is the resource handle which we need to delete to RD.
126 * @param nHandles The counts of resource handle.
127 * @param cbData Asynchronous callback function that is invoked by the stack when
128 * response is received. The callback is generated for each response
130 * @param qos Quality of service.
132 * @return ::OC_STACK_OK on success, some other value upon failure.
134 OCStackResult OCRDDelete(OCDoHandle *handle, const char *host,
135 OCConnectivityType connectivityType,
136 OCResourceHandle *resourceHandles, uint8_t nHandles,
137 OCCallbackData *cbData, OCQualityOfService qos);
140 * Delete RD resource from Resource Directory.
142 * @param handle To refer to the request sent out on behalf of
143 * calling this API. This handle can be used to cancel this operation
144 * via the OCCancel API.
145 * @note: This reference is handled internally, and should not be free'd by
146 * the consumer. A NULL handle is permitted in the event where the caller
147 * has no use for the return value.
148 * @param host The address of the RD.
149 * @param id An unique identifier of publishing device.
150 * @param connectivityType Type of connectivity indicating the interface.
151 * @param resourceHandles This is the resource handle which we need to delete to RD.
152 * @param nHandles The counts of resource handle.
153 * @param cbData Asynchronous callback function that is invoked by the stack when
154 * response is received. The callback is generated for each response
156 * @param qos Quality of service.
158 * @return ::OC_STACK_OK on success, some other value upon failure.
160 OCStackResult OCRDDeleteWithDeviceId(OCDoHandle *handle, const char *host,
161 const unsigned char *id,
162 OCConnectivityType connectivityType,
163 OCResourceHandle *resourceHandles, uint8_t nHandles,
164 OCCallbackData *cbData, OCQualityOfService qos);
170 #endif // __cplusplus
172 #endif //_RESOURCE_DIRECTORY_CLIENT_H_