• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 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 #ifndef I_DEVICE_H
17 #define I_DEVICE_H
18 
19 #include <string>
20 
21 namespace OHOS {
22 namespace Msdp {
23 namespace DeviceStatus {
24 
25 class IDevice {
26 public:
27     enum KeyboardType {
28         KEYBOARD_TYPE_NONE,
29         KEYBOARD_TYPE_UNKNOWN,
30         KEYBOARD_TYPE_ALPHABETICKEYBOARD,
31         KEYBOARD_TYPE_DIGITALKEYBOARD,
32         KEYBOARD_TYPE_HANDWRITINGPEN,
33         KEYBOARD_TYPE_REMOTECONTROL,
34         KEYBOARD_TYPE_MAX
35     };
36 
37     enum Capability {
38         DEVICE_CAP_KEYBOARD = 0,
39         DEVICE_CAP_TOUCH,
40         DEVICE_CAP_POINTER,
41         DEVICE_CAP_TABLET_TOOL,
42         DEVICE_CAP_TABLET_PAD,
43         DEVICE_CAP_GESTURE,
44         DEVICE_CAP_SWITCH,
45         DEVICE_CAP_JOYSTICK,
46         DEVICE_CAP_MAX
47     };
48 
49 public:
50     IDevice() = default;
51     virtual ~IDevice() = default;
52 
53     virtual int32_t Open() = 0;
54     virtual void Close() = 0;
55 
56     virtual void SetId(int32_t id) = 0;
57     virtual void SetDevPath(const std::string &devPath) = 0;
58     virtual void SetSysPath(const std::string &sysPath) = 0;
59     virtual void SetName(const std::string &name) = 0;
60     virtual void SetBus(int32_t bus) = 0;
61     virtual void SetVersion(int32_t version) = 0;
62     virtual void SetProduct(int32_t product) = 0;
63     virtual void SetVendor(int32_t vendor) = 0;
64     virtual void SetPhys(const std::string &phys) = 0;
65     virtual void SetUniq(const std::string &uniq) = 0;
66     virtual void SetKeyboardType(KeyboardType keyboardType) = 0;
67     virtual void AddCapability(Capability capability) = 0;
68 
69     virtual int32_t GetId() const = 0;
70     virtual std::string GetDevPath() const = 0;
71     virtual std::string GetSysPath() const = 0;
72     virtual std::string GetName() const = 0;
73     virtual int32_t GetBus() const = 0;
74     virtual int32_t GetVersion() const = 0;
75     virtual int32_t GetProduct() const = 0;
76     virtual int32_t GetVendor() const = 0;
77     virtual std::string GetPhys() const = 0;
78     virtual std::string GetUniq() const = 0;
79     virtual KeyboardType GetKeyboardType() const = 0;
80     virtual bool IsPointerDevice() const = 0;
81     virtual bool IsKeyboard() const = 0;
82     virtual bool IsRemote() const = 0;
83 };
84 } // namespace DeviceStatus
85 } // namespace Msdp
86 } // namespace OHOS
87 #endif // I_DEVICE_H