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 THINGRESOURCESERVER_H_
22 #define THINGRESOURCESERVER_H_
26 #include "OCPlatform.h"
32 #define COAP_IP "0.0.0.0"
34 #define COAP_MODE OC::ModeType::Server
35 #define COAP_SRVTYPE OC::ServiceType::InProc
37 #define RESOURCE_TYPE_NAME_TEMP "oic.r.temperature"
38 #define RESOURCE_TYPE_NAME_HUMID "oic.r.humidity"
40 // Forward declaring the entityHandler
42 class TemphumidResource
45 /// Access this property from a TB client
48 std::string m_resourceUri;
49 std::vector<std::string> m_resourceTypes;
50 std::vector<std::string> m_resourceInterfaces;
51 OCResourceHandle m_resourceHandle;
52 OC::OCRepresentation m_resourceRep;
53 OC::ObservationIds m_interestedObservers;
57 m_humid(0), m_temp(0), m_resourceHandle(0)
59 m_resourceUri = "/Thing_TempHumSensor";
60 m_resourceTypes.push_back(RESOURCE_TYPE_NAME_TEMP);
61 m_resourceTypes.push_back(RESOURCE_TYPE_NAME_HUMID);
62 m_resourceInterfaces.push_back(OC::DEFAULT_INTERFACE);
64 printf("Running thing as %s\n", m_resourceUri.c_str());
65 m_resourceRep.setUri(m_resourceUri);
72 void registerResource();
74 OCResourceHandle getHandle();
76 void setResourceRepresentation(OC::OCRepresentation &rep);
78 OC::OCRepresentation getResourceRepresentation();
81 #endif /* THINGRESOURCESERVER_H_ */