Documentation ¶
Overview ¶
Package monitor is a library for handling the Arduino Pluggable-Monitor protocol (https://github.com/arduino/tooling-rfcs/blob/main/RFCs/0004-pluggable-monitor.md#pluggable-monitor-api-via-stdinstdout)
The library implements the state machine and the parsing logic to communicate with a pluggable-monitor client. All the commands issued by the client are conveniently translated into function calls, in particular the Monitor interface are the only functions that must be implemented to get a fully working pluggable monitor using this library.
A usage example is provided in the dummy-monitor package.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Monitor ¶
type Monitor interface { // Hello is called once at startup to provide the userAgent string // and the protocolVersion negotiated with the client. Hello(userAgent string, protocolVersion int) error // Describe is called to obtain the description of the communication port Describe() (*PortDescriptor, error) // Configure allows to set the configuration parameters for the communication port Configure(parameterName string, value string) error // Open allows to open a communication with the board using TCP/IP Open(boardPort string) (io.ReadWriter, error) // Close will close the currently open port and TCP/IP connection Close() error // Quit is called just before the server terminates. This function can be // used by the monitor as a last chance to gracefully close resources. Quit() }
Monitor is an interface that represents the business logic that a pluggable monitor must implement. The communication protocol is completely hidden and it's handled by a MonitorServer.
type PortDescriptor ¶
type PortDescriptor struct { Protocol string `json:"protocol,omitempty"` ConfigurationParameter map[string]*PortParameterDescriptor `json:"configuration_parameters,omitempty"` }
PortDescriptor is a struct to describe the characteristic of a port
type PortParameterDescriptor ¶
type PortParameterDescriptor struct { Label string `json:"label,omitempty"` Type string `json:"type,omitempty"` Values []string `json:"value,omitempty"` Selected string `json:"selected,omitempty"` }
PortParameterDescriptor contains characteristics for every parameter
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
A Server is a pluggable monitor protocol handler, it must be created using the NewServer function.
func NewServer ¶
NewServer creates a new monitor server backed by the provided pluggable monitor implementation. To start the server use the Run method.