mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-26 13:48:49 +08:00
35 lines
724 B
Go
35 lines
724 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/hybridgroup/gobot"
|
|
"github.com/hybridgroup/gobot/platforms/ble"
|
|
)
|
|
|
|
func main() {
|
|
gbot := gobot.NewGobot()
|
|
|
|
bleAdaptor := ble.NewBLEClientAdaptor("ble", os.Args[1])
|
|
info := ble.NewBLEDeviceInformationDriver(bleAdaptor, "info")
|
|
|
|
work := func() {
|
|
fmt.Println("Model number:", info.GetModelNumber())
|
|
fmt.Println("Firmware rev:", info.GetFirmwareRevision())
|
|
fmt.Println("Hardware rev:", info.GetHardwareRevision())
|
|
fmt.Println("Manufacturer name:", info.GetManufacturerName())
|
|
fmt.Println("PnPId:", info.GetPnPId())
|
|
}
|
|
|
|
robot := gobot.NewRobot("bleBot",
|
|
[]gobot.Connection{bleAdaptor},
|
|
[]gobot.Device{info},
|
|
work,
|
|
)
|
|
|
|
gbot.AddRobot(robot)
|
|
|
|
gbot.Start()
|
|
}
|