Peripheral – A BLE peripheral device¶
Implement a BLE peripheral which runs locally. Set up using the supplied services, and then allow advertising to be started and stopped.
import bleio # Create a Characteristic. chara = bleio.Characteristic(bleio.UUID(0x2919), read=True, notify=True) # Create a Service providing that one Characteristic. serv = bleio.Service(bleio.UUID(0x180f), [chara]) # Create a peripheral and start it up. periph = bleio.Peripheral([service]) periph.start_advertising() while not periph.connected: # Wait for connection. pass
Peripheral(services, *, name='CIRCUITPY')¶
Create a new Peripheral object. :param iterable services: the Service objects representing services available from this peripheral. :param str name: The name used when advertising this peripheral
True if connected to a BLE Central device.
The peripheral’s name, included when advertising. (read-only)
start_advertising(*, connectable=True, data=None)¶
Starts advertising the peripheral. The peripheral’s name and services are included in the advertisement packets.
Stop sending advertising packets.