jag run -d host sample.toit
SCAN_DURATION ::= Duration --ms=250
find_by_name central/ble.Central name/string:
central.scan --duration=SCAN_DURATION: | device/ble.RemoteScannedDevice |
if device.data.name and device.data.name.contains name:
return device.address
throw "no ring device found"
// Copyright (C) 2023 Toitware ApS.
// Use of this source code is governed by a Zero-Clause BSD license that can
// be found in the examples/LICENSE file.
import ble
SCAN-DURATION ::= Duration --s=3
main:
adapter := ble.Adapter
central := adapter.central
addresses := []
central.scan --duration=SCAN-DURATION: | device/ble.RemoteScannedDevice |
addresses.add device.address
print addresses
cm started
Version: v1.33.0
SDK version: v2.0.0-alpha.145
Build date: 2024-04-22T20:36:07Z