motionsensor

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package motionsensor provides the API for the io4edge motion sensor function block

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents a client for the motionSensor

func NewClientFromUniversalAddress

func NewClientFromUniversalAddress(addrOrService string, timeout time.Duration) (*Client, error)

NewClientFromUniversalAddress creates a new motionSensor client from addrOrService. If addrOrService is of the form "host:port", it creates the client from that host/port, otherwise it assumes addrOrService is the instance name of a mdns service (without _io4edge_motionSensor._tcp). The timeout specifies the maximal time waiting for a service to show up. If 0, use default timeout. Not used for "host:port"

func (*Client) Close

func (c *Client) Close()

Close terminates the underlying connection to the functionblock

func (*Client) DownloadConfiguration

func (c *Client) DownloadConfiguration() (*Configuration, error)

DownloadConfiguration reads the template function block configuration

func (*Client) ReadStream

func (c *Client) ReadStream(timeout time.Duration) (*StreamData, error)

ReadStream reads the next stream data object from the buffer.

Returns the meta data and the unmarshalled function specific stream data

func (*Client) StartStream

func (c *Client) StartStream(opts ...functionblock.StreamConfigOption) error

StartStream starts the stream on this connection. Arguments may be one or more of the functionblock.WithXXX() functions that may be passed to functionblock.StartStream() Options that are not specified take default values.

func (*Client) StopStream

func (c *Client) StopStream() error

StopStream stops the stream on this connection

func (*Client) UploadConfiguration

func (c *Client) UploadConfiguration(opts ...ConfigOption) error

UploadConfiguration configures the analogInTypeA function block Arguments may be one or more of the following functions:

  • WithSampleRate
  • WithFullScale
  • WithHighPassFilterEnable
  • WithBandWidthRatio

Options that are not specified take default value (SampleRate 12.5Hz, FullScale:2g, HighPassFilter: disable, BandWidthRatio: 2)

type ConfigOption

type ConfigOption func(*fspb.ConfigurationSet)

ConfigOption is a type to pass options to UploadConfiguration()

func WithBandWidthRatio

func WithBandWidthRatio(ratio int32) ConfigOption

WithBandWidthRatio may be passed to UploadConfiguration.

band width of low/hig-hpass as ratio of sample_rate .e.g. select 2 when the filterbandwith shall be sample_rate/2

func WithFullScale

func WithFullScale(fullScale int32) ConfigOption

WithFullScale may be passed to UploadConfiguration.

fullscale is the full scale acceleration in g

func WithHighPassFilterEnable

func WithHighPassFilterEnable(enable bool) ConfigOption

WithHighPassFilterEnable may be passed to UploadConfiguration.

func WithSampleRate

func WithSampleRate(sampleRateMilliHz uint32) ConfigOption

WithSampleRate may be passed to UploadConfiguration.

sampleReate is the desired data rate in 1/1000 Hz

type Configuration

type Configuration struct {
	SampleRateMilliHz    uint32
	FullScaleG           int32
	HighPassFilterEnable bool
	BandWidthRatio       int32
}

Configuration describes the current configuration of the motionSensor function. Returned by DownloadConfiguration()

type StreamData

type StreamData struct {
	functionblock.StreamDataMeta
	FSData *fspb.StreamData
}

StreamData contains the meta data of the stream and the unmarshalled function specific data

Jump to

Keyboard shortcuts

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