@@ -99,15 +99,10 @@ 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+ Boards : event .Port .MatchingBoards ,
104+ Port : event .Port .Port ,
105+ Error : event .Error ,
111106 })
112107 }
113108}
@@ -176,15 +171,10 @@ func (dr result) String() string {
176171}
177172
178173type 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"`
174+ Type string `json:"eventType"`
175+ Boards []* rpc.BoardListItem `json:"matching_boards,omitempty"`
176+ Port * rpc.Port `json:"port,omitempty"`
177+ Error string `json:"error,omitempty"`
188178}
189179
190180func (dr watchEvent ) Data () interface {} {
@@ -199,11 +189,11 @@ func (dr watchEvent) String() string {
199189 "remove" : tr ("Disconnected" ),
200190 }[dr .Type ]
201191
202- address := fmt .Sprintf ("%s://%s" , dr .Protocol , dr .Address )
203- if dr .Protocol == "serial" || dr .Protocol == "" {
204- address = dr .Address
192+ address := fmt .Sprintf ("%s://%s" , dr .Port . Protocol , dr . Port .Address )
193+ if dr .Port . Protocol == "serial" || dr . Port .Protocol == "" {
194+ address = dr .Port . Address
205195 }
206- protocol := dr .ProtocolLabel
196+ protocol := dr .Port . ProtocolLabel
207197 if boards := dr .Boards ; len (boards ) > 0 {
208198 sort .Slice (boards , func (i , j int ) bool {
209199 x , y := boards [i ], boards [j ]
0 commit comments