@@ -99,15 +99,11 @@ func watchList(inst *rpc.Instance) {
9999
100100 for event := range eventsChan {
101101 feedback .PrintResult (watchEvent {
102- Type : event .EventType ,
103- Label : event .Port .Port .Label ,
104- Address : event .Port .Port .Address ,
105- Protocol : event .Port .Port .Protocol ,
106- ProtocolLabel : event .Port .Port .ProtocolLabel ,
107- HardwareID : event .Port .Port .HardwareId ,
108- Properties : event .Port .Port .Properties ,
109- Boards : event .Port .MatchingBoards ,
110- Error : event .Error ,
102+ Type : event .EventType ,
103+ Properties : event .Port .Port .Properties ,
104+ Boards : event .Port .MatchingBoards ,
105+ Port : event .Port .Port ,
106+ Error : event .Error ,
111107 })
112108 }
113109}
@@ -176,15 +172,11 @@ func (dr result) String() string {
176172}
177173
178174type watchEvent struct {
179- Type string `json:"type"`
180- Address string `json:"address,omitempty"`
181- Label string `json:"label,omitempty"`
182- Protocol string `json:"protocol,omitempty"`
183- ProtocolLabel string `json:"protocol_label,omitempty"`
184- HardwareID string `json:"hardwareId,omitempty"`
185- Properties map [string ]string `json:"properties"`
186- Boards []* rpc.BoardListItem `json:"boards,omitempty"`
187- Error string `json:"error,omitempty"`
175+ Type string `json:"eventType"`
176+ Properties map [string ]string `json:"properties"`
177+ Boards []* rpc.BoardListItem `json:"matching_boards,omitempty"`
178+ Port * rpc.Port `json:"port,omitempty"`
179+ Error string `json:"error,omitempty"`
188180}
189181
190182func (dr watchEvent ) Data () interface {} {
@@ -199,11 +191,11 @@ func (dr watchEvent) String() string {
199191 "remove" : tr ("Disconnected" ),
200192 }[dr .Type ]
201193
202- address := fmt .Sprintf ("%s://%s" , dr .Protocol , dr .Address )
203- if dr .Protocol == "serial" || dr .Protocol == "" {
204- address = dr .Address
194+ address := fmt .Sprintf ("%s://%s" , dr .Port . Protocol , dr . Port .Address )
195+ if dr .Port . Protocol == "serial" || dr . Port .Protocol == "" {
196+ address = dr .Port . Address
205197 }
206- protocol := dr .ProtocolLabel
198+ protocol := dr .Port . ProtocolLabel
207199 if boards := dr .Boards ; len (boards ) > 0 {
208200 sort .Slice (boards , func (i , j int ) bool {
209201 x , y := boards [i ], boards [j ]
0 commit comments