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"
40 * Discover Local RD across the network.
42 * @param connectivityType Type of connectivity indicating the interface.
43 * @param cbBiasFactor Asynchronous callback function that is invoked by the stack when
44 * response is received. The callback is generated for each response
46 * @param qos Quality of service.
48 * @return ::OC_STACK_OK on success, some other value upon failure.
50 OCStackResult OCRDDiscover(OCConnectivityType connectivityType, OCCallbackData *cbBiasFactor,
51 OCQualityOfService qos);
54 * Publish RD resource to Resource Directory.
56 * @param host The address of the RD.
57 * @param connectivityType Type of connectivity indicating the interface.
58 * @param resourceHandles This is the resource handle which we need to register to RD.
59 * @param nHandles The counts of resource handle.
60 * @param cbData Asynchronous callback function that is invoked by the stack when
61 * response is received. The callback is generated for each response
63 * @param qos Quality of service.
65 * @return ::OC_STACK_OK on success, some other value upon failure.
67 OCStackResult OCRDPublish(const char *host, OCConnectivityType connectivityType,
68 OCResourceHandle *resourceHandles, uint8_t nHandles,
69 OCCallbackData *cbData, OCQualityOfService qos);
72 * Publish RD resource to Resource Directory with a specific id.
74 * @param host The address of the RD.
75 * @param id An unique identifier of publishing device.
76 * @param connectivityType Type of connectivity indicating the interface.
77 * @param resourceHandles This is the resource handle which we need to register to RD.
78 * @param nHandles The counts of resource handle.
79 * @param cbData Asynchronous callback function that is invoked by the stack when
80 * response is received. The callback is generated for each response
82 * @param qos Quality of service.
84 * @return ::OC_STACK_OK on success, some other value upon failure.
86 OCStackResult OCRDPublishWithDeviceId(const char *host, const unsigned char *id,
87 OCConnectivityType connectivityType,
88 OCResourceHandle *resourceHandles, uint8_t nHandles,
89 OCCallbackData *cbData, OCQualityOfService qos);
92 * Delete RD resource from Resource Directory.
94 * @param host The address of the RD.
95 * @param connectivityType Type of connectivity indicating the interface.
96 * @param resourceHandles This is the resource handle which we need to delete to RD.
97 * @param nHandles The counts of resource handle.
98 * @param cbData Asynchronous callback function that is invoked by the stack when
99 * response is received. The callback is generated for each response
101 * @param qos Quality of service.
103 * @return ::OC_STACK_OK on success, some other value upon failure.
105 OCStackResult OCRDDelete(const char *host, OCConnectivityType connectivityType,
106 OCResourceHandle *resourceHandles, uint8_t nHandles,
107 OCCallbackData *cbData, OCQualityOfService qos);
110 * Delete RD resource from Resource Directory.
112 * @param host The address of the RD.
113 * @param id An unique identifier of publishing device.
114 * @param connectivityType Type of connectivity indicating the interface.
115 * @param resourceHandles This is the resource handle which we need to delete to RD.
116 * @param nHandles The counts of resource handle.
117 * @param cbData Asynchronous callback function that is invoked by the stack when
118 * response is received. The callback is generated for each response
120 * @param qos Quality of service.
122 * @return ::OC_STACK_OK on success, some other value upon failure.
124 OCStackResult OCRDDeleteWithDeviceId(const char *host, const unsigned char *id,
125 OCConnectivityType connectivityType,
126 OCResourceHandle *resourceHandles, uint8_t nHandles,
127 OCCallbackData *cbData, OCQualityOfService qos);
133 #endif // __cplusplus
135 #endif //_RESOURCE_DIRECTORY_CLIENT_H_