bumble 0.0.194__py3-none-any.whl → 0.0.195__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bumble/_version.py +2 -2
- bumble/apps/auracast.py +407 -0
- bumble/apps/bench.py +77 -23
- bumble/apps/controller_info.py +3 -3
- bumble/core.py +689 -115
- bumble/device.py +441 -12
- bumble/hci.py +250 -12
- bumble/host.py +25 -0
- bumble/pandora/host.py +3 -2
- bumble/profiles/bap.py +101 -5
- bumble/profiles/le_audio.py +49 -0
- bumble/profiles/pbp.py +46 -0
- bumble/rfcomm.py +10 -1
- {bumble-0.0.194.dist-info → bumble-0.0.195.dist-info}/METADATA +1 -1
- {bumble-0.0.194.dist-info → bumble-0.0.195.dist-info}/RECORD +19 -16
- {bumble-0.0.194.dist-info → bumble-0.0.195.dist-info}/LICENSE +0 -0
- {bumble-0.0.194.dist-info → bumble-0.0.195.dist-info}/WHEEL +0 -0
- {bumble-0.0.194.dist-info → bumble-0.0.195.dist-info}/entry_points.txt +0 -0
- {bumble-0.0.194.dist-info → bumble-0.0.195.dist-info}/top_level.txt +0 -0
bumble/core.py
CHANGED
|
@@ -16,11 +16,14 @@
|
|
|
16
16
|
# Imports
|
|
17
17
|
# -----------------------------------------------------------------------------
|
|
18
18
|
from __future__ import annotations
|
|
19
|
+
import dataclasses
|
|
19
20
|
import enum
|
|
20
21
|
import struct
|
|
21
22
|
from typing import List, Optional, Tuple, Union, cast, Dict
|
|
23
|
+
from typing_extensions import Self
|
|
22
24
|
|
|
23
|
-
from .company_ids import COMPANY_IDENTIFIERS
|
|
25
|
+
from bumble.company_ids import COMPANY_IDENTIFIERS
|
|
26
|
+
from bumble.utils import OpenIntEnum
|
|
24
27
|
|
|
25
28
|
|
|
26
29
|
# -----------------------------------------------------------------------------
|
|
@@ -692,11 +695,569 @@ class DeviceClass:
|
|
|
692
695
|
return name_or_number(class_names, minor_device_class)
|
|
693
696
|
|
|
694
697
|
|
|
698
|
+
# -----------------------------------------------------------------------------
|
|
699
|
+
# Appearance
|
|
700
|
+
# -----------------------------------------------------------------------------
|
|
701
|
+
class Appearance:
|
|
702
|
+
class Category(OpenIntEnum):
|
|
703
|
+
UNKNOWN = 0x0000
|
|
704
|
+
PHONE = 0x0001
|
|
705
|
+
COMPUTER = 0x0002
|
|
706
|
+
WATCH = 0x0003
|
|
707
|
+
CLOCK = 0x0004
|
|
708
|
+
DISPLAY = 0x0005
|
|
709
|
+
REMOTE_CONTROL = 0x0006
|
|
710
|
+
EYE_GLASSES = 0x0007
|
|
711
|
+
TAG = 0x0008
|
|
712
|
+
KEYRING = 0x0009
|
|
713
|
+
MEDIA_PLAYER = 0x000A
|
|
714
|
+
BARCODE_SCANNER = 0x000B
|
|
715
|
+
THERMOMETER = 0x000C
|
|
716
|
+
HEART_RATE_SENSOR = 0x000D
|
|
717
|
+
BLOOD_PRESSURE = 0x000E
|
|
718
|
+
HUMAN_INTERFACE_DEVICE = 0x000F
|
|
719
|
+
GLUCOSE_METER = 0x0010
|
|
720
|
+
RUNNING_WALKING_SENSOR = 0x0011
|
|
721
|
+
CYCLING = 0x0012
|
|
722
|
+
CONTROL_DEVICE = 0x0013
|
|
723
|
+
NETWORK_DEVICE = 0x0014
|
|
724
|
+
SENSOR = 0x0015
|
|
725
|
+
LIGHT_FIXTURES = 0x0016
|
|
726
|
+
FAN = 0x0017
|
|
727
|
+
HVAC = 0x0018
|
|
728
|
+
AIR_CONDITIONING = 0x0019
|
|
729
|
+
HUMIDIFIER = 0x001A
|
|
730
|
+
HEATING = 0x001B
|
|
731
|
+
ACCESS_CONTROL = 0x001C
|
|
732
|
+
MOTORIZED_DEVICE = 0x001D
|
|
733
|
+
POWER_DEVICE = 0x001E
|
|
734
|
+
LIGHT_SOURCE = 0x001F
|
|
735
|
+
WINDOW_COVERING = 0x0020
|
|
736
|
+
AUDIO_SINK = 0x0021
|
|
737
|
+
AUDIO_SOURCE = 0x0022
|
|
738
|
+
MOTORIZED_VEHICLE = 0x0023
|
|
739
|
+
DOMESTIC_APPLIANCE = 0x0024
|
|
740
|
+
WEARABLE_AUDIO_DEVICE = 0x0025
|
|
741
|
+
AIRCRAFT = 0x0026
|
|
742
|
+
AV_EQUIPMENT = 0x0027
|
|
743
|
+
DISPLAY_EQUIPMENT = 0x0028
|
|
744
|
+
HEARING_AID = 0x0029
|
|
745
|
+
GAMING = 0x002A
|
|
746
|
+
SIGNAGE = 0x002B
|
|
747
|
+
PULSE_OXIMETER = 0x0031
|
|
748
|
+
WEIGHT_SCALE = 0x0032
|
|
749
|
+
PERSONAL_MOBILITY_DEVICE = 0x0033
|
|
750
|
+
CONTINUOUS_GLUCOSE_MONITOR = 0x0034
|
|
751
|
+
INSULIN_PUMP = 0x0035
|
|
752
|
+
MEDICATION_DELIVERY = 0x0036
|
|
753
|
+
SPIROMETER = 0x0037
|
|
754
|
+
OUTDOOR_SPORTS_ACTIVITY = 0x0051
|
|
755
|
+
|
|
756
|
+
class UnknownSubcategory(OpenIntEnum):
|
|
757
|
+
GENERIC_UNKNOWN = 0x00
|
|
758
|
+
|
|
759
|
+
class PhoneSubcategory(OpenIntEnum):
|
|
760
|
+
GENERIC_PHONE = 0x00
|
|
761
|
+
|
|
762
|
+
class ComputerSubcategory(OpenIntEnum):
|
|
763
|
+
GENERIC_COMPUTER = 0x00
|
|
764
|
+
DESKTOP_WORKSTATION = 0x01
|
|
765
|
+
SERVER_CLASS_COMPUTER = 0x02
|
|
766
|
+
LAPTOP = 0x03
|
|
767
|
+
HANDHELD_PC_PDA = 0x04
|
|
768
|
+
PALM_SIZE_PC_PDA = 0x05
|
|
769
|
+
WEARABLE_COMPUTER = 0x06
|
|
770
|
+
TABLET = 0x07
|
|
771
|
+
DOCKING_STATION = 0x08
|
|
772
|
+
ALL_IN_ONE = 0x09
|
|
773
|
+
BLADE_SERVER = 0x0A
|
|
774
|
+
CONVERTIBLE = 0x0B
|
|
775
|
+
DETACHABLE = 0x0C
|
|
776
|
+
IOT_GATEWAY = 0x0D
|
|
777
|
+
MINI_PC = 0x0E
|
|
778
|
+
STICK_PC = 0x0F
|
|
779
|
+
|
|
780
|
+
class WatchSubcategory(OpenIntEnum):
|
|
781
|
+
GENENERIC_WATCH = 0x00
|
|
782
|
+
SPORTS_WATCH = 0x01
|
|
783
|
+
SMARTWATCH = 0x02
|
|
784
|
+
|
|
785
|
+
class ClockSubcategory(OpenIntEnum):
|
|
786
|
+
GENERIC_CLOCK = 0x00
|
|
787
|
+
|
|
788
|
+
class DisplaySubcategory(OpenIntEnum):
|
|
789
|
+
GENERIC_DISPLAY = 0x00
|
|
790
|
+
|
|
791
|
+
class RemoteControlSubcategory(OpenIntEnum):
|
|
792
|
+
GENERIC_REMOTE_CONTROL = 0x00
|
|
793
|
+
|
|
794
|
+
class EyeglassesSubcategory(OpenIntEnum):
|
|
795
|
+
GENERIC_EYEGLASSES = 0x00
|
|
796
|
+
|
|
797
|
+
class TagSubcategory(OpenIntEnum):
|
|
798
|
+
GENERIC_TAG = 0x00
|
|
799
|
+
|
|
800
|
+
class KeyringSubcategory(OpenIntEnum):
|
|
801
|
+
GENERIC_KEYRING = 0x00
|
|
802
|
+
|
|
803
|
+
class MediaPlayerSubcategory(OpenIntEnum):
|
|
804
|
+
GENERIC_MEDIA_PLAYER = 0x00
|
|
805
|
+
|
|
806
|
+
class BarcodeScannerSubcategory(OpenIntEnum):
|
|
807
|
+
GENERIC_BARCODE_SCANNER = 0x00
|
|
808
|
+
|
|
809
|
+
class ThermometerSubcategory(OpenIntEnum):
|
|
810
|
+
GENERIC_THERMOMETER = 0x00
|
|
811
|
+
EAR_THERMOMETER = 0x01
|
|
812
|
+
|
|
813
|
+
class HeartRateSensorSubcategory(OpenIntEnum):
|
|
814
|
+
GENERIC_HEART_RATE_SENSOR = 0x00
|
|
815
|
+
HEART_RATE_BELT = 0x01
|
|
816
|
+
|
|
817
|
+
class BloodPressureSubcategory(OpenIntEnum):
|
|
818
|
+
GENERIC_BLOOD_PRESSURE = 0x00
|
|
819
|
+
ARM_BLOOD_PRESSURE = 0x01
|
|
820
|
+
WRIST_BLOOD_PRESSURE = 0x02
|
|
821
|
+
|
|
822
|
+
class HumanInterfaceDeviceSubcategory(OpenIntEnum):
|
|
823
|
+
GENERIC_HUMAN_INTERFACE_DEVICE = 0x00
|
|
824
|
+
KEYBOARD = 0x01
|
|
825
|
+
MOUSE = 0x02
|
|
826
|
+
JOYSTICK = 0x03
|
|
827
|
+
GAMEPAD = 0x04
|
|
828
|
+
DIGITIZER_TABLET = 0x05
|
|
829
|
+
CARD_READER = 0x06
|
|
830
|
+
DIGITAL_PEN = 0x07
|
|
831
|
+
BARCODE_SCANNER = 0x08
|
|
832
|
+
TOUCHPAD = 0x09
|
|
833
|
+
PRESENTATION_REMOTE = 0x0A
|
|
834
|
+
|
|
835
|
+
class GlucoseMeterSubcategory(OpenIntEnum):
|
|
836
|
+
GENERIC_GLUCOSE_METER = 0x00
|
|
837
|
+
|
|
838
|
+
class RunningWalkingSensorSubcategory(OpenIntEnum):
|
|
839
|
+
GENERIC_RUNNING_WALKING_SENSOR = 0x00
|
|
840
|
+
IN_SHOE_RUNNING_WALKING_SENSOR = 0x01
|
|
841
|
+
ON_SHOW_RUNNING_WALKING_SENSOR = 0x02
|
|
842
|
+
ON_HIP_RUNNING_WALKING_SENSOR = 0x03
|
|
843
|
+
|
|
844
|
+
class CyclingSubcategory(OpenIntEnum):
|
|
845
|
+
GENERIC_CYCLING = 0x00
|
|
846
|
+
CYCLING_COMPUTER = 0x01
|
|
847
|
+
SPEED_SENSOR = 0x02
|
|
848
|
+
CADENCE_SENSOR = 0x03
|
|
849
|
+
POWER_SENSOR = 0x04
|
|
850
|
+
SPEED_AND_CADENCE_SENSOR = 0x05
|
|
851
|
+
|
|
852
|
+
class ControlDeviceSubcategory(OpenIntEnum):
|
|
853
|
+
GENERIC_CONTROL_DEVICE = 0x00
|
|
854
|
+
SWITCH = 0x01
|
|
855
|
+
MULTI_SWITCH = 0x02
|
|
856
|
+
BUTTON = 0x03
|
|
857
|
+
SLIDER = 0x04
|
|
858
|
+
ROTARY_SWITCH = 0x05
|
|
859
|
+
TOUCH_PANEL = 0x06
|
|
860
|
+
SINGLE_SWITCH = 0x07
|
|
861
|
+
DOUBLE_SWITCH = 0x08
|
|
862
|
+
TRIPLE_SWITCH = 0x09
|
|
863
|
+
BATTERY_SWITCH = 0x0A
|
|
864
|
+
ENERGY_HARVESTING_SWITCH = 0x0B
|
|
865
|
+
PUSH_BUTTON = 0x0C
|
|
866
|
+
|
|
867
|
+
class NetworkDeviceSubcategory(OpenIntEnum):
|
|
868
|
+
GENERIC_NETWORK_DEVICE = 0x00
|
|
869
|
+
ACCESS_POINT = 0x01
|
|
870
|
+
MESH_DEVICE = 0x02
|
|
871
|
+
MESH_NETWORK_PROXY = 0x03
|
|
872
|
+
|
|
873
|
+
class SensorSubcategory(OpenIntEnum):
|
|
874
|
+
GENERIC_SENSOR = 0x00
|
|
875
|
+
MOTION_SENSOR = 0x01
|
|
876
|
+
AIR_QUALITY_SENSOR = 0x02
|
|
877
|
+
TEMPERATURE_SENSOR = 0x03
|
|
878
|
+
HUMIDITY_SENSOR = 0x04
|
|
879
|
+
LEAK_SENSOR = 0x05
|
|
880
|
+
SMOKE_SENSOR = 0x06
|
|
881
|
+
OCCUPANCY_SENSOR = 0x07
|
|
882
|
+
CONTACT_SENSOR = 0x08
|
|
883
|
+
CARBON_MONOXIDE_SENSOR = 0x09
|
|
884
|
+
CARBON_DIOXIDE_SENSOR = 0x0A
|
|
885
|
+
AMBIENT_LIGHT_SENSOR = 0x0B
|
|
886
|
+
ENERGY_SENSOR = 0x0C
|
|
887
|
+
COLOR_LIGHT_SENSOR = 0x0D
|
|
888
|
+
RAIN_SENSOR = 0x0E
|
|
889
|
+
FIRE_SENSOR = 0x0F
|
|
890
|
+
WIND_SENSOR = 0x10
|
|
891
|
+
PROXIMITY_SENSOR = 0x11
|
|
892
|
+
MULTI_SENSOR = 0x12
|
|
893
|
+
FLUSH_MOUNTED_SENSOR = 0x13
|
|
894
|
+
CEILING_MOUNTED_SENSOR = 0x14
|
|
895
|
+
WALL_MOUNTED_SENSOR = 0x15
|
|
896
|
+
MULTISENSOR = 0x16
|
|
897
|
+
ENERGY_METER = 0x17
|
|
898
|
+
FLAME_DETECTOR = 0x18
|
|
899
|
+
VEHICLE_TIRE_PRESSURE_SENSOR = 0x19
|
|
900
|
+
|
|
901
|
+
class LightFixturesSubcategory(OpenIntEnum):
|
|
902
|
+
GENERIC_LIGHT_FIXTURES = 0x00
|
|
903
|
+
WALL_LIGHT = 0x01
|
|
904
|
+
CEILING_LIGHT = 0x02
|
|
905
|
+
FLOOR_LIGHT = 0x03
|
|
906
|
+
CABINET_LIGHT = 0x04
|
|
907
|
+
DESK_LIGHT = 0x05
|
|
908
|
+
TROFFER_LIGHT = 0x06
|
|
909
|
+
PENDANT_LIGHT = 0x07
|
|
910
|
+
IN_GROUND_LIGHT = 0x08
|
|
911
|
+
FLOOD_LIGHT = 0x09
|
|
912
|
+
UNDERWATER_LIGHT = 0x0A
|
|
913
|
+
BOLLARD_WITH_LIGHT = 0x0B
|
|
914
|
+
PATHWAY_LIGHT = 0x0C
|
|
915
|
+
GARDEN_LIGHT = 0x0D
|
|
916
|
+
POLE_TOP_LIGHT = 0x0E
|
|
917
|
+
SPOTLIGHT = 0x0F
|
|
918
|
+
LINEAR_LIGHT = 0x10
|
|
919
|
+
STREET_LIGHT = 0x11
|
|
920
|
+
SHELVES_LIGHT = 0x12
|
|
921
|
+
BAY_LIGHT = 0x013
|
|
922
|
+
EMERGENCY_EXIT_LIGHT = 0x14
|
|
923
|
+
LIGHT_CONTROLLER = 0x15
|
|
924
|
+
LIGHT_DRIVER = 0x16
|
|
925
|
+
BULB = 0x17
|
|
926
|
+
LOW_BAY_LIGHT = 0x18
|
|
927
|
+
HIGH_BAY_LIGHT = 0x19
|
|
928
|
+
|
|
929
|
+
class FanSubcategory(OpenIntEnum):
|
|
930
|
+
GENERIC_FAN = 0x00
|
|
931
|
+
CEILING_FAN = 0x01
|
|
932
|
+
AXIAL_FAN = 0x02
|
|
933
|
+
EXHAUST_FAN = 0x03
|
|
934
|
+
PEDESTAL_FAN = 0x04
|
|
935
|
+
DESK_FAN = 0x05
|
|
936
|
+
WALL_FAN = 0x06
|
|
937
|
+
|
|
938
|
+
class HvacSubcategory(OpenIntEnum):
|
|
939
|
+
GENERIC_HVAC = 0x00
|
|
940
|
+
THERMOSTAT = 0x01
|
|
941
|
+
HUMIDIFIER = 0x02
|
|
942
|
+
DEHUMIDIFIER = 0x03
|
|
943
|
+
HEATER = 0x04
|
|
944
|
+
RADIATOR = 0x05
|
|
945
|
+
BOILER = 0x06
|
|
946
|
+
HEAT_PUMP = 0x07
|
|
947
|
+
INFRARED_HEATER = 0x08
|
|
948
|
+
RADIANT_PANEL_HEATER = 0x09
|
|
949
|
+
FAN_HEATER = 0x0A
|
|
950
|
+
AIR_CURTAIN = 0x0B
|
|
951
|
+
|
|
952
|
+
class AirConditioningSubcategory(OpenIntEnum):
|
|
953
|
+
GENERIC_AIR_CONDITIONING = 0x00
|
|
954
|
+
|
|
955
|
+
class HumidifierSubcategory(OpenIntEnum):
|
|
956
|
+
GENERIC_HUMIDIFIER = 0x00
|
|
957
|
+
|
|
958
|
+
class HeatingSubcategory(OpenIntEnum):
|
|
959
|
+
GENERIC_HEATING = 0x00
|
|
960
|
+
RADIATOR = 0x01
|
|
961
|
+
BOILER = 0x02
|
|
962
|
+
HEAT_PUMP = 0x03
|
|
963
|
+
INFRARED_HEATER = 0x04
|
|
964
|
+
RADIANT_PANEL_HEATER = 0x05
|
|
965
|
+
FAN_HEATER = 0x06
|
|
966
|
+
AIR_CURTAIN = 0x07
|
|
967
|
+
|
|
968
|
+
class AccessControlSubcategory(OpenIntEnum):
|
|
969
|
+
GENERIC_ACCESS_CONTROL = 0x00
|
|
970
|
+
ACCESS_DOOR = 0x01
|
|
971
|
+
GARAGE_DOOR = 0x02
|
|
972
|
+
EMERGENCY_EXIT_DOOR = 0x03
|
|
973
|
+
ACCESS_LOCK = 0x04
|
|
974
|
+
ELEVATOR = 0x05
|
|
975
|
+
WINDOW = 0x06
|
|
976
|
+
ENTRANCE_GATE = 0x07
|
|
977
|
+
DOOR_LOCK = 0x08
|
|
978
|
+
LOCKER = 0x09
|
|
979
|
+
|
|
980
|
+
class MotorizedDeviceSubcategory(OpenIntEnum):
|
|
981
|
+
GENERIC_MOTORIZED_DEVICE = 0x00
|
|
982
|
+
MOTORIZED_GATE = 0x01
|
|
983
|
+
AWNING = 0x02
|
|
984
|
+
BLINDS_OR_SHADES = 0x03
|
|
985
|
+
CURTAINS = 0x04
|
|
986
|
+
SCREEN = 0x05
|
|
987
|
+
|
|
988
|
+
class PowerDeviceSubcategory(OpenIntEnum):
|
|
989
|
+
GENERIC_POWER_DEVICE = 0x00
|
|
990
|
+
POWER_OUTLET = 0x01
|
|
991
|
+
POWER_STRIP = 0x02
|
|
992
|
+
PLUG = 0x03
|
|
993
|
+
POWER_SUPPLY = 0x04
|
|
994
|
+
LED_DRIVER = 0x05
|
|
995
|
+
FLUORESCENT_LAMP_GEAR = 0x06
|
|
996
|
+
HID_LAMP_GEAR = 0x07
|
|
997
|
+
CHARGE_CASE = 0x08
|
|
998
|
+
POWER_BANK = 0x09
|
|
999
|
+
|
|
1000
|
+
class LightSourceSubcategory(OpenIntEnum):
|
|
1001
|
+
GENERIC_LIGHT_SOURCE = 0x00
|
|
1002
|
+
INCANDESCENT_LIGHT_BULB = 0x01
|
|
1003
|
+
LED_LAMP = 0x02
|
|
1004
|
+
HID_LAMP = 0x03
|
|
1005
|
+
FLUORESCENT_LAMP = 0x04
|
|
1006
|
+
LED_ARRAY = 0x05
|
|
1007
|
+
MULTI_COLOR_LED_ARRAY = 0x06
|
|
1008
|
+
LOW_VOLTAGE_HALOGEN = 0x07
|
|
1009
|
+
ORGANIC_LIGHT_EMITTING_DIODE = 0x08
|
|
1010
|
+
|
|
1011
|
+
class WindowCoveringSubcategory(OpenIntEnum):
|
|
1012
|
+
GENERIC_WINDOW_COVERING = 0x00
|
|
1013
|
+
WINDOW_SHADES = 0x01
|
|
1014
|
+
WINDOW_BLINDS = 0x02
|
|
1015
|
+
WINDOW_AWNING = 0x03
|
|
1016
|
+
WINDOW_CURTAIN = 0x04
|
|
1017
|
+
EXTERIOR_SHUTTER = 0x05
|
|
1018
|
+
EXTERIOR_SCREEN = 0x06
|
|
1019
|
+
|
|
1020
|
+
class AudioSinkSubcategory(OpenIntEnum):
|
|
1021
|
+
GENERIC_AUDIO_SINK = 0x00
|
|
1022
|
+
STANDALONE_SPEAKER = 0x01
|
|
1023
|
+
SOUNDBAR = 0x02
|
|
1024
|
+
BOOKSHELF_SPEAKER = 0x03
|
|
1025
|
+
STANDMOUNTED_SPEAKER = 0x04
|
|
1026
|
+
SPEAKERPHONE = 0x05
|
|
1027
|
+
|
|
1028
|
+
class AudioSourceSubcategory(OpenIntEnum):
|
|
1029
|
+
GENERIC_AUDIO_SOURCE = 0x00
|
|
1030
|
+
MICROPHONE = 0x01
|
|
1031
|
+
ALARM = 0x02
|
|
1032
|
+
BELL = 0x03
|
|
1033
|
+
HORN = 0x04
|
|
1034
|
+
BROADCASTING_DEVICE = 0x05
|
|
1035
|
+
SERVICE_DESK = 0x06
|
|
1036
|
+
KIOSK = 0x07
|
|
1037
|
+
BROADCASTING_ROOM = 0x08
|
|
1038
|
+
AUDITORIUM = 0x09
|
|
1039
|
+
|
|
1040
|
+
class MotorizedVehicleSubcategory(OpenIntEnum):
|
|
1041
|
+
GENERIC_MOTORIZED_VEHICLE = 0x00
|
|
1042
|
+
CAR = 0x01
|
|
1043
|
+
LARGE_GOODS_VEHICLE = 0x02
|
|
1044
|
+
TWO_WHEELED_VEHICLE = 0x03
|
|
1045
|
+
MOTORBIKE = 0x04
|
|
1046
|
+
SCOOTER = 0x05
|
|
1047
|
+
MOPED = 0x06
|
|
1048
|
+
THREE_WHEELED_VEHICLE = 0x07
|
|
1049
|
+
LIGHT_VEHICLE = 0x08
|
|
1050
|
+
QUAD_BIKE = 0x09
|
|
1051
|
+
MINIBUS = 0x0A
|
|
1052
|
+
BUS = 0x0B
|
|
1053
|
+
TROLLEY = 0x0C
|
|
1054
|
+
AGRICULTURAL_VEHICLE = 0x0D
|
|
1055
|
+
CAMPER_CARAVAN = 0x0E
|
|
1056
|
+
RECREATIONAL_VEHICLE_MOTOR_HOME = 0x0F
|
|
1057
|
+
|
|
1058
|
+
class DomesticApplianceSubcategory(OpenIntEnum):
|
|
1059
|
+
GENERIC_DOMESTIC_APPLIANCE = 0x00
|
|
1060
|
+
REFRIGERATOR = 0x01
|
|
1061
|
+
FREEZER = 0x02
|
|
1062
|
+
OVEN = 0x03
|
|
1063
|
+
MICROWAVE = 0x04
|
|
1064
|
+
TOASTER = 0x05
|
|
1065
|
+
WASHING_MACHINE = 0x06
|
|
1066
|
+
DRYER = 0x07
|
|
1067
|
+
COFFEE_MAKER = 0x08
|
|
1068
|
+
CLOTHES_IRON = 0x09
|
|
1069
|
+
CURLING_IRON = 0x0A
|
|
1070
|
+
HAIR_DRYER = 0x0B
|
|
1071
|
+
VACUUM_CLEANER = 0x0C
|
|
1072
|
+
ROBOTIC_VACUUM_CLEANER = 0x0D
|
|
1073
|
+
RICE_COOKER = 0x0E
|
|
1074
|
+
CLOTHES_STEAMER = 0x0F
|
|
1075
|
+
|
|
1076
|
+
class WearableAudioDeviceSubcategory(OpenIntEnum):
|
|
1077
|
+
GENERIC_WEARABLE_AUDIO_DEVICE = 0x00
|
|
1078
|
+
EARBUD = 0x01
|
|
1079
|
+
HEADSET = 0x02
|
|
1080
|
+
HEADPHONES = 0x03
|
|
1081
|
+
NECK_BAND = 0x04
|
|
1082
|
+
|
|
1083
|
+
class AircraftSubcategory(OpenIntEnum):
|
|
1084
|
+
GENERIC_AIRCRAFT = 0x00
|
|
1085
|
+
LIGHT_AIRCRAFT = 0x01
|
|
1086
|
+
MICROLIGHT = 0x02
|
|
1087
|
+
PARAGLIDER = 0x03
|
|
1088
|
+
LARGE_PASSENGER_AIRCRAFT = 0x04
|
|
1089
|
+
|
|
1090
|
+
class AvEquipmentSubcategory(OpenIntEnum):
|
|
1091
|
+
GENERIC_AV_EQUIPMENT = 0x00
|
|
1092
|
+
AMPLIFIER = 0x01
|
|
1093
|
+
RECEIVER = 0x02
|
|
1094
|
+
RADIO = 0x03
|
|
1095
|
+
TUNER = 0x04
|
|
1096
|
+
TURNTABLE = 0x05
|
|
1097
|
+
CD_PLAYER = 0x06
|
|
1098
|
+
DVD_PLAYER = 0x07
|
|
1099
|
+
BLUERAY_PLAYER = 0x08
|
|
1100
|
+
OPTICAL_DISC_PLAYER = 0x09
|
|
1101
|
+
SET_TOP_BOX = 0x0A
|
|
1102
|
+
|
|
1103
|
+
class DisplayEquipmentSubcategory(OpenIntEnum):
|
|
1104
|
+
GENERIC_DISPLAY_EQUIPMENT = 0x00
|
|
1105
|
+
TELEVISION = 0x01
|
|
1106
|
+
MONITOR = 0x02
|
|
1107
|
+
PROJECTOR = 0x03
|
|
1108
|
+
|
|
1109
|
+
class HearingAidSubcategory(OpenIntEnum):
|
|
1110
|
+
GENERIC_HEARING_AID = 0x00
|
|
1111
|
+
IN_EAR_HEARING_AID = 0x01
|
|
1112
|
+
BEHIND_EAR_HEARING_AID = 0x02
|
|
1113
|
+
COCHLEAR_IMPLANT = 0x03
|
|
1114
|
+
|
|
1115
|
+
class GamingSubcategory(OpenIntEnum):
|
|
1116
|
+
GENERIC_GAMING = 0x00
|
|
1117
|
+
HOME_VIDEO_GAME_CONSOLE = 0x01
|
|
1118
|
+
PORTABLE_HANDHELD_CONSOLE = 0x02
|
|
1119
|
+
|
|
1120
|
+
class SignageSubcategory(OpenIntEnum):
|
|
1121
|
+
GENERIC_SIGNAGE = 0x00
|
|
1122
|
+
DIGITAL_SIGNAGE = 0x01
|
|
1123
|
+
ELECTRONIC_LABEL = 0x02
|
|
1124
|
+
|
|
1125
|
+
class PulseOximeterSubcategory(OpenIntEnum):
|
|
1126
|
+
GENERIC_PULSE_OXIMETER = 0x00
|
|
1127
|
+
FINGERTIP_PULSE_OXIMETER = 0x01
|
|
1128
|
+
WRIST_WORN_PULSE_OXIMETER = 0x02
|
|
1129
|
+
|
|
1130
|
+
class WeightScaleSubcategory(OpenIntEnum):
|
|
1131
|
+
GENERIC_WEIGHT_SCALE = 0x00
|
|
1132
|
+
|
|
1133
|
+
class PersonalMobilityDeviceSubcategory(OpenIntEnum):
|
|
1134
|
+
GENERIC_PERSONAL_MOBILITY_DEVICE = 0x00
|
|
1135
|
+
POWERED_WHEELCHAIR = 0x01
|
|
1136
|
+
MOBILITY_SCOOTER = 0x02
|
|
1137
|
+
|
|
1138
|
+
class ContinuousGlucoseMonitorSubcategory(OpenIntEnum):
|
|
1139
|
+
GENERIC_CONTINUOUS_GLUCOSE_MONITOR = 0x00
|
|
1140
|
+
|
|
1141
|
+
class InsulinPumpSubcategory(OpenIntEnum):
|
|
1142
|
+
GENERIC_INSULIN_PUMP = 0x00
|
|
1143
|
+
INSULIN_PUMP_DURABLE_PUMP = 0x01
|
|
1144
|
+
INSULIN_PUMP_PATCH_PUMP = 0x02
|
|
1145
|
+
INSULIN_PEN = 0x03
|
|
1146
|
+
|
|
1147
|
+
class MedicationDeliverySubcategory(OpenIntEnum):
|
|
1148
|
+
GENERIC_MEDICATION_DELIVERY = 0x00
|
|
1149
|
+
|
|
1150
|
+
class SpirometerSubcategory(OpenIntEnum):
|
|
1151
|
+
GENERIC_SPIROMETER = 0x00
|
|
1152
|
+
HANDHELD_SPIROMETER = 0x01
|
|
1153
|
+
|
|
1154
|
+
class OutdoorSportsActivitySubcategory(OpenIntEnum):
|
|
1155
|
+
GENERIC_OUTDOOR_SPORTS_ACTIVITY = 0x00
|
|
1156
|
+
LOCATION_DISPLAY = 0x01
|
|
1157
|
+
LOCATION_AND_NAVIGATION_DISPLAY = 0x02
|
|
1158
|
+
LOCATION_POD = 0x03
|
|
1159
|
+
LOCATION_AND_NAVIGATION_POD = 0x04
|
|
1160
|
+
|
|
1161
|
+
class _OpenSubcategory(OpenIntEnum):
|
|
1162
|
+
GENERIC = 0x00
|
|
1163
|
+
|
|
1164
|
+
SUBCATEGORY_CLASSES = {
|
|
1165
|
+
Category.UNKNOWN: UnknownSubcategory,
|
|
1166
|
+
Category.PHONE: PhoneSubcategory,
|
|
1167
|
+
Category.COMPUTER: ComputerSubcategory,
|
|
1168
|
+
Category.WATCH: WatchSubcategory,
|
|
1169
|
+
Category.CLOCK: ClockSubcategory,
|
|
1170
|
+
Category.DISPLAY: DisplaySubcategory,
|
|
1171
|
+
Category.REMOTE_CONTROL: RemoteControlSubcategory,
|
|
1172
|
+
Category.EYE_GLASSES: EyeglassesSubcategory,
|
|
1173
|
+
Category.TAG: TagSubcategory,
|
|
1174
|
+
Category.KEYRING: KeyringSubcategory,
|
|
1175
|
+
Category.MEDIA_PLAYER: MediaPlayerSubcategory,
|
|
1176
|
+
Category.BARCODE_SCANNER: BarcodeScannerSubcategory,
|
|
1177
|
+
Category.THERMOMETER: ThermometerSubcategory,
|
|
1178
|
+
Category.HEART_RATE_SENSOR: HeartRateSensorSubcategory,
|
|
1179
|
+
Category.BLOOD_PRESSURE: BloodPressureSubcategory,
|
|
1180
|
+
Category.HUMAN_INTERFACE_DEVICE: HumanInterfaceDeviceSubcategory,
|
|
1181
|
+
Category.GLUCOSE_METER: GlucoseMeterSubcategory,
|
|
1182
|
+
Category.RUNNING_WALKING_SENSOR: RunningWalkingSensorSubcategory,
|
|
1183
|
+
Category.CYCLING: CyclingSubcategory,
|
|
1184
|
+
Category.CONTROL_DEVICE: ControlDeviceSubcategory,
|
|
1185
|
+
Category.NETWORK_DEVICE: NetworkDeviceSubcategory,
|
|
1186
|
+
Category.SENSOR: SensorSubcategory,
|
|
1187
|
+
Category.LIGHT_FIXTURES: LightFixturesSubcategory,
|
|
1188
|
+
Category.FAN: FanSubcategory,
|
|
1189
|
+
Category.HVAC: HvacSubcategory,
|
|
1190
|
+
Category.AIR_CONDITIONING: AirConditioningSubcategory,
|
|
1191
|
+
Category.HUMIDIFIER: HumidifierSubcategory,
|
|
1192
|
+
Category.HEATING: HeatingSubcategory,
|
|
1193
|
+
Category.ACCESS_CONTROL: AccessControlSubcategory,
|
|
1194
|
+
Category.MOTORIZED_DEVICE: MotorizedDeviceSubcategory,
|
|
1195
|
+
Category.POWER_DEVICE: PowerDeviceSubcategory,
|
|
1196
|
+
Category.LIGHT_SOURCE: LightSourceSubcategory,
|
|
1197
|
+
Category.WINDOW_COVERING: WindowCoveringSubcategory,
|
|
1198
|
+
Category.AUDIO_SINK: AudioSinkSubcategory,
|
|
1199
|
+
Category.AUDIO_SOURCE: AudioSourceSubcategory,
|
|
1200
|
+
Category.MOTORIZED_VEHICLE: MotorizedVehicleSubcategory,
|
|
1201
|
+
Category.DOMESTIC_APPLIANCE: DomesticApplianceSubcategory,
|
|
1202
|
+
Category.WEARABLE_AUDIO_DEVICE: WearableAudioDeviceSubcategory,
|
|
1203
|
+
Category.AIRCRAFT: AircraftSubcategory,
|
|
1204
|
+
Category.AV_EQUIPMENT: AvEquipmentSubcategory,
|
|
1205
|
+
Category.DISPLAY_EQUIPMENT: DisplayEquipmentSubcategory,
|
|
1206
|
+
Category.HEARING_AID: HearingAidSubcategory,
|
|
1207
|
+
Category.GAMING: GamingSubcategory,
|
|
1208
|
+
Category.SIGNAGE: SignageSubcategory,
|
|
1209
|
+
Category.PULSE_OXIMETER: PulseOximeterSubcategory,
|
|
1210
|
+
Category.WEIGHT_SCALE: WeightScaleSubcategory,
|
|
1211
|
+
Category.PERSONAL_MOBILITY_DEVICE: PersonalMobilityDeviceSubcategory,
|
|
1212
|
+
Category.CONTINUOUS_GLUCOSE_MONITOR: ContinuousGlucoseMonitorSubcategory,
|
|
1213
|
+
Category.INSULIN_PUMP: InsulinPumpSubcategory,
|
|
1214
|
+
Category.MEDICATION_DELIVERY: MedicationDeliverySubcategory,
|
|
1215
|
+
Category.SPIROMETER: SpirometerSubcategory,
|
|
1216
|
+
Category.OUTDOOR_SPORTS_ACTIVITY: OutdoorSportsActivitySubcategory,
|
|
1217
|
+
}
|
|
1218
|
+
|
|
1219
|
+
category: Category
|
|
1220
|
+
subcategory: enum.IntEnum
|
|
1221
|
+
|
|
1222
|
+
@classmethod
|
|
1223
|
+
def from_int(cls, appearance: int) -> Self:
|
|
1224
|
+
category = cls.Category(appearance >> 6)
|
|
1225
|
+
return cls(category, appearance & 0x3F)
|
|
1226
|
+
|
|
1227
|
+
def __init__(self, category: Category, subcategory: int) -> None:
|
|
1228
|
+
self.category = category
|
|
1229
|
+
if subcategory_class := self.SUBCATEGORY_CLASSES.get(category):
|
|
1230
|
+
self.subcategory = subcategory_class(subcategory)
|
|
1231
|
+
else:
|
|
1232
|
+
self.subcategory = self._OpenSubcategory(subcategory)
|
|
1233
|
+
|
|
1234
|
+
def __int__(self) -> int:
|
|
1235
|
+
return self.category << 6 | self.subcategory
|
|
1236
|
+
|
|
1237
|
+
def __repr__(self) -> str:
|
|
1238
|
+
return (
|
|
1239
|
+
'Appearance('
|
|
1240
|
+
f'category={self.category.name}, '
|
|
1241
|
+
f'subcategory={self.subcategory.name}'
|
|
1242
|
+
')'
|
|
1243
|
+
)
|
|
1244
|
+
|
|
1245
|
+
def __str__(self) -> str:
|
|
1246
|
+
return f'{self.category.name}/{self.subcategory.name}'
|
|
1247
|
+
|
|
1248
|
+
|
|
695
1249
|
# -----------------------------------------------------------------------------
|
|
696
1250
|
# Advertising Data
|
|
697
1251
|
# -----------------------------------------------------------------------------
|
|
698
|
-
|
|
699
|
-
List[UUID],
|
|
1252
|
+
AdvertisingDataObject = Union[
|
|
1253
|
+
List[UUID],
|
|
1254
|
+
Tuple[UUID, bytes],
|
|
1255
|
+
bytes,
|
|
1256
|
+
str,
|
|
1257
|
+
int,
|
|
1258
|
+
Tuple[int, int],
|
|
1259
|
+
Tuple[int, bytes],
|
|
1260
|
+
Appearance,
|
|
700
1261
|
]
|
|
701
1262
|
|
|
702
1263
|
|
|
@@ -704,109 +1265,115 @@ class AdvertisingData:
|
|
|
704
1265
|
# fmt: off
|
|
705
1266
|
# pylint: disable=line-too-long
|
|
706
1267
|
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
1268
|
+
FLAGS = 0x01
|
|
1269
|
+
INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS = 0x02
|
|
1270
|
+
COMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS = 0x03
|
|
1271
|
+
INCOMPLETE_LIST_OF_32_BIT_SERVICE_CLASS_UUIDS = 0x04
|
|
1272
|
+
COMPLETE_LIST_OF_32_BIT_SERVICE_CLASS_UUIDS = 0x05
|
|
1273
|
+
INCOMPLETE_LIST_OF_128_BIT_SERVICE_CLASS_UUIDS = 0x06
|
|
1274
|
+
COMPLETE_LIST_OF_128_BIT_SERVICE_CLASS_UUIDS = 0x07
|
|
1275
|
+
SHORTENED_LOCAL_NAME = 0x08
|
|
1276
|
+
COMPLETE_LOCAL_NAME = 0x09
|
|
1277
|
+
TX_POWER_LEVEL = 0x0A
|
|
1278
|
+
CLASS_OF_DEVICE = 0x0D
|
|
1279
|
+
SIMPLE_PAIRING_HASH_C = 0x0E
|
|
1280
|
+
SIMPLE_PAIRING_HASH_C_192 = 0x0E
|
|
1281
|
+
SIMPLE_PAIRING_RANDOMIZER_R = 0x0F
|
|
1282
|
+
SIMPLE_PAIRING_RANDOMIZER_R_192 = 0x0F
|
|
1283
|
+
DEVICE_ID = 0x10
|
|
1284
|
+
SECURITY_MANAGER_TK_VALUE = 0x10
|
|
1285
|
+
SECURITY_MANAGER_OUT_OF_BAND_FLAGS = 0x11
|
|
1286
|
+
PERIPHERAL_CONNECTION_INTERVAL_RANGE = 0x12
|
|
1287
|
+
LIST_OF_16_BIT_SERVICE_SOLICITATION_UUIDS = 0x14
|
|
1288
|
+
LIST_OF_128_BIT_SERVICE_SOLICITATION_UUIDS = 0x15
|
|
1289
|
+
SERVICE_DATA = 0x16
|
|
1290
|
+
SERVICE_DATA_16_BIT_UUID = 0x16
|
|
1291
|
+
PUBLIC_TARGET_ADDRESS = 0x17
|
|
1292
|
+
RANDOM_TARGET_ADDRESS = 0x18
|
|
1293
|
+
APPEARANCE = 0x19
|
|
1294
|
+
ADVERTISING_INTERVAL = 0x1A
|
|
1295
|
+
LE_BLUETOOTH_DEVICE_ADDRESS = 0x1B
|
|
1296
|
+
LE_ROLE = 0x1C
|
|
1297
|
+
SIMPLE_PAIRING_HASH_C_256 = 0x1D
|
|
1298
|
+
SIMPLE_PAIRING_RANDOMIZER_R_256 = 0x1E
|
|
1299
|
+
LIST_OF_32_BIT_SERVICE_SOLICITATION_UUIDS = 0x1F
|
|
1300
|
+
SERVICE_DATA_32_BIT_UUID = 0x20
|
|
1301
|
+
SERVICE_DATA_128_BIT_UUID = 0x21
|
|
1302
|
+
LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE = 0x22
|
|
1303
|
+
LE_SECURE_CONNECTIONS_RANDOM_VALUE = 0x23
|
|
1304
|
+
URI = 0x24
|
|
1305
|
+
INDOOR_POSITIONING = 0x25
|
|
1306
|
+
TRANSPORT_DISCOVERY_DATA = 0x26
|
|
1307
|
+
LE_SUPPORTED_FEATURES = 0x27
|
|
1308
|
+
CHANNEL_MAP_UPDATE_INDICATION = 0x28
|
|
1309
|
+
PB_ADV = 0x29
|
|
1310
|
+
MESH_MESSAGE = 0x2A
|
|
1311
|
+
MESH_BEACON = 0x2B
|
|
1312
|
+
BIGINFO = 0x2C
|
|
1313
|
+
BROADCAST_CODE = 0x2D
|
|
1314
|
+
RESOLVABLE_SET_IDENTIFIER = 0x2E
|
|
1315
|
+
ADVERTISING_INTERVAL_LONG = 0x2F
|
|
1316
|
+
BROADCAST_NAME = 0x30
|
|
1317
|
+
ENCRYPTED_ADVERTISING_DATA = 0X31
|
|
1318
|
+
PERIODIC_ADVERTISING_RESPONSE_TIMING_INFORMATION = 0X32
|
|
1319
|
+
ELECTRONIC_SHELF_LABEL = 0X34
|
|
1320
|
+
THREE_D_INFORMATION_DATA = 0x3D
|
|
1321
|
+
MANUFACTURER_SPECIFIC_DATA = 0xFF
|
|
758
1322
|
|
|
759
1323
|
AD_TYPE_NAMES = {
|
|
760
|
-
FLAGS:
|
|
761
|
-
INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS:
|
|
762
|
-
COMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS:
|
|
763
|
-
INCOMPLETE_LIST_OF_32_BIT_SERVICE_CLASS_UUIDS:
|
|
764
|
-
COMPLETE_LIST_OF_32_BIT_SERVICE_CLASS_UUIDS:
|
|
765
|
-
INCOMPLETE_LIST_OF_128_BIT_SERVICE_CLASS_UUIDS:
|
|
766
|
-
COMPLETE_LIST_OF_128_BIT_SERVICE_CLASS_UUIDS:
|
|
767
|
-
SHORTENED_LOCAL_NAME:
|
|
768
|
-
COMPLETE_LOCAL_NAME:
|
|
769
|
-
TX_POWER_LEVEL:
|
|
770
|
-
CLASS_OF_DEVICE:
|
|
771
|
-
SIMPLE_PAIRING_HASH_C:
|
|
772
|
-
SIMPLE_PAIRING_HASH_C_192:
|
|
773
|
-
SIMPLE_PAIRING_RANDOMIZER_R:
|
|
774
|
-
SIMPLE_PAIRING_RANDOMIZER_R_192:
|
|
775
|
-
DEVICE_ID:
|
|
776
|
-
SECURITY_MANAGER_TK_VALUE:
|
|
777
|
-
SECURITY_MANAGER_OUT_OF_BAND_FLAGS:
|
|
778
|
-
PERIPHERAL_CONNECTION_INTERVAL_RANGE:
|
|
779
|
-
LIST_OF_16_BIT_SERVICE_SOLICITATION_UUIDS:
|
|
780
|
-
LIST_OF_128_BIT_SERVICE_SOLICITATION_UUIDS:
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
1324
|
+
FLAGS: 'FLAGS',
|
|
1325
|
+
INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS: 'INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS',
|
|
1326
|
+
COMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS: 'COMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS',
|
|
1327
|
+
INCOMPLETE_LIST_OF_32_BIT_SERVICE_CLASS_UUIDS: 'INCOMPLETE_LIST_OF_32_BIT_SERVICE_CLASS_UUIDS',
|
|
1328
|
+
COMPLETE_LIST_OF_32_BIT_SERVICE_CLASS_UUIDS: 'COMPLETE_LIST_OF_32_BIT_SERVICE_CLASS_UUIDS',
|
|
1329
|
+
INCOMPLETE_LIST_OF_128_BIT_SERVICE_CLASS_UUIDS: 'INCOMPLETE_LIST_OF_128_BIT_SERVICE_CLASS_UUIDS',
|
|
1330
|
+
COMPLETE_LIST_OF_128_BIT_SERVICE_CLASS_UUIDS: 'COMPLETE_LIST_OF_128_BIT_SERVICE_CLASS_UUIDS',
|
|
1331
|
+
SHORTENED_LOCAL_NAME: 'SHORTENED_LOCAL_NAME',
|
|
1332
|
+
COMPLETE_LOCAL_NAME: 'COMPLETE_LOCAL_NAME',
|
|
1333
|
+
TX_POWER_LEVEL: 'TX_POWER_LEVEL',
|
|
1334
|
+
CLASS_OF_DEVICE: 'CLASS_OF_DEVICE',
|
|
1335
|
+
SIMPLE_PAIRING_HASH_C: 'SIMPLE_PAIRING_HASH_C',
|
|
1336
|
+
SIMPLE_PAIRING_HASH_C_192: 'SIMPLE_PAIRING_HASH_C_192',
|
|
1337
|
+
SIMPLE_PAIRING_RANDOMIZER_R: 'SIMPLE_PAIRING_RANDOMIZER_R',
|
|
1338
|
+
SIMPLE_PAIRING_RANDOMIZER_R_192: 'SIMPLE_PAIRING_RANDOMIZER_R_192',
|
|
1339
|
+
DEVICE_ID: 'DEVICE_ID',
|
|
1340
|
+
SECURITY_MANAGER_TK_VALUE: 'SECURITY_MANAGER_TK_VALUE',
|
|
1341
|
+
SECURITY_MANAGER_OUT_OF_BAND_FLAGS: 'SECURITY_MANAGER_OUT_OF_BAND_FLAGS',
|
|
1342
|
+
PERIPHERAL_CONNECTION_INTERVAL_RANGE: 'PERIPHERAL_CONNECTION_INTERVAL_RANGE',
|
|
1343
|
+
LIST_OF_16_BIT_SERVICE_SOLICITATION_UUIDS: 'LIST_OF_16_BIT_SERVICE_SOLICITATION_UUIDS',
|
|
1344
|
+
LIST_OF_128_BIT_SERVICE_SOLICITATION_UUIDS: 'LIST_OF_128_BIT_SERVICE_SOLICITATION_UUIDS',
|
|
1345
|
+
SERVICE_DATA_16_BIT_UUID: 'SERVICE_DATA_16_BIT_UUID',
|
|
1346
|
+
PUBLIC_TARGET_ADDRESS: 'PUBLIC_TARGET_ADDRESS',
|
|
1347
|
+
RANDOM_TARGET_ADDRESS: 'RANDOM_TARGET_ADDRESS',
|
|
1348
|
+
APPEARANCE: 'APPEARANCE',
|
|
1349
|
+
ADVERTISING_INTERVAL: 'ADVERTISING_INTERVAL',
|
|
1350
|
+
LE_BLUETOOTH_DEVICE_ADDRESS: 'LE_BLUETOOTH_DEVICE_ADDRESS',
|
|
1351
|
+
LE_ROLE: 'LE_ROLE',
|
|
1352
|
+
SIMPLE_PAIRING_HASH_C_256: 'SIMPLE_PAIRING_HASH_C_256',
|
|
1353
|
+
SIMPLE_PAIRING_RANDOMIZER_R_256: 'SIMPLE_PAIRING_RANDOMIZER_R_256',
|
|
1354
|
+
LIST_OF_32_BIT_SERVICE_SOLICITATION_UUIDS: 'LIST_OF_32_BIT_SERVICE_SOLICITATION_UUIDS',
|
|
1355
|
+
SERVICE_DATA_32_BIT_UUID: 'SERVICE_DATA_32_BIT_UUID',
|
|
1356
|
+
SERVICE_DATA_128_BIT_UUID: 'SERVICE_DATA_128_BIT_UUID',
|
|
1357
|
+
LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE: 'LE_SECURE_CONNECTIONS_CONFIRMATION_VALUE',
|
|
1358
|
+
LE_SECURE_CONNECTIONS_RANDOM_VALUE: 'LE_SECURE_CONNECTIONS_RANDOM_VALUE',
|
|
1359
|
+
URI: 'URI',
|
|
1360
|
+
INDOOR_POSITIONING: 'INDOOR_POSITIONING',
|
|
1361
|
+
TRANSPORT_DISCOVERY_DATA: 'TRANSPORT_DISCOVERY_DATA',
|
|
1362
|
+
LE_SUPPORTED_FEATURES: 'LE_SUPPORTED_FEATURES',
|
|
1363
|
+
CHANNEL_MAP_UPDATE_INDICATION: 'CHANNEL_MAP_UPDATE_INDICATION',
|
|
1364
|
+
PB_ADV: 'PB_ADV',
|
|
1365
|
+
MESH_MESSAGE: 'MESH_MESSAGE',
|
|
1366
|
+
MESH_BEACON: 'MESH_BEACON',
|
|
1367
|
+
BIGINFO: 'BIGINFO',
|
|
1368
|
+
BROADCAST_CODE: 'BROADCAST_CODE',
|
|
1369
|
+
RESOLVABLE_SET_IDENTIFIER: 'RESOLVABLE_SET_IDENTIFIER',
|
|
1370
|
+
ADVERTISING_INTERVAL_LONG: 'ADVERTISING_INTERVAL_LONG',
|
|
1371
|
+
BROADCAST_NAME: 'BROADCAST_NAME',
|
|
1372
|
+
ENCRYPTED_ADVERTISING_DATA: 'ENCRYPTED_ADVERTISING_DATA',
|
|
1373
|
+
PERIODIC_ADVERTISING_RESPONSE_TIMING_INFORMATION: 'PERIODIC_ADVERTISING_RESPONSE_TIMING_INFORMATION',
|
|
1374
|
+
ELECTRONIC_SHELF_LABEL: 'ELECTRONIC_SHELF_LABEL',
|
|
1375
|
+
THREE_D_INFORMATION_DATA: 'THREE_D_INFORMATION_DATA',
|
|
1376
|
+
MANUFACTURER_SPECIFIC_DATA: 'MANUFACTURER_SPECIFIC_DATA'
|
|
810
1377
|
}
|
|
811
1378
|
|
|
812
1379
|
LE_LIMITED_DISCOVERABLE_MODE_FLAG = 0x01
|
|
@@ -915,7 +1482,11 @@ class AdvertisingData:
|
|
|
915
1482
|
ad_data_str = f'company={company_name}, data={ad_data[2:].hex()}'
|
|
916
1483
|
elif ad_type == AdvertisingData.APPEARANCE:
|
|
917
1484
|
ad_type_str = 'Appearance'
|
|
918
|
-
|
|
1485
|
+
appearance = Appearance.from_int(struct.unpack_from('<H', ad_data, 0)[0])
|
|
1486
|
+
ad_data_str = str(appearance)
|
|
1487
|
+
elif ad_type == AdvertisingData.BROADCAST_NAME:
|
|
1488
|
+
ad_type_str = 'Broadcast Name'
|
|
1489
|
+
ad_data_str = ad_data.decode('utf-8')
|
|
919
1490
|
else:
|
|
920
1491
|
ad_type_str = AdvertisingData.AD_TYPE_NAMES.get(ad_type, f'0x{ad_type:02X}')
|
|
921
1492
|
ad_data_str = ad_data.hex()
|
|
@@ -924,7 +1495,7 @@ class AdvertisingData:
|
|
|
924
1495
|
|
|
925
1496
|
# pylint: disable=too-many-return-statements
|
|
926
1497
|
@staticmethod
|
|
927
|
-
def ad_data_to_object(ad_type: int, ad_data: bytes) ->
|
|
1498
|
+
def ad_data_to_object(ad_type: int, ad_data: bytes) -> AdvertisingDataObject:
|
|
928
1499
|
if ad_type in (
|
|
929
1500
|
AdvertisingData.COMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS,
|
|
930
1501
|
AdvertisingData.INCOMPLETE_LIST_OF_16_BIT_SERVICE_CLASS_UUIDS,
|
|
@@ -959,16 +1530,14 @@ class AdvertisingData:
|
|
|
959
1530
|
AdvertisingData.SHORTENED_LOCAL_NAME,
|
|
960
1531
|
AdvertisingData.COMPLETE_LOCAL_NAME,
|
|
961
1532
|
AdvertisingData.URI,
|
|
1533
|
+
AdvertisingData.BROADCAST_NAME,
|
|
962
1534
|
):
|
|
963
1535
|
return ad_data.decode("utf-8")
|
|
964
1536
|
|
|
965
1537
|
if ad_type in (AdvertisingData.TX_POWER_LEVEL, AdvertisingData.FLAGS):
|
|
966
1538
|
return cast(int, struct.unpack('B', ad_data)[0])
|
|
967
1539
|
|
|
968
|
-
if ad_type in (
|
|
969
|
-
AdvertisingData.APPEARANCE,
|
|
970
|
-
AdvertisingData.ADVERTISING_INTERVAL,
|
|
971
|
-
):
|
|
1540
|
+
if ad_type in (AdvertisingData.ADVERTISING_INTERVAL,):
|
|
972
1541
|
return cast(int, struct.unpack('<H', ad_data)[0])
|
|
973
1542
|
|
|
974
1543
|
if ad_type == AdvertisingData.CLASS_OF_DEVICE:
|
|
@@ -980,6 +1549,11 @@ class AdvertisingData:
|
|
|
980
1549
|
if ad_type == AdvertisingData.MANUFACTURER_SPECIFIC_DATA:
|
|
981
1550
|
return (cast(int, struct.unpack_from('<H', ad_data, 0)[0]), ad_data[2:])
|
|
982
1551
|
|
|
1552
|
+
if ad_type == AdvertisingData.APPEARANCE:
|
|
1553
|
+
return Appearance.from_int(
|
|
1554
|
+
cast(int, struct.unpack_from('<H', ad_data, 0)[0])
|
|
1555
|
+
)
|
|
1556
|
+
|
|
983
1557
|
return ad_data
|
|
984
1558
|
|
|
985
1559
|
def append(self, data: bytes) -> None:
|
|
@@ -993,27 +1567,27 @@ class AdvertisingData:
|
|
|
993
1567
|
self.ad_structures.append((ad_type, ad_data))
|
|
994
1568
|
offset += length
|
|
995
1569
|
|
|
996
|
-
def get_all(self, type_id: int, raw: bool = False) -> List[
|
|
1570
|
+
def get_all(self, type_id: int, raw: bool = False) -> List[AdvertisingDataObject]:
|
|
997
1571
|
'''
|
|
998
1572
|
Get Advertising Data Structure(s) with a given type
|
|
999
1573
|
|
|
1000
1574
|
Returns a (possibly empty) list of matches.
|
|
1001
1575
|
'''
|
|
1002
1576
|
|
|
1003
|
-
def process_ad_data(ad_data: bytes) ->
|
|
1577
|
+
def process_ad_data(ad_data: bytes) -> AdvertisingDataObject:
|
|
1004
1578
|
return ad_data if raw else self.ad_data_to_object(type_id, ad_data)
|
|
1005
1579
|
|
|
1006
1580
|
return [process_ad_data(ad[1]) for ad in self.ad_structures if ad[0] == type_id]
|
|
1007
1581
|
|
|
1008
|
-
def get(self, type_id: int, raw: bool = False) -> Optional[
|
|
1582
|
+
def get(self, type_id: int, raw: bool = False) -> Optional[AdvertisingDataObject]:
|
|
1009
1583
|
'''
|
|
1010
1584
|
Get Advertising Data Structure(s) with a given type
|
|
1011
1585
|
|
|
1012
1586
|
Returns the first entry, or None if no structure matches.
|
|
1013
1587
|
'''
|
|
1014
1588
|
|
|
1015
|
-
|
|
1016
|
-
return
|
|
1589
|
+
all_objects = self.get_all(type_id, raw=raw)
|
|
1590
|
+
return all_objects[0] if all_objects else None
|
|
1017
1591
|
|
|
1018
1592
|
def __bytes__(self):
|
|
1019
1593
|
return b''.join(
|