tmc

package
v0.0.0-...-efe4ef5 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2023 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package tmc provides an HTTP interface to test and measurement devices

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AcquireWaveform

func AcquireWaveform(o Oscilloscope) http.HandlerFunc

AcquireWaveform transfers the data from the oscilloscope to the user

func GetAcqLength

func GetAcqLength(o Oscilloscope) http.HandlerFunc

GetAcqLength exposes an HTTP interface to GetAcqLength

func GetAcqMode

func GetAcqMode(o Oscilloscope) http.HandlerFunc

GetAcqMode exposes an HTTP interface to GetAcqMode

func GetBitDepth

func GetBitDepth(o Oscilloscope) http.HandlerFunc

GetBitDepth exposes an HTTP interface to GetBitDepth

func GetChannelLabel

func GetChannelLabel(d DAQ) http.HandlerFunc

GetChannelLabel retrieves the label associated with a channel over HTTP

func GetFrequency

func GetFrequency(fg FunctionGenerator) http.HandlerFunc

GetFrequency exposes an HTTP interface to the GetFrequency method

func GetFunction

func GetFunction(fg FunctionGenerator) http.HandlerFunc

GetFunction exposes an HTTP interface to the GetFunction method

func GetOffset

func GetOffset(fg FunctionGenerator) http.HandlerFunc

GetOffset exposes an HTTP interface to the GetOffset method

func GetOutput

func GetOutput(fg FunctionGenerator) http.HandlerFunc

GetOutput exposes an HTTP interface to the GetOutput method

func GetRecordingChannel

func GetRecordingChannel(d DAQ) http.HandlerFunc

GetRecordingChannel returns the channel of a recording in samples

func GetRecordingLength

func GetRecordingLength(d DAQ) http.HandlerFunc

GetRecordingLength returns the length of a recording in samples

func GetSampleRate

func GetSampleRate(m SampleRateManipulator) http.HandlerFunc

GetSampleRate exposes an HTTP interface to GetSampleRate

func GetScale

func GetScale(o Oscilloscope) http.HandlerFunc

GetScale returns the scale of a channel

func GetTimebase

func GetTimebase(o Oscilloscope) http.HandlerFunc

GetTimebase exposes an HTTP interface to GetTimebase

func GetVoltage

func GetVoltage(fg FunctionGenerator) http.HandlerFunc

GetVoltage exposes an HTTP interface to the GetVoltage method

func HTTPFunctionGenerator

func HTTPFunctionGenerator(fg FunctionGenerator, table generichttp.RouteTable)

HTTPFunctionGenerator injects an HTTP interface to a function generator into a route table

func Record

func Record(d DAQ) http.HandlerFunc

Record causes the DAQ to record and sends the result back as a CSV file

func SetAcqLength

func SetAcqLength(o Oscilloscope) http.HandlerFunc

SetAcqLength exposes an HTTP interface to SetAcqLength

func SetAcqMode

func SetAcqMode(o Oscilloscope) http.HandlerFunc

SetAcqMode exposes an HTTP interface to SetAcqMode

func SetBitDepth

func SetBitDepth(o Oscilloscope) http.HandlerFunc

SetBitDepth exposes an HTTP interface to SetBitDepth

func SetChannelLabel

func SetChannelLabel(d DAQ) http.HandlerFunc

SetChannelLabel sets the channel label on a DAQ

func SetFrequency

func SetFrequency(fg FunctionGenerator) http.HandlerFunc

SetFrequency exposes an HTTP interface to the SetFrequency method

func SetFunction

func SetFunction(fg FunctionGenerator) http.HandlerFunc

SetFunction exposes an HTTP interface to the SetFunction method

func SetOffset

func SetOffset(fg FunctionGenerator) http.HandlerFunc

SetOffset exposes an HTTP interface to the SetOffset method

func SetOutput

func SetOutput(fg FunctionGenerator) http.HandlerFunc

SetOutput exposes an HTTP interface to the Output control methods

func SetOutputLoad

func SetOutputLoad(fg FunctionGenerator) http.HandlerFunc

SetOutputLoad exposes an HTTP interface to the SetOutputLoad method

func SetRecordingChannel

func SetRecordingChannel(d DAQ) http.HandlerFunc

SetRecordingChannel sets the channel of a recording in samples

func SetRecordingLength

func SetRecordingLength(d DAQ) http.HandlerFunc

SetRecordingLength sets the length of a recording in samples

func SetSampleRate

func SetSampleRate(m SampleRateManipulator) http.HandlerFunc

SetSampleRate exposes an HTTP interface to SetSampleRate

func SetScale

func SetScale(o Oscilloscope) http.HandlerFunc

SetScale sets the scale of a channel

func SetTimebase

func SetTimebase(o Oscilloscope) http.HandlerFunc

SetTimebase exposes an HTTP interface to SetTimebase

func SetVoltage

func SetVoltage(fg FunctionGenerator) http.HandlerFunc

SetVoltage exposes an HTTP interface to the SetVoltage method

func SetWaveform

func SetWaveform(fg FunctionGenerator) http.HandlerFunc

func StartAcq

func StartAcq(o Oscilloscope) http.HandlerFunc

StartAcq triggers DAQ on the scope

Types

type DAQ

type DAQ interface {
	SampleRateManipulator

	// SetChannelLabel sets the label used for a given channel
	SetChannelLabel(int, string) error
	// GetChannelLabel retrieves the label used by a given channel
	GetChannelLabel(int) (string, error)

	// SetRecordingLength sets the number of samples used
	// in a recording
	SetRecordingLength(int) error
	// GetRecordingLength retrieves the number of samples used
	// in a recording
	GetRecordingLength() (int, error)

	// SetRecordingChannel sets the channel used
	// to record data
	SetRecordingChannel(int) error
	// GetRecordingChannel retrieves the channel
	// used to record data
	GetRecordingChannel() (int, error)

	// Record captures data
	Record() (oscilloscope.Recording, error)
}

DAQ is the interface of a data acquisition device

type FunctionGenerator

type FunctionGenerator interface {
	// SetFunctions sets the function
	SetFunction(string) error

	// GetFunction returns the current function type used
	GetFunction() (string, error)

	// SetFrequency configures the frequency of the output waveform
	SetFrequency(float64) error

	// GetFrequency gets the frequency of the output waveform
	GetFrequency() (float64, error)

	// SetVoltage configures the voltage of the output waveform
	SetVoltage(float64) error

	// GetVoltage retrieves the voltage of the output waveform
	GetVoltage() (float64, error)

	// SetOffset configures the offset of the output waveform
	SetOffset(float64) error

	// GetOffset retrieves the offset of the output waveform
	GetOffset() (float64, error)

	// SetPutput configures if the generator output is active
	SetOutput(bool) error

	// GetOutput queries if the generator output is active
	GetOutput() (bool, error)

	// SetOutputLoad sets the output load of the generator in ohms
	SetOutputLoad(float64) error

	// SetWaveform uplodas an arbitrary waveform to the function generator
	SetWaveform([]uint16) error
}

FunctionGenerator describes an interface to a function generator

type HTTPDAQ

type HTTPDAQ struct {
	D DAQ

	RouteTable generichttp.RouteTable
}

HTTPDAQ is an HTTP adapter to a DAQ

func NewHTTPDAQ

func NewHTTPDAQ(d DAQ) HTTPDAQ

NewHTTPDAQ returns a newly HTTP wrapped DAQ

func (HTTPDAQ) RT

RT satisfies generichttp.HTTPer

type HTTPFunctionGeneratorT

type HTTPFunctionGeneratorT struct {
	FG FunctionGenerator

	RouteTable generichttp.RouteTable
}

HTTPFunctionGeneratorT holds an HTTP wrapper to a function generator

func NewHTTPFunctionGenerator

func NewHTTPFunctionGenerator(fg FunctionGenerator) HTTPFunctionGeneratorT

NewHTTPFunctionGenerator wraps a function generator in an HTTP interface

func (HTTPFunctionGeneratorT) RT

RT makes this generichttp.httper compliant

type HTTPOscilloscope

type HTTPOscilloscope struct {
	O Oscilloscope

	RouteTable generichttp.RouteTable
}

HTTPOscilloscope holds an HTTP wrapper to a function generator

func NewHTTPOscilloscope

func NewHTTPOscilloscope(o Oscilloscope) HTTPOscilloscope

NewHTTPOscilloscope wraps a function generator in an HTTP interface

func (HTTPOscilloscope) RT

RT makes this generichttp.httper compliant

type Oscilloscope

type Oscilloscope interface {
	SampleRateManipulator
	// SetScale configures the full vertical range of a channel
	SetScale(string, float64) error

	// GetScale returns the full vertical range of a channel
	GetScale(string) (float64, error)

	// SetTimebase configures the full vertical range of a channel
	SetTimebase(float64) error

	// GetTimebase returns the full vertical range of a channel
	GetTimebase() (float64, error)

	// SetBandwidthLimit turns the bandwidth limit for a channel on or off
	SetBandwidthLimit(string, bool) error

	// SetBitDepth configures the bit depth of a scope
	SetBitDepth(int) error

	// GetBitDepth retrieves the bit depth of the scope
	GetBitDepth() (int, error)

	// SetAcqLength configures the number of data points to capture
	SetAcqLength(int) error

	// GetAcqLength retrieves the number of data points to be captured
	GetAcqLength() (int, error)

	// SetAcqMode configures the acquisition mode used by the scope
	SetAcqMode(string) error

	// GetAcqMode returns the acquisition mode used by the scope
	GetAcqMode() (string, error)

	// StartAcq begins DAQ
	StartAcq() error

	// AcquireWaveform triggers a measurement on the scope and returns the data
	AcquireWaveform([]string) (oscilloscope.Waveform, error)
}

Oscilloscope describes an interface to a digital oscilloscope

type SampleRateManipulator

type SampleRateManipulator interface {
	// SetSampleRate configures the analog sampling rate of the scope
	SetSampleRate(float64) error

	// GetSampleRate returns the analog sampling rate of the scope
	GetSampleRate() (float64, error)
}

SampleRateManipulator can manipulate their sampling rate

Jump to

Keyboard shortcuts

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