Documentation
¶
Index ¶
- Constants
- type Event
- type PluggableDiscovery
- func (disc *PluggableDiscovery) GetID() string
- func (disc *PluggableDiscovery) List() ([]*Port, error)
- func (disc *PluggableDiscovery) Quit()
- func (disc *PluggableDiscovery) Run() (err error)
- func (disc *PluggableDiscovery) Start() error
- func (disc *PluggableDiscovery) StartSync(size int) (<-chan *Event, error)
- func (disc *PluggableDiscovery) State() int
- func (disc *PluggableDiscovery) Stop() error
- func (disc *PluggableDiscovery) String() string
- type Port
Constants ¶
const ( Alive int = iota Idling Running Syncing Dead )
To work correctly a Pluggable Discovery must respect the state machine specifed on the documentation: https://arduino.github.io/arduino-cli/latest/pluggable-discovery-specification/#state-machine States a PluggableDiscovery can be in
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type PluggableDiscovery ¶
type PluggableDiscovery struct {
// contains filtered or unexported fields
}
PluggableDiscovery is a tool that detects communication ports to interact with the boards.
func New ¶
func New(id string, args ...string) *PluggableDiscovery
New create and connect to the given pluggable discovery
func (*PluggableDiscovery) GetID ¶
func (disc *PluggableDiscovery) GetID() string
GetID returns the identifier for this discovery
func (*PluggableDiscovery) List ¶
func (disc *PluggableDiscovery) List() ([]*Port, error)
List executes an enumeration of the ports and returns a list of the available ports at the moment of the call.
func (*PluggableDiscovery) Quit ¶
func (disc *PluggableDiscovery) Quit()
Quit terminates the discovery. No more commands can be accepted by the discovery.
func (*PluggableDiscovery) Run ¶
func (disc *PluggableDiscovery) Run() (err error)
Run starts the discovery executable process and sends the HELLO command to the discovery to agree on the pluggable discovery protocol. This must be the first command to run in the communication with the discovery. If the process is started but the HELLO command fails the process is killed.
func (*PluggableDiscovery) Start ¶
func (disc *PluggableDiscovery) Start() error
Start initializes and start the discovery inter subroutines. This command must be called before List or StartSync.
func (*PluggableDiscovery) StartSync ¶
func (disc *PluggableDiscovery) StartSync(size int) (<-chan *Event, error)
StartSync puts the discovery in "events" mode: the discovery will send "add" and "remove" events each time a new port is detected or removed respectively. After calling StartSync an initial burst of "add" events may be generated to report all the ports available at the moment of the start. It also creates a channel used to receive events from the pluggable discovery. The event channel must be consumed as quickly as possible since it may block the discovery if it becomes full. The channel size is configurable.
func (*PluggableDiscovery) State ¶
func (disc *PluggableDiscovery) State() int
State returns the current state of this PluggableDiscovery
func (*PluggableDiscovery) Stop ¶
func (disc *PluggableDiscovery) Stop() error
Stop stops the discovery inter subroutines and possibly free the internally used resources. This command should be called if the client wants to pause the discovery for a while.
func (*PluggableDiscovery) String ¶
func (disc *PluggableDiscovery) String() string
type Port ¶
type Port struct { Address string `json:"address"` AddressLabel string `json:"label"` Protocol string `json:"protocol"` ProtocolLabel string `json:"protocolLabel"` HardwareID string `json:"hardwareId,omitempty"` Properties *properties.Map `json:"properties"` }
Port containts metadata about a port to connect to a board.
func PortFromRPCPort ¶
PortFromRPCPort converts an *rpc.Port to a *Port
Directories
¶
Path | Synopsis |
---|---|
discovery_client is a command line UI client to test pluggable discoveries.
|
discovery_client is a command line UI client to test pluggable discoveries. |