Documentation ¶
Overview ¶
Package pebble contains the Gobot adaptor and driver for Pebble smart watch.
Installing:
It requires the 2.x iOS or Android app, and "watchbot" app (https://github.com/hybridgroup/watchbot) installed on Pebble watch. Then install running:
go get github.com/hybridgroup/gobot/platforms/pebble
Example:
Before running the example, make sure configuration settings match with your program. In the example, api host is your computer IP, robot name is 'pebble' and robot api port is 8080
package main import ( "fmt" "github.com/hybridgroup/gobot" "github.com/hybridgroup/gobot/api" "github.com/hybridgroup/gobot/platforms/pebble" ) func main() { gbot := gobot.NewGobot() api.NewAPI(gbot).Start() pebbleAdaptor := pebble.NewPebbleAdaptor("pebble") pebbleDriver := pebble.NewPebbleDriver(pebbleAdaptor, "pebble") work := func() { pebbleDriver.SendNotification("Hello Pebble!") gobot.On(pebbleDriver.Event("button"), func(data interface{}) { fmt.Println("Button pushed: " + data.(string)) }) gobot.On(pebbleDriver.Event("tap"), func(data interface{}) { fmt.Println("Tap event detected") }) } robot := gobot.NewRobot("pebble", []gobot.Connection{pebbleAdaptor}, []gobot.Device{pebbleDriver}, work, ) gbot.AddRobot(robot) gbot.Start() }
For more information refer to the pebble README: https://github.com/hybridgroup/gobot/blob/master/platforms/pebble/README.md
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PebbleAdaptor ¶
func NewPebbleAdaptor ¶
func NewPebbleAdaptor(name string) *PebbleAdaptor
NewPebbleAdaptor creates a new pebble adaptor with specified name
func (*PebbleAdaptor) Connect ¶
func (a *PebbleAdaptor) Connect() bool
Connect returns true if connection to pebble is established succesfully
func (*PebbleAdaptor) Finalize ¶
func (a *PebbleAdaptor) Finalize() bool
Finalize returns true if connection to pebble is finalized succesfully
type PebbleDriver ¶
func NewPebbleDriver ¶
func NewPebbleDriver(adaptor *PebbleAdaptor, name string) *PebbleDriver
NewPebbleDriver creates a new pebble driver with specified name Adds following events:
button - Sent when a pebble button is pressed accel - Pebble watch acceleromenter data tab - When a pebble watch tap event is detected
And the following API commands:
"publish_event" "send_notification" "pending_message"
func (*PebbleDriver) Halt ¶
func (d *PebbleDriver) Halt() bool
Halt returns true if driver is halted succesfully
func (*PebbleDriver) PendingMessage ¶
func (d *PebbleDriver) PendingMessage() string
PendingMessages returns messages to be sent as notifications to pebble (Not intented to be used directly)
func (*PebbleDriver) PublishEvent ¶
func (d *PebbleDriver) PublishEvent(name string, data string)
PublishEvent publishes event with specified name and data in gobot
func (*PebbleDriver) SendNotification ¶
func (d *PebbleDriver) SendNotification(message string) string
SendNotification appends message to list of notifications to be sent to watch
func (*PebbleDriver) Start ¶
func (d *PebbleDriver) Start() bool
Start returns true if driver is initialized correctly