1c29fa5a6Sopenharmony_ci/*
2c29fa5a6Sopenharmony_ci * Copyright (c) 2024 Huawei Device Co., Ltd.
3c29fa5a6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4c29fa5a6Sopenharmony_ci * you may not use this file except in compliance with the License.
5c29fa5a6Sopenharmony_ci * You may obtain a copy of the License at
6c29fa5a6Sopenharmony_ci *
7c29fa5a6Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0
8c29fa5a6Sopenharmony_ci *
9c29fa5a6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10c29fa5a6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11c29fa5a6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12c29fa5a6Sopenharmony_ci * See the License for the specific language governing permissions and
13c29fa5a6Sopenharmony_ci * limitations under the License.
14c29fa5a6Sopenharmony_ci */
15c29fa5a6Sopenharmony_ci
16c29fa5a6Sopenharmony_ci#include "virtual_uwb_remote_control.h"
17c29fa5a6Sopenharmony_ci
18c29fa5a6Sopenharmony_cinamespace OHOS {
19c29fa5a6Sopenharmony_cinamespace MMI {
20c29fa5a6Sopenharmony_cinamespace {
21c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MAX_X = 719;
22c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MAX_Y = 1279;
23c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_PRESSURE_MAX = 3000;
24c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MT_MOVEFLAG_MAX = 100;
25c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MT_SLOT_MAX = 10;
26c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MT_TOUCH_MAJOR_MAX = 1;
27c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MT_TOUCH_MINOR_MAX = 1;
28c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MT_ORIENTATION_MIN = -90;
29c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MT_ORIENTATION_MAX = 90;
30c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MT_BLOB_ID_MAX = 10;
31c29fa5a6Sopenharmony_ciconstexpr int32_t ABS_MT_TRACKING_ID_MAX = 9;
32c29fa5a6Sopenharmony_ci
33c29fa5a6Sopenharmony_ciAbsInfo absInfos[] = {
34c29fa5a6Sopenharmony_ci    { ABS_X, 0, ABS_MAX_X, 0, 0 },
35c29fa5a6Sopenharmony_ci    { ABS_Y, 0, ABS_MAX_Y, 0, 0 },
36c29fa5a6Sopenharmony_ci    { ABS_PRESSURE, 0, ABS_PRESSURE_MAX, 0, 0 },
37c29fa5a6Sopenharmony_ci    { ABS_MT_PRESSURE, 0, ABS_PRESSURE_MAX, 0, 0 },
38c29fa5a6Sopenharmony_ci    { ABS_MT_MOVEFLAG, 0, ABS_MT_MOVEFLAG_MAX, 0, 0 },
39c29fa5a6Sopenharmony_ci    { ABS_MT_SLOT, 0, ABS_MT_SLOT_MAX, 0, 0 },
40c29fa5a6Sopenharmony_ci    { ABS_MT_TOUCH_MAJOR, 0, ABS_MT_TOUCH_MAJOR_MAX, 0, 0 },
41c29fa5a6Sopenharmony_ci    { ABS_MT_TOUCH_MINOR, 0, ABS_MT_TOUCH_MINOR_MAX, 0, 0 },
42c29fa5a6Sopenharmony_ci    { ABS_MT_ORIENTATION, ABS_MT_ORIENTATION_MIN, ABS_MT_ORIENTATION_MAX, 0, 0 },
43c29fa5a6Sopenharmony_ci    { ABS_MT_POSITION_X, 0, ABS_MAX_X, 0, 0 },
44c29fa5a6Sopenharmony_ci    { ABS_MT_POSITION_Y, 0, ABS_MAX_Y, 0, 0 },
45c29fa5a6Sopenharmony_ci    { ABS_MT_BLOB_ID, 0, ABS_MT_BLOB_ID_MAX, 0, 0 },
46c29fa5a6Sopenharmony_ci    { ABS_MT_TRACKING_ID, 0, ABS_MT_TRACKING_ID_MAX, 0, 0 }
47c29fa5a6Sopenharmony_ci};
48c29fa5a6Sopenharmony_ci} // namespace
49c29fa5a6Sopenharmony_ci
50c29fa5a6Sopenharmony_ciVirtualUwbRemoteControl::VirtualUwbRemoteControl() : VirtualDevice("Virtual UWB RemoteControl", BUS_USB, 0x6006, 0x6006)
51c29fa5a6Sopenharmony_ci{
52c29fa5a6Sopenharmony_ci    eventTypes_ = { EV_SYN, EV_KEY, EV_REL, EV_ABS };
53c29fa5a6Sopenharmony_ci    properties_ = { INPUT_PROP_DIRECT };
54c29fa5a6Sopenharmony_ci    keys_ = {
55c29fa5a6Sopenharmony_ci        KEY_HOMEPAGE, KEY_POWER, KEY_BACK, KEY_MENU, KEY_ENTER, KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN,
56c29fa5a6Sopenharmony_ci        KEY_VOICECOMMAND, KEY_VOLUMEDOWN, KEY_VOLUMEUP, BTN_TOUCH, BTN_LEFT, BTN_RIGHT, BTN_TOOL_FINGER
57c29fa5a6Sopenharmony_ci    };
58c29fa5a6Sopenharmony_ci    abs_ = {
59c29fa5a6Sopenharmony_ci        ABS_X, ABS_Y, ABS_PRESSURE, ABS_MT_SLOT, ABS_MT_TOUCH_MAJOR, ABS_MT_TOUCH_MINOR, ABS_MT_ORIENTATION,
60c29fa5a6Sopenharmony_ci        ABS_MT_POSITION_X, ABS_MT_POSITION_Y, ABS_MT_BLOB_ID, ABS_MT_TRACKING_ID, ABS_MT_PRESSURE, ABS_MT_MOVEFLAG
61c29fa5a6Sopenharmony_ci    };
62c29fa5a6Sopenharmony_ci    relBits_ = { REL_X, REL_Y, REL_WHEEL, REL_WHEEL_HI_RES };
63c29fa5a6Sopenharmony_ci    for (const auto &item : absInfos) {
64c29fa5a6Sopenharmony_ci        SetAbsValue(item);
65c29fa5a6Sopenharmony_ci    }
66c29fa5a6Sopenharmony_ci}
67c29fa5a6Sopenharmony_ci} // namespace MMI
68c29fa5a6Sopenharmony_ci} // namespace OHOS