summaryrefslogtreecommitdiff
path: root/examples/bluetooth
AgeCommit message (Collapse)Author
2025-07-31examples/bluetooth/ble_advertising.py: Fix decoding UUIDs.Damien George
The UUID32 case was incorrect: first, the "<d" should have been "<I", and second, the UUID constructor treats integer arguments as UUID16. So this UUID32 case needs to pass in the actual data bytes. And then it's simpler to just make all cases pass in the data bytes. Signed-off-by: Damien George <damien@micropython.org>
2023-09-01examples/bluetooth: Link to aioble in BLE examples.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-09-01examples/bluetooth: Raise ValueError when advertising data is too large.Alexander Wilde
Signed-off-by: Alexander Wilde <alexander.wilde87@gmail.com>
2023-08-16all: Add missing imports for micropython.const.Angus Gratton
Found by Ruff checking F821. Signed-off-by: Angus Gratton <angus@redyak.com.au>
2023-04-26examples/bluetooth/ble_temperature_central.py: Remove service tuple.Jim Mussared
This is unused in the client, only needed in the server. Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2023-02-15examples/bluetooth: Fix check for _conn_handle being None.Damien George
Fixes issue #10755. Signed-off-by: Damien George <damien@micropython.org>
2023-02-02top: Update Python formatting to black "2023 stable style".Jim Mussared
See https://black.readthedocs.io/en/stable/the_black_code_style/index.html Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2020-12-02examples/bluetooth: Add bonding/passkey demo.Jim Mussared
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2020-12-02extmod/modbluetooth: Allow setting char/desc enc/auth options.Andrew Leech
This widens the characteristic/descriptor flags to 16-bit, to allow setting encryption/authentication requirements. Sets the required flags for NimBLE and btstack implementations. The BLE.FLAG_* constants will eventually be deprecated in favour of copy and paste Python constants (like the IRQs). Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
2020-09-26examples/bluetooth: Update to use positional-only args to irq().Jim Mussared
To match 6a6a5f9e151473bdcc1d14725d680691ff665a82.
2020-08-29all: Update Python code to conform to latest black formatting.Damien George
Updating to Black v20.8b1 there are two changes that affect the code in this repository: - If there is a trailing comma in a list (eg [], () or function call) then that list is now written out with one line per element. So remove such trailing commas where the list should stay on one line. - Spaces at the start of """ doc strings are removed. Signed-off-by: Damien George <damien@micropython.org>
2020-07-20extmod/modbluetooth: Add event for "indicate acknowledgement".Jim Mussared
This commit adds the IRQ_GATTS_INDICATE_DONE BLE event which will be raised with the status of gatts_indicate (unlike notify, indications require acknowledgement). An example of its use is added to ble_temperature.py, and to the multitests in ble_characteristic.py. Implemented for btstack and nimble bindings, tested in both directions between unix/btstack and pybd/nimble.
2020-07-18examples/bluetooth: Add simple UART demo with central and peripheral.Jim Mussared
2020-07-18examples/bluetooth: In ble_advertising.py, skip appearance if not set.Jim Mussared
2020-06-10examples/bluetooth: Fix event code in ble_temperature_central.py.Jim Mussared
2020-06-05examples/bluetooth: Fix incorrect value of BR/EDR flag in advertising.jxltom
According to Supplement to the Bluetooth Core Specification v8 Part A 1.3.1, to support BR/EDR the code should set the fifth bit (Simultaneous LE and BR/EDR to Same Device Capable (Controller)) and fourth bit (Simultaneous LE and BR/EDR to Same Device Capable (Host)) of the flag.
2020-06-05extmod/modbluetooth: Ensure status=0 always on success.Jim Mussared
This commit makes sure that all discovery complete and read/write status events set the status to zero on success. The status value will be implementation-dependent on non-success cases.
2020-06-05extmod/modbluetooth: Implement read done event.Jim Mussared
On btstack there's no status associated with the read result, it comes through as a separate event. This allows you to detect read failures or timeouts.
2020-06-05extmod/modbluetooth: Add discover complete events for svc/char/desc.Jim Mussared
Without this it's difficult to implement a state machine correctly if the desired services are not found.
2020-06-05extmod/modbluetooth: Make modbluetooth event not a bitfield.Jim Mussared
There doesn't appear to be any use for only triggering on specific events, so it's just easier to number them sequentially. This makes them smaller values so they take up only 1 byte in the ringbuf, only 1 byte for the opcode in the bytecode, and makes room for more events. Also add a couple of new event types that need to be implemented (to avoid re-numbering later). And rename _COMPLETE and _STATUS to _DONE for consistency. In the future the "trigger" keyword argument can be reinstated by requiring the user to compute the bitmask, eg: ble.irq(handler, 1 << _IRQ_SCAN_RESULT | 1 << _IRQ_SCAN_DONE)
2020-03-12examples/bluetooth: Replace "connectable" parameter with "adv_type".Thomas Friebel
Follow up to dd0bc26e65734b8a4fafa3769008e92e2ec6645d which changed the parameter list of the IRQ_SCAN_RESULT event. Adapt ble_temperature_central.py accordingly.
2020-02-28all: Reformat C and Python source code with tools/codeformat.py.Damien George
This is run with uncrustify 0.70.1, and black 19.10b0.
2020-02-28examples/bluetooth/ble_temperature_central.py: Shorten comment.Damien George
So the line length is less than 100 characters.
2019-11-25examples/bluetooth: Add example for reading temperature sensor.Jim Mussared
2019-11-25examples/bluetooth: Add helpers for decoding advertising payloads.Jim Mussared
Extracts name and service UUID fields.
2019-10-29examples/bluetooth/ble_uart_peripheral: Use append mode for RX char.Jim Mussared
2019-10-22examples/bluetooth/ble_uart_peripheral.py: Add usage demo.Jim Mussared
2019-10-22examples/bluetooth: Use UUIDs directly to add services to adv payload.Jim Mussared
2019-10-18examples/bluetooth: Add basic BLE peripheral examples.Jim Mussared
Consisting of: - ble_advertising.py -- helper to generate advertising payload. - ble_temperature.py -- simple temperature device. - ble_uart_periperhal.py -- BLE UART wrapper. - ble_uart_repl.py -- dupterm-compatible uart.