X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=resource%2Finclude%2FOCPlatform.h;h=84e7163c9125bfeef30bf6d4c0c803989843c14a;hb=refs%2Ftags%2Fsubmit%2Ftizen_4.0%2F20171010.021147;hp=74251a600e7fa69ed23829048f8fff92f40db8df;hpb=9c343f426f611ebdd6b60c4bfb4375b1d6e05219;p=platform%2Fupstream%2Fiotivity.git diff --git a/resource/include/OCPlatform.h b/resource/include/OCPlatform.h index 74251a6..84e7163 100644 --- a/resource/include/OCPlatform.h +++ b/resource/include/OCPlatform.h @@ -44,12 +44,27 @@ namespace OC * @note Any calls made to this AFTER the first call to OCPlatform::Instance * will have no affect */ - void Configure(const PlatformConfig& config); + OCStackResult Configure(const PlatformConfig& config); // typedef for handle to cancel presence info with typedef OCDoHandle OCPresenceHandle; /** + * API for stop Base layer including resource and connectivity abstraction. + * + * @return Returns ::OC_STACK_OK if success. + */ + OCStackResult stop(); + + /** + * API for start Base layer including resource and connectivity abstraction. + * OCInit will be invoked. + * + * @return Returns ::OC_STACK_OK if success. + */ + OCStackResult start(); + + /** * API for notifying base that resource's attributes have changed. * * @param resourceHandle resource handle of the resource @@ -173,6 +188,18 @@ namespace OC OCConnectivityType connectivityType, FindCallback resourceHandler, FindErrorCallback errorHandler, QualityOfService QoS); + OCStackResult findResourceList(const std::string& host, const std::string& resourceURI, + OCConnectivityType connectivityType, FindResListCallback resourceHandler, + QualityOfService QoS = QualityOfService::LowQos); + + OCStackResult findResourceList(const std::string& host, const std::string& resourceURI, + OCConnectivityType connectivityType, FindResListCallback resourceHandler, + FindErrorCallback errorHandler, QualityOfService QoS = QualityOfService::LowQos); + + OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::string& value); + OCStackResult setPropertyValue(OCPayloadType type, const std::string& tag, const std::vector& value); + OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::string& value); + OCStackResult getPropertyValue(OCPayloadType type, const std::string& tag, std::vector& value); /** * API for Device Discovery * @@ -266,6 +293,13 @@ namespace OC * first parameter can take fully qualified URI and core will take that as is for further * operations * @note OCStackResult is defined in ocstack.h. + * @note entity handler callback : + * When you set specific return value like OC_EH_CHANGED, OC_EH_CONTENT, + * OC_EH_SLOW and etc in entity handler callback, + * ocstack will be not send response automatically to client + * except for error return value like OC_EH_ERROR + * If you want to send response to client with specific result, + * OCDoResponse API should be called with the result value. */ OCStackResult registerResource(OCResourceHandle& resourceHandle, std::string& resourceURI, @@ -310,6 +344,13 @@ namespace OC * any undefined resources or default actions. * if NULL is passed it removes the device default entity handler. * @return Returns ::OC_STACK_OK if no errors and ::OC_STACK_ERROR in case of stack process error + * @note entity handler callback : + * When you set specific return value like OC_EH_CHANGED, OC_EH_CONTENT, + * OC_EH_SLOW and etc in entity handler callback, + * ocstack will be not send response automatically to client + * except for error return value like OC_EH_ERROR + * If you want to send response to client with specific result, + * sendResponse API should be called with the result value. */ OCStackResult setDefaultDeviceEntityHandler(EntityHandler entityHandler); @@ -663,132 +704,45 @@ namespace OC OCAccountManager::Ptr constructAccountManagerObject(const std::string& host, OCConnectivityType connectivityType); #endif // WITH_CLOUD -#ifdef RD_CLIENT - /** - * API for Virtual Resource("/oic/d" and "/oic/p") Publish to Resource Directory. - * @note This API applies to resource server side only. - * - * @param host Host IP Address of a service to direct resource publish query. - * @param connectivityType ::OCConnectivityType type of connectivity. - * @param callback Handles callbacks, success states and failure states. - * - * @return Returns ::OC_STACK_OK if success. - */ - OCStackResult publishResourceToRD(const std::string& host, - OCConnectivityType connectivityType, - PublishResourceCallback callback); +#ifdef TCP_ADAPTER /** - * @overload - * - * @param host Host IP Address of a service to direct resource publish query. - * @param connectivityType ::OCConnectivityType type of connectivity. - * @param callback Handles callbacks, success states and failure states. - * @param QoS the quality of communication. + * gets OCRepresentation of KeepAlive resource from given host. * + * @param host Host IP Address of KeepAlive resource + * @param resultCallback Function to callback with result code and OCRepresentation. * @return Returns ::OC_STACK_OK if success. */ - OCStackResult publishResourceToRD(const std::string& host, - OCConnectivityType connectivityType, - PublishResourceCallback callback, - QualityOfService QoS); + OCStackResult findKeepAliveResource(std::string host, KeepAliveCallback resultCallback); /** - * API for Resource Publish to Resource Directory. - * @note This API applies to resource server side only. - * - * @param host Host IP Address of a service to direct resource publish query. - * @param connectivityType ::OCConnectivityType type of connectivity. - * @param resourceHandle resource handle of the resource. - * @param callback Handles callbacks, success states and failure states. - * - * @return Returns ::OC_STACK_OK if success. - */ - OCStackResult publishResourceToRD(const std::string& host, - OCConnectivityType connectivityType, - ResourceHandles& resourceHandles, - PublishResourceCallback callback); - - /** - * @overload - * - * @param host Host IP Address of a service to direct resource publish query. - * @param connectivityType ::OCConnectivityType type of connectivity. - * @param resourceHandle resource handle of the resource. - * @param callback function to callback with published resources. - * @param QoS the quality of communication. - * @see publishResourceToRD(const std::string&, OCConnectivityType, OCResourceHandle, - * uint8_t, PublishResourceCallback) - */ - OCStackResult publishResourceToRD(const std::string& host, - OCConnectivityType connectivityType, - ResourceHandles& resourceHandles, - PublishResourceCallback callback, QualityOfService QoS); - + * send KeepAlive request to given host. + * + * @param rep include interval time of expected pong response + * @param resultCallback handles callback + * + * @return Returns ::OC_STACK_OK on success, some other value upon failure. + * + */ + OCStackResult sendKeepAliveRequest(std::string host, const OCRepresentation& rep, + KeepAliveCallback resultCallback); +#endif /** - * API for published resource delete from Resource Directory. - * @note This API applies to resource server side only. - * - * @param host Host IP Address of a service to direct resource delete query. - * @param connectivityType ::OCConnectivityType type of connectivity. - * @param callback Handles callbacks, success states and failure states. + * gets the deviceId of the client * + * @param deviceId pointer. * @return Returns ::OC_STACK_OK if success. */ - OCStackResult deleteResourceFromRD(const std::string& host, - OCConnectivityType connectivityType, - DeleteResourceCallback callback); + OCStackResult getDeviceId(OCUUIdentity *deviceId); /** - * @overload - * - * @param host Host IP Address of a service to direct resource delete query. - * @param connectivityType ::OCConnectivityType type of connectivity. - * @param callback Handles callbacks, success states and failure states. - * @param QoS the quality of communication. + * sets the deviceId of the client * + * @param deviceId pointer. * @return Returns ::OC_STACK_OK if success. */ - OCStackResult deleteResourceFromRD(const std::string& host, - OCConnectivityType connectivityType, - DeleteResourceCallback callback, - QualityOfService QoS); - - /** - * @overload - * - * @param host Host IP Address of a service to direct resource delete query. - * @param connectivityType ::OCConnectivityType type of connectivity. - * @param resourceHandle resource handle of the resource. - * @param callback function to callback with published resources. - * @see publishResourceToRD(const std::string&, OCConnectivityType, OCResourceHandle, - * uint8_t, PublishResourceCallback) - */ - OCStackResult deleteResourceFromRD(const std::string& host, - OCConnectivityType connectivityType, - ResourceHandles& resourceHandles, - DeleteResourceCallback callback); - - /** - * @overload - * - * @param host Host IP Address of a service to direct resource delete query. - * @param connectivityType ::OCConnectivityType type of connectivity. - * @param resourceHandle resource handle of the resource. - * @param callback function to callback with published resources. - * @param QoS the quality of communication. - * @see publishResourceToRD(const std::string&, OCConnectivityType, OCResourceHandle, - * uint8_t, PublishResourceCallback) - */ - OCStackResult deleteResourceFromRD(const std::string& host, - OCConnectivityType connectivityType, - ResourceHandles& resourceHandles, - DeleteResourceCallback callback, QualityOfService QoS); -#endif + OCStackResult setDeviceId(const OCUUIdentity *deviceId); } } #endif // OC_PLATFORM_H_ - - -