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://gobot.io/x/watchbot) installed on Pebble watch. Then install running:
Please refer to the main [README.md](https://github.com/hybridgroup/gobot/blob/release/README.md)
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" "gobot.io/x/gobot/v2" "gobot.io/x/gobot/v2/api" "gobot.io/x/gobot/v2/platforms/pebble" ) func main() { manager := gobot.NewManager() api.NewAPI(manager).Start() pebbleAdaptor := pebble.NewAdaptor() watch := pebble.NewDriver(pebbleAdaptor) work := func() { watch.SendNotification("Hello Pebble!") watch.On(watch.Event("button"), func(data interface{}) { fmt.Println("Button pushed: " + data.(string)) }) watch.On(watch.Event("tap"), func(data interface{}) { fmt.Println("Tap event detected") }) } robot := gobot.NewRobot("pebble", []gobot.Connection{pebbleAdaptor}, []gobot.Device{watch}, work, ) manager.AddRobot(robot) if err := manager.Start(); err != nil { panic(err) } }
For more information refer to the pebble README: https://github.com/hybridgroup/gobot/blob/release/platforms/pebble/README.md
Index ¶
- type Adaptor
- type Driver
- func (d *Driver) Connection() gobot.Connection
- func (d *Driver) Halt() error
- func (d *Driver) Name() string
- func (d *Driver) PendingMessage() string
- func (d *Driver) PublishEvent(name string, data string)
- func (d *Driver) SendNotification(message string) string
- func (d *Driver) SetName(n string)
- func (d *Driver) Start() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adaptor ¶
type Adaptor struct {
// contains filtered or unexported fields
}
type Driver ¶
type Driver struct { gobot.Commander gobot.Eventer Messages []string // contains filtered or unexported fields }
func NewDriver ¶
NewDriver creates a new pebble driver 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 (*Driver) Connection ¶
func (d *Driver) Connection() gobot.Connection
func (*Driver) PendingMessage ¶
PendingMessages returns messages to be sent as notifications to pebble (Not intended to be used directly)
func (*Driver) PublishEvent ¶
PublishEvent publishes event with specified name and data in gobot
func (*Driver) SendNotification ¶
SendNotification appends message to list of notifications to be sent to watch