1 /*
2  * Copyright (C) 2017 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #include "virtual_touchscreen.h"
18 
19 namespace cuttlefish_input_service {
20 
GetEventTypes() const21 const std::vector<const uint32_t>& VirtualTouchScreen::GetEventTypes() const {
22   static const std::vector<const uint32_t> evt_types{EV_ABS, EV_KEY};
23   return evt_types;
24 }
GetKeys() const25 const std::vector<const uint32_t>& VirtualTouchScreen::GetKeys() const {
26   static const std::vector<const uint32_t> keys{BTN_TOUCH};
27   return keys;
28 }
GetProperties() const29 const std::vector<const uint32_t>& VirtualTouchScreen::GetProperties() const {
30   static const std::vector<const uint32_t> properties{INPUT_PROP_DIRECT};
31   return properties;
32 }
GetAbs() const33 const std::vector<const uint32_t>& VirtualTouchScreen::GetAbs() const {
34   static const std::vector<const uint32_t> abs{ABS_X, ABS_Y};
35   return abs;
36 }
37 
VirtualTouchScreen(uint32_t width,uint32_t height)38 VirtualTouchScreen::VirtualTouchScreen(uint32_t width, uint32_t height)
39     : VirtualDeviceBase("VSoC touchscreen", 0x6006) {
40   dev_.absmin[ABS_X] = 0;
41   dev_.absmax[ABS_X] = width;
42   dev_.absmin[ABS_Y] = 0;
43   dev_.absmax[ABS_Y] = height;
44 }
45 
46 }  // namespace cuttlefish_input_service
47