@@ -99,15 +99,11 @@ func watchList(inst *rpc.Instance) {
99
99
100
100
for event := range eventsChan {
101
101
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 ,
111
107
})
112
108
}
113
109
}
@@ -176,15 +172,11 @@ func (dr result) String() string {
176
172
}
177
173
178
174
type 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"`
188
180
}
189
181
190
182
func (dr watchEvent ) Data () interface {} {
@@ -199,11 +191,11 @@ func (dr watchEvent) String() string {
199
191
"remove" : tr ("Disconnected" ),
200
192
}[dr .Type ]
201
193
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
205
197
}
206
- protocol := dr .ProtocolLabel
198
+ protocol := dr .Port . ProtocolLabel
207
199
if boards := dr .Boards ; len (boards ) > 0 {
208
200
sort .Slice (boards , func (i , j int ) bool {
209
201
x , y := boards [i ], boards [j ]
0 commit comments