1 /*
2 * Copyright (c) 2021-2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16 #include "input_device.h"
17
18 namespace OHOS {
19 namespace MMI {
InputDevice(int32_t id,std::string name,int32_t deviceType,int32_t bus,int32_t version,int32_t product,int32_t vendor,std::string phys,std::string uniq,std::vector<AxisInfo> axis)20 InputDevice::InputDevice(int32_t id, std::string name, int32_t deviceType, int32_t bus, int32_t version,
21 int32_t product, int32_t vendor, std::string phys, std::string uniq, std::vector<AxisInfo> axis)
22 : id_(id), name_(name), type_(deviceType), bus_(bus), version_(version), product_(product),
23 vendor_(vendor), phys_(phys), uniq_(uniq), axis_(axis) {}
24
SetId(int32_t deviceId)25 void InputDevice::SetId(int32_t deviceId)
26 {
27 id_ = deviceId;
28 }
29
GetId() const30 int32_t InputDevice::GetId() const
31 {
32 return id_;
33 }
34
SetName(std::string name)35 void InputDevice::SetName(std::string name)
36 {
37 name_ = name;
38 }
39
GetName() const40 std::string InputDevice::GetName() const
41 {
42 return name_;
43 }
44
SetType(int32_t deviceType)45 void InputDevice::SetType(int32_t deviceType)
46 {
47 type_ = deviceType;
48 }
49
GetType() const50 int32_t InputDevice::GetType() const
51 {
52 return type_;
53 }
54
SetBus(int32_t bus)55 void InputDevice::SetBus(int32_t bus)
56 {
57 bus_ = bus;
58 }
59
GetBus() const60 int32_t InputDevice::GetBus() const
61 {
62 return bus_;
63 }
64
SetVersion(int32_t version)65 void InputDevice::SetVersion(int32_t version)
66 {
67 version_ = version;
68 }
69
GetVersion() const70 int32_t InputDevice::GetVersion() const
71 {
72 return version_;
73 }
74
SetProduct(int32_t product)75 void InputDevice::SetProduct(int32_t product)
76 {
77 product_ = product;
78 }
79
GetProduct() const80 int32_t InputDevice::GetProduct() const
81 {
82 return product_;
83 }
84
SetVendor(int32_t vendor)85 void InputDevice::SetVendor(int32_t vendor)
86 {
87 vendor_ = vendor;
88 }
89
GetVendor() const90 int32_t InputDevice::GetVendor() const
91 {
92 return vendor_;
93 }
94
SetPhys(std::string phys)95 void InputDevice::SetPhys(std::string phys)
96 {
97 phys_ = phys;
98 }
99
GetPhys() const100 std::string InputDevice::GetPhys() const
101 {
102 return phys_;
103 }
104
SetUniq(std::string uniq)105 void InputDevice::SetUniq(std::string uniq)
106 {
107 uniq_ = uniq;
108 }
109
GetUniq() const110 std::string InputDevice::GetUniq() const
111 {
112 return uniq_;
113 }
114
AddAxisInfo(AxisInfo axis)115 void InputDevice::AddAxisInfo(AxisInfo axis)
116 {
117 axis_.push_back(axis);
118 }
119
GetAxisInfo()120 std::vector<InputDevice::AxisInfo> InputDevice::GetAxisInfo()
121 {
122 return axis_;
123 }
124
AxisInfo(int32_t type,int32_t min,int32_t max,int32_t fuzz,int32_t flat,int32_t resolution)125 InputDevice::AxisInfo::AxisInfo(int32_t type, int32_t min, int32_t max, int32_t fuzz, int32_t flat, int32_t resolution)
126 : axisType_(type), minimum_(min), maximum_(max), fuzz_(fuzz), flat_(flat), resolution_(resolution) {}
127
SetAxisType(int32_t type)128 void InputDevice::AxisInfo::SetAxisType(int32_t type)
129 {
130 axisType_ = type;
131 }
132
GetAxisType() const133 int32_t InputDevice::AxisInfo::GetAxisType() const
134 {
135 return axisType_;
136 }
137
SetMinimum(int32_t min)138 void InputDevice::AxisInfo::SetMinimum(int32_t min)
139 {
140 minimum_ = min;
141 }
142
GetMinimum() const143 int32_t InputDevice::AxisInfo::GetMinimum() const
144 {
145 return minimum_;
146 }
147
SetMaximum(int32_t max)148 void InputDevice::AxisInfo::SetMaximum(int32_t max)
149 {
150 maximum_ = max;
151 }
152
GetMaximum() const153 int32_t InputDevice::AxisInfo::GetMaximum() const
154 {
155 return maximum_;
156 }
157
SetFuzz(int32_t fuzz)158 void InputDevice::AxisInfo::SetFuzz(int32_t fuzz)
159 {
160 fuzz_ = fuzz;
161 }
162
GetFuzz() const163 int32_t InputDevice::AxisInfo::GetFuzz() const
164 {
165 return fuzz_;
166 }
167
SetFlat(int32_t flat)168 void InputDevice::AxisInfo::SetFlat(int32_t flat)
169 {
170 flat_ = flat;
171 }
172
GetFlat() const173 int32_t InputDevice::AxisInfo::GetFlat() const
174 {
175 return flat_;
176 }
177
SetResolution(int32_t resolution)178 void InputDevice::AxisInfo::SetResolution(int32_t resolution)
179 {
180 resolution_ = resolution;
181 }
182
GetResolution() const183 int32_t InputDevice::AxisInfo::GetResolution() const
184 {
185 return resolution_;
186 }
187 } // namespace MMI
188 } // namespace OHOS