Пример #1
0
func onStateChanged(d gatt.Device, s gatt.State) {
	fmt.Println("State:", s)
	switch s {
	case gatt.StatePoweredOn:
		fmt.Println("Scanning...")
		d.Scan([]gatt.UUID{}, false)
		return
	default:
		d.StopScanning()
	}
}
Пример #2
0
func onStateChanged(d gatt.Device, s gatt.State) {
	log.Println("State of BT:", s)
	switch s {
	case gatt.StatePoweredOn:
		log.Println("Scanning for ID:", baseDeviceId)
		d.Scan([]gatt.UUID{}, false)
		return
	default:
		d.StopScanning()
	}
}