mirror of
https://github.com/hybridgroup/gobot.git
synced 2025-04-24 13:48:49 +08:00
handleResponse should not send commands
Signed-off-by: Olivier Charvin <oliverpool@hotmail.fr>
This commit is contained in:
parent
26dfd39df4
commit
8374ea05b0
@ -253,6 +253,11 @@ func (d *Driver) Start() error {
|
||||
|
||||
// handle responses
|
||||
go func() {
|
||||
d.On(d.Event(ConnectedEvent), func(interface{}) {
|
||||
d.SendDateTime()
|
||||
d.processVideo()
|
||||
})
|
||||
|
||||
for {
|
||||
err := d.handleResponse(cmdConn)
|
||||
if err != nil {
|
||||
@ -769,8 +774,6 @@ func (d *Driver) handleResponse(r io.Reader) error {
|
||||
// parse text packet
|
||||
if buf[0] == 0x63 && buf[1] == 0x6f && buf[2] == 0x6e {
|
||||
d.Publish(d.Event(ConnectedEvent), nil)
|
||||
d.SendDateTime()
|
||||
d.processVideo()
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -100,11 +100,11 @@ func TestHandleResponse(t *testing.T) {
|
||||
msg: bytes.NewReader(statusMessage(videoEncoderRateCommand)),
|
||||
events: []gobot.Event{{Name: SetVideoEncoderRateEvent}},
|
||||
},
|
||||
// {
|
||||
// name: "videoEncoderRateCommand",
|
||||
// msg: bytes.NewReader([]byte{0x63, 0x6f, 0x6e}),
|
||||
// events: []gobot.Event{{Name: ConnectedEvent}},
|
||||
// },
|
||||
{
|
||||
name: "ConnectedEvent",
|
||||
msg: bytes.NewReader([]byte{0x63, 0x6f, 0x6e}),
|
||||
events: []gobot.Event{{Name: ConnectedEvent}},
|
||||
},
|
||||
}
|
||||
|
||||
for _, c := range cc {
|
||||
|
Loading…
x
Reference in New Issue
Block a user