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_
25 #include <condition_variable>
27 #include "OCPlatform.h"
29 #include "NotificationManager.h"
31 #define SUCCESS_RESPONSE 0
34 using namespace OCPlatform;
37 class ResourceManager;
39 class VirtualRepresentation
43 std::string m_virtualUri;
44 std::string m_originHostIP;
45 std::string m_resourceTypeName;
46 std::string m_resourceInterface;
47 uint8_t m_resourceProperty;
49 OCResourceHandle m_resourceHandle;
51 static AttributeMap s_attributeMap;
52 static std::mutex s_mutexAttributeMap;
53 static std::condition_variable s_conditionAttributeMap;
54 static bool m_isReadyAttributeMap;
56 int getRepresentation(OCRepresentation& oc);
61 std::string getHostIP();
62 std::string getResourceTypeName();
63 std::string getResourceInterface();
64 uint8_t getResourceProperty();
65 OCResourceHandle getResourceHandle();
67 int setUri(std::string uri);
68 int setHostIP(std::string ip);
69 int setResourceTypeName(std::string typeName);
70 int setResourceInterface(std::string interface);
71 int setResourceProperty(uint8_t property);
72 int setResourceHandle(OCResourceHandle & handle);
75 VirtualRepresentation();
76 virtual ~VirtualRepresentation();
78 std::string addVirtualTag(std::string uri);
80 OCEntityHandlerResult entityHandler(const std::shared_ptr<OCResourceRequest> request ,
81 const std::shared_ptr<OCResourceResponse> response);
82 void onObserve(const HeaderOptions &headerOption, const OCRepresentation &rep ,
83 const int eCode , const int sequenceNumber);
87 #endif /* VIRTUALREPRESENTATION_H_ */