1 //******************************************************************
3 // Copyright 2014 Intel Corporation.
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 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
29 #include "OCPlatform.h"
37 shared_ptr<PlatformConfig> m_platformConfig;
38 OCRepresentation m_temperatureRepresentation;
39 OCResourceHandle m_temperatureResource;
40 OCRepresentation m_ambientLightRepresentation;
41 OCResourceHandle m_ambientLightResource;
42 OCRepresentation m_ledRepresentation;
43 OCResourceHandle m_ledResource;
44 ObservationIds m_ambientLightObservers;
45 ObservationIds m_temperatureObservers;
46 shared_ptr<IoTObserver> m_ambientLightObserverLoop;
47 shared_ptr<IoTObserver> m_temperatureObserverLoop;
49 void initializePlatform();
50 void setupResources();
51 void createResource(string, string, EntityHandler, OCResourceHandle&);
53 OCRepresentation getTemperatureRepresentation();
54 OCRepresentation getLightRepresentation();
55 OCRepresentation getLEDRepresentation();
56 void putLEDRepresentation();
58 //Polling threads to periodically query sensor values and notify
60 void temperatureObserverLoop();
61 void lightObserverLoop();
63 OCEntityHandlerResult temperatureEntityHandler(shared_ptr<OCResourceRequest>);
64 OCEntityHandlerResult lightEntityHandler(shared_ptr<OCResourceRequest>);
65 OCEntityHandlerResult LEDEntityHandler(shared_ptr<OCResourceRequest>);
71 #endif /* SERVER_H_ */