Documentation
¶
Overview ¶
Package templatemodule provides the API for the io4edeg template functionblock
Index ¶
- type Client
- func (c *Client) Close()
- func (c *Client) Describe() (*Description, error)
- func (c *Client) DownloadConfiguration() (*Configuration, error)
- func (c *Client) GetCounter() (uint32, error)
- func (c *Client) ReadStream(timeout time.Duration) (*StreamData, error)
- func (c *Client) SetCounter(value uint32) error
- func (c *Client) StartStream(opts ...StreamConfigOption) error
- func (c *Client) StopStream() error
- func (c *Client) UploadConfiguration(opts ...ConfigOption) error
- type ConfigOption
- type Configuration
- type Description
- type StreamConfigOption
- type StreamConfiguration
- type StreamData
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 templateModule
func NewClientFromUniversalAddress ¶
NewClientFromUniversalAddress creates a new templateModule 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_templateModule._tcp). The timeout specifies the maximal time waiting for a service to show up. Not used for "host:port"
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 template function block description
func (*Client) DownloadConfiguration ¶
func (c *Client) DownloadConfiguration() (*Configuration, error)
DownloadConfiguration reads the template function block configuration
func (*Client) GetCounter ¶
GetCounter reads the templates module counter from the device
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) SetCounter ¶
SetCounter sets the templates module counter in the device
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:
- WithModulo
- WithFBStreamOption(functionblock.WithXXXX(...))
Options that are not specified take default values.
func (*Client) StopStream ¶
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
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 WithSampleRate ¶ added in v1.0.0
func WithSampleRate(sampleRate uint32) ConfigOption
WithSampleRate may be passed to UploadConfiguration.
sampleRate defines the sample rate in Hz (300..4000).
type Configuration ¶
type Configuration struct {
SampleRate uint32
}
Configuration describes the current configuration of the templateModule function. Returned by DownloadConfiguration()
type Description ¶
type Description struct {
Ident string
}
Description represents the describe response of the templateModule
type StreamConfigOption ¶ added in v1.0.0
type StreamConfigOption func(*StreamConfiguration)
StreamConfigOption is a type to pass options to StartStream()
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()
func WithModulo ¶ added in v1.0.0
func WithModulo(modulo uint32) StreamConfigOption
WithModulo may be passed to StartStream.
modulo defines how often samples are pushed to the stream modulo==2 pushes each 2nd sample, module==4 pushes each 4th sample and so forth
type StreamConfiguration ¶ added in v1.0.0
type StreamConfiguration struct { Modulo uint32 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