Virtual Bluetooth controller
Project description
RootCanal
Binding to the RootCanal controller implementation. Enables virtual testing of Bluetooth applications directly in Python.
Usage
from rootcanal.controller import Controller
from rootcanal.bluetooth import Address
import hci_packets as hci
import llcp_packets as llcp
import lmp_packets as lmp
import ll_packets as ll
controller = Controller::new(Address("ca:fe:ca:fe:00:00"))
# Send HCI Reset to the controller and wait for the response.
controller.send_cmd(hci.Reset())
_ = await controller.expect_evt(hci.ResetCommplete)
# Enable page scan.
controller.send_cmd(hci.WriteScanEnable(scan_enable=hci.ScanEnable.PAGE_SCAN_ONLY))
_ = await controller.expect_evt(hci.WriteScanEnableComplete)
# Send classic connection request.
controller.send_ll(
ll.Page(
class_of_device=0,
allow_role_switch=0,
source_address=Address("11:11:11:11:11:11")))
_ = await controller.expect_evt(hci.ConnectionRequest)
# Accept the connection request.
_ = await controller.send_cmd(
hci.AcceptConnectionRequest(
bd_addr=Address("11:11:11:11:11:11"),
role=hci.AcceptConnectionRequestRole.REMAIN_PERIPHERAL))
_ = await controller.expect_evt(hci.AcceptConnectionRequestStatus)
_ = await controller.expect_ll(hci.PageResponse)
_ = await controller.expect_evt(hci.ConnectionComplete)
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
rootcanal-1.3.0-py3-none-any.whl
(21.3 MB
view hashes)
Close
Hashes for rootcanal-1.3.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed4f9bdc10e5089cdf66e163d814d39c81ad5ca8f6d7d209bb14211ac47daf10 |
|
MD5 | 892f93f19e4fcc2970b80d2e439c8a42 |
|
BLAKE2b-256 | 9e8575ce9ffe7f7524a02274aa115709593ff02980b3ac9ea91ed2c1a2f6494c |