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 RESOURCE_UPDATE_AUTOMATION_H_
22 #define RESOURCE_UPDATE_AUTOMATION_H_
24 #include "simulator_resource_server.h"
27 class AttributeUpdateAutomation
30 AttributeUpdateAutomation(int id, SimulatorResourceServer *resource,
31 const std::string &attrName, AutomationType type, int interval,
32 updateCompleteCallback callback,
33 std::function<void (const int)> finishedCallback);
40 void updateAttribute();
41 void setAttributeValue();
43 SimulatorResourceServer *m_resource;
44 std::string m_attrName;
45 AutomationType m_type;
49 SimulatorResourceModel::Attribute m_attribute;
50 updateCompleteCallback m_callback;
51 std::function<void (const int)> m_finishedCallback;
52 std::thread *m_thread;
55 typedef std::shared_ptr<AttributeUpdateAutomation> AttributeUpdateAutomationSP;
57 class ResourceUpdateAutomation
60 ResourceUpdateAutomation(int id, SimulatorResourceServer *resource,
61 AutomationType type, int interval,
62 updateCompleteCallback callback,
63 std::function<void (const int)> finishedCallback);
70 void updateAttributes(std::vector<SimulatorResourceModel::Attribute> attributes);
72 SimulatorResourceServer *m_resource;
73 AutomationType m_type;
77 updateCompleteCallback m_callback;
78 std::function<void (const int)> m_finishedCallback;
79 std::thread *m_thread;
82 typedef std::shared_ptr<ResourceUpdateAutomation> ResourceUpdateAutomationSP;