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();
49 * Virtual destructor for ProtocolBridgeResource
51 virtual ~ProtocolBridgeResource();
54 * Initialize attributes of the resource
58 virtual void initAttributes() = 0;
61 * This function should be implemented by the according bundle resource
62 * and execute the according business logic (e.g., light switch or sensor resource)
63 * to retrieve a sensor value. If a new sensor value is retrieved, the
64 * setAttribute data should be called to update the value.
65 * The implementor of the function can decide weather to notify OIC clients
66 * about the changed state or not.
68 * @param key Name of attribute to get
71 * @return Value of all attributes
73 virtual RCSResourceAttributes &handleGetAttributesRequest() = 0;
76 * This function should be implemented by the according bundle resource
77 * and execute the according business logic (e.g., light switch or sensor resource)
78 * and write either on soft sensor values or external bridged devices.
80 * The call of this method could for example trigger a HTTP PUT request on
81 * an external APIs. This method is responsible to update the resource internal
82 * data and call the setAttribute method.
84 * The implementor of the function can decide weather to notify OIC clients
85 * about the changed state or not.
87 * @param key Name of attribute to set
89 * @param attrs Attributes to set
93 virtual void handleSetAttributesRequest(RCSResourceAttributes &attrs) = 0;