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 ¶
- type PebbleAdaptor
- type PebbleDriver
- func (d *PebbleDriver) Connection() gobot.Connection
- func (d *PebbleDriver) Halt() (errs []error)
- func (d *PebbleDriver) Name() string
- func (d *PebbleDriver) PendingMessage() string
- func (d *PebbleDriver) PublishEvent(name string, data string)
- func (d *PebbleDriver) SendNotification(message string) string
- func (d *PebbleDriver) Start() (errs []error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PebbleAdaptor ¶
type PebbleAdaptor struct {
// contains filtered or unexported fields
}
func NewPebbleAdaptor ¶
func NewPebbleAdaptor(name string) *PebbleAdaptor
NewPebbleAdaptor creates a new pebble adaptor with specified name
func (*PebbleAdaptor) Connect ¶
func (a *PebbleAdaptor) Connect() (errs []error)
Connect returns true if connection to pebble is established succesfully
func (*PebbleAdaptor) Finalize ¶
func (a *PebbleAdaptor) Finalize() (errs []error)
Finalize returns true if connection to pebble is finalized succesfully
func (*PebbleAdaptor) Name ¶
func (a *PebbleAdaptor) Name() string
type PebbleDriver ¶
type PebbleDriver struct { gobot.Commander gobot.Eventer Messages []string // contains filtered or unexported fields }
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) Connection ¶
func (d *PebbleDriver) Connection() gobot.Connection
func (*PebbleDriver) Halt ¶
func (d *PebbleDriver) Halt() (errs []error)
Halt returns true if driver is halted succesfully
func (*PebbleDriver) Name ¶
func (d *PebbleDriver) Name() string
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() (errs []error)
Start returns true if driver is initialized correctly