[ble] Add support to change ble name from KMKKeyboard.go

This commit is contained in:
Dimitris Zervas
2020-09-15 01:16:14 +03:00
committed by Kyle Brown
parent 18eeb4eadc
commit e5700eeb5f
5 changed files with 12 additions and 10 deletions

View File

@@ -14,19 +14,20 @@ BLE_APPEARANCE_HID_KEYBOARD = 961
class BLEHID(AbstractHID):
def post_init(self):
def post_init(self, ble_name='KMK Keyboard', **kwargs):
self.devices = {}
hid = HIDService()
advertisement = ProvideServicesAdvertisement(hid)
advertisement.appearance = BLE_APPEARANCE_HID_KEYBOARD
scan_response = Advertisement()
scan_response.complete_name = 'KMK Keyboard'
ble = BLERadio()
ble.name = ble_name
# ble.tx_power = 2
if not ble.connected:
ble.start_advertising(advertisement, scan_response)
ble.start_advertising(advertisement)
while not ble.connected:
pass