Btferret
Python and C Bluetooth Library
Install / Use
/learn @petzval/BtferretREADME
Python and C Bluetooth Library
Version 25
Contents
-
- 3.1 Bluetooth Connections
- 3.2 btferret
- 3.3 devices.txt file
- 3.4 Windows-Android-HC-05 Classic servers
- 3.5 Windows-Android Classic clients
- 3.6 LE client
- 3.7 LE server
- 3.8 Pi-Pi client-server connection
- 3.9 Broadcast to all mesh servers
- 3.10 sample.c
- 3.11 HID Devices
- 3.12 Standard LE Profiles
- 3.13 File transfer
-
- 4.1 Function list
- 4.2 Functions
- 4.2.1 classic_scan
- 4.2.2 classic_server
- 4.2.3 close_all
- 4.2.4 connect_node
- 4.2.5 ctic_name
- 4.2.6 ctic_ok
- 4.2.7 device_address
- 4.2.8 device_connected
- 4.2.9 device_info
- 4.2.10 device_name
- 4.2.11 device_paired
- 4.2.12 device_type
- 4.2.13 disconnect_node
- 4.2.14 find_channel
- 4.2.15 find_ctics
- 4.2.16 find_ctic_index
- 4.2.17 hid_key_code
- 4.2.18 init_blue
- 4.2.19 input_filename
- 4.2.20 input_integer
- 4.2.21 input_radio
- 4.2.22 input_select
- 4.2.23 input_string
- 4.2.24 keys_to_callback
- 4.2.25 le_advert
- 4.2.26 le_handles
- 4.2.27 le_interval
- 4.2.28 le_pair
- 4.2.29 le_scan
- 4.2.30 le_server
- 4.2.31 list_channels
- 4.2.32 list_ctics
- 4.2.33 list_uuid
- 4.2.34 localnode
- 4.2.35 mesh_on
- 4.2.36 mesh_off
- 4.2.37 mesh_server
- 4.2.38 node_server
- 4.2.39 notify_ctic
- 4.2.40 output_file
- 4.2.41 print
- 4.2.42 Print_data
- 4.2.43 read_all_endchar
- 4.2.44 read_ctic
- 4.2.45 read_error
- 4.2.46 read_mesh
- 4.2.47 read_node_count
- 4.2.48 read_node_endchar
- 4.2.49 read_node-all_clear
- 4.2.50 read_notify
- 4.2.51 register_serial
- 4.2.52 save_pair_info
- 4.2.53 scroll_back-forward
- 4.2.54 set_flags
- 4.2.55 set_le_interval
- 4.2.56 set_le_random_address
- 4.2.57 set_le_wait
- 4.2.58 set_notify_node
- 4.2.59 set_print_flag
- 4.2.60 sleep_ms
- 4.2.61 strtohex
- 4.2.62 time_ms
- 4.2.63 universal_server
- 4.2.64 user_function
- 4.2.65 uuid_advert
- 4.2.66 wait_for_disconnect
- 4.2.67 write_ctic
- 4.2.68 write_mesh
- 4.2.69 write_node
-
- 5.1 What gives with UUIDs?
- 5.2 Packet formats
- 5.3 Procedures
- 5.3.1 HCI socket read/write packets
- 5.3.2 Classic procedures
- 5.3.3 Classic connect with PIN code
- 5.3.4 Classic disconnect initiated by server
- 5.3.5 Classic scan
- 5.3.6 Classic server simple
- 5.3.7 Classic server pair and link key
- 5.3.8 SDP database operations
- 5.3.9 LE Procedures
- 5.3.10 Read LE services
- 5.3.11 LE scan
- 5.4 Server code for other machines
- 5.5 Client code for other machines
1 Introduction
This is a C and Python Bluetooth interface that has been developed for Raspberry Pis (but has also had some testing on Ubuntu, and should work on other Linux systems).
It will also run on Windows if a Raspberry Pi Pico 2W or Zero 2W is used as a Bluetooth dongle on a PC. Python and C code described here and written for Linux can be run from the Windows command line, or pasted into a Windows GUI source file (with no knowledge of Windows programming needed). Instructions for this are in the Windows README file in the windows folder.
It will also run on a Pico as a replacement for btstack, with your code written in C. Instructions in the Pico README file in the picostack folder. In principle, the btlib.c library can repalce any Bluetooth stack such as bluez or btstack.
A Pi running this interface can connect simultaneous
