xref: /aosp_15_r20/external/pigweed/pw_bluetooth/public/pw_bluetooth/types.h (revision 61c4878ac05f98d0ceed94b57d316916de578985)
1 // Copyright 2022 The Pigweed Authors
2 //
3 // Licensed under the Apache License, Version 2.0 (the "License"); you may not
4 // use this file except in compliance with the License. You may obtain a copy of
5 // the License at
6 //
7 //     https://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, WITHOUT
11 // WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 // License for the specific language governing permissions and limitations under
13 // the License.
14 #pragma once
15 
16 #include <array>
17 #include <cstdint>
18 #include <string_view>
19 
20 #include "pw_bluetooth/address.h"
21 #include "pw_bluetooth/uuid.h"
22 
23 namespace pw::bluetooth {
24 
25 // 64-bit unique value used by the system to identify peer devices.
26 using PeerId = uint64_t;
27 
28 using DeviceName = std::string_view;
29 
30 // A 128-bit secret key.
31 using Key = std::array<uint8_t, 16>;
32 
33 /// Refers to the role of a Bluetooth device in a physical channel piconet.
34 enum class ConnectionRole : uint8_t {
35   // The connection initiating device.
36   kCentral,
37   // The advertising device.
38   kPeripheral
39 };
40 
41 /// Possible values for the LE Appearance property which describes the external
42 /// appearance of a peer at a high level.
43 /// (See the Bluetooth assigned-numbers document:
44 /// https://www.bluetooth.com/specifications/gatt/viewer?attributeXmlFile=org.bluetooth.characteristic.gap.appearance.xml)
45 enum class Appearance : uint16_t {
46   kUnknown = 0,
47   kPhone = 64,
48   kComputer = 128,
49   kWatch = 192,
50   kWatchSports = 193,
51   kClock = 256,
52   kDisplay = 320,
53   kRemoteControl = 384,
54   kEyeGlasses = 448,
55   kTag = 512,
56   kKeyring = 576,
57   kMediaPlayer = 640,
58   kBarcodeScanner = 704,
59   kThermometer = 768,
60   kThermometerEar = 769,
61   kHeartRateSensor = 832,
62   kHeartRateSensorBelt = 833,
63   kBloodPressure = 896,
64   kBloodPressureArm = 897,
65   kBloodPressureWrist = 898,
66   kHid = 960,
67   kHidKeyboard = 961,
68   kHidMouse = 962,
69   kHidJoystick = 963,
70   kHidGamepad = 964,
71   kHidDigitizerTablet = 965,
72   kHidCardReader = 966,
73   kHidDigitalPen = 967,
74   kHidBarcodeScanner = 968,
75   kGlucoseMeter = 1024,
76   kRunningWalkingSensor = 1088,
77   kRunningWalkingSensorInShoe = 1089,
78   kRunningWalkingSensorOnShoe = 1090,
79   kRunningWalkingSensorOnHip = 1091,
80   kCycling = 1152,
81   kCyclingComputer = 1153,
82   kCyclingSpeedSensor = 1154,
83   kCyclingCadenceSensor = 1155,
84   kCyclingPowerSensor = 1156,
85   kCyclingSpeedAndCadenceSensor = 1157,
86   kPulseOximeter = 3136,
87   kPulseOximeterFingertip = 3137,
88   kPulseOximeterWrist = 3138,
89   kWeightScale = 3200,
90   kPersonalMobility = 3264,
91   kPersonalMobilityWheelchair = 3265,
92   kPersonalMobilityScooter = 3266,
93   kGlucoseMonitor = 3328,
94   kSportsActivity = 5184,
95   kSportsActivityLocationDisplay = 5185,
96   kSportsActivityLocationAndNavDisplay = 5186,
97   kSportsActivityLocationPod = 5187,
98   kSportsActivityLocationAndNavPod = 5188,
99 };
100 
101 }  // namespace pw::bluetooth
102