Documentation
¶
Index ¶
- type Client
- type CommandError
- type Handler
- func (h *Handler) Identify(ctx context.Context) (id string, err error)
- func (h *Handler) QueryEventStatusEnable(ctx context.Context) (bit uint8, err error)
- func (h *Handler) QueryEventStatusRegister(ctx context.Context) (bit uint8, err error)
- func (h *Handler) QueryServiceRequestEnable(ctx context.Context) (bit uint8, err error)
- func (h *Handler) QueryStatusByteRegister(ctx context.Context) (bit uint8, err error)
- func (h *Handler) Recall(ctx context.Context, mem uint8) error
- func (h *Handler) Reset() error
- func (h *Handler) Save(ctx context.Context, mem uint8) error
- func (h *Handler) SetEventStatusEnable(ctx context.Context, bit uint8) error
- func (h *Handler) SetServiceRequestEnable(ctx context.Context, bit uint8) error
- func (h *Handler) Trigger(ctx context.Context) error
- func (h *Handler) WaitForComplete(ctx context.Context, timeout time.Duration) error
- type InvalidFormatError
- type InvalidProtocolError
- type TCPClient
- func (c *TCPClient) BulkExec(cmds ...string) error
- func (c *TCPClient) BulkExecContext(ctx context.Context, cmds ...string) error
- func (c *TCPClient) Close() error
- func (c *TCPClient) Exec(cmd string) error
- func (c *TCPClient) ExecContext(ctx context.Context, cmd string) error
- func (c *TCPClient) Ping() error
- func (c *TCPClient) PingContext(ctx context.Context) error
- func (c *TCPClient) Query(cmd string) (res string, err error)
- func (c *TCPClient) QueryContext(ctx context.Context, cmd string) (res string, err error)
- Bugs
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client interface { // Close closes the connection. Close() error // Exec executes a SCPI command. Exec(cmd string) error // ExecContext executes a SCPI command. ExecContext(ctx context.Context, cmd string) error // BulkExec executes multiple SCPI commands. BulkExec(cmds ...string) error // BulkExecContext executes multiple SCPI commands. BulkExecContext(ctx context.Context, cmds ...string) error // Ping verifies the connection to the device is still alive, // establishing a connection if necessary. Ping() error // PingContext verifies the connection to the device is still alive, // establishing a connection if necessary. PingContext(ctx context.Context) error // Query queries the device for the results of the specified command. Query(cmd string) (res string, err error) // QueryContext queries the device for the results of the specified command. QueryContext(ctx context.Context, cmd string) (res string, err error) }
Client is a client of a device controlled using SCPI commands.
type CommandError ¶
type CommandError struct {
// contains filtered or unexported fields
}
CommandError is the error of SCPI commands.
func (*CommandError) Code ¶
func (e *CommandError) Code() int
Code returns the error code of a SCPI device.
func (*CommandError) Error ¶
func (e *CommandError) Error() string
type Handler ¶
type Handler struct {
Client
}
Handler is a handler for a device controlled using SCPI commands.
func NewHandler ¶
NewHandler returns a new handler for a device controlled using SCPI commands.
func (*Handler) Identify ¶
Identify returns the identification data.
The standards order is follows:
Manufacturer Model number Serial number (or 0) Firmware version
func (*Handler) QueryEventStatusEnable ¶
QueryEventStatusEnable queries the event status enable.
func (*Handler) QueryEventStatusRegister ¶
QueryEventStatusRegister queries the event status register. The register is cleared when it is executed.
func (*Handler) QueryServiceRequestEnable ¶
QueryServiceRequestEnable queries the Service Request Enable.
func (*Handler) QueryStatusByteRegister ¶
QueryStatusByteRegister queries the Status Byte Register.
func (*Handler) Recall ¶
Recall restored the instrument to a state that was previously stored in locations 0 through 9 with the Save.
func (*Handler) Reset ¶
Reset resets the instrument to a factory pre-defined condition and clears the error log.
func (*Handler) Save ¶
Save saves the instrument setting to one of the ten non-volatile memory locations.
func (*Handler) SetEventStatusEnable ¶
SetEventStatusEnable sets the value in the enable register for the Standard Event Status group. The selected bits are then reported to bit 5 of the Status Byte.
func (*Handler) SetServiceRequestEnable ¶
SetServiceRequestEnable sets the value of the Service Request Enable register.
type InvalidFormatError ¶
type InvalidFormatError string
InvalidFormatError occures if the format of the response is invalid.
func (InvalidFormatError) Error ¶
func (e InvalidFormatError) Error() string
type InvalidProtocolError ¶
type InvalidProtocolError string
InvalidProtocolError occures if the protocol is invalid.
func (InvalidProtocolError) Error ¶
func (e InvalidProtocolError) Error() string
type TCPClient ¶
type TCPClient struct {
// contains filtered or unexported fields
}
TCPClient is an implementation of the Client interface for TCP network connections.
func NewTCPClient ¶
NewTCPClient returns a new TCP client of a device controlled using SCPI commands.
func (*TCPClient) BulkExecContext ¶
BulkExecContext implements the Client BulkExecContext method.
func (*TCPClient) ExecContext ¶
ExecContext implements the Client ExecContext method.
func (*TCPClient) PingContext ¶
PingContext implements the Client PingContext method.
Notes ¶
Bugs ¶
PingContext is not implemented yet.