• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #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_MIC = 0x100,     // Cellular call MIC
34     VIRMODEM_SPEAKER = 0x200, // Cellular call Speaker
35     MAX_DH = 0x80000000
36 };
37 
38 const std::unordered_map<DHType, std::string> DHTypeStrMap = {
39     { DHType::CAMERA, "CAMERA" },
40     { DHType::AUDIO, "AUDIO" },
41     { DHType::SCREEN, "SCREEN" },
42     { DHType::GPS, "GPS" },
43     { DHType::INPUT, "INPUT" },
44     { DHType::HFP, "HFP" },
45     { DHType::A2D, "A2D" },
46     { DHType::VIRMODEM_MIC, "VIRMODEM_MIC" },
47     { DHType::VIRMODEM_SPEAKER, "VIRMODEM_SPEAKER" },
48 };
49 
50 struct DeviceInfo {
51     std::string uuid;
52     std::string deviceId;
53     std::string deviceName;
54     uint16_t deviceType;
55 
DeviceInfoDeviceInfo56     explicit DeviceInfo(std::string uuid, std::string deviceId, std::string deviceName, uint16_t deviceType)
57         : uuid(uuid), deviceId(deviceId), deviceName(deviceName), deviceType(deviceType) {}
58 };
59 
60 /* The key is DHType, the value is the prefix of DHId */
61 const std::unordered_map<DHType, std::string> DHTypePrefixMap = {
62     {DHType::CAMERA, "Camera"},
63     {DHType::SCREEN, "Screen"},
64     {DHType::INPUT, "Input"},
65 };
66 } // namespace DistributedHardware
67 } // namespace OHOS
68 #endif
69