Documentation ¶
Overview ¶
Package functionblock provides the API for the io4edge function blocks
Index ¶
- func HaveResponseStatus(err error, status fbv1.Status) bool
- type Client
- func (c *Client) Describe(fsCmd proto.Message) (*anypb.Any, error)
- func (c *Client) DownloadConfiguration(fsCmd proto.Message) (*anypb.Any, error)
- func (c *Client) FunctionControlGet(fsCmd proto.Message) (*anypb.Any, error)
- func (c *Client) FunctionControlSet(fsCmd proto.Message) (*anypb.Any, error)
- func (c *Client) ReadStream(timeout time.Duration) (*StreamData, error)
- func (c *Client) StartStream(config *StreamConfiguration, fsCmd proto.Message) error
- func (c *Client) StopStream() error
- func (c *Client) UploadConfiguration(fsCmd proto.Message) (*anypb.Any, error)
- type ResponseError
- type StreamConfiguration
- type StreamData
- type StreamDataMeta
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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
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
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
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
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
StopStream stops the stream
func (*Client) UploadConfiguration ¶ added in v0.2.0
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
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
StreamDataMeta contains meta information about a Stream Data message