mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-29 13:49:14 +08:00
Merge pull request #79 from strongh/leap-fix
Leap examples and adaptor fix
This commit is contained in:
commit
5a15fb3198
@ -20,8 +20,8 @@ func NewLeapMotionAdaptor(name string, port string) *LeapMotionAdaptor {
|
||||
port,
|
||||
),
|
||||
connect: func(l *LeapMotionAdaptor) {
|
||||
origin := fmt.Sprintf("http://%v", l.Port)
|
||||
url := fmt.Sprintf("ws://%v/v3.json", l.Port)
|
||||
origin := fmt.Sprintf("http://%v", l.Port())
|
||||
url := fmt.Sprintf("ws://%v/v3.json", l.Port())
|
||||
ws, err := websocket.Dial(url, "", origin)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -20,7 +20,7 @@ func NewLeapMotionDriver(a *LeapMotionAdaptor, name string) *LeapMotionDriver {
|
||||
),
|
||||
}
|
||||
|
||||
l.AddEvent("Message")
|
||||
l.AddEvent("message")
|
||||
return l
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ func (l *LeapMotionDriver) Start() bool {
|
||||
for {
|
||||
var msg []byte
|
||||
websocket.Message.Receive(l.adaptor().ws, &msg)
|
||||
gobot.Publish(l.Event("Message"), l.ParseFrame(msg))
|
||||
gobot.Publish(l.Event("message"), l.ParseFrame(msg))
|
||||
}
|
||||
}()
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user