diff --git a/.licenses/go/google.golang.org/protobuf/encoding/protojson.dep.yml b/.licenses/go/google.golang.org/protobuf/encoding/protojson.dep.yml deleted file mode 100644 index 145d27efb97..00000000000 --- a/.licenses/go/google.golang.org/protobuf/encoding/protojson.dep.yml +++ /dev/null @@ -1,63 +0,0 @@ ---- -name: google.golang.org/protobuf/encoding/protojson -version: v1.26.0 -type: go -summary: Package protojson marshals and unmarshals protocol buffer messages as JSON - format. -homepage: https://pkg.go.dev/google.golang.org/protobuf/encoding/protojson -license: bsd-3-clause -licenses: -- sources: protobuf@v1.26.0/LICENSE - text: | - Copyright (c) 2018 The Go Authors. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - * Neither the name of Google Inc. nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: protobuf@v1.26.0/PATENTS - text: | - Additional IP Rights Grant (Patents) - - "This implementation" means the copyrightable works distributed by - Google as part of the Go project. - - Google hereby grants to You a perpetual, worldwide, non-exclusive, - no-charge, royalty-free, irrevocable (except as stated in this section) - patent license to make, have made, use, offer to sell, sell, import, - transfer and otherwise run, modify and propagate the contents of this - implementation of Go, where such license applies only to those patent - claims, both currently owned or controlled by Google and acquired in - the future, licensable by Google that are necessarily infringed by this - implementation of Go. This grant does not include claims that would be - infringed only as a consequence of further modification of this - implementation. If you or your agent or exclusive licensee institute or - order or agree to the institution of patent litigation against any - entity (including a cross-claim or counterclaim in a lawsuit) alleging - that this implementation of Go or any code incorporated within this - implementation of Go constitutes direct or contributory patent - infringement, or inducement of patent infringement, then any patent - rights granted to you under this License for this implementation of Go - shall terminate as of the date such litigation is filed. -notices: [] diff --git a/.licenses/go/google.golang.org/protobuf/internal/encoding/json.dep.yml b/.licenses/go/google.golang.org/protobuf/internal/encoding/json.dep.yml deleted file mode 100644 index a8164f7c47c..00000000000 --- a/.licenses/go/google.golang.org/protobuf/internal/encoding/json.dep.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -name: google.golang.org/protobuf/internal/encoding/json -version: v1.26.0 -type: go -summary: -homepage: https://pkg.go.dev/google.golang.org/protobuf/internal/encoding/json -license: bsd-3-clause -licenses: -- sources: protobuf@v1.26.0/LICENSE - text: | - Copyright (c) 2018 The Go Authors. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - * Neither the name of Google Inc. nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: protobuf@v1.26.0/PATENTS - text: | - Additional IP Rights Grant (Patents) - - "This implementation" means the copyrightable works distributed by - Google as part of the Go project. - - Google hereby grants to You a perpetual, worldwide, non-exclusive, - no-charge, royalty-free, irrevocable (except as stated in this section) - patent license to make, have made, use, offer to sell, sell, import, - transfer and otherwise run, modify and propagate the contents of this - implementation of Go, where such license applies only to those patent - claims, both currently owned or controlled by Google and acquired in - the future, licensable by Google that are necessarily infringed by this - implementation of Go. This grant does not include claims that would be - infringed only as a consequence of further modification of this - implementation. If you or your agent or exclusive licensee institute or - order or agree to the institution of patent litigation against any - entity (including a cross-claim or counterclaim in a lawsuit) alleging - that this implementation of Go or any code incorporated within this - implementation of Go constitutes direct or contributory patent - infringement, or inducement of patent infringement, then any patent - rights granted to you under this License for this implementation of Go - shall terminate as of the date such litigation is filed. -notices: [] diff --git a/.licenses/go/google.golang.org/protobuf/types/known/structpb.dep.yml b/.licenses/go/google.golang.org/protobuf/types/known/structpb.dep.yml deleted file mode 100644 index 0c939fbecfb..00000000000 --- a/.licenses/go/google.golang.org/protobuf/types/known/structpb.dep.yml +++ /dev/null @@ -1,62 +0,0 @@ ---- -name: google.golang.org/protobuf/types/known/structpb -version: v1.26.0 -type: go -summary: Package structpb contains generated types for google/protobuf/struct.proto. -homepage: https://pkg.go.dev/google.golang.org/protobuf/types/known/structpb -license: bsd-3-clause -licenses: -- sources: protobuf@v1.26.0/LICENSE - text: | - Copyright (c) 2018 The Go Authors. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are - met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above - copyright notice, this list of conditions and the following disclaimer - in the documentation and/or other materials provided with the - distribution. - * Neither the name of Google Inc. nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -- sources: protobuf@v1.26.0/PATENTS - text: | - Additional IP Rights Grant (Patents) - - "This implementation" means the copyrightable works distributed by - Google as part of the Go project. - - Google hereby grants to You a perpetual, worldwide, non-exclusive, - no-charge, royalty-free, irrevocable (except as stated in this section) - patent license to make, have made, use, offer to sell, sell, import, - transfer and otherwise run, modify and propagate the contents of this - implementation of Go, where such license applies only to those patent - claims, both currently owned or controlled by Google and acquired in - the future, licensable by Google that are necessarily infringed by this - implementation of Go. This grant does not include claims that would be - infringed only as a consequence of further modification of this - implementation. If you or your agent or exclusive licensee institute or - order or agree to the institution of patent litigation against any - entity (including a cross-claim or counterclaim in a lawsuit) alleging - that this implementation of Go or any code incorporated within this - implementation of Go constitutes direct or contributory patent - infringement, or inducement of patent infringement, then any patent - rights granted to you under this License for this implementation of Go - shall terminate as of the date such litigation is filed. -notices: [] diff --git a/Taskfile.yml b/Taskfile.yml index aea91f1c023..801f21d620a 100755 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -198,7 +198,6 @@ tasks: desc: Compile protobuf definitions cmds: - '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/commands/v1/*.proto' - - '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/monitor/v1/*.proto' - '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/settings/v1/*.proto' - '{{ default "protoc" .PROTOC_BINARY }} --proto_path=rpc --go_out=./rpc --go_opt=paths=source_relative --go-grpc_out=./rpc --go-grpc_opt=paths=source_relative ./rpc/cc/arduino/cli/debug/v1/*.proto' @@ -206,7 +205,6 @@ tasks: desc: Generate docs for protobuf definitions cmds: - '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,commands.md --proto_path=rpc ./rpc/cc/arduino/cli/commands/v1/*.proto' - - '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,monitor.md --proto_path=rpc ./rpc/cc/arduino/cli/monitor/v1/*.proto' - '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,settings.md --proto_path=rpc ./rpc/cc/arduino/cli/settings/v1/*.proto' - '{{ default "protoc" .PROTOC_BINARY }} --doc_out=./docs/rpc --doc_opt=markdown,debug.md --proto_path=rpc ./rpc/cc/arduino/cli/debug/v1/*.proto' diff --git a/arduino/monitors/null.go b/arduino/monitors/null.go deleted file mode 100644 index bd80703ab68..00000000000 --- a/arduino/monitors/null.go +++ /dev/null @@ -1,70 +0,0 @@ -// This file is part of arduino-cli. -// -// Copyright 2021 ARDUINO SA (http://www.arduino.cc/) -// -// This software is released under the GNU General Public License version 3, -// which covers the main part of arduino-cli. -// The terms of this license can be found at: -// https://www.gnu.org/licenses/gpl-3.0.en.html -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package monitors - -import ( - "log" - "time" -) - -// NullMonitor outputs zeros at a constant rate and discards anything sent -type NullMonitor struct { - started time.Time - sent int - bps float64 -} - -// OpenNullMonitor creates a monitor that outputs the same character at a fixed -// rate. -func OpenNullMonitor(bytesPerSecondRate float64) *NullMonitor { - log.Printf("Started streaming at %f\n", bytesPerSecondRate) - return &NullMonitor{ - started: time.Now(), - bps: bytesPerSecondRate, - } -} - -// Close the connection -func (mon *NullMonitor) Close() error { - return nil -} - -// Read bytes from the port -func (mon *NullMonitor) Read(bytes []byte) (int, error) { - for { - elapsed := time.Since(mon.started).Seconds() - n := int(elapsed*mon.bps) - mon.sent - if n == 0 { - // Delay until the next char... - time.Sleep(time.Millisecond) - continue - } - if len(bytes) < n { - n = len(bytes) - } - mon.sent += n - for i := 0; i < n; i++ { - bytes[i] = 0 - } - return n, nil - } -} - -// Write bytes to the port -func (mon *NullMonitor) Write(bytes []byte) (int, error) { - // Discard all chars - return len(bytes), nil -} diff --git a/arduino/monitors/serial.go b/arduino/monitors/serial.go deleted file mode 100644 index 95df6eba21f..00000000000 --- a/arduino/monitors/serial.go +++ /dev/null @@ -1,65 +0,0 @@ -// This file is part of arduino-cli. -// -// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) -// -// This software is released under the GNU General Public License version 3, -// which covers the main part of arduino-cli. -// The terms of this license can be found at: -// https://www.gnu.org/licenses/gpl-3.0.en.html -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package monitors - -import ( - "github.com/arduino/arduino-cli/i18n" - "github.com/pkg/errors" - "go.bug.st/serial" -) - -const ( - defaultBaudRate = 9600 -) - -var tr = i18n.Tr - -// SerialMonitor is a monitor for serial ports -type SerialMonitor struct { - port serial.Port -} - -// OpenSerialMonitor creates a monitor instance for a serial port -func OpenSerialMonitor(portName string, baudRate int) (*SerialMonitor, error) { - // use default baud rate if not provided - if baudRate == 0 { - baudRate = defaultBaudRate - } - - port, err := serial.Open(portName, &serial.Mode{BaudRate: baudRate}) - if err != nil { - return nil, errors.Wrap(err, tr("error opening serial monitor")) - } - - return &SerialMonitor{ - port: port, - }, nil -} - -// Close the connection -func (mon *SerialMonitor) Close() error { - return mon.port.Close() -} - -// Read bytes from the port -func (mon *SerialMonitor) Read(bytes []byte) (int, error) { - return mon.port.Read(bytes) -} - -// Write bytes to the port -func (mon *SerialMonitor) Write(bytes []byte) (int, error) { - return mon.port.Write(bytes) -} diff --git a/arduino/monitors/types.go b/arduino/monitors/types.go deleted file mode 100644 index 96a37115845..00000000000 --- a/arduino/monitors/types.go +++ /dev/null @@ -1,25 +0,0 @@ -// This file is part of arduino-cli. -// -// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) -// -// This software is released under the GNU General Public License version 3, -// which covers the main part of arduino-cli. -// The terms of this license can be found at: -// https://www.gnu.org/licenses/gpl-3.0.en.html -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package monitors - -import ( - "io" -) - -// Monitor is the interface implemented by different device monitors -type Monitor interface { - io.ReadWriteCloser -} diff --git a/cli/daemon/daemon.go b/cli/daemon/daemon.go index 81a571708ac..f5ff279528e 100644 --- a/cli/daemon/daemon.go +++ b/cli/daemon/daemon.go @@ -33,7 +33,6 @@ import ( "github.com/arduino/arduino-cli/i18n" srv_commands "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/commands/v1" srv_debug "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/debug/v1" - srv_monitor "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/monitor/v1" srv_settings "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/settings/v1" "github.com/arduino/go-paths-helper" "github.com/sirupsen/logrus" @@ -106,9 +105,6 @@ func runDaemonCommand(cmd *cobra.Command, args []string) { VersionString: globals.VersionInfo.VersionString, }) - // Register the monitors service - srv_monitor.RegisterMonitorServiceServer(s, &daemon.MonitorService{}) - // Register the settings service srv_settings.RegisterSettingsServiceServer(s, &daemon.SettingsService{}) diff --git a/commands/daemon/monitor.go b/commands/daemon/monitor.go deleted file mode 100644 index 606a6804219..00000000000 --- a/commands/daemon/monitor.go +++ /dev/null @@ -1,194 +0,0 @@ -// This file is part of arduino-cli. -// -// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) -// -// This software is released under the GNU General Public License version 3, -// which covers the main part of arduino-cli. -// The terms of this license can be found at: -// https://www.gnu.org/licenses/gpl-3.0.en.html -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -package daemon - -import ( - "errors" - "io" - "sync/atomic" - - "github.com/arduino/arduino-cli/arduino/monitors" - rpc "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/monitor/v1" -) - -// MonitorService implements the `Monitor` service -type MonitorService struct { - rpc.UnimplementedMonitorServiceServer -} - -// StreamingOpen returns a stream response that can be used to fetch data from the -// monitor target. The first message passed through the `StreamingOpenReq` must -// contain monitor configuration params, not data. -func (s *MonitorService) StreamingOpen(stream rpc.MonitorService_StreamingOpenServer) error { - // grab the first message - msg, err := stream.Recv() - if err != nil { - return err - } - - // ensure it's a config message and not data - config := msg.GetConfig() - if config == nil { - return errors.New(tr("first message must contain monitor configuration, not data")) - } - - // select which type of monitor we need - var mon monitors.Monitor - switch config.GetType() { - case rpc.MonitorConfig_TARGET_TYPE_SERIAL: - // grab port speed from additional config data - var baudRate float64 - addCfg := config.GetAdditionalConfig() - for k, v := range addCfg.GetFields() { - if k == "BaudRate" { - baudRate = v.GetNumberValue() - break - } - } - - // get the Monitor instance - var err error - if mon, err = monitors.OpenSerialMonitor(config.GetTarget(), int(baudRate)); err != nil { - return err - } - - case rpc.MonitorConfig_TARGET_TYPE_NULL: - if addCfg, ok := config.GetAdditionalConfig().AsMap()["OutputRate"]; !ok { - mon = monitors.OpenNullMonitor(100.0) // 100 bytes per second as default - } else if outputRate, ok := addCfg.(float64); !ok { - return errors.New(tr("OutputRate in Null monitor must be a float64")) - } else { - // get the Monitor instance - mon = monitors.OpenNullMonitor(outputRate) - } - } - - // we'll use these channels to communicate with the goroutines - // handling the stream and the target respectively - streamClosed := make(chan error) - targetClosed := make(chan error) - - // set rate limiting window - bufferSize := int(config.GetRecvRateLimitBuffer()) - rateLimitEnabled := (bufferSize > 0) - if !rateLimitEnabled { - bufferSize = 1024 - } - buffer := make([]byte, bufferSize) - bufferUsed := 0 - - var writeSlots int32 - - // now we can read the other messages and re-route to the monitor... - go func() { - for { - msg, err := stream.Recv() - if err == io.EOF { - // stream was closed - streamClosed <- nil - break - } - - if err != nil { - // error reading from stream - streamClosed <- err - break - } - - if rateLimitEnabled { - // Increase rate limiter write slots - atomic.AddInt32(&writeSlots, msg.GetRecvAcknowledge()) - } - - if _, err := mon.Write(msg.GetData()); err != nil { - // error writing to target - targetClosed <- err - break - } - } - }() - - // ...and read from the monitor and forward to the output stream - go func() { - dropBuffer := make([]byte, 10240) - dropped := 0 - for { - if bufferUsed < bufferSize { - if n, err := mon.Read(buffer[bufferUsed:]); err != nil { - // error reading from target - targetClosed <- err - break - } else if n == 0 { - // target was closed - targetClosed <- nil - break - } else { - bufferUsed += n - } - } else { - // FIXME: a very rare condition but still... - // we may be waiting here while, in the meantime, a transmit slot is - // freed: in this case the (filled) buffer will stay in the server - // until the following Read exits (-> the next char arrives from the - // monitor). - - if n, err := mon.Read(dropBuffer); err != nil { - // error reading from target - targetClosed <- err - break - } else if n == 0 { - // target was closed - targetClosed <- nil - break - } else { - dropped += n - } - } - - slots := atomic.LoadInt32(&writeSlots) - if !rateLimitEnabled || slots > 0 { - if err = stream.Send(&rpc.StreamingOpenResponse{ - Data: buffer[:bufferUsed], - Dropped: int32(dropped), - }); err != nil { - // error sending to stream - streamClosed <- err - break - } - bufferUsed = 0 - dropped = 0 - - // Rate limit, filling all the available window - if rateLimitEnabled { - atomic.AddInt32(&writeSlots, -1) - } - } - } - }() - - // let goroutines route messages from/to the monitor - // until either the client closes the stream or the - // monitor target is closed - for { - select { - case err := <-streamClosed: - mon.Close() - return err - case err := <-targetClosed: - return err - } - } -} diff --git a/docs/FAQ.md b/docs/FAQ.md index 29b7cd6bdb5..4dd052f809a 100644 --- a/docs/FAQ.md +++ b/docs/FAQ.md @@ -25,9 +25,6 @@ by this command is very limited and you may want to look for other tools if you There are many excellent serial terminals to chose from. On Linux or macOS, you may already have [screen][screen] installed. On Windows, a good choice for command line usage is Plink, included with [PuTTY][putty]. -Arduino CLI does provide a gRPC interface which offers the capability for powerful integration with custom monitors. See -the [Monitor service documentation][monitor service]. - ## Additional assistance If your question wasn't answered, feel free to ask on [Arduino CLI's forum board][1]. @@ -37,5 +34,4 @@ If your question wasn't answered, feel free to ask on [Arduino CLI's forum board [1]: https://forum.arduino.cc/index.php?board=145.0 [screen]: https://www.gnu.org/software/screen/manual/screen.html [putty]: https://www.chiark.greenend.org.uk/~sgtatham/putty/ -[monitor service]: rpc/monitor.md [monitor command]: commands/arduino-cli_monitor.md diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md index 402ce4e2493..e0f13468c04 100644 --- a/docs/UPGRADING.md +++ b/docs/UPGRADING.md @@ -2,6 +2,26 @@ Here you can find a list of migration guides to handle breaking changes between releases of the CLI. +## Nightly builds: not yet released + +### gRPC `Monitor` service and related gRPC calls have been removed + +The gRPC `Monitor` service and the gRPC call `Monitor.StreamingOpen` have been removed in favor of the new Pluggable +Monitor API in the gRPC `Commands` service: + +- `Commands.Monitor`: open a monitor connection to a communication port. +- `Commands.EnumerateMonitorPortSettings`: enumerate the possible configurations parameters for a communication port. + +Please refer to the official documentation and the reference client implementation for details on how to use the new +API. + +https://arduino.github.io/arduino-cli/dev/rpc/commands/#monitorrequest +https://arduino.github.io/arduino-cli/dev/rpc/commands/#monitorresponse +https://arduino.github.io/arduino-cli/dev/rpc/commands/#enumeratemonitorportsettingsrequest +https://arduino.github.io/arduino-cli/dev/rpc/commands/#enumeratemonitorportsettingsresponse + +https://github.com/arduino/arduino-cli/blob/master/commands/daemon/term_example/main.go + ## 0.23.0 ### Arduino IDE builtin libraries are now excluded from the build when running `arduino-cli` standalone diff --git a/mkdocs.yml b/mkdocs.yml index 16327cb4511..28f342fbf69 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -100,7 +100,6 @@ nav: - version: commands/arduino-cli_version.md - gRPC reference: - commands: rpc/commands.md - - monitor: rpc/monitor.md - settings: rpc/settings.md - debug: rpc/debug.md - configuration.md diff --git a/rpc/cc/arduino/cli/monitor/v1/monitor.pb.go b/rpc/cc/arduino/cli/monitor/v1/monitor.pb.go deleted file mode 100644 index 4e50f0a0683..00000000000 --- a/rpc/cc/arduino/cli/monitor/v1/monitor.pb.go +++ /dev/null @@ -1,508 +0,0 @@ -// This file is part of arduino-cli. -// -// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) -// -// This software is released under the GNU General Public License version 3, -// which covers the main part of arduino-cli. -// The terms of this license can be found at: -// https://www.gnu.org/licenses/gpl-3.0.en.html -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -// Code generated by protoc-gen-go. DO NOT EDIT. -// versions: -// protoc-gen-go v1.26.0 -// protoc v3.17.3 -// cc/arduino/cli/monitor/v1/monitor.proto is a deprecated file. - -package monitor - -import ( - protoreflect "google.golang.org/protobuf/reflect/protoreflect" - protoimpl "google.golang.org/protobuf/runtime/protoimpl" - structpb "google.golang.org/protobuf/types/known/structpb" - reflect "reflect" - sync "sync" -) - -const ( - // Verify that this generated code is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) - // Verify that runtime/protoimpl is sufficiently up-to-date. - _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) -) - -type MonitorConfig_TargetType int32 - -const ( - MonitorConfig_TARGET_TYPE_SERIAL MonitorConfig_TargetType = 0 - MonitorConfig_TARGET_TYPE_NULL MonitorConfig_TargetType = 99 -) - -// Enum value maps for MonitorConfig_TargetType. -var ( - MonitorConfig_TargetType_name = map[int32]string{ - 0: "TARGET_TYPE_SERIAL", - 99: "TARGET_TYPE_NULL", - } - MonitorConfig_TargetType_value = map[string]int32{ - "TARGET_TYPE_SERIAL": 0, - "TARGET_TYPE_NULL": 99, - } -) - -func (x MonitorConfig_TargetType) Enum() *MonitorConfig_TargetType { - p := new(MonitorConfig_TargetType) - *p = x - return p -} - -func (x MonitorConfig_TargetType) String() string { - return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x)) -} - -func (MonitorConfig_TargetType) Descriptor() protoreflect.EnumDescriptor { - return file_cc_arduino_cli_monitor_v1_monitor_proto_enumTypes[0].Descriptor() -} - -func (MonitorConfig_TargetType) Type() protoreflect.EnumType { - return &file_cc_arduino_cli_monitor_v1_monitor_proto_enumTypes[0] -} - -func (x MonitorConfig_TargetType) Number() protoreflect.EnumNumber { - return protoreflect.EnumNumber(x) -} - -// Deprecated: Use MonitorConfig_TargetType.Descriptor instead. -func (MonitorConfig_TargetType) EnumDescriptor() ([]byte, []int) { - return file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescGZIP(), []int{1, 0} -} - -// The top-level message sent by the client for the `StreamingOpen` method. -// Multiple `StreamingOpenReq` messages can be sent but the first message -// must contain a `monitor_config` message to initialize the monitor target. -// All subsequent messages must contain bytes to be sent to the target -// and must not contain a `monitor_config` message. -// DEPRECATION WARNING: StreamingOpenRequest is deprecated and will be removed -// in a future release. Use ArduinoCoreService.Monitor and -// ArduinoCoreService.EnumerateMonitorPortSettings instead. -// -// Deprecated: Do not use. -type StreamingOpenRequest struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // Content must be either a monitor config or data to be sent. - // - // Types that are assignable to Content: - // *StreamingOpenRequest_Config - // *StreamingOpenRequest_Data - // *StreamingOpenRequest_RecvAcknowledge - Content isStreamingOpenRequest_Content `protobuf_oneof:"content"` -} - -func (x *StreamingOpenRequest) Reset() { - *x = StreamingOpenRequest{} - if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[0] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StreamingOpenRequest) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamingOpenRequest) ProtoMessage() {} - -func (x *StreamingOpenRequest) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[0] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StreamingOpenRequest.ProtoReflect.Descriptor instead. -func (*StreamingOpenRequest) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescGZIP(), []int{0} -} - -func (m *StreamingOpenRequest) GetContent() isStreamingOpenRequest_Content { - if m != nil { - return m.Content - } - return nil -} - -func (x *StreamingOpenRequest) GetConfig() *MonitorConfig { - if x, ok := x.GetContent().(*StreamingOpenRequest_Config); ok { - return x.Config - } - return nil -} - -func (x *StreamingOpenRequest) GetData() []byte { - if x, ok := x.GetContent().(*StreamingOpenRequest_Data); ok { - return x.Data - } - return nil -} - -func (x *StreamingOpenRequest) GetRecvAcknowledge() int32 { - if x, ok := x.GetContent().(*StreamingOpenRequest_RecvAcknowledge); ok { - return x.RecvAcknowledge - } - return 0 -} - -type isStreamingOpenRequest_Content interface { - isStreamingOpenRequest_Content() -} - -type StreamingOpenRequest_Config struct { - // Provides information to the monitor that specifies which is the target. - // The first `StreamingOpenReq` message must contain a `config` - // message. - Config *MonitorConfig `protobuf:"bytes,1,opt,name=config,proto3,oneof"` -} - -type StreamingOpenRequest_Data struct { - // The data to be sent to the target being monitored. - Data []byte `protobuf:"bytes,2,opt,name=data,proto3,oneof"` -} - -type StreamingOpenRequest_RecvAcknowledge struct { - // When the rate limiter is enabled, this parameter is used to report the - // number of successfully processed StreamingOpenResp messages (with data). - RecvAcknowledge int32 `protobuf:"varint,3,opt,name=recv_acknowledge,json=recvAcknowledge,proto3,oneof"` -} - -func (*StreamingOpenRequest_Config) isStreamingOpenRequest_Content() {} - -func (*StreamingOpenRequest_Data) isStreamingOpenRequest_Content() {} - -func (*StreamingOpenRequest_RecvAcknowledge) isStreamingOpenRequest_Content() {} - -// Tells the monitor which target to open and provides additional parameters -// that might be needed to configure the target or the monitor itself. -// DEPRECATION WARNING: MonitorConfig is deprecated and will be removed -// in a future release. Use ArduinoCoreService.Monitor and -// ArduinoCoreService.EnumerateMonitorPortSettings instead. -// -// Deprecated: Do not use. -type MonitorConfig struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The target name. - Target string `protobuf:"bytes,1,opt,name=target,proto3" json:"target,omitempty"` - Type MonitorConfig_TargetType `protobuf:"varint,2,opt,name=type,proto3,enum=cc.arduino.cli.monitor.v1.MonitorConfig_TargetType" json:"type,omitempty"` - // Additional parameters that might be needed to configure the target or the - // monitor itself. - AdditionalConfig *structpb.Struct `protobuf:"bytes,3,opt,name=additional_config,json=additionalConfig,proto3" json:"additional_config,omitempty"` - // This parameter indicates how many bytes should be buffered on the server - // side before dropping. If >0 then the server will enable a rate limiter and - // will send incoming data to the client only when the client allows it: see - // the StreamingOpenReq.recv_acknowledge parameter for details. - RecvRateLimitBuffer int32 `protobuf:"varint,4,opt,name=recv_rate_limit_buffer,json=recvRateLimitBuffer,proto3" json:"recv_rate_limit_buffer,omitempty"` -} - -func (x *MonitorConfig) Reset() { - *x = MonitorConfig{} - if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[1] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *MonitorConfig) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*MonitorConfig) ProtoMessage() {} - -func (x *MonitorConfig) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[1] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use MonitorConfig.ProtoReflect.Descriptor instead. -func (*MonitorConfig) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescGZIP(), []int{1} -} - -func (x *MonitorConfig) GetTarget() string { - if x != nil { - return x.Target - } - return "" -} - -func (x *MonitorConfig) GetType() MonitorConfig_TargetType { - if x != nil { - return x.Type - } - return MonitorConfig_TARGET_TYPE_SERIAL -} - -func (x *MonitorConfig) GetAdditionalConfig() *structpb.Struct { - if x != nil { - return x.AdditionalConfig - } - return nil -} - -func (x *MonitorConfig) GetRecvRateLimitBuffer() int32 { - if x != nil { - return x.RecvRateLimitBuffer - } - return 0 -} - -// DEPRECATION WARNING: StreamingOpenResponse is deprecated and will be removed -// in a future release. Use ArduinoCoreService.Monitor and -// ArduinoCoreService.EnumerateMonitorPortSettings instead. -// -// Deprecated: Do not use. -type StreamingOpenResponse struct { - state protoimpl.MessageState - sizeCache protoimpl.SizeCache - unknownFields protoimpl.UnknownFields - - // The data received from the target. - Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"` - // The number of bytes dropped. - // During regular updates this number should be 0, but in case the - // client is not able to process the recv window quickly enough this - // parameter will report the number of dropped bytes. - Dropped int32 `protobuf:"varint,2,opt,name=dropped,proto3" json:"dropped,omitempty"` -} - -func (x *StreamingOpenResponse) Reset() { - *x = StreamingOpenResponse{} - if protoimpl.UnsafeEnabled { - mi := &file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[2] - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - ms.StoreMessageInfo(mi) - } -} - -func (x *StreamingOpenResponse) String() string { - return protoimpl.X.MessageStringOf(x) -} - -func (*StreamingOpenResponse) ProtoMessage() {} - -func (x *StreamingOpenResponse) ProtoReflect() protoreflect.Message { - mi := &file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[2] - if protoimpl.UnsafeEnabled && x != nil { - ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) - if ms.LoadMessageInfo() == nil { - ms.StoreMessageInfo(mi) - } - return ms - } - return mi.MessageOf(x) -} - -// Deprecated: Use StreamingOpenResponse.ProtoReflect.Descriptor instead. -func (*StreamingOpenResponse) Descriptor() ([]byte, []int) { - return file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescGZIP(), []int{2} -} - -func (x *StreamingOpenResponse) GetData() []byte { - if x != nil { - return x.Data - } - return nil -} - -func (x *StreamingOpenResponse) GetDropped() int32 { - if x != nil { - return x.Dropped - } - return 0 -} - -var File_cc_arduino_cli_monitor_v1_monitor_proto protoreflect.FileDescriptor - -var file_cc_arduino_cli_monitor_v1_monitor_proto_rawDesc = []byte{ - 0x0a, 0x27, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, 0x69, - 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x2f, 0x76, 0x31, 0x2f, 0x6d, 0x6f, 0x6e, 0x69, - 0x74, 0x6f, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x19, 0x63, 0x63, 0x2e, 0x61, 0x72, - 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, - 0x72, 0x2e, 0x76, 0x31, 0x1a, 0x1c, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2f, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2f, 0x73, 0x74, 0x72, 0x75, 0x63, 0x74, 0x2e, 0x70, 0x72, 0x6f, - 0x74, 0x6f, 0x22, 0xac, 0x01, 0x0a, 0x14, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, - 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x42, 0x0a, 0x06, 0x63, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x28, 0x2e, 0x63, 0x63, - 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x6d, 0x6f, 0x6e, - 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x43, - 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x48, 0x00, 0x52, 0x06, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, - 0x14, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0c, 0x48, 0x00, 0x52, - 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x2b, 0x0a, 0x10, 0x72, 0x65, 0x63, 0x76, 0x5f, 0x61, 0x63, - 0x6b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x48, - 0x00, 0x52, 0x0f, 0x72, 0x65, 0x63, 0x76, 0x41, 0x63, 0x6b, 0x6e, 0x6f, 0x77, 0x6c, 0x65, 0x64, - 0x67, 0x65, 0x3a, 0x02, 0x18, 0x01, 0x42, 0x09, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, - 0x74, 0x22, 0xab, 0x02, 0x0a, 0x0d, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x12, 0x16, 0x0a, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x06, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x12, 0x47, 0x0a, 0x04, 0x74, - 0x79, 0x70, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x33, 0x2e, 0x63, 0x63, 0x2e, 0x61, - 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, - 0x6f, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x4d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x43, 0x6f, 0x6e, - 0x66, 0x69, 0x67, 0x2e, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x52, 0x04, - 0x74, 0x79, 0x70, 0x65, 0x12, 0x44, 0x0a, 0x11, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, 0x6f, 0x6e, - 0x61, 0x6c, 0x5f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0b, 0x32, - 0x17, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, - 0x66, 0x2e, 0x53, 0x74, 0x72, 0x75, 0x63, 0x74, 0x52, 0x10, 0x61, 0x64, 0x64, 0x69, 0x74, 0x69, - 0x6f, 0x6e, 0x61, 0x6c, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x12, 0x33, 0x0a, 0x16, 0x72, 0x65, - 0x63, 0x76, 0x5f, 0x72, 0x61, 0x74, 0x65, 0x5f, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x5f, 0x62, 0x75, - 0x66, 0x66, 0x65, 0x72, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x13, 0x72, 0x65, 0x63, 0x76, - 0x52, 0x61, 0x74, 0x65, 0x4c, 0x69, 0x6d, 0x69, 0x74, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0x22, - 0x3a, 0x0a, 0x0a, 0x54, 0x61, 0x72, 0x67, 0x65, 0x74, 0x54, 0x79, 0x70, 0x65, 0x12, 0x16, 0x0a, - 0x12, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, 0x54, 0x59, 0x50, 0x45, 0x5f, 0x53, 0x45, 0x52, - 0x49, 0x41, 0x4c, 0x10, 0x00, 0x12, 0x14, 0x0a, 0x10, 0x54, 0x41, 0x52, 0x47, 0x45, 0x54, 0x5f, - 0x54, 0x59, 0x50, 0x45, 0x5f, 0x4e, 0x55, 0x4c, 0x4c, 0x10, 0x63, 0x3a, 0x02, 0x18, 0x01, 0x22, - 0x49, 0x0a, 0x15, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x6e, - 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x64, 0x61, 0x74, 0x61, - 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x04, 0x64, 0x61, 0x74, 0x61, 0x12, 0x18, 0x0a, 0x07, - 0x64, 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x64, - 0x72, 0x6f, 0x70, 0x70, 0x65, 0x64, 0x3a, 0x02, 0x18, 0x01, 0x32, 0x8f, 0x01, 0x0a, 0x0e, 0x4d, - 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x78, 0x0a, - 0x0d, 0x53, 0x74, 0x72, 0x65, 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x6e, 0x12, 0x2f, - 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, 0x2e, - 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, 0x61, - 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, - 0x30, 0x2e, 0x63, 0x63, 0x2e, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2e, 0x63, 0x6c, 0x69, - 0x2e, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x74, 0x72, 0x65, - 0x61, 0x6d, 0x69, 0x6e, 0x67, 0x4f, 0x70, 0x65, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0x00, 0x28, 0x01, 0x30, 0x01, 0x1a, 0x03, 0x88, 0x02, 0x01, 0x42, 0x49, 0x5a, 0x44, - 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, - 0x6e, 0x6f, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2d, 0x63, 0x6c, 0x69, 0x2f, 0x72, - 0x70, 0x63, 0x2f, 0x63, 0x63, 0x2f, 0x61, 0x72, 0x64, 0x75, 0x69, 0x6e, 0x6f, 0x2f, 0x63, 0x6c, - 0x69, 0x2f, 0x6d, 0x6f, 0x6e, 0x69, 0x74, 0x6f, 0x72, 0x2f, 0x76, 0x31, 0x3b, 0x6d, 0x6f, 0x6e, - 0x69, 0x74, 0x6f, 0x72, 0xb8, 0x01, 0x01, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, -} - -var ( - file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescOnce sync.Once - file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescData = file_cc_arduino_cli_monitor_v1_monitor_proto_rawDesc -) - -func file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescGZIP() []byte { - file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescOnce.Do(func() { - file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescData = protoimpl.X.CompressGZIP(file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescData) - }) - return file_cc_arduino_cli_monitor_v1_monitor_proto_rawDescData -} - -var file_cc_arduino_cli_monitor_v1_monitor_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes = make([]protoimpl.MessageInfo, 3) -var file_cc_arduino_cli_monitor_v1_monitor_proto_goTypes = []interface{}{ - (MonitorConfig_TargetType)(0), // 0: cc.arduino.cli.monitor.v1.MonitorConfig.TargetType - (*StreamingOpenRequest)(nil), // 1: cc.arduino.cli.monitor.v1.StreamingOpenRequest - (*MonitorConfig)(nil), // 2: cc.arduino.cli.monitor.v1.MonitorConfig - (*StreamingOpenResponse)(nil), // 3: cc.arduino.cli.monitor.v1.StreamingOpenResponse - (*structpb.Struct)(nil), // 4: google.protobuf.Struct -} -var file_cc_arduino_cli_monitor_v1_monitor_proto_depIdxs = []int32{ - 2, // 0: cc.arduino.cli.monitor.v1.StreamingOpenRequest.config:type_name -> cc.arduino.cli.monitor.v1.MonitorConfig - 0, // 1: cc.arduino.cli.monitor.v1.MonitorConfig.type:type_name -> cc.arduino.cli.monitor.v1.MonitorConfig.TargetType - 4, // 2: cc.arduino.cli.monitor.v1.MonitorConfig.additional_config:type_name -> google.protobuf.Struct - 1, // 3: cc.arduino.cli.monitor.v1.MonitorService.StreamingOpen:input_type -> cc.arduino.cli.monitor.v1.StreamingOpenRequest - 3, // 4: cc.arduino.cli.monitor.v1.MonitorService.StreamingOpen:output_type -> cc.arduino.cli.monitor.v1.StreamingOpenResponse - 4, // [4:5] is the sub-list for method output_type - 3, // [3:4] is the sub-list for method input_type - 3, // [3:3] is the sub-list for extension type_name - 3, // [3:3] is the sub-list for extension extendee - 0, // [0:3] is the sub-list for field type_name -} - -func init() { file_cc_arduino_cli_monitor_v1_monitor_proto_init() } -func file_cc_arduino_cli_monitor_v1_monitor_proto_init() { - if File_cc_arduino_cli_monitor_v1_monitor_proto != nil { - return - } - if !protoimpl.UnsafeEnabled { - file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamingOpenRequest); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*MonitorConfig); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { - switch v := v.(*StreamingOpenResponse); i { - case 0: - return &v.state - case 1: - return &v.sizeCache - case 2: - return &v.unknownFields - default: - return nil - } - } - } - file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes[0].OneofWrappers = []interface{}{ - (*StreamingOpenRequest_Config)(nil), - (*StreamingOpenRequest_Data)(nil), - (*StreamingOpenRequest_RecvAcknowledge)(nil), - } - type x struct{} - out := protoimpl.TypeBuilder{ - File: protoimpl.DescBuilder{ - GoPackagePath: reflect.TypeOf(x{}).PkgPath(), - RawDescriptor: file_cc_arduino_cli_monitor_v1_monitor_proto_rawDesc, - NumEnums: 1, - NumMessages: 3, - NumExtensions: 0, - NumServices: 1, - }, - GoTypes: file_cc_arduino_cli_monitor_v1_monitor_proto_goTypes, - DependencyIndexes: file_cc_arduino_cli_monitor_v1_monitor_proto_depIdxs, - EnumInfos: file_cc_arduino_cli_monitor_v1_monitor_proto_enumTypes, - MessageInfos: file_cc_arduino_cli_monitor_v1_monitor_proto_msgTypes, - }.Build() - File_cc_arduino_cli_monitor_v1_monitor_proto = out.File - file_cc_arduino_cli_monitor_v1_monitor_proto_rawDesc = nil - file_cc_arduino_cli_monitor_v1_monitor_proto_goTypes = nil - file_cc_arduino_cli_monitor_v1_monitor_proto_depIdxs = nil -} diff --git a/rpc/cc/arduino/cli/monitor/v1/monitor.proto b/rpc/cc/arduino/cli/monitor/v1/monitor.proto deleted file mode 100644 index 0ca1d752def..00000000000 --- a/rpc/cc/arduino/cli/monitor/v1/monitor.proto +++ /dev/null @@ -1,106 +0,0 @@ -// This file is part of arduino-cli. -// -// Copyright 2020 ARDUINO SA (http://www.arduino.cc/) -// -// This software is released under the GNU General Public License version 3, -// which covers the main part of arduino-cli. -// The terms of this license can be found at: -// https://www.gnu.org/licenses/gpl-3.0.en.html -// -// You can be released from the requirements of the above licenses by purchasing -// a commercial license. Buying such a license is mandatory if you want to -// modify or otherwise use the software for commercial activities involving the -// Arduino software without disclosing the source code of your own applications. -// To purchase a commercial license, send an email to license@arduino.cc. - -syntax = "proto3"; - -package cc.arduino.cli.monitor.v1; - -option deprecated = true; -option go_package = "github.com/arduino/arduino-cli/rpc/cc/arduino/cli/monitor/v1;monitor"; - -import "google/protobuf/struct.proto"; - -// MonitorService provides services for boards monitor. -// DEPRECATION WARNING: MonitorService is deprecated and will be removed in a -// future release. Use ArduinoCoreService.Monitor and -// ArduinoCoreService.EnumerateMonitorPortSettings instead. -service MonitorService { - option deprecated = true; - - // Open a bidirectional monitor stream. This can be used to implement - // something similar to the Arduino IDE's Serial Monitor. - rpc StreamingOpen(stream StreamingOpenRequest) - returns (stream StreamingOpenResponse) {} -} - -// The top-level message sent by the client for the `StreamingOpen` method. -// Multiple `StreamingOpenReq` messages can be sent but the first message -// must contain a `monitor_config` message to initialize the monitor target. -// All subsequent messages must contain bytes to be sent to the target -// and must not contain a `monitor_config` message. -// DEPRECATION WARNING: StreamingOpenRequest is deprecated and will be removed -// in a future release. Use ArduinoCoreService.Monitor and -// ArduinoCoreService.EnumerateMonitorPortSettings instead. -message StreamingOpenRequest { - option deprecated = true; - - // Content must be either a monitor config or data to be sent. - oneof content { - // Provides information to the monitor that specifies which is the target. - // The first `StreamingOpenReq` message must contain a `config` - // message. - MonitorConfig config = 1; - - // The data to be sent to the target being monitored. - bytes data = 2; - - // When the rate limiter is enabled, this parameter is used to report the - // number of successfully processed StreamingOpenResp messages (with data). - int32 recv_acknowledge = 3; - } -} - -// Tells the monitor which target to open and provides additional parameters -// that might be needed to configure the target or the monitor itself. -// DEPRECATION WARNING: MonitorConfig is deprecated and will be removed -// in a future release. Use ArduinoCoreService.Monitor and -// ArduinoCoreService.EnumerateMonitorPortSettings instead. -message MonitorConfig { - option deprecated = true; - - enum TargetType { - TARGET_TYPE_SERIAL = 0; - TARGET_TYPE_NULL = 99; - } - - // The target name. - string target = 1; - TargetType type = 2; - // Additional parameters that might be needed to configure the target or the - // monitor itself. - google.protobuf.Struct additional_config = 3; - - // This parameter indicates how many bytes should be buffered on the server - // side before dropping. If >0 then the server will enable a rate limiter and - // will send incoming data to the client only when the client allows it: see - // the StreamingOpenReq.recv_acknowledge parameter for details. - int32 recv_rate_limit_buffer = 4; -} - -// DEPRECATION WARNING: StreamingOpenResponse is deprecated and will be removed -// in a future release. Use ArduinoCoreService.Monitor and -// ArduinoCoreService.EnumerateMonitorPortSettings instead. -message StreamingOpenResponse { - option deprecated = true; - - // The data received from the target. - bytes data = 1; - - // The number of bytes dropped. - // During regular updates this number should be 0, but in case the - // client is not able to process the recv window quickly enough this - // parameter will report the number of dropped bytes. - int32 dropped = 2; -} \ No newline at end of file diff --git a/rpc/cc/arduino/cli/monitor/v1/monitor_grpc.pb.go b/rpc/cc/arduino/cli/monitor/v1/monitor_grpc.pb.go deleted file mode 100644 index be00975faa2..00000000000 --- a/rpc/cc/arduino/cli/monitor/v1/monitor_grpc.pb.go +++ /dev/null @@ -1,147 +0,0 @@ -// Code generated by protoc-gen-go-grpc. DO NOT EDIT. -// versions: -// - protoc-gen-go-grpc v1.2.0 -// - protoc v3.17.3 -// cc/arduino/cli/monitor/v1/monitor.proto is a deprecated file. - -package monitor - -import ( - context "context" - grpc "google.golang.org/grpc" - codes "google.golang.org/grpc/codes" - status "google.golang.org/grpc/status" -) - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -// Requires gRPC-Go v1.32.0 or later. -const _ = grpc.SupportPackageIsVersion7 - -// MonitorServiceClient is the client API for MonitorService service. -// -// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. -// -// Deprecated: Do not use. -type MonitorServiceClient interface { - // Open a bidirectional monitor stream. This can be used to implement - // something similar to the Arduino IDE's Serial Monitor. - StreamingOpen(ctx context.Context, opts ...grpc.CallOption) (MonitorService_StreamingOpenClient, error) -} - -type monitorServiceClient struct { - cc grpc.ClientConnInterface -} - -// Deprecated: Do not use. -func NewMonitorServiceClient(cc grpc.ClientConnInterface) MonitorServiceClient { - return &monitorServiceClient{cc} -} - -func (c *monitorServiceClient) StreamingOpen(ctx context.Context, opts ...grpc.CallOption) (MonitorService_StreamingOpenClient, error) { - stream, err := c.cc.NewStream(ctx, &MonitorService_ServiceDesc.Streams[0], "/cc.arduino.cli.monitor.v1.MonitorService/StreamingOpen", opts...) - if err != nil { - return nil, err - } - x := &monitorServiceStreamingOpenClient{stream} - return x, nil -} - -type MonitorService_StreamingOpenClient interface { - Send(*StreamingOpenRequest) error - Recv() (*StreamingOpenResponse, error) - grpc.ClientStream -} - -type monitorServiceStreamingOpenClient struct { - grpc.ClientStream -} - -func (x *monitorServiceStreamingOpenClient) Send(m *StreamingOpenRequest) error { - return x.ClientStream.SendMsg(m) -} - -func (x *monitorServiceStreamingOpenClient) Recv() (*StreamingOpenResponse, error) { - m := new(StreamingOpenResponse) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// MonitorServiceServer is the server API for MonitorService service. -// All implementations must embed UnimplementedMonitorServiceServer -// for forward compatibility -// -// Deprecated: Do not use. -type MonitorServiceServer interface { - // Open a bidirectional monitor stream. This can be used to implement - // something similar to the Arduino IDE's Serial Monitor. - StreamingOpen(MonitorService_StreamingOpenServer) error - mustEmbedUnimplementedMonitorServiceServer() -} - -// UnimplementedMonitorServiceServer must be embedded to have forward compatible implementations. -type UnimplementedMonitorServiceServer struct { -} - -func (UnimplementedMonitorServiceServer) StreamingOpen(MonitorService_StreamingOpenServer) error { - return status.Errorf(codes.Unimplemented, "method StreamingOpen not implemented") -} -func (UnimplementedMonitorServiceServer) mustEmbedUnimplementedMonitorServiceServer() {} - -// UnsafeMonitorServiceServer may be embedded to opt out of forward compatibility for this service. -// Use of this interface is not recommended, as added methods to MonitorServiceServer will -// result in compilation errors. -type UnsafeMonitorServiceServer interface { - mustEmbedUnimplementedMonitorServiceServer() -} - -// Deprecated: Do not use. -func RegisterMonitorServiceServer(s grpc.ServiceRegistrar, srv MonitorServiceServer) { - s.RegisterService(&MonitorService_ServiceDesc, srv) -} - -func _MonitorService_StreamingOpen_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(MonitorServiceServer).StreamingOpen(&monitorServiceStreamingOpenServer{stream}) -} - -type MonitorService_StreamingOpenServer interface { - Send(*StreamingOpenResponse) error - Recv() (*StreamingOpenRequest, error) - grpc.ServerStream -} - -type monitorServiceStreamingOpenServer struct { - grpc.ServerStream -} - -func (x *monitorServiceStreamingOpenServer) Send(m *StreamingOpenResponse) error { - return x.ServerStream.SendMsg(m) -} - -func (x *monitorServiceStreamingOpenServer) Recv() (*StreamingOpenRequest, error) { - m := new(StreamingOpenRequest) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// MonitorService_ServiceDesc is the grpc.ServiceDesc for MonitorService service. -// It's only intended for direct use with grpc.RegisterService, -// and not to be introspected or modified (even as a copy) -var MonitorService_ServiceDesc = grpc.ServiceDesc{ - ServiceName: "cc.arduino.cli.monitor.v1.MonitorService", - HandlerType: (*MonitorServiceServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "StreamingOpen", - Handler: _MonitorService_StreamingOpen_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "cc/arduino/cli/monitor/v1/monitor.proto", -}