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 PROTOCOLBRIDGERESOURCE_H_
22 #define PROTOCOLBRIDGERESOURCE_H_
24 #include "BundleResource.h"
34 * @class ProtocolBridgeResource
35 * @brief This class represents bundle resource template for Protocol Bridge
36 * to be registered in the container and make resource server
39 class ProtocolBridgeResource: public BundleResource
44 * Constructor for ProtocolBridgeResource
46 ProtocolBridgeResource()
52 * Virtual destructor for ProtocolBridgeResource
54 virtual ~ProtocolBridgeResource()
60 * Initialize attributes of the resource
64 virtual void initAttributes() = 0;
67 * This function should be implemented by the according bundle resource
68 * and execute the according business logic (e.g., light switch or sensor resource)
69 * to retrieve a sensor value. If a new sensor value is retrieved, the
70 * setAttribute data should be called to update the value.
71 * The implementor of the function can decide weather to notify OIC clients
72 * about the changed state or not.
74 * @param queryParams Request parameters
76 * @return Value of all attributes
78 virtual RCSResourceAttributes handleGetAttributesRequest(const
79 std::map< std::string, std::string > &queryParams) = 0;
82 * This function should be implemented by the according bundle resource
83 * and execute the according business logic (e.g., light switch or sensor resource)
84 * and write either on soft sensor values or external bridged devices.
86 * The call of this method could for example trigger a HTTP PUT request on
87 * an external APIs. This method is responsible to update the resource internal
88 * data and call the setAttribute method.
90 * The implementor of the function can decide weather to notify OIC clients
91 * about the changed state or not.
93 * @param attrs Attributes to set
94 * @param queryParams Request parameters
98 virtual void handleSetAttributesRequest(const RCSResourceAttributes &attrs,
99 const std::map< std::string, std::string > &queryParams) = 0;