1 /******************************************************************
3 * Copyright 2015 Samsung Electronics All Rights Reserved.
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 SIMULATOR_RESOURCE_SERVER_IMPL_H_
22 #define SIMULATOR_RESOURCE_SERVER_IMPL_H_
24 #include "simulator_resource_server.h"
25 #include "resource_update_automation_mngr.h"
27 class SimulatorResourceServerImpl : public SimulatorResourceServer
30 SimulatorResourceServerImpl();
32 void setURI(const std::string &uri);
34 void setResourceType(const std::string &resourceType);
36 void setInterfaceType(const std::string &interfaceType);
38 void setName(const std::string &name);
40 void setObservable(bool state);
42 bool isObservable() const;
44 int startUpdateAutomation(AutomationType type, int updateInterval,
45 updateCompleteCallback callback);
47 int startUpdateAutomation(const std::string &attrName, AutomationType type,
48 int updateInterval, updateCompleteCallback callback);
50 std::vector<int> getResourceAutomationIds();
52 std::vector<int> getAttributeAutomationIds();
54 void stopUpdateAutomation(const int id);
56 void setModelChangeCallback(ResourceModelChangedCB callback);
58 void setObserverCallback(ObserverCB callback);
60 std::vector<ObserverInfo> getObserversList();
62 void notify(uint8_t id);
73 OC::OCRepresentation getOCRepresentation();
74 bool modifyResourceModel(OC::OCRepresentation &ocRep);
75 OCEntityHandlerResult entityHandler(std::shared_ptr<OC::OCResourceRequest> request);
76 void resourceModified();
78 ResourceModelChangedCB m_callback;
79 ObserverCB m_observeCallback;
80 UpdateAutomationMngr m_updateAutomationMgr;
81 std::vector<ObserverInfo> m_observersList;
83 OCResourceProperty m_property;
84 OCResourceHandle m_resourceHandle;
87 typedef std::shared_ptr<SimulatorResourceServerImpl> SimulatorResourceServerImplSP;