@@ -56,12 +56,12 @@ func (p *Port) AddToCommand(cmd *cobra.Command, srv rpc.ArduinoCoreServiceServer
56
56
// This method allows will bypass the discoveries if:
57
57
// - a nil instance is passed: in this case the plain port and protocol arguments are returned (even if empty)
58
58
// - a protocol is specified: in this case the discoveries are not needed to autodetect the protocol.
59
- func (p * Port ) GetPortAddressAndProtocol (instance * rpc.Instance , defaultAddress , defaultProtocol string ) (string , string , error ) {
59
+ func (p * Port ) GetPortAddressAndProtocol (instance * rpc.Instance , srv rpc. ArduinoCoreServiceServer , defaultAddress , defaultProtocol string ) (string , string , error ) {
60
60
if p .protocol != "" || instance == nil {
61
61
return p .address , p .protocol , nil
62
62
}
63
63
64
- port , err := p .GetPort (instance , defaultAddress , defaultProtocol )
64
+ port , err := p .GetPort (instance , srv , defaultAddress , defaultProtocol )
65
65
if err != nil {
66
66
return "" , "" , err
67
67
}
@@ -70,8 +70,7 @@ func (p *Port) GetPortAddressAndProtocol(instance *rpc.Instance, defaultAddress,
70
70
71
71
// GetPort returns the Port obtained by parsing command line arguments.
72
72
// The extra metadata for the ports is obtained using the pluggable discoveries.
73
- func (p * Port ) GetPort (instance * rpc.Instance , defaultAddress , defaultProtocol string ) (* rpc.Port , error ) {
74
-
73
+ func (p * Port ) GetPort (instance * rpc.Instance , srv rpc.ArduinoCoreServiceServer , defaultAddress , defaultProtocol string ) (* rpc.Port , error ) {
75
74
address := p .address
76
75
protocol := p .protocol
77
76
if address == "" && (defaultAddress != "" || defaultProtocol != "" ) {
@@ -91,7 +90,10 @@ func (p *Port) GetPort(instance *rpc.Instance, defaultAddress, defaultProtocol s
91
90
92
91
ctx , cancel := context .WithCancel (context .Background ())
93
92
defer cancel ()
94
- watcher , err := commands .BoardListWatch (ctx , & rpc.BoardListWatchRequest {Instance : instance })
93
+
94
+ stream , watcher := commands .BoardListWatchProxyToChan (ctx )
95
+ err := srv .BoardListWatch (& rpc.BoardListWatchRequest {Instance : instance }, stream )
96
+
95
97
if err != nil {
96
98
return nil , err
97
99
}
0 commit comments