diff --git a/404.html b/404.html index bb2dc430..2163212f 100644 --- a/404.html +++ b/404.html @@ -839,8 +839,8 @@
  • - - Link Relay + + Bench
  • @@ -945,6 +945,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1195,7 +1209,7 @@ diff --git a/api/examples.html b/api/examples.html index dfecbef9..ba213b16 100644 --- a/api/examples.html +++ b/api/examples.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/api/guide.html b/api/guide.html index bd7c72ab..ac0eca45 100644 --- a/api/guide.html +++ b/api/guide.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/api/reference.html b/api/reference.html index 60a564be..fe91569b 100644 --- a/api/reference.html +++ b/api/reference.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1219,13 +1233,7 @@ address[0] is the LSB of the address, address[5] is the MSB.

    Source code in bumble/hci.py -
    1674
    -1675
    -1676
    -1677
    -1678
    -1679
    -1680
    +          
    1680
     1681
     1682
     1683
    @@ -1349,7 +1357,20 @@ address[0] is the LSB of the address, address[5] is the MSB.

    1801 1802 1803 -1804
    class Address:
    +1804
    +1805
    +1806
    +1807
    +1808
    +1809
    +1810
    +1811
    +1812
    +1813
    +1814
    +1815
    +1816
    +1817
    class Address:
         '''
         Bluetooth Address (see Bluetooth spec Vol 6, Part B - 1.3 DEVICE ADDRESS)
         NOTE: the address bytes are stored in little-endian byte order here, so
    @@ -1368,6 +1389,11 @@ address[0] is the LSB of the address, address[5] is the MSB.

    RANDOM_IDENTITY_ADDRESS: 'RANDOM_IDENTITY_ADDRESS', } + # Type declarations + NIL: Address + ANY: Address + ANY_RANDOM: Address + # pylint: disable-next=unnecessary-lambda ADDRESS_TYPE_SPEC = {'size': 1, 'mapper': lambda x: Address.address_type_name(x)} @@ -1400,7 +1426,9 @@ address[0] is the LSB of the address, address[5] is the MSB.

    address_type = data[offset - 1] return Address.parse_address_with_type(data, offset, address_type) - def __init__(self, address, address_type=RANDOM_DEVICE_ADDRESS): + def __init__( + self, address: Union[bytes, str], address_type: int = RANDOM_DEVICE_ADDRESS + ): ''' Initialize an instance. `address` may be a byte array in little-endian format, or a hex string in big-endian format (with optional ':' @@ -1515,18 +1543,7 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    Source code in bumble/hci.py -
    1725
    -1726
    -1727
    -1728
    -1729
    -1730
    -1731
    -1732
    -1733
    -1734
    -1735
    -1736
    +        
    1736
     1737
     1738
     1739
    @@ -1539,7 +1556,22 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    1746 1747 1748 -1749
    def __init__(self, address, address_type=RANDOM_DEVICE_ADDRESS):
    +1749
    +1750
    +1751
    +1752
    +1753
    +1754
    +1755
    +1756
    +1757
    +1758
    +1759
    +1760
    +1761
    +1762
    def __init__(
    +    self, address: Union[bytes, str], address_type: int = RANDOM_DEVICE_ADDRESS
    +):
         '''
         Initialize an instance. `address` may be a byte array in little-endian
         format, or a hex string in big-endian format (with optional ':'
    @@ -1586,14 +1618,14 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    Source code in bumble/hci.py -
    1797
    -1798
    -1799
    -1800
    -1801
    -1802
    -1803
    -1804
    def __str__(self):
    +        
    1810
    +1811
    +1812
    +1813
    +1814
    +1815
    +1816
    +1817
    def __str__(self):
         '''
         String representation of the address, MSB first
         '''
    @@ -1628,21 +1660,7 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    Source code in bumble/hci.py -
    1834
    -1835
    -1836
    -1837
    -1838
    -1839
    -1840
    -1841
    -1842
    -1843
    -1844
    -1845
    -1846
    -1847
    -1848
    +          
    1848
     1849
     1850
     1851
    @@ -1652,11 +1670,32 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    1855 1856 1857 -1858
    class HCI_Packet:
    +1858
    +1859
    +1860
    +1861
    +1862
    +1863
    +1864
    +1865
    +1866
    +1867
    +1868
    +1869
    +1870
    +1871
    +1872
    +1873
    +1874
    +1875
    +1876
    +1877
    class HCI_Packet:
         '''
         Abstract Base class for HCI packets
         '''
     
    +    hci_packet_type: int
    +
         @staticmethod
         def from_bytes(packet):
             packet_type = packet[0]
    @@ -1675,6 +1714,9 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    def __init__(self, name): self.name = name + def __bytes__(self) -> bytes: + raise NotImplementedError + def __repr__(self) -> str: return self.name
    @@ -1716,29 +1758,7 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    Source code in bumble/hci.py -
    1870
    -1871
    -1872
    -1873
    -1874
    -1875
    -1876
    -1877
    -1878
    -1879
    -1880
    -1881
    -1882
    -1883
    -1884
    -1885
    -1886
    -1887
    -1888
    -1889
    -1890
    -1891
    -1892
    +          
    1892
     1893
     1894
     1895
    @@ -1812,13 +1832,35 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    1963 1964 1965 -1966
    class HCI_Command(HCI_Packet):
    +1966
    +1967
    +1968
    +1969
    +1970
    +1971
    +1972
    +1973
    +1974
    +1975
    +1976
    +1977
    +1978
    +1979
    +1980
    +1981
    +1982
    +1983
    +1984
    +1985
    +1986
    +1987
    +1988
    class HCI_Command(HCI_Packet):
         '''
         See Bluetooth spec @ Vol 2, Part E - 5.4.1 HCI Command Packet
         '''
     
         hci_packet_type = HCI_COMMAND_PACKET
    -    command_classes = {}
    +    command_classes: Dict[int, Type[HCI_Command]] = {}
     
         @staticmethod
         def command(fields=(), return_parameters_fields=()):
    @@ -1944,34 +1986,34 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    Source code in bumble/hci.py -
    1878
    -1879
    -1880
    -1881
    -1882
    -1883
    -1884
    -1885
    -1886
    -1887
    -1888
    -1889
    -1890
    -1891
    -1892
    -1893
    -1894
    -1895
    -1896
    -1897
    -1898
    -1899
    -1900
    +        
    1900
     1901
     1902
     1903
     1904
    -1905
    @staticmethod
    +1905
    +1906
    +1907
    +1908
    +1909
    +1910
    +1911
    +1912
    +1913
    +1914
    +1915
    +1916
    +1917
    +1918
    +1919
    +1920
    +1921
    +1922
    +1923
    +1924
    +1925
    +1926
    +1927
    @staticmethod
     def command(fields=(), return_parameters_fields=()):
         '''
         Decorator used to declare and register subclasses
    @@ -2028,16 +2070,16 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    Source code in bumble/hci.py -
    2009
    -2010
    -2011
    -2012
    -2013
    -2014
    -2015
    -2016
    -2017
    -2018
    @HCI_Command.command(
    +          
    2031
    +2032
    +2033
    +2034
    +2035
    +2036
    +2037
    +2038
    +2039
    +2040
    @HCI_Command.command(
         [
             ('connection_handle', 2),
             ('reason', {'size': 1, 'mapper': HCI_Constant.error_name}),
    @@ -2108,7 +2150,7 @@ the type is set to PUBLIC_DEVICE_ADDRESS.

    diff --git a/apps_and_tools/bench.html b/apps_and_tools/bench.html new file mode 100644 index 00000000..0408f8eb --- /dev/null +++ b/apps_and_tools/bench.html @@ -0,0 +1,1451 @@ + + + + + + + + + + + + + + + + Bench - Bumble + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    + +
    + + + + +
    + + +
    + +
    + + + + + + +
    +
    + + + +
    +
    +
    + + + + +
    +
    +
    + + + +
    +
    +
    + + + +
    +
    +
    + + +
    +
    + + + + +

    BENCH TOOL

    +

    The "bench" tool implements a number of different ways of measuring the +throughput and/or latency between two devices.

    +

    General Usage

    +
    Usage: bench.py [OPTIONS] COMMAND [ARGS]...
    +
    +Options:
    +  --device-config FILENAME        Device configuration file
    +  --role [sender|receiver|ping|pong]
    +  --mode [gatt-client|gatt-server|l2cap-client|l2cap-server|rfcomm-client|rfcomm-server]
    +  --att-mtu MTU                   GATT MTU (gatt-client mode)  [23<=x<=517]
    +  -s, --packet-size SIZE          Packet size (server role)  [8<=x<=4096]
    +  -c, --packet-count COUNT        Packet count (server role)
    +  -sd, --start-delay SECONDS      Start delay (server role)
    +  --help                          Show this message and exit.
    +
    +Commands:
    +  central     Run as a central (initiates the connection)
    +  peripheral  Run as a peripheral (waits for a connection)
    +
    +

    Options for the central Command

    +
    Usage: bumble-bench central [OPTIONS] TRANSPORT
    +
    +  Run as a central (initiates the connection)
    +
    +Options:
    +  --peripheral ADDRESS_OR_NAME    Address or name to connect to
    +  --connection-interval, --ci CONNECTION_INTERVAL
    +                                  Connection interval (in ms)
    +  --phy [1m|2m|coded]             PHY to use
    +  --help                          Show this message and exit.
    +
    +

    To test once device against another, one of the two devices must be running +the peripheral command and the other the central command. The device +running the peripheral command will accept connections from the device +running the central command. +When using Bluetooth LE (all modes except for rfcomm-server and rfcomm-clientutils), +the default addresses configured in the tool should be sufficient. But when using +Bluetooth Classic, the address of the Peripheral must be specified on the Central +using the --peripheral option. The address will be printed by the Peripheral when +it starts.

    +

    Independently of whether the device is the Central or Peripheral, each device selects a +mode and and role to run as. The mode and role of the Central and Peripheral +must be compatible.

    + + + + + + + + + + + + + + + + + + + + + +
    Device 1 modeDevice 2 mode
    gatt-clientgatt-server
    l2cap-clientl2cap-server
    rfcomm-clientrfcomm-server
    + + + + + + + + + + + + + + + + + +
    Device 1 roleDevice 2 role
    senderreceiver
    pingpong
    +

    Examples

    +

    In the following examples, we have two USB Bluetooth controllers, one on usb:0 and +the other on usb:1, and two consoles/terminals. We will run a command in each.

    +
    +

    GATT Throughput

    +

    Using the default mode and role for the Central and Peripheral.

    +

    In the first console/terminal: +

    $ bumble-bench peripheral usb:0
    +

    +

    In the second console/terminal: +

    $ bumble-bench central usb:1
    +

    +

    In this default configuration, the Central runs a Sender, as a GATT client, +connecting to the Peripheral running a Receiver, as a GATT server.

    +
    +
    +

    L2CAP Throughput

    +

    In the first console/terminal: +

    $ bumble-bench --mode l2cap-server peripheral usb:0
    +

    +

    In the second console/terminal: +

    $ bumble-bench --mode l2cap-client central usb:1
    +

    +
    +
    +

    RFComm Throughput

    +

    In the first console/terminal: +

    $ bumble-bench --mode rfcomm-server peripheral usb:0
    +

    +

    NOTE: the BT address of the Peripheral will be printed out, use it with the +--peripheral option for the Central.

    +

    In this example, we use a larger packet size and packet count than the default.

    +

    In the second console/terminal: +

    $ bumble-bench --mode rfcomm-client --packet-size 2000 --packet-count 100 central --peripheral 00:16:A4:5A:40:F2 usb:1
    +

    +
    +
    +

    Ping/Pong Latency

    +

    In the first console/terminal: +

    $ bumble-bench --role pong peripheral usb:0
    +

    +

    In the second console/terminal: +

    $ bumble-bench --role ping central usb:1
    +

    +
    +
    +

    Reversed modes with GATT and custom connection interval

    +

    In the first console/terminal: +

    $ bumble-bench --mode gatt-client peripheral usb:0
    +

    +

    In the second console/terminal: +

    $ bumble-bench --mode gatt-server central --ci 10 usb:1
    +

    +
    +
    +

    Reversed modes with L2CAP and custom PHY

    +

    In the first console/terminal: +

    $ bumble-bench --mode l2cap-client peripheral usb:0
    +

    +

    In the second console/terminal: +

    $ bumble-bench --mode l2cap-server central --phy 2m usb:1
    +

    +
    +
    +

    Reversed roles with L2CAP

    +

    In the first console/terminal: +

    $ bumble-bench --mode l2cap-client --role sender peripheral usb:0
    +

    +

    In the second console/terminal: +

    $ bumble-bench --mode l2cap-server --role receiver central usb:1
    +

    +
    + + + + + +
    + +
    +
    + +
    + + + + +
    +
    +
    +
    + + + + + + + + + \ No newline at end of file diff --git a/apps_and_tools/console.html b/apps_and_tools/console.html index 0f7bafba..9f2b8022 100644 --- a/apps_and_tools/console.html +++ b/apps_and_tools/console.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1261,13 +1275,13 @@ -
  • - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/apps_and_tools/gg_bridge.html b/apps_and_tools/gg_bridge.html index 7d871db3..bfc6eddd 100644 --- a/apps_and_tools/gg_bridge.html +++ b/apps_and_tools/gg_bridge.html @@ -846,8 +846,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/apps_and_tools/hci_bridge.html b/apps_and_tools/hci_bridge.html index 345b1aff..6d2dbe27 100644 --- a/apps_and_tools/hci_bridge.html +++ b/apps_and_tools/hci_bridge.html @@ -846,8 +846,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1243,7 +1257,7 @@ a Bluetooth host, and we are connecting it to a virtual controller attached to a @@ -1280,7 +1294,7 @@ a Bluetooth host, and we are connecting it to a virtual controller attached to a diff --git a/apps_and_tools/index.html b/apps_and_tools/index.html index 99f62fd3..2fdbf7c3 100644 --- a/apps_and_tools/index.html +++ b/apps_and_tools/index.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1205,6 +1219,7 @@ These include:

    • Console - an interactive text-based console
    • +
    • Bench - Speed and Latency benchmarking between two devices (LE and Classic)
    • Pair - Pair/bond two devices (LE and Classic)
    • Unbond - Remove a previously established bond
    • HCI Bridge - a HCI transport bridge to connect two HCI transports and filter/snoop the HCI packets
    • @@ -1267,7 +1282,7 @@ These include:

      diff --git a/apps_and_tools/link_relay.html b/apps_and_tools/link_relay.html index 129f2a58..b335992e 100644 --- a/apps_and_tools/link_relay.html +++ b/apps_and_tools/link_relay.html @@ -844,21 +844,11 @@ - - -
    • - - - - - - - - - Link Relay +
    • + + Bench -
    • @@ -962,6 +952,30 @@ + + + + + + + +
    • + + + + + + + + + Link Relay + + +
    • + + + +
    @@ -1244,7 +1258,7 @@ The moniker syntax is: link-relay:ws://<hostname>/<room>
    -
  • - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/apps_and_tools/show.html b/apps_and_tools/show.html index d7c73f38..005facf2 100644 --- a/apps_and_tools/show.html +++ b/apps_and_tools/show.html @@ -846,8 +846,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/apps_and_tools/unbond.html b/apps_and_tools/unbond.html index 333d1ad6..dfb36ab0 100644 --- a/apps_and_tools/unbond.html +++ b/apps_and_tools/unbond.html @@ -846,8 +846,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/apps_and_tools/usb_probe.html b/apps_and_tools/usb_probe.html index 2898b0a7..8c1a6879 100644 --- a/apps_and_tools/usb_probe.html +++ b/apps_and_tools/usb_probe.html @@ -846,8 +846,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1317,13 +1331,13 @@ Product: USB2.0-BT -
  • - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/components/gatt.html b/components/gatt.html index 0074ca2c..b0425f70 100644 --- a/components/gatt.html +++ b/components/gatt.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/components/host.html b/components/host.html index 6e3a1d97..ec25e47b 100644 --- a/components/host.html +++ b/components/host.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/components/security_manager.html b/components/security_manager.html index bfedb0a7..b2c10ac8 100644 --- a/components/security_manager.html +++ b/components/security_manager.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1256,7 +1270,7 @@ diff --git a/development/code_style.html b/development/code_style.html index e535d54e..6d5405b0 100644 --- a/development/code_style.html +++ b/development/code_style.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1286,7 +1300,7 @@ You may want to configure your own environment to "format on save" with bl diff --git a/development/contributing.html b/development/contributing.html index 51592de4..dbdcb04f 100644 --- a/development/contributing.html +++ b/development/contributing.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1261,7 +1275,7 @@ To run the basic checks (essentially: running the tests, the linter, and the for diff --git a/development/python_environments.html b/development/python_environments.html index 614d7c8e..6f26b0f4 100644 --- a/development/python_environments.html +++ b/development/python_environments.html @@ -921,8 +921,8 @@
  • - - Link Relay + + Bench
  • @@ -1027,6 +1027,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1399,7 +1413,7 @@ This will create a new environment, named bumble, which you can the diff --git a/examples/index.html b/examples/index.html index db67ab61..b6a91389 100644 --- a/examples/index.html +++ b/examples/index.html @@ -844,8 +844,8 @@
  • - - Link Relay + + Bench
  • @@ -950,6 +950,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1629,7 +1643,7 @@ for those characteristics at regular intervals.

    diff --git a/getting_started.html b/getting_started.html index c145e606..7dfc5d67 100644 --- a/getting_started.html +++ b/getting_started.html @@ -854,8 +854,8 @@
  • - - Link Relay + + Bench
  • @@ -960,6 +960,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1328,7 +1342,7 @@ details on interfacing with either hardware modules or virtual controllers over diff --git a/hardware/index.html b/hardware/index.html index c875291e..18cf960f 100644 --- a/hardware/index.html +++ b/hardware/index.html @@ -844,8 +844,8 @@
  • - - Link Relay + + Bench
  • @@ -950,6 +950,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1232,7 +1246,7 @@ On Linux, the VHCI Transport can be used t @@ -1269,7 +1283,7 @@ On Linux, the VHCI Transport can be used t diff --git a/index.html b/index.html index f0741318..6f4b5418 100644 --- a/index.html +++ b/index.html @@ -1064,8 +1064,8 @@
  • - - Link Relay + + Bench
  • @@ -1170,6 +1170,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1609,8 +1623,7 @@ The project initially only supported BLE (Bluetooth Low Energy), but support for eventually added. Support for BLE is therefore currently somewhat more advanced than for Classic.

    Warning

    -

    This project is still very much experimental and in an alpha state where a lot of things are still missing or broken, and what's there changes frequently. -Also, there are still a few hardcoded values/parameters in some of the examples and apps which need to be changed (those will eventually be command line arguments, as appropriate)

    +

    This project is still in an early state of development where some things are still missing or broken, and what's implemented may change and evolve frequently.

    Overview

    The goal of this project is to offer a suite of components that can be put together to implement a number of tasks related to Bluetooth. That's fairly open-ended, but at the very least, it should be possible to:

    @@ -1765,7 +1778,7 @@ Some platforms support features that not all platforms support

    diff --git a/platforms/android.html b/platforms/android.html index 54c9e4df..1fabd572 100644 --- a/platforms/android.html +++ b/platforms/android.html @@ -844,8 +844,8 @@
  • - - Link Relay + + Bench
  • @@ -950,6 +950,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1137,10 +1151,23 @@
  • - - Connecting to Root Canal + + Connecting to Netsim + +
  • @@ -1254,10 +1281,23 @@
  • - - Connecting to Root Canal + + Connecting to Netsim + +
  • @@ -1296,20 +1336,21 @@ emulator.

    • Connecting the Bumble host stack to the Android emulator's virtual controller.
    • Using Bumble as an HCI bridge to connect the Android emulator to a physical - Bluetooth controller, such as a USB dongle
    • + Bluetooth controller, such as a USB dongle, or other HCI transport.

    Warning

    Bluetooth support in the Android emulator is a recent feature that may still be evolving. The information contained here be somewhat out of sync with the version of the emulator you are using. -You will need version 31.3.8.0 or later.

    +You will need version 33.1.4.0 or later.

    The Android emulator supports Bluetooth in two ways: either by exposing virtual Bluetooth controllers to which you can connect a virtual Bluetooth host stack, or -by exposing an way to connect your own virtual controller to the Android Bluetooth +by exposing a way to connect your own virtual controller to the Android Bluetooth stack via a virtual HCI interface. -Both ways are controlled via gRPC requests to the Android emulator.

    +Both ways are controlled via gRPC requests to the Android emulator controller and/or +from the Android emulator.

    Launching the Emulator

    If the version of the emulator you are running does not yet support enabling Bluetooth support by default or automatically, you must launch the emulator from @@ -1319,43 +1360,69 @@ the command line.

    For details on how to launch the Android emulator from the command line, visit this Android Studio user guide page

  • -

    The -grpc <port> command line option may be used to select a gRPC port other than the default.

    -

    Connecting to Root Canal

    -

    The Android emulator's virtual Bluetooth controller is called Root Canal. -Multiple instances of Root Canal virtual controllers can be instantiated, they -communicate link layer packets between them, thus creating a virtual radio network. -Configuring a Bumble Device instance to use Root Canal as a virtual controller +

    The -packet-streamer-endpoint <endpoint> command line option may be used to enable +Bluetooth emulation and tell the emulator which virtual controller to connect to.

    +

    Connecting to Netsim

    +

    If the emulator doesn't have Bluetooth emulation enabled by default, use the +-packet-streamer-endpoint default option to tell it to connect to Netsim. +If Netsim is not running, the emulator will start it automatically.

    +

    The Android emulator's virtual Bluetooth controller is called Netsim. +Netsim runs as a background process and allows multiple clients to connect to it, +each connecting to its own virtual controller instance hosted by Netsim. All the +clients connected to the same Netsim process can then "talk" to each other over a +virtual radio link layer. +Netsim supports other wireless protocols than Bluetooth, but the relevant part here +is Bluetooth. The virtual Bluetooth controller used by Netsim is sometimes referred to +as Root Canal.

    +

    Configuring a Bumble Device instance to use netsim as a virtual controller allows that virtual device to communicate with the Android Bluetooth stack, and through it with Android applications as well as system-managed profiles. -To connect a Bumble host stack to a Root Canal virtual controller instance, use -the bumble android-emulator transport in host mode (the default).

    +To connect a Bumble host stack to a netsim virtual controller instance, use +the Bumble android-netsim transport in host mode (the default).

    -

    Run the example GATT server connected to the emulator

    -
    $ python run_gatt_server.py device1.json android-emulator
    +

    Run the example GATT server connected to the emulator via Netsim

    +
    $ python run_gatt_server.py device1.json android-netsim
     
    +

    By default, the Bumble android-netsim transport will try to automatically discover +the port number on which the netsim process is exposing its gRPC server interface. If +that discovery process fails, or if you want to specify the interface manually, you +can pass a hostname and port as parameters to the transport, as: android-netsim:<host>:<port>.

    +
    +

    Run the example GATT server connected to the emulator via Netsim on a localhost, port 8877

    +
    $ python run_gatt_server.py device1.json android-netsim:localhost:8877
    +
    +
    +

    Multiple Instances

    +

    If you want to connect multiple Bumble devices to netsim, it may be useful to give each one +a netsim controller with a specific name. This can be done using the name=<name> transport option. +For example: android-netsim:localhost:8877,name=bumble1

    Connecting a Custom Virtual Controller

    This is an advanced use case, which may not be officially supported, but should work in recent -versions of the emulator. -You will likely need to start the emulator from the command line, in order to specify the -forward-vhci option (unless the emulator offers a way to control that feature from a user/ui menu).

    +versions of the emulator.

    +

    The first step is to run the Bumble HCI bridge, specifying netsim as the "host" end of the +bridge, and another controller (typically a USB Bluetooth dongle, but any other supported +transport can work as well) as the "controller" end of the bridge.

    +

    To connect a virtual controller to the Android Bluetooth stack, use the bumble android-netsim transport in controller mode. For example, with port number 8877, the transport name would be: android-netsim:_:8877,mode=controller.

    -

    Launch the emulator with VHCI forwarding

    -

    In this example, we launch an emulator AVD named "Tiramisu" -

    $ emulator -forward-vhci -avd Tiramisu
    +

    Connect the Android emulator to the first USB Bluetooth dongle, using the hci_bridge application

    +
    $ bumble-hci-bridge android-netsim:_:8877,mode=controller usb:0
    +
    +
    +

    Then, you can start the emulator and tell it to connect to this bridge, instead of netsim. +You will likely need to start the emulator from the command line, in order to specify the -packet-streamer-endpoint <hostname>:<port> option (unless the emulator offers a way to control that feature from a user/ui menu).

    +
    +

    Launch the emulator with a netsim replacement

    +

    In this example, we launch an emulator AVD named "Tiramisu", with a Bumble HCI bridge running +on port 8877. +

    $ emulator -packet-streamer-endpoint localhost:8877 -avd Tiramisu
     

    Tip

    -

    Attaching a virtual controller use the VHCI forwarder while the Android Bluetooth stack -is running isn't supported. So you need to disable Bluetooth in your running Android guest +

    Attaching a virtual controller while the Android Bluetooth stack is running may not be well supported. So you may need to disable Bluetooth in your running Android guest before attaching the virtual controller, then re-enable it once attached.

    -

    To connect a virtual controller to the Android Bluetooth stack, use the bumble android-emulator transport in controller mode. For example, using the default gRPC port, the transport name would be: android-emulator:mode=controller.

    -
    -

    Connect the Android emulator to the first USB Bluetooth dongle, using the hci_bridge application

    -
    $ bumble-hci-bridge android-emulator:mode=controller usb:0
    -
    -

    Other Tools

    The show application that's included with Bumble can be used to parse and pretty-print the HCI packets from an Android HCI "snoop log" (see this page @@ -1421,7 +1488,7 @@ Use the --format snoop option to specify that the file is in that s

    diff --git a/platforms/index.html b/platforms/index.html index a3792278..5539bc71 100644 --- a/platforms/index.html +++ b/platforms/index.html @@ -844,8 +844,8 @@
  • - - Link Relay + + Bench
  • @@ -950,6 +950,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1264,7 +1278,7 @@ diff --git a/platforms/linux.html b/platforms/linux.html index 098bc0dc..f91e50dc 100644 --- a/platforms/linux.html +++ b/platforms/linux.html @@ -844,8 +844,8 @@
  • - - Link Relay + + Bench
  • @@ -950,6 +950,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1660,7 +1674,7 @@ F0:F1:F2:F3:F4:F5 Bumble diff --git a/platforms/macos.html b/platforms/macos.html index 669b98dd..da89de16 100644 --- a/platforms/macos.html +++ b/platforms/macos.html @@ -844,8 +844,8 @@
  • - - Link Relay + + Bench
  • @@ -950,6 +950,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1309,7 +1323,7 @@ A reboot shouldn't be necessary after that. See
    diff --git a/platforms/windows.html b/platforms/windows.html index ac97b048..5a135746 100644 --- a/platforms/windows.html +++ b/platforms/windows.html @@ -844,8 +844,8 @@
  • - - Link Relay + + Bench
  • @@ -950,6 +950,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1308,7 +1322,7 @@ Once the WinUSB driver is correctly assigned to your device, you can confirm tha diff --git a/sitemap.xml b/sitemap.xml index 0faa8ea4..251e4a86 100644 --- a/sitemap.xml +++ b/sitemap.xml @@ -2,247 +2,252 @@ None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 daily None - 2022-12-19 + 2023-05-03 + daily + + + None + 2023-05-03 daily \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 8ca683ce..534ce0c3 100644 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ diff --git a/transports/android_emulator.html b/transports/android_emulator.html index 2be71650..1214d3c0 100644 --- a/transports/android_emulator.html +++ b/transports/android_emulator.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1247,26 +1261,46 @@

    ANDROID EMULATOR TRANSPORT

    -

    The Android emulator transport either connects, as a host, to a "Root Canal" virtual controller -("host" mode), or attaches a virtual controller to the Android Bluetooth host stack ("controller" mode).

    +
    +

    Warning

    +

    Bluetooth support in the Android emulator has recently changed. The older mode, using +the android-emulator transport name with Bumble, while still implemented, is now +obsolete, and may not be supported by recent versions of the emulator. +Use the android-netsim transport name instead.

    +
    +

    The Android "netsim" transport either connects, as a host, to a Netsim virtual controller +("host" mode), or acts as a virtual controller itself ("controller" mode) accepting host +connections.

    Moniker

    -

    The moniker syntax for an Android Emulator transport is: android-emulator:[mode=<host|controller>][<hostname>:<port>], where -the mode parameter can specify running as a host or a controller, and <hostname>:<port> can specify a host name (or IP address) and TCP port number on which to reach the gRPC server for the emulator. -Both the mode=<host|controller> and <hostname>:<port> parameters are optional (so the moniker android-emulator by itself is a valid moniker, which will create a transport in host mode, connected to localhost on the default gRPC port for the emulator).

    +

    The moniker syntax for an Android Emulator "netsim" transport is: android-netsim:[<host>:<port>][<options>], +where <options> is a ','-separated list of <name>=<value> pairs. +Themodeparameter name can specify running as a host or a controller, and:can specify a host name (or IP address) and TCP port number on which to reach the gRPC server for the emulator (in "host" mode), or to accept gRPC connections (in "controller" mode). +Both themode=and:parameters are optional (so the monikerandroid-netsimby itself is a valid moniker, which will create a transport inhostmode, connected tolocalhost` on the default gRPC port for the Netsim background process).

    Example

    -

    android-emulator -connect as a host to the emulator on localhost:8554

    +

    android-netsim +connect as a host to Netsim on the gRPC port discovered automatically.

    Example

    -

    android-emulator:mode=controller -connect as a controller to the emulator on localhost:8554

    +

    android-netsim:_:8555,mode=controller +Run as a controller, accepting gRPC connection on port 8555.

    Example

    -

    android-emulator:localhost:8555 -connect as a host to the emulator on localhost:8555

    +

    android-netsim:localhost:8555 +connect as a host to Netsim on localhost:8555

    +
    +
    +

    Example

    +

    android-netsim:localhost:8555 +connect as a host to Netsim on localhost:8555

    +
    +
    +

    Example

    +

    android-netsim:name=bumble1234 +connect as a host to Netsim on the discovered gRPC port, using bumble1234 as the +controller instance name.

    @@ -1323,7 +1357,7 @@ connect as a host to the emulator on localhost:8555

    diff --git a/transports/file.html b/transports/file.html index 3ca661d4..5d76556e 100644 --- a/transports/file.html +++ b/transports/file.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1311,7 +1325,7 @@ Opens the pseudo terminal /dev/ttys001 as a transport

    diff --git a/transports/hci_socket.html b/transports/hci_socket.html index 0381e409..9c1312e9 100644 --- a/transports/hci_socket.html +++ b/transports/hci_socket.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1318,7 +1332,7 @@ Use an HCI socket to the first Bluetooth controller (hci0 on Linux) diff --git a/transports/index.html b/transports/index.html index fe5dcfb7..decc4260 100644 --- a/transports/index.html +++ b/transports/index.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1216,7 +1230,8 @@ Several types of transports are supported:

  • PTY: a PTY (pseudo terminal) is used to send/receive HCI packets. This is convenient to expose a virtual controller as if it were an HCI UART
  • VHCI: used to attach a virtual controller to a Bluetooth stack on platforms that support it.
  • HCI Socket: an HCI socket, on platforms that support it, to send/receive HCI packets to/from an HCI controller managed by the OS.
  • -
  • Android Emulator: a gRPC connection to an Android emulator is used to setup either an HCI interface to the emulator's "Root Canal" virtual controller, or attach a virtual controller to the Android Bluetooth host stack.
  • +
  • Android Emulator: a gRPC connection to the Android emulator's "netsim" + virtual controller, or from the Android emulator, is used to setup either an HCI interface to the emulator's "netsim" virtual controller, or serve as a virtual controller for the Android Bluetooth host stack.
  • File: HCI packets are read/written to a file-like node in the filesystem.
  • @@ -1274,7 +1289,7 @@ Several types of transports are supported:

    diff --git a/transports/pty.html b/transports/pty.html index 304912e3..329ddcbb 100644 --- a/transports/pty.html +++ b/transports/pty.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1311,7 +1325,7 @@ Creates a PTY entry and a symbolic link, named virtual_hci, linking diff --git a/transports/serial.html b/transports/serial.html index 691dbbfb..24b54b68 100644 --- a/transports/serial.html +++ b/transports/serial.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1311,7 +1325,7 @@ Opens the serial port /dev/tty.usbmodem0006839912172 at 10000 diff --git a/transports/tcp_client.html b/transports/tcp_client.html index aca8a550..9e765199 100644 --- a/transports/tcp_client.html +++ b/transports/tcp_client.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1310,7 +1324,7 @@ Connects to port 9001 on the local host

    diff --git a/transports/tcp_server.html b/transports/tcp_server.html index 476128c9..7650bfd8 100644 --- a/transports/tcp_server.html +++ b/transports/tcp_server.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1312,7 +1326,7 @@ Waits for and accepts connections on port 9001

    diff --git a/transports/udp.html b/transports/udp.html index 07b9e23c..194900a0 100644 --- a/transports/udp.html +++ b/transports/udp.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1310,7 +1324,7 @@ UDP transport where packets are received on port 9000 and sent to < diff --git a/transports/usb.html b/transports/usb.html index 862f7c3f..a04ddb76 100644 --- a/transports/usb.html +++ b/transports/usb.html @@ -948,8 +948,8 @@
  • - - Link Relay + + Bench
  • @@ -1054,6 +1054,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1474,7 +1488,7 @@ Bus 003 Device 014: ID 0b05:17cb ASUSTek Computer, Inc. Broadcom BCM20702A0 Blue diff --git a/transports/vhci.html b/transports/vhci.html index a57e1b32..0a5354e1 100644 --- a/transports/vhci.html +++ b/transports/vhci.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1314,7 +1328,7 @@ Attaches a virtual controller transport to /dev/vhci

    diff --git a/transports/ws_client.html b/transports/ws_client.html index 5c47aa13..bf645049 100644 --- a/transports/ws_client.html +++ b/transports/ws_client.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1310,7 +1324,7 @@ UDP transport where packets are received on port 9000 and sent to < diff --git a/transports/ws_server.html b/transports/ws_server.html index 88f75019..0db9e77d 100644 --- a/transports/ws_server.html +++ b/transports/ws_server.html @@ -887,8 +887,8 @@
  • - - Link Relay + + Bench
  • @@ -993,6 +993,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1310,7 +1324,7 @@ UDP transport where packets are received on port 9000 and sent to < diff --git a/use_cases/index.html b/use_cases/index.html index 3d050ab8..8d70c4f7 100644 --- a/use_cases/index.html +++ b/use_cases/index.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1265,7 +1279,7 @@ diff --git a/use_cases/use_case_1.html b/use_cases/use_case_1.html index 5358b27d..4e727670 100644 --- a/use_cases/use_case_1.html +++ b/use_cases/use_case_1.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1264,7 +1278,7 @@ diff --git a/use_cases/use_case_2.html b/use_cases/use_case_2.html index 4fd3aa6d..f1aeca7d 100644 --- a/use_cases/use_case_2.html +++ b/use_cases/use_case_2.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1264,7 +1278,7 @@ diff --git a/use_cases/use_case_3.html b/use_cases/use_case_3.html index 300bc878..6ab73eee 100644 --- a/use_cases/use_case_3.html +++ b/use_cases/use_case_3.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1264,7 +1278,7 @@ diff --git a/use_cases/use_case_4.html b/use_cases/use_case_4.html index 18b9f63f..b085601e 100644 --- a/use_cases/use_case_4.html +++ b/use_cases/use_case_4.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1264,7 +1278,7 @@ diff --git a/use_cases/use_case_5.html b/use_cases/use_case_5.html index 32c98601..6bef7fec 100644 --- a/use_cases/use_case_5.html +++ b/use_cases/use_case_5.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1270,7 +1284,7 @@ diff --git a/use_cases/use_case_6.html b/use_cases/use_case_6.html index 2a10ed03..5670d61e 100644 --- a/use_cases/use_case_6.html +++ b/use_cases/use_case_6.html @@ -856,8 +856,8 @@
  • - - Link Relay + + Bench
  • @@ -962,6 +962,20 @@ + + + + + +
  • + + Link Relay + +
  • + + + + @@ -1264,7 +1278,7 @@