binaryiotypea

package
v1.4.0 Latest Latest
Warning

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

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

Documentation

Overview

Package binaryiotypea provides the API for the io4edge binaryIoTypeA functionblock

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 binaryIoTypeA Module

func NewClientFromUniversalAddress

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

NewClientFromUniversalAddress creates a new binaryIoTypeA 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_binaryIoTypeA._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) AllInputs

func (c *Client) AllInputs(mask uint8) (uint8, error)

AllInputs reads the state of all input pins defined by mask.

Each bit in the returned value corresponds to one channel, bit0 being channel 0. The bit is false if the input level is below switching threshold, true otherwise. Channels whose bit is cleared in mask are reported as 0

func (*Client) Close added in v1.0.0

func (c *Client) Close()

Close terminates the underlying connection to the functionblock

func (*Client) Describe

func (c *Client) Describe() (*Description, error)

Describe reads the binaryIoTypeA function block description

func (*Client) DownloadConfiguration

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

DownloadConfiguration reads the binaryIoTypeA function block configuration

func (*Client) ExitErrorState

func (c *Client) ExitErrorState() error

ExitErrorState tries to recover the binary output controller from error state.

The binary output controller enters error state when there is an overurrent condition for a long time.

In the error state, no outputs can be set; inputs can still be read. This call tells the binary output controller to try again. This call does however not wait if the recovery was successful or not.

func (*Client) Input

func (c *Client) Input(channel int) (bool, error)

Input reads the state of the input pin of a single channel.

The returned value is false if the input level is below switching threshold, true otherwise

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) SetAllOutputs

func (c *Client) SetAllOutputs(states uint8, mask uint8) error

SetAllOutputs sets all or a group of output channels

states: binary coded map of outputs. 0 means switch off, 1 means switch on, LSB is Output0

mask: defines which channels are affected by the set all command.

func (*Client) SetOutput

func (c *Client) SetOutput(channel int, state bool) error

SetOutput sets a single output channel a "true" state turns on the output switch

func (*Client) StartStream

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

StartStream starts the stream on this connection. Arguments may be one or more of the following functions:

  • WithChannelFilterMask
  • WithFBStreamOption(functionblock.WithXXXX(...))

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 binaryIoTypeA function block. Arguments may be one or more of the following functions:

  • WithOutputWatchdog
  • WithInputFritting

Options that are not specified take default values.

type ConfigOption added in v1.0.0

type ConfigOption func(*fspb.ConfigurationSet)

ConfigOption is a type to pass options to UploadConfiguration()

func WithInputFritting added in v1.0.0

func WithInputFritting(mask uint8) ConfigOption

WithInputFritting may be passed to UploadConfiguration. mask defines on which inputs the fritting pulses shall be enabled (bit0=first IO).

func WithOutputWatchdog added in v1.0.0

func WithOutputWatchdog(mask uint8, timoutMs uint32) ConfigOption

WithOutputWatchdog may be passed to UploadConfiguration. mask defines to which outputs the watchdog shall apply (bit0=first IO). timeoutMs defines the watchdog timeout in ms, it's the same for all selected outputs

type Configuration

type Configuration struct {
	// InputFrittingMask reflects on which inputs the fritting pulses are enabled
	InputFrittingMask uint8
	// OutputWatchdogMask reflects on which outputs the watchdog is enabled
	OutputWatchdogMask uint8
	// OutputWatchdogTimeoutMs reflects the watchdog timeout in ms
	OutputWatchdogTimeoutMs uint32
}

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

type Description

type Description struct {
	NumberOfChannels int
}

Description represents the describe response of the binaryIoTypeA function

type StreamConfigOption added in v1.0.0

type StreamConfigOption func(*StreamConfiguration)

StreamConfigOption is a type to pass options to StartStream()

func WithChannelFilterMask added in v1.0.0

func WithChannelFilterMask(channelFilterMask uint8) StreamConfigOption

WithChannelFilterMask may be passed to StartStream.

channelFilterMask defines the watched channels. Only changes on those channels generate samples in the stream

func WithFBStreamOption added in v1.0.0

func WithFBStreamOption(opt functionblock.StreamConfigOption) StreamConfigOption

WithFBStreamOption may be passed to StartStream.

opt is one of the functions that may be passed to functionblock.StartStream, e.g. WithBucketSamples()

type StreamConfiguration added in v1.0.0

type StreamConfiguration struct {
	ChannelFilterMask uint8
	FBOptions         []functionblock.StreamConfigOption
}

StreamConfiguration defines the configuration of a stream

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