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_
31 #define OIC_RD_PUBLISH_TTL 86400
33 #define OIC_RD_DEFAULT_RESOURCE 2
35 #define DEFAULT_MESSAGE_TYPE "application/json"
38 * Discover Local RD across the network.
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
44 * @param qos Quality of service.
46 * @return ::OC_STACK_OK on success, some other value upon failure.
48 OCStackResult OCRDDiscover(OCConnectivityType connectivityType, OCCallbackData *cbBiasFactor,
49 OCQualityOfService qos);
52 * Publish RD resource to Resource Directory.
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
61 * @param qos Quality of service.
63 * @return ::OC_STACK_OK on success, some other value upon failure.
65 OCStackResult OCRDPublish(const char *host, OCConnectivityType connectivityType,
66 OCResourceHandle *resourceHandles, uint8_t nHandles,
67 OCCallbackData *cbData, OCQualityOfService qos);
70 * Publish RD resource to Resource Directory with a specific id.
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
80 * @param qos Quality of service.
82 * @return ::OC_STACK_OK on success, some other value upon failure.
84 OCStackResult OCRDPublishWithDeviceId(const char *host, const unsigned char *id,
85 OCConnectivityType connectivityType,
86 OCResourceHandle *resourceHandles, uint8_t nHandles,
87 OCCallbackData *cbData, OCQualityOfService qos);
90 * Delete RD resource from Resource Directory.
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
99 * @param qos Quality of service.
101 * @return ::OC_STACK_OK on success, some other value upon failure.
103 OCStackResult OCRDDelete(const char *host, OCConnectivityType connectivityType,
104 OCResourceHandle *resourceHandles, uint8_t nHandles,
105 OCCallbackData *cbData, OCQualityOfService qos);
108 * Delete RD resource from Resource Directory.
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
118 * @param qos Quality of service.
120 * @return ::OC_STACK_OK on success, some other value upon failure.
122 OCStackResult OCRDDeleteWithDeviceId(const char *host, const unsigned char *id,
123 OCConnectivityType connectivityType,
124 OCResourceHandle *resourceHandles, uint8_t nHandles,
125 OCCallbackData *cbData, OCQualityOfService qos);
129 #endif // __cplusplus
131 #endif //_RESOURCE_DIRECTORY_CLIENT_H_