iotivity 0.9.0
[platform/upstream/iotivity.git] / service / notification-manager / NotificationManager / include / VirtualRepresentation.h
1 //******************************************************************
2 //
3 // Copyright 2014 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
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
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
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.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 #ifndef VIRTUALREPRESENTATION_H_
22 #define VIRTUALREPRESENTATION_H_
23
24 #include "NotificationManager.h"
25
26 #define SUCCESS_RESPONSE 0
27
28 using namespace OC;
29 using namespace OCPlatform;
30 using namespace std;
31
32 class ResourceManager;
33
34 class VirtualRepresentation
35 {
36
37 private:
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;
43
44     OCResourceHandle m_resourceHandle;
45
46     static AttributeMap s_attributeMap;
47     static std::mutex s_mutexAttributeMap;
48     static std::condition_variable s_conditionAttributeMap;
49     static bool m_isReadyAttributeMap;
50
51     int getRepresentation(OCRepresentation& oc);
52
53 public:
54
55     std::string getUri();
56     std::string getHostIP();
57     std::string getResourceTypeName();
58     std::string getResourceInterface();
59     uint8_t getResourceProperty();
60     OCResourceHandle getResourceHandle();
61
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);
68
69 public:
70     VirtualRepresentation();
71     virtual ~VirtualRepresentation();
72
73     std::string addVirtualTag(std::string uri);
74
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);
79
80 };
81
82 #endif /* VIRTUALREPRESENTATION_H_ */