planktoscope

package
v0.3.10 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package planktoscope provides a high-level client for control of planktoscopes

Index

Constants

View Source
const (
	Protocol = "planktoscope-v2.3"
)

Variables

This section is empty.

Functions

func GetMQTTConfig

func GetMQTTConfig(brokerURL, clientID string) (c *mqtt.ClientOptions, err error)

Types

type Broadcaster

type Broadcaster struct {
	// contains filtered or unexported fields
}

func NewBroadcaster

func NewBroadcaster() *Broadcaster

func (*Broadcaster) BroadcastNext

func (b *Broadcaster) BroadcastNext()

func (*Broadcaster) Broadcasted

func (b *Broadcaster) Broadcasted() <-chan struct{}

type CameraSettings added in v0.3.3

type CameraSettings struct {
	StateKnown           bool
	ISO                  uint64
	ShutterSpeed         uint64
	AutoWhiteBalance     bool
	WhiteBalanceRedGain  float64
	WhiteBalanceBlueGain float64
}

func DefaultCameraSettings added in v0.3.3

func DefaultCameraSettings() CameraSettings

type Client

type Client struct {
	Config Config
	Logger godest.Logger
	MQTT   mqtt.Client
	// contains filtered or unexported fields
}

func NewClient

func NewClient(c Config, l godest.Logger) (client *Client, err error)

func (*Client) CameraStateBroadcasted added in v0.3.3

func (c *Client) CameraStateBroadcasted() <-chan struct{}

func (*Client) Close added in v0.1.7

func (c *Client) Close()

func (*Client) Connect added in v0.1.7

func (c *Client) Connect() error

func (*Client) ConnectedAtLeastOnce added in v0.1.7

func (c *Client) ConnectedAtLeastOnce() <-chan struct{}

func (*Client) GetState

func (c *Client) GetState() Planktoscope

func (*Client) HasConnection added in v0.1.7

func (c *Client) HasConnection() bool

func (*Client) ImagerStateBroadcasted added in v0.3.9

func (c *Client) ImagerStateBroadcasted() <-chan struct{}

func (*Client) PumpStateBroadcasted

func (c *Client) PumpStateBroadcasted() <-chan struct{}

func (*Client) RunControllerAction added in v0.3.5

func (c *Client) RunControllerAction(ctx context.Context, command string, params hcl.Body) error

func (*Client) RunImagingAction added in v0.3.9

func (c *Client) RunImagingAction(ctx context.Context, p PlanktoscopeImagingParams) error

func (*Client) RunPumpAction added in v0.3.5

func (c *Client) RunPumpAction(ctx context.Context, p PlanktoscopePumpParams) error

func (*Client) RunStopImagingAction added in v0.3.9

func (c *Client) RunStopImagingAction(ctx context.Context) error

func (*Client) RunStopPumpAction added in v0.3.5

func (c *Client) RunStopPumpAction(ctx context.Context) error

func (*Client) SetCamera added in v0.3.3

func (c *Client) SetCamera(
	iso, shutterSpeed uint64,
	autoWhiteBalance bool, whiteBalanceRedGain, whiteBalanceBlueGain float64,
) (mqtt.Token, error)

func (*Client) SetMetadata added in v0.3.9

func (c *Client) SetMetadata(
	sampleProjectID, sampleID string, acquisitionTime time.Time,
) (mqtt.Token, error)

func (*Client) Shutdown added in v0.1.7

func (c *Client) Shutdown(ctx context.Context) error

func (*Client) StartImaging added in v0.3.9

func (c *Client) StartImaging(
	forward bool, stepVolume, stepDelay float64, steps uint64,
) (mqtt.Token, error)

func (*Client) StartPump

func (c *Client) StartPump(forward bool, volume, flowrate float64) (mqtt.Token, error)

func (*Client) StopImaging added in v0.3.9

func (c *Client) StopImaging() (mqtt.Token, error)

func (*Client) StopPump

func (c *Client) StopPump() (mqtt.Token, error)

type ClientID added in v0.3.4

type ClientID int64

type Config

type Config struct {
	URL      string
	ClientID string
	MQTT     mqtt.ClientOptions
}

func GetConfig

func GetConfig(brokerURL, clientInstanceID string) (c Config, err error)

type Imager added in v0.3.9

type Imager struct {
	StateKnown bool
	Imaging    bool
	Start      time.Time
}

type ImagerSettings added in v0.3.9

type ImagerSettings struct {
	Forward    bool
	StepVolume float64
	StepDelay  float64
	Steps      uint64
}

func DefaultImagerSettings added in v0.3.9

func DefaultImagerSettings() ImagerSettings

type Orchestrator added in v0.1.7

type Orchestrator struct {
	// contains filtered or unexported fields
}

func NewOrchestrator added in v0.1.7

func NewOrchestrator(logger godest.Logger) *Orchestrator

func (*Orchestrator) Add added in v0.1.7

func (o *Orchestrator) Add(id ClientID, url string) error

func (*Orchestrator) Close added in v0.1.7

func (o *Orchestrator) Close(ctx context.Context) error

func (*Orchestrator) Get added in v0.1.7

func (o *Orchestrator) Get(id ClientID) (c *Client, ok bool)

func (*Orchestrator) Remove added in v0.1.7

func (o *Orchestrator) Remove(ctx context.Context, id ClientID) error

func (*Orchestrator) Update added in v0.1.7

func (o *Orchestrator) Update(ctx context.Context, id ClientID, url string) error

type Planktoscope

type Planktoscope struct {
	Pump           Pump
	PumpSettings   PumpSettings
	CameraSettings CameraSettings
	Imager         Imager
	ImagerSettings ImagerSettings
}

type PlanktoscopeImagingParams added in v0.3.9

type PlanktoscopeImagingParams struct {
	SampleProjectID string  `hcl:"sample_project_id"` // TODO: move the project ID somewhere else?
	SampleID        string  `hcl:"sample_id"`         // TODO: move the sample ID somewhere else?
	Forward         bool    `hcl:"forward"`
	StepVolume      float64 `hcl:"step_volume"`
	StepDelay       float64 `hcl:"step_delay"`
	Steps           uint64  `hcl:"steps"`
}

type PlanktoscopePumpParams added in v0.3.5

type PlanktoscopePumpParams struct {
	Forward  bool    `hcl:"forward"`
	Volume   float64 `hcl:"volume"`
	Flowrate float64 `hcl:"flowrate"`
}

type Pump

type Pump struct {
	StateKnown bool
	Pumping    bool
	Start      time.Time
	Duration   time.Duration
	Deadline   time.Time
}

type PumpSettings

type PumpSettings struct {
	Forward  bool
	Volume   float64
	Flowrate float64
}

func DefaultPumpSettings added in v0.3.3

func DefaultPumpSettings() PumpSettings

Jump to

Keyboard shortcuts

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