model

package
v0.0.0-...-32abb6c Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const DF1SymbolMessageFrame_ENDTRANSACTION uint8 = 0x03
View Source
const DF1SymbolMessageFrame_MESSAGEEND uint8 = 0x10

Constant values.

View Source
const DF1Symbol_MESSAGESTART uint8 = 0x10

Constant values.

Variables

This section is empty.

Functions

func CrcCheck

func CrcCheck(ctx context.Context, destinationAddress uint8, sourceAddress uint8, command DF1Command) func() (uint16, error)

func DF1CommandParse

func DF1CommandParse[T DF1Command](ctx context.Context, theBytes []byte) (T, error)

func DF1CommandParseWithBuffer

func DF1CommandParseWithBuffer[T DF1Command](ctx context.Context, readBuffer utils.ReadBuffer) (T, error)

func DF1CommandParseWithBufferProducer

func DF1CommandParseWithBufferProducer[T DF1Command]() func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error)

func DF1SymbolParse

func DF1SymbolParse[T DF1Symbol](ctx context.Context, theBytes []byte) (T, error)

func DF1SymbolParseWithBuffer

func DF1SymbolParseWithBuffer[T DF1Symbol](ctx context.Context, readBuffer utils.ReadBuffer) (T, error)

func DF1SymbolParseWithBufferProducer

func DF1SymbolParseWithBufferProducer[T DF1Symbol]() func(ctx context.Context, readBuffer utils.ReadBuffer) (T, error)

func DataLength

func DataLength(ctx context.Context, data []byte) uint16

func DataTerminate

func DataTerminate(ctx context.Context, io utils.ReadBuffer) func([]byte) bool

func NewDF1Command

func NewDF1Command(status uint8, transactionCounter uint16) *_DF1Command

NewDF1Command factory function for _DF1Command

func NewDF1Symbol

func NewDF1Symbol() *_DF1Symbol

NewDF1Symbol factory function for _DF1Symbol

func NewDF1SymbolMessageFrame

func NewDF1SymbolMessageFrame(destinationAddress uint8, sourceAddress uint8, command DF1Command) *_DF1SymbolMessageFrame

NewDF1SymbolMessageFrame factory function for _DF1SymbolMessageFrame

func NewDF1SymbolMessageFrameACK

func NewDF1SymbolMessageFrameACK() *_DF1SymbolMessageFrameACK

NewDF1SymbolMessageFrameACK factory function for _DF1SymbolMessageFrameACK

func NewDF1SymbolMessageFrameNAK

func NewDF1SymbolMessageFrameNAK() *_DF1SymbolMessageFrameNAK

NewDF1SymbolMessageFrameNAK factory function for _DF1SymbolMessageFrameNAK

func NewDF1UnprotectedReadRequest

func NewDF1UnprotectedReadRequest(status uint8, transactionCounter uint16, address uint16, size uint8) *_DF1UnprotectedReadRequest

NewDF1UnprotectedReadRequest factory function for _DF1UnprotectedReadRequest

func NewDF1UnprotectedReadResponse

func NewDF1UnprotectedReadResponse(status uint8, transactionCounter uint16, data []byte) *_DF1UnprotectedReadResponse

NewDF1UnprotectedReadResponse factory function for _DF1UnprotectedReadResponse

func ReadData

func ReadData(ctx context.Context, io utils.ReadBuffer) func(context.Context) (uint8, error)

func WriteData

func WriteData(ctx context.Context, io utils.WriteBuffer, element byte) error

Types

type DF1Command

type DF1Command interface {
	DF1CommandContract
	DF1CommandRequirements
	fmt.Stringer
	utils.LengthAware
	utils.Serializable
	utils.Copyable
	// IsDF1Command is a marker method to prevent unintentional type checks (interfaces of same signature)
	IsDF1Command()
	// CreateBuilder creates a DF1CommandBuilder
	CreateDF1CommandBuilder() DF1CommandBuilder
}

DF1Command is the corresponding interface of DF1Command

func CastDF1Command deprecated

func CastDF1Command(structType any) DF1Command

Deprecated: use the interface for direct cast

type DF1CommandBuilder

type DF1CommandBuilder interface {
	utils.Copyable
	// WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls)
	WithMandatoryFields(status uint8, transactionCounter uint16) DF1CommandBuilder
	// WithStatus adds Status (property field)
	WithStatus(uint8) DF1CommandBuilder
	// WithTransactionCounter adds TransactionCounter (property field)
	WithTransactionCounter(uint16) DF1CommandBuilder
	// AsDF1UnprotectedReadRequest converts this build to a subType of DF1Command. It is always possible to return to current builder using Done()
	AsDF1UnprotectedReadRequest() DF1UnprotectedReadRequestBuilder
	// AsDF1UnprotectedReadResponse converts this build to a subType of DF1Command. It is always possible to return to current builder using Done()
	AsDF1UnprotectedReadResponse() DF1UnprotectedReadResponseBuilder
	// Build builds the DF1Command or returns an error if something is wrong
	PartialBuild() (DF1CommandContract, error)
	// MustBuild does the same as Build but panics on error
	PartialMustBuild() DF1CommandContract
	// Build builds the DF1Command or returns an error if something is wrong
	Build() (DF1Command, error)
	// MustBuild does the same as Build but panics on error
	MustBuild() DF1Command
}

DF1CommandBuilder is a builder for DF1Command

func NewDF1CommandBuilder

func NewDF1CommandBuilder() DF1CommandBuilder

NewDF1CommandBuilder() creates a DF1CommandBuilder

type DF1CommandContract

type DF1CommandContract interface {
	// GetStatus returns Status (property field)
	GetStatus() uint8
	// GetTransactionCounter returns TransactionCounter (property field)
	GetTransactionCounter() uint16
	// IsDF1Command is a marker method to prevent unintentional type checks (interfaces of same signature)
	IsDF1Command()
	// CreateBuilder creates a DF1CommandBuilder
	CreateDF1CommandBuilder() DF1CommandBuilder
}

DF1CommandContract provides a set of functions which can be overwritten by a sub struct

type DF1CommandRequirements

type DF1CommandRequirements interface {
	GetLengthInBits(ctx context.Context) uint16
	GetLengthInBytes(ctx context.Context) uint16
	// GetCommandCode returns CommandCode (discriminator field)
	GetCommandCode() uint8
}

DF1CommandRequirements provides a set of functions which need to be implemented by a sub struct

type DF1Symbol

type DF1Symbol interface {
	DF1SymbolContract
	DF1SymbolRequirements
	fmt.Stringer
	utils.LengthAware
	utils.Serializable
	utils.Copyable
	// IsDF1Symbol is a marker method to prevent unintentional type checks (interfaces of same signature)
	IsDF1Symbol()
	// CreateBuilder creates a DF1SymbolBuilder
	CreateDF1SymbolBuilder() DF1SymbolBuilder
}

DF1Symbol is the corresponding interface of DF1Symbol

func CastDF1Symbol deprecated

func CastDF1Symbol(structType any) DF1Symbol

Deprecated: use the interface for direct cast

type DF1SymbolBuilder

type DF1SymbolBuilder interface {
	utils.Copyable
	// WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls)
	WithMandatoryFields() DF1SymbolBuilder
	// AsDF1SymbolMessageFrame converts this build to a subType of DF1Symbol. It is always possible to return to current builder using Done()
	AsDF1SymbolMessageFrame() DF1SymbolMessageFrameBuilder
	// AsDF1SymbolMessageFrameACK converts this build to a subType of DF1Symbol. It is always possible to return to current builder using Done()
	AsDF1SymbolMessageFrameACK() DF1SymbolMessageFrameACKBuilder
	// AsDF1SymbolMessageFrameNAK converts this build to a subType of DF1Symbol. It is always possible to return to current builder using Done()
	AsDF1SymbolMessageFrameNAK() DF1SymbolMessageFrameNAKBuilder
	// Build builds the DF1Symbol or returns an error if something is wrong
	PartialBuild() (DF1SymbolContract, error)
	// MustBuild does the same as Build but panics on error
	PartialMustBuild() DF1SymbolContract
	// Build builds the DF1Symbol or returns an error if something is wrong
	Build() (DF1Symbol, error)
	// MustBuild does the same as Build but panics on error
	MustBuild() DF1Symbol
}

DF1SymbolBuilder is a builder for DF1Symbol

func NewDF1SymbolBuilder

func NewDF1SymbolBuilder() DF1SymbolBuilder

NewDF1SymbolBuilder() creates a DF1SymbolBuilder

type DF1SymbolContract

type DF1SymbolContract interface {
	// IsDF1Symbol is a marker method to prevent unintentional type checks (interfaces of same signature)
	IsDF1Symbol()
	// CreateBuilder creates a DF1SymbolBuilder
	CreateDF1SymbolBuilder() DF1SymbolBuilder
}

DF1SymbolContract provides a set of functions which can be overwritten by a sub struct

type DF1SymbolMessageFrame

type DF1SymbolMessageFrame interface {
	fmt.Stringer
	utils.LengthAware
	utils.Serializable
	utils.Copyable
	DF1Symbol
	// GetDestinationAddress returns DestinationAddress (property field)
	GetDestinationAddress() uint8
	// GetSourceAddress returns SourceAddress (property field)
	GetSourceAddress() uint8
	// GetCommand returns Command (property field)
	GetCommand() DF1Command
	// IsDF1SymbolMessageFrame is a marker method to prevent unintentional type checks (interfaces of same signature)
	IsDF1SymbolMessageFrame()
	// CreateBuilder creates a DF1SymbolMessageFrameBuilder
	CreateDF1SymbolMessageFrameBuilder() DF1SymbolMessageFrameBuilder
}

DF1SymbolMessageFrame is the corresponding interface of DF1SymbolMessageFrame

func CastDF1SymbolMessageFrame deprecated

func CastDF1SymbolMessageFrame(structType any) DF1SymbolMessageFrame

Deprecated: use the interface for direct cast

type DF1SymbolMessageFrameACK

type DF1SymbolMessageFrameACK interface {
	fmt.Stringer
	utils.LengthAware
	utils.Serializable
	utils.Copyable
	DF1Symbol
	// IsDF1SymbolMessageFrameACK is a marker method to prevent unintentional type checks (interfaces of same signature)
	IsDF1SymbolMessageFrameACK()
	// CreateBuilder creates a DF1SymbolMessageFrameACKBuilder
	CreateDF1SymbolMessageFrameACKBuilder() DF1SymbolMessageFrameACKBuilder
}

DF1SymbolMessageFrameACK is the corresponding interface of DF1SymbolMessageFrameACK

func CastDF1SymbolMessageFrameACK deprecated

func CastDF1SymbolMessageFrameACK(structType any) DF1SymbolMessageFrameACK

Deprecated: use the interface for direct cast

type DF1SymbolMessageFrameACKBuilder

type DF1SymbolMessageFrameACKBuilder interface {
	utils.Copyable
	// WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls)
	WithMandatoryFields() DF1SymbolMessageFrameACKBuilder
	// Done is used to finish work on this child and return (or create one if none) to the parent builder
	Done() DF1SymbolBuilder
	// Build builds the DF1SymbolMessageFrameACK or returns an error if something is wrong
	Build() (DF1SymbolMessageFrameACK, error)
	// MustBuild does the same as Build but panics on error
	MustBuild() DF1SymbolMessageFrameACK
}

DF1SymbolMessageFrameACKBuilder is a builder for DF1SymbolMessageFrameACK

func NewDF1SymbolMessageFrameACKBuilder

func NewDF1SymbolMessageFrameACKBuilder() DF1SymbolMessageFrameACKBuilder

NewDF1SymbolMessageFrameACKBuilder() creates a DF1SymbolMessageFrameACKBuilder

type DF1SymbolMessageFrameBuilder

type DF1SymbolMessageFrameBuilder interface {
	utils.Copyable
	// WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls)
	WithMandatoryFields(destinationAddress uint8, sourceAddress uint8, command DF1Command) DF1SymbolMessageFrameBuilder
	// WithDestinationAddress adds DestinationAddress (property field)
	WithDestinationAddress(uint8) DF1SymbolMessageFrameBuilder
	// WithSourceAddress adds SourceAddress (property field)
	WithSourceAddress(uint8) DF1SymbolMessageFrameBuilder
	// WithCommand adds Command (property field)
	WithCommand(DF1Command) DF1SymbolMessageFrameBuilder
	// WithCommandBuilder adds Command (property field) which is build by the builder
	WithCommandBuilder(func(DF1CommandBuilder) DF1CommandBuilder) DF1SymbolMessageFrameBuilder
	// Done is used to finish work on this child and return (or create one if none) to the parent builder
	Done() DF1SymbolBuilder
	// Build builds the DF1SymbolMessageFrame or returns an error if something is wrong
	Build() (DF1SymbolMessageFrame, error)
	// MustBuild does the same as Build but panics on error
	MustBuild() DF1SymbolMessageFrame
}

DF1SymbolMessageFrameBuilder is a builder for DF1SymbolMessageFrame

func NewDF1SymbolMessageFrameBuilder

func NewDF1SymbolMessageFrameBuilder() DF1SymbolMessageFrameBuilder

NewDF1SymbolMessageFrameBuilder() creates a DF1SymbolMessageFrameBuilder

type DF1SymbolMessageFrameNAK

type DF1SymbolMessageFrameNAK interface {
	fmt.Stringer
	utils.LengthAware
	utils.Serializable
	utils.Copyable
	DF1Symbol
	// IsDF1SymbolMessageFrameNAK is a marker method to prevent unintentional type checks (interfaces of same signature)
	IsDF1SymbolMessageFrameNAK()
	// CreateBuilder creates a DF1SymbolMessageFrameNAKBuilder
	CreateDF1SymbolMessageFrameNAKBuilder() DF1SymbolMessageFrameNAKBuilder
}

DF1SymbolMessageFrameNAK is the corresponding interface of DF1SymbolMessageFrameNAK

func CastDF1SymbolMessageFrameNAK deprecated

func CastDF1SymbolMessageFrameNAK(structType any) DF1SymbolMessageFrameNAK

Deprecated: use the interface for direct cast

type DF1SymbolMessageFrameNAKBuilder

type DF1SymbolMessageFrameNAKBuilder interface {
	utils.Copyable
	// WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls)
	WithMandatoryFields() DF1SymbolMessageFrameNAKBuilder
	// Done is used to finish work on this child and return (or create one if none) to the parent builder
	Done() DF1SymbolBuilder
	// Build builds the DF1SymbolMessageFrameNAK or returns an error if something is wrong
	Build() (DF1SymbolMessageFrameNAK, error)
	// MustBuild does the same as Build but panics on error
	MustBuild() DF1SymbolMessageFrameNAK
}

DF1SymbolMessageFrameNAKBuilder is a builder for DF1SymbolMessageFrameNAK

func NewDF1SymbolMessageFrameNAKBuilder

func NewDF1SymbolMessageFrameNAKBuilder() DF1SymbolMessageFrameNAKBuilder

NewDF1SymbolMessageFrameNAKBuilder() creates a DF1SymbolMessageFrameNAKBuilder

type DF1SymbolRequirements

type DF1SymbolRequirements interface {
	GetLengthInBits(ctx context.Context) uint16
	GetLengthInBytes(ctx context.Context) uint16
	// GetSymbolType returns SymbolType (discriminator field)
	GetSymbolType() uint8
}

DF1SymbolRequirements provides a set of functions which need to be implemented by a sub struct

type DF1UnprotectedReadRequest

type DF1UnprotectedReadRequest interface {
	fmt.Stringer
	utils.LengthAware
	utils.Serializable
	utils.Copyable
	DF1Command
	// GetAddress returns Address (property field)
	GetAddress() uint16
	// GetSize returns Size (property field)
	GetSize() uint8
	// IsDF1UnprotectedReadRequest is a marker method to prevent unintentional type checks (interfaces of same signature)
	IsDF1UnprotectedReadRequest()
	// CreateBuilder creates a DF1UnprotectedReadRequestBuilder
	CreateDF1UnprotectedReadRequestBuilder() DF1UnprotectedReadRequestBuilder
}

DF1UnprotectedReadRequest is the corresponding interface of DF1UnprotectedReadRequest

func CastDF1UnprotectedReadRequest deprecated

func CastDF1UnprotectedReadRequest(structType any) DF1UnprotectedReadRequest

Deprecated: use the interface for direct cast

type DF1UnprotectedReadRequestBuilder

type DF1UnprotectedReadRequestBuilder interface {
	utils.Copyable
	// WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls)
	WithMandatoryFields(address uint16, size uint8) DF1UnprotectedReadRequestBuilder
	// WithAddress adds Address (property field)
	WithAddress(uint16) DF1UnprotectedReadRequestBuilder
	// WithSize adds Size (property field)
	WithSize(uint8) DF1UnprotectedReadRequestBuilder
	// Done is used to finish work on this child and return (or create one if none) to the parent builder
	Done() DF1CommandBuilder
	// Build builds the DF1UnprotectedReadRequest or returns an error if something is wrong
	Build() (DF1UnprotectedReadRequest, error)
	// MustBuild does the same as Build but panics on error
	MustBuild() DF1UnprotectedReadRequest
}

DF1UnprotectedReadRequestBuilder is a builder for DF1UnprotectedReadRequest

func NewDF1UnprotectedReadRequestBuilder

func NewDF1UnprotectedReadRequestBuilder() DF1UnprotectedReadRequestBuilder

NewDF1UnprotectedReadRequestBuilder() creates a DF1UnprotectedReadRequestBuilder

type DF1UnprotectedReadResponse

type DF1UnprotectedReadResponse interface {
	fmt.Stringer
	utils.LengthAware
	utils.Serializable
	utils.Copyable
	DF1Command
	// GetData returns Data (property field)
	GetData() []byte
	// IsDF1UnprotectedReadResponse is a marker method to prevent unintentional type checks (interfaces of same signature)
	IsDF1UnprotectedReadResponse()
	// CreateBuilder creates a DF1UnprotectedReadResponseBuilder
	CreateDF1UnprotectedReadResponseBuilder() DF1UnprotectedReadResponseBuilder
}

DF1UnprotectedReadResponse is the corresponding interface of DF1UnprotectedReadResponse

func CastDF1UnprotectedReadResponse deprecated

func CastDF1UnprotectedReadResponse(structType any) DF1UnprotectedReadResponse

Deprecated: use the interface for direct cast

type DF1UnprotectedReadResponseBuilder

type DF1UnprotectedReadResponseBuilder interface {
	utils.Copyable
	// WithMandatoryFields adds all mandatory fields (convenience for using multiple builder calls)
	WithMandatoryFields(data []byte) DF1UnprotectedReadResponseBuilder
	// WithData adds Data (property field)
	WithData(...byte) DF1UnprotectedReadResponseBuilder
	// Done is used to finish work on this child and return (or create one if none) to the parent builder
	Done() DF1CommandBuilder
	// Build builds the DF1UnprotectedReadResponse or returns an error if something is wrong
	Build() (DF1UnprotectedReadResponse, error)
	// MustBuild does the same as Build but panics on error
	MustBuild() DF1UnprotectedReadResponse
}

DF1UnprotectedReadResponseBuilder is a builder for DF1UnprotectedReadResponse

func NewDF1UnprotectedReadResponseBuilder

func NewDF1UnprotectedReadResponseBuilder() DF1UnprotectedReadResponseBuilder

NewDF1UnprotectedReadResponseBuilder() creates a DF1UnprotectedReadResponseBuilder

Jump to

Keyboard shortcuts

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