# Start advertising before messing with the display so that we can connect immediately. radio = adafruit_ble.BLERadio() advertisement = SolicitServicesAdvertisement() advertisement.solicited_services.append(AppleNotificationCenterService) SCALE = 2 display = tft_gizmo.TFT_Gizmo() group = displayio.Group(scale=SCALE) display.show(group) width = display.width // SCALE height = display.height // SCALE radio_widget = AdvertisingWidget("CIRCUITPY", width, height) group.append(radio_widget) current_notification = None all_ids = [] last_press = time.monotonic() active_connection, notification_service = find_connection() while True: if not active_connection: radio.start_advertising(advertisement) while not active_connection: active_connection, notification_service = find_connection() while active_connection.connected: all_ids.clear()
if AppleNotificationCenterService not in connection: continue if not connection.paired: connection.pair() return connection, connection[AppleNotificationCenterService] return None, None # Start advertising before messing with the display so that we can connect immediately. radio = adafruit_ble.BLERadio() a = SolicitServicesAdvertisement() a.solicited_services.append(AppleNotificationCenterService) display = eink_gizmo.EInk_Gizmo() radio_widget = AdvertisingWidget(radio.name, display.width, display.height) display.show(radio_widget) # True when the screen reflects our current state. screen_updated = False latest_notification = None active_connection, notification_service = find_connection() while True: if not active_connection: radio.start_advertising(a) screen_updated = False while not active_connection: active_connection, notification_service = find_connection() if not screen_updated and display.time_to_refresh == 0: