binaryiotyped

package
v2.1.1 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2025 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package binaryiotyped provides the API for the io4edge binaryIoTypeD 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 binaryIoTypeD Module

func NewClientFromUniversalAddress

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

NewClientFromUniversalAddress creates a new binaryIoTypeD 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_binaryIoTypeD._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 binaryIoTypeD function block configuration

func (*Client) Inputs

func (c *Client) Inputs() (states uint32, diag []uint32, err error)

Inputs gets the state of all channels, regardless whether they are configured as input or output.

Each bit in the returned "inputs" corresponds to one channel, bit0 being channel 0. The bit is false if the pin level is inactive, or true if active. diag is a slice with bitfields containing diagnostic bits for each channel.Each bit in the returned state corresponds to one channel, bit0 being channel 0.

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, a "false" state turns it off.

func (*Client) SetOutputs

func (c *Client) SetOutputs(states uint32, mask uint32) error

SetOutputs sets all or a group of output channels

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

mask: binary coded map of outputs to be set. 0 means do not change, 1 means change, LSB is Channel0

func (*Client) UploadConfiguration

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

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

  • WithChannelConfig

Options that are not specified remain unchanged.

type ConfigOption

type ConfigOption func(*fspb.ConfigurationSet)

ConfigOption is a type to pass options to UploadConfiguration()

func WithChannelConfig

func WithChannelConfig(ch []*fspb.ChannelConfig) ConfigOption

WithChannelConfig may be passed to UploadConfiguration. each entry describes the configuration of one channel. Undescribed channels remain unchanged.

type Configuration

type Configuration struct {
	// ChannelConfig describes the configuration of each channel
	ChannelConfig []*fspb.ChannelConfig
}

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

Jump to

Keyboard shortcuts

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