• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021-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 OHOS_DISTRIBUTED_HARDWARE_DEVICE_TYPE_H
17 #define OHOS_DISTRIBUTED_HARDWARE_DEVICE_TYPE_H
18 
19 #include <string>
20 #include <unordered_map>
21 
22 namespace OHOS {
23 namespace DistributedHardware {
24 enum class DHType : uint32_t {
25     UNKNOWN = 0x0,            // unknown device
26     CAMERA = 0x01,            // Camera
27     AUDIO = 0x02,             // Mic
28     SCREEN = 0x08,            // Display
29     GPS = 0x10,               // GPS
30     INPUT = 0x20,             // Key board
31     HFP = 0x40,               // HFP External device
32     A2D = 0x80,               // A2DP External device
33     VIRMODEM_AUDIO = 0x100,     // Cellular call AUDIO
34     MAX_DH = 0x80000000
35 };
36 
37 enum class DHSubtype : uint32_t {
38     CAMERA = 0x01,            // Camera
39     SCREEN = 0x08,            // Display
40     INPUT = 0x20,             // Key board
41     AUDIO_MIC = 0x400,        // AUDIO Mic
42     AUDIO_SPEAKER = 0x800     // AUDIO Speaker
43 };
44 
45 const std::unordered_map<DHType, std::string> DHTypeStrMap = {
46     { DHType::CAMERA, "CAMERA" },
47     { DHType::AUDIO, "AUDIO" },
48     { DHType::SCREEN, "SCREEN" },
49     { DHType::GPS, "GPS" },
50     { DHType::INPUT, "INPUT" },
51     { DHType::HFP, "HFP" },
52     { DHType::A2D, "A2D" },
53     { DHType::VIRMODEM_AUDIO, "VIRMODEM_AUDIO" },
54 };
55 
56 struct DeviceInfo {
57     std::string uuid;
58     std::string deviceId;
59     std::string deviceName;
60     uint16_t deviceType;
61 
DeviceInfoDeviceInfo62     explicit DeviceInfo(std::string uuid, std::string deviceId, std::string deviceName, uint16_t deviceType)
63         : uuid(uuid), deviceId(deviceId), deviceName(deviceName), deviceType(deviceType) {}
64 };
65 
66 /* The key is DHType, the value is the prefix of DHId */
67 const std::unordered_map<DHType, std::string> DHTypePrefixMap = {
68     {DHType::CAMERA, "Camera"},
69     {DHType::SCREEN, "Screen"},
70     {DHType::INPUT, "Input"},
71 };
72 } // namespace DistributedHardware
73 } // namespace OHOS
74 #endif
75