1 //******************************************************************
3 // Copyright 2014 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 VIRTUALREPRESENTATION_H_
22 #define VIRTUALREPRESENTATION_H_
24 #include "NotificationManager.h"
26 #define SUCCESS_RESPONSE 0
29 using namespace OCPlatform;
32 class ResourceManager;
34 class VirtualRepresentation
38 std::string m_virtualUri;
39 std::string m_originHostIP;
40 std::string m_resourceTypeName;
41 std::string m_resourceInterface;
42 uint8_t m_resourceProperty;
44 OCResourceHandle m_resourceHandle;
46 static AttributeMap s_attributeMap;
47 static std::mutex s_mutexAttributeMap;
48 static std::condition_variable s_conditionAttributeMap;
49 static bool m_isReadyAttributeMap;
51 int getRepresentation(OCRepresentation& oc);
56 std::string getHostIP();
57 std::string getResourceTypeName();
58 std::string getResourceInterface();
59 uint8_t getResourceProperty();
60 OCResourceHandle getResourceHandle();
62 int setUri(std::string uri);
63 int setHostIP(std::string ip);
64 int setResourceTypeName(std::string typeName);
65 int setResourceInterface(std::string interface);
66 int setResourceProperty(uint8_t property);
67 int setResourceHandle(OCResourceHandle & handle);
70 VirtualRepresentation();
71 virtual ~VirtualRepresentation();
73 std::string addVirtualTag(std::string uri);
75 OCEntityHandlerResult entityHandler(const std::shared_ptr<OCResourceRequest> request ,
76 const std::shared_ptr<OCResourceResponse> response);
77 void onObserve(const HeaderOptions &headerOption, const OCRepresentation &rep ,
78 const int eCode , const int sequenceNumber);
82 #endif /* VIRTUALREPRESENTATION_H_ */