mvbsniffer

package
v1.6.1 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Overview

Package mvbsniffer provides the API for the io4edge mvbSniffer 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 mvbSniffer Module

func NewClientFromUniversalAddress

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

NewClientFromUniversalAddress creates a new mvbSniffer 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_mvbSniffer._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) 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) SelectExternalInputString

func (c *Client) SelectExternalInputString() string

SelectExternalInputString generates a string to switch the MVB receiver to the external signal

func (*Client) SendPattern

func (c *Client) SendPattern(s string) error

SendPattern sends a string to the self-test generator

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:

  • WithFilterMask
  • WithFBStreamOption(functionblock.WithXXXX(...))

Options that are not specified take default values.

func (*Client) StopGeneratorString

func (c *Client) StopGeneratorString() string

StopGeneratorString generates a string to stop the MVB pattern generator

func (*Client) StopStream

func (c *Client) StopStream() error

StopStream stops the stream on this connection

type CommandList

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

CommandList holds the list of generator commands generated by AddxxxFrame

func NewCommandList

func NewCommandList() *CommandList

NewCommandList starts a new list of commands

func (*CommandList) AddMasterFrame

func (c *CommandList) AddMasterFrame(redundantFrameDelayNs int, lineB bool, pauseAfterUs int, fcode uint8, address uint16) error

AddMasterFrame adds a MVB master frame to the command list

func (*CommandList) AddMasterFrameWithError

func (c *CommandList) AddMasterFrameWithError(redundantFrameDelayNs int, lineB bool, pauseAfterUs int, fcode uint8, address uint16, injectedError ErrorInject) error

AddMasterFrameWithError adds a MVB master frame with an injected error to the command list

func (*CommandList) AddSlaveFrame

func (c *CommandList) AddSlaveFrame(redundantFrameDelayNs int, lineB bool, pauseAfterUs int, data []uint8) error

AddSlaveFrame adds a MVB slave frame to the command list

func (*CommandList) AddSlaveFrameWithError

func (c *CommandList) AddSlaveFrameWithError(redundantFrameDelayNs int, lineB bool, pauseAfterUs int, data []uint8, injectedError ErrorInject) error

AddSlaveFrameWithError adds a MVB slave frame with an injected error to the command list

func (*CommandList) DumpCommandBytes

func (c *CommandList) DumpCommandBytes()

DumpCommandBytes prints the list of commands (before encoding)

func (*CommandList) StartGeneratorString

func (c *CommandList) StartGeneratorString(internalLoop bool) string

StartGeneratorString generates from the command list a string that can be sent to the MVB pattern generator to start the pattern

type ErrorInject

type ErrorInject struct {
	ErrorInA     bool
	ErrorInB     bool
	FullBitError bool  // half otherwise
	Position     uint8 // Positiion = 2.66us + (n * 5.33us)  [n=0..31]
}

ErrorInject defines the parameters for generator error injection

type FilterMask

type FilterMask struct {
	// MVB f_codes filter mask. Each bit corresponds to a specific f_code, bit 0=fcode-0, bit 1=fcode-1 etc
	FCodeMask uint16
	// Address to compare
	Address uint16
	// mask for comparison. Only bits set to one are compared against address
	Mask uint16
	// whether to include frames without slave response
	IncludeTimedoutFrames bool
}

FilterMask defines a specific filter for MVB telegrams

type StreamConfigOption

type StreamConfigOption func(*StreamConfiguration)

StreamConfigOption is a type to pass options to StartStream()

func WithFBStreamOption

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 WithFilterMask

func WithFilterMask(mask FilterMask) StreamConfigOption

WithFilterMask may be passed once or multiple times to StartStream.

type StreamConfiguration

type StreamConfiguration struct {
	FilterMask []*fspb.FilterMask
	FBOptions  []functionblock.StreamConfigOption
}

StreamConfiguration defines the configuration of a stream

type StreamData

type StreamData struct {
	functionblock.StreamDataMeta
	FSData *fspb.TelegramCollection
}

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

type StreamFilter

type StreamFilter struct {
	Masks []FilterMask
}

StreamFilter defines the MVB filter to be applied to a stream Refer to firmware documentation for max. numeber of Masks supported

Jump to

Keyboard shortcuts

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