functionblock

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Overview

Package functionblock provides the API for the io4edge function blocks

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HaveResponseStatus added in v0.2.0

func HaveResponseStatus(err error, status fbv1.Status) bool

HaveResponseStatus checks if err corresponds to functionblock status error code

Types

type Client added in v0.2.0

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

Client represents a client for a generic functionblock

func NewClientFromUniversalAddress added in v0.2.0

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

NewClientFromUniversalAddress creates a new functionblock 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 an mdns service.

If service is non-empty and addrOrService is a mdns instance name, it is appended to the addrOrService. .e.g. if addrOrService is "iou01-sn01-binio" and service is "_io4edge_binaryIoTypeA._tcp", the mdns instance name "iou01-sn01-binio._io4edge_binaryIoTypeA._tcp" is used.

The timeout specifies the maximal time waiting for a service to show up. Not used for "host:port"

func (*Client) Describe added in v0.2.0

func (c *Client) Describe(fsCmd proto.Message) (*anypb.Any, error)

Describe executes the configuration describe command on the device.

fsCmd is the function specific configuration describe object

returns the function specific response as a protobuf any object

func (*Client) DownloadConfiguration added in v0.2.0

func (c *Client) DownloadConfiguration(fsCmd proto.Message) (*anypb.Any, error)

DownloadConfiguration executes the configuration get command on the device.

fsCmd is the function specific configuration get object

returns the function specific response as a protobuf any object

func (*Client) FunctionControlGet added in v0.2.0

func (c *Client) FunctionControlGet(fsCmd proto.Message) (*anypb.Any, error)

FunctionControlGet executes the function control get command on the device.

fsCmd is the function specific command object

returns the function specific response as a protobuf any object

func (*Client) FunctionControlSet added in v0.2.0

func (c *Client) FunctionControlSet(fsCmd proto.Message) (*anypb.Any, error)

FunctionControlSet executes the function control set command on the device.

fsCmd is the function specific command object

returns the function specific response as a protobuf any object

func (*Client) ReadStream added in v0.2.0

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

ReadStream reads the next stream data object from the buffer

func (*Client) StartStream added in v0.2.0

func (c *Client) StartStream(config *StreamConfiguration, fsCmd proto.Message) error

StartStream starts the stream with configuration config, passing the function specific configuration from fscmd

func (*Client) StopStream added in v0.2.0

func (c *Client) StopStream() error

StopStream stops the stream

func (*Client) UploadConfiguration added in v0.2.0

func (c *Client) UploadConfiguration(fsCmd proto.Message) (*anypb.Any, error)

UploadConfiguration executes the configuration set command on the device.

fsCmd is the function specific configuration set object

returns the function specific response as a protobuf any object

type ResponseError added in v0.2.0

type ResponseError struct {
	Action        string
	Status        fbv1.Status
	FwErrorString string
}

ResponseError holds the details of functionblock errors

func (*ResponseError) Error added in v0.2.0

func (e *ResponseError) Error() string

func (*ResponseError) StatusCode added in v0.2.0

func (e *ResponseError) StatusCode() fbv1.Status

StatusCode returns the numeric error status code from the functionblock

type StreamConfiguration added in v0.2.0

type StreamConfiguration struct {
	BucketSamples     uint32
	KeepaliveInterval uint32
	BufferedSamples   uint32
}

StreamConfiguration defines the configuration of a stream

type StreamData added in v0.2.0

type StreamData struct {
	StreamDataMeta
	FSData *anypb.Any // function specific data
}

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

type StreamDataMeta added in v0.2.0

type StreamDataMeta struct {
	DeliveryTimestamp uint64
	Sequence          uint32
}

StreamDataMeta contains meta information about a Stream Data message

Jump to

Keyboard shortcuts

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