Imported Upstream version 1.0.0
[platform/upstream/iotivity.git] / service / simulator / src / service-provider / simulator_resource_server.cpp
1 /******************************************************************
2  *
3  * Copyright 2015 Samsung Electronics All Rights Reserved.
4  *
5  *
6  *
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  *
19  ******************************************************************/
20
21 #include "simulator_resource_server.h"
22
23 SimulatorResourceServer::SimulatorResourceServer()
24 {
25 }
26
27 std::string SimulatorResourceServer::getURI() const
28 {
29     return m_uri;
30 }
31
32 std::string SimulatorResourceServer::getResourceType() const
33 {
34     return m_resourceType;
35 }
36
37 std::string SimulatorResourceServer::getInterfaceType() const
38 {
39     return m_interfaceType;
40 }
41
42 std::string SimulatorResourceServer::getName() const
43 {
44     return m_name;
45 }
46
47 void SimulatorResourceServer::addAttribute(SimulatorResourceModel::Attribute &attribute)
48 {
49     m_resModel.addAttribute(attribute);
50 }
51
52 void SimulatorResourceServer::setRange(const std::string &attrName, const int min, const int max)
53 {
54     m_resModel.setRange(attrName, min, max);
55 }
56
57 SimulatorResourceModel SimulatorResourceServer::getModel() const
58 {
59     return m_resModel;
60 }
61
62 void SimulatorResourceServer::updateFromAllowedValues(const std::string &attrName,
63         unsigned int index)
64 {
65     m_resModel.updateAttributeFromAllowedValues(attrName, index);
66
67     // Notify all the subscribers
68     notifyAll();
69 }
70
71 void SimulatorResourceServer::removeAttribute(const std::string &attrName)
72 {
73     m_resModel.removeAttribute(attrName);
74 }
75