mirror of
https://github.com/micropython/micropython.git
synced 2026-01-04 11:10:14 +01:00
extmod/modbluetooth: Add support for changing the GAP device name.
This commit allows the user to set/get the GAP device name used by service
0x1800, characteristic 0x2a00. The usage is:
BLE.config(gap_name="myname")
print(BLE.config("gap_name"))
As part of this change the compile-time setting
MICROPY_PY_BLUETOOTH_DEFAULT_NAME is renamed to
MICROPY_PY_BLUETOOTH_DEFAULT_GAP_NAME to emphasise its link to GAP and this
new "gap_name" config value. And the default value of this for the NimBLE
bindings is changed from "PYBD" to "MPY NIMBLE" to be more generic.
This commit is contained in:
@@ -171,6 +171,10 @@ bool mp_bluetooth_is_active(void);
|
||||
// Gets the MAC addr of this device in big-endian format.
|
||||
void mp_bluetooth_get_device_addr(uint8_t *addr);
|
||||
|
||||
// Get or set the GAP device name that will be used by service 0x1800, characteristic 0x2a00.
|
||||
size_t mp_bluetooth_gap_get_device_name(const uint8_t **buf);
|
||||
int mp_bluetooth_gap_set_device_name(const uint8_t *buf, size_t len);
|
||||
|
||||
// Start advertisement. Will re-start advertisement when already enabled.
|
||||
// Returns errno on failure.
|
||||
int mp_bluetooth_gap_advertise_start(bool connectable, int32_t interval_us, const uint8_t *adv_data, size_t adv_data_len, const uint8_t *sr_data, size_t sr_data_len);
|
||||
|
||||
Reference in New Issue
Block a user