1
0
mirror of https://github.com/hybridgroup/gobot.git synced 2025-05-01 13:48:57 +08:00
hybridgroup.gobot/examples/ble_generic_access.go
deadprogram e995b372b8 ble: add generic access service driver
Signed-off-by: deadprogram <ron@hybridgroup.com>
2016-12-27 19:44:36 +01:00

28 lines
460 B
Go

package main
import (
"fmt"
"os"
"gobot.io/x/gobot"
"gobot.io/x/gobot/platforms/ble"
)
func main() {
bleAdaptor := ble.NewClientAdaptor(os.Args[1])
access := ble.NewGenericAccessDriver(bleAdaptor)
work := func() {
fmt.Println("Device name:", access.GetDeviceName())
fmt.Println("Appearance:", access.GetAppearance())
}
robot := gobot.NewRobot("bleBot",
[]gobot.Connection{bleAdaptor},
[]gobot.Device{access},
work,
)
robot.Start()
}