visa

package module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: MIT Imports: 4 Imported by: 1

README

visa

Go-based Virtual Instrument Software Architecture (VISA) resource manager.

GoDoc Go Report Card License Badge

Background

The primary purpose of this package is to parse a VISA resource address string in order to create a new VISA resource, which abstracts the interface type—USBTMC, TCPIP, ASRL. By registering a driver for the interface type, application developers can decide which interface types to support and which to exclude, so as to not unnecessarily bloat their packages.

The primary source of information is the VPP-4.3: The VISA Library dated June 19, 2014, which can be found at the IVI Specifications webpage.

Usage

In order to not bloat an end developer's application, the desired HW interface driver(s) have to be registered, similar to Go's SQL package. Currently, there are TCPIP, USBTMC, and Serial (ASRL) drivers available.

"github.com/gotmc/visa"
_ "github.com/gotmc/visa/drivers/tcpip"
_ "github.com/gotmc/visa/drivers/usbtmc"
_ "github.com/gotmc/visa/drivers/asrl"

Installation

$ go get github.com/gotmc/visa

Documentation

Documentation can be found at either:

Contributing

Contributions are welcome! To contribute please:

  1. Fork the repository
  2. Create a feature branch
  3. Code
  4. Submit a pull request
Testing

Prior to submitting a pull request, please run:

$ make check
$ make lint

To update and view the test coverage report:

$ make cover

License

visa is released under the MIT license. Please see the LICENSE.txt file for more information.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Register

func Register(interfaceType InterfaceType, driver Driver)

Register is called to register a driver for use by the program.

Types

type Driver

type Driver interface {
	Open(address string) (Resource, error)
}

Driver defines the behavior required by types that want to implement a new search type.

type InterfaceType

type InterfaceType int

InterfaceType identifies the type of the HW interface: USBTMC, TCPIP, or ASRL (serial).

const (
	USBTMC InterfaceType = iota
	TCPIP
	ASRL
)

The available HW interface types for the VISA resource.

func (InterfaceType) String

func (i InterfaceType) String() string

String implements the Stringer interface for the InterfaceType.

type Resource

type Resource interface {
	Close() error
	Read(p []byte) (n int, err error)
	Write(p []byte) (n int, err error)
	WriteString(s string) (n int, err error)
	Command(format string, a ...any) error
	Query(s string) (value string, err error)
}

Resource is the interface that defines a VISA resource.

func NewResource

func NewResource(address string) (Resource, error)

NewResource creates a new Resource using the given VISA address.

Directories

Path Synopsis
driver
examples

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL