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"
41 class TemphumidResource
44 /// Access this property from a TB client
47 std::string m_resourceUri;
48 std::vector<std::string> m_resourceTypes;
49 std::vector<std::string> m_resourceInterfaces;
50 OCResourceHandle m_resourceHandle;
51 OC::OCRepresentation m_resourceRep;
52 OC::ObservationIds m_interestedObservers;
56 m_humid(0), m_temp(0), m_resourceHandle(0)
58 m_resourceUri = "/Thing_TempHumSensor1";
59 m_resourceTypes.push_back(RESOURCE_TYPE_NAME_TEMP);
60 m_resourceTypes.push_back(RESOURCE_TYPE_NAME_HUMID);
61 m_resourceInterfaces.push_back(OC::DEFAULT_INTERFACE);
63 printf("Running thing as %s\n", m_resourceUri.c_str());
64 m_resourceRep.setUri(m_resourceUri);
71 void registerResource();
73 OCResourceHandle getHandle();
75 void setResourceRepresentation(OC::OCRepresentation &rep);
77 OC::OCRepresentation getResourceRepresentation();
80 #endif /* THINGRESOURCESERVER_H_ */