cbus

package
v0.0.0-...-f9e1acc Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var PossibleSalCommands = map[readWriteModel.ApplicationId][]CommandAndArgumentsCount{
	readWriteModel.ApplicationId_RESERVED:                           nil,
	readWriteModel.ApplicationId_FREE_USAGE:                         nil,
	readWriteModel.ApplicationId_TEMPERATURE_BROADCAST:              c2nl(readWriteModel.TemperatureBroadcastCommandTypeValues),
	readWriteModel.ApplicationId_ROOM_CONTROL_SYSTEM:                nil,
	readWriteModel.ApplicationId_LIGHTING:                           c2nl(readWriteModel.LightingCommandTypeValues),
	readWriteModel.ApplicationId_VENTILATION:                        c2nl(readWriteModel.LightingCommandTypeValues),
	readWriteModel.ApplicationId_IRRIGATION_CONTROL:                 c2nl(readWriteModel.LightingCommandTypeValues),
	readWriteModel.ApplicationId_POOLS_SPAS_PONDS_FOUNTAINS_CONTROL: c2nl(readWriteModel.LightingCommandTypeValues),
	readWriteModel.ApplicationId_HEATING:                            c2nl(readWriteModel.LightingCommandTypeValues),
	readWriteModel.ApplicationId_AIR_CONDITIONING:                   c2nl(readWriteModel.AirConditioningCommandTypeValues),
	readWriteModel.ApplicationId_TRIGGER_CONTROL:                    c2nl(readWriteModel.TriggerControlCommandTypeValues),
	readWriteModel.ApplicationId_ENABLE_CONTROL:                     c2nl(readWriteModel.EnableControlCommandTypeValues),
	readWriteModel.ApplicationId_AUDIO_AND_VIDEO:                    c2nl(readWriteModel.LightingCommandTypeValues),
	readWriteModel.ApplicationId_SECURITY:                           c2nl(readWriteModel.SecurityCommandTypeValues),
	readWriteModel.ApplicationId_METERING:                           c2nl(readWriteModel.MeteringCommandTypeValues),
	readWriteModel.ApplicationId_ACCESS_CONTROL:                     c2nl(readWriteModel.AccessControlCommandTypeValues),
	readWriteModel.ApplicationId_CLOCK_AND_TIMEKEEPING:              c2nl(readWriteModel.ClockAndTimekeepingCommandTypeValues),
	readWriteModel.ApplicationId_TELEPHONY_STATUS_AND_CONTROL:       c2nl(readWriteModel.TelephonyCommandTypeValues),
	readWriteModel.ApplicationId_MEASUREMENT:                        c2nl(readWriteModel.MeasurementCommandTypeValues),
	readWriteModel.ApplicationId_TESTING:                            nil,
	readWriteModel.ApplicationId_MEDIA_TRANSPORT_CONTROL:            c2nl(readWriteModel.MediaTransportControlCommandTypeValues),
	readWriteModel.ApplicationId_ERROR_REPORTING:                    c2nl(readWriteModel.ErrorReportingCommandTypeValues),
	readWriteModel.ApplicationId_HVAC_ACTUATOR:                      c2nl(readWriteModel.LightingCommandTypeValues),
}

Functions

func CreateRequestContext

func CreateRequestContext(cBusMessage readWriteModel.CBusMessage) readWriteModel.RequestContext

func CreateRequestContextWithInfoCallback

func CreateRequestContextWithInfoCallback(cBusMessage readWriteModel.CBusMessage, infoCallBack func(string)) readWriteModel.RequestContext

func MapEncodedReply

func MapEncodedReply(localLog zerolog.Logger, transaction transactions.RequestTransaction, encodedReply readWriteModel.EncodedReply, tagName string, addResponseCode func(name string, responseCode apiModel.PlcResponseCode), addPlcValue func(name string, plcValue apiValues.PlcValue)) error

func NewDriver

func NewDriver(_options ...options.WithOption) plc4go.PlcDriver

func TagToCBusMessage

func TagToCBusMessage(tag apiModel.PlcTag, value apiValues.PlcValue, alphaGenerator *AlphaGenerator, messageCodec *MessageCodec) (cBusMessage readWriteModel.CBusMessage, supportsRead, supportsWrite, supportsSubscribe bool, err error)

Types

type AlphaGenerator

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

func (*AlphaGenerator) Serialize

func (d *AlphaGenerator) Serialize() ([]byte, error)

func (*AlphaGenerator) SerializeWithWriteBuffer

func (d *AlphaGenerator) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*AlphaGenerator) String

func (d *AlphaGenerator) String() string

type Browser

type Browser struct {
	_default.DefaultBrowser
	// contains filtered or unexported fields
}

func NewBrowser

func NewBrowser(connection plc4go.PlcConnection, _options ...options.WithOption) *Browser

func (*Browser) BrowseQuery

func (m *Browser) BrowseQuery(ctx context.Context, interceptor func(result apiModel.PlcBrowseItem) bool, queryName string, query apiModel.PlcQuery) (responseCode apiModel.PlcResponseCode, queryResults []apiModel.PlcBrowseItem)

type CALGetStatusTag

type CALGetStatusTag interface {
	Tag
	CalTag

	GetParameter() readWriteModel.Parameter
	GetCount() uint8
}

CALGetStatusTag can be used to get device/network management tags

func NewCALGetStatusTag

func NewCALGetStatusTag(unitAddress readWriteModel.UnitAddress, bridgeAddresses []readWriteModel.BridgeAddress, parameter readWriteModel.Parameter, count uint8, numElements uint16) CALGetStatusTag

type CALIdentifyTag

type CALIdentifyTag interface {
	Tag
	CalTag

	GetAttribute() readWriteModel.Attribute
}

CALIdentifyTag can be used to get device/network management tags

func NewCALIdentifyTag

func NewCALIdentifyTag(unitAddress readWriteModel.UnitAddress, bridgeAddresses []readWriteModel.BridgeAddress, attribute readWriteModel.Attribute, numElements uint16) CALIdentifyTag

type CALRecallTag

type CALRecallTag interface {
	Tag
	CalTag

	GetParameter() readWriteModel.Parameter
	GetCount() uint8
}

CALRecallTag can be used to get device/network management tags

func NewCALRecallTag

func NewCALRecallTag(unitAddress readWriteModel.UnitAddress, bridgeAddresses []readWriteModel.BridgeAddress, parameter readWriteModel.Parameter, count uint8, numElements uint16) CALRecallTag

type CalTag

type CalTag interface {
	GetBridgeAddresses() []readWriteModel.BridgeAddress
	GetUnitAddress() readWriteModel.UnitAddress
}

type CommandAndArgumentsCount

type CommandAndArgumentsCount interface {
	fmt.Stringer
	PLC4XEnumName() string
	NumberOfArguments() uint8
}

type Configuration

type Configuration struct {
	Srchk    bool
	Exstat   bool
	Pun      bool
	LocalSal bool
	Pcn      bool
	Idmon    bool
	Monitor  bool
	Smart    bool
	XonXoff  bool
	Connect  bool

	MonitoredApplication1 byte
	MonitoredApplication2 byte
}

func ParseFromOptions

func ParseFromOptions(log zerolog.Logger, options map[string][]string) (Configuration, error)

func (*Configuration) Serialize

func (d *Configuration) Serialize() ([]byte, error)

func (*Configuration) SerializeWithWriteBuffer

func (d *Configuration) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*Configuration) String

func (d *Configuration) String() string

type Connection

type Connection struct {
	_default.DefaultConnection
	// contains filtered or unexported fields
}

func NewConnection

func NewConnection(messageCodec *MessageCodec, configuration Configuration, driverContext DriverContext, tagHandler spi.PlcTagHandler, tm transactions.RequestTransactionManager, connectionOptions map[string][]string, _options ...options.WithOption) *Connection

func (*Connection) BrowseRequestBuilder

func (c *Connection) BrowseRequestBuilder() apiModel.PlcBrowseRequestBuilder

func (*Connection) Close

func (c *Connection) Close() <-chan plc4go.PlcConnectionCloseResult

func (*Connection) ConnectWithContext

func (c *Connection) ConnectWithContext(ctx context.Context) <-chan plc4go.PlcConnectionConnectResult

func (*Connection) GetConnection

func (c *Connection) GetConnection() plc4go.PlcConnection

func (*Connection) GetConnectionId

func (c *Connection) GetConnectionId() string

func (*Connection) GetMessageCodec

func (c *Connection) GetMessageCodec() spi.MessageCodec

func (*Connection) GetMetadata

func (c *Connection) GetMetadata() apiModel.PlcConnectionMetadata

func (*Connection) GetTracer

func (c *Connection) GetTracer() tracer.Tracer

func (*Connection) IsTraceEnabled

func (c *Connection) IsTraceEnabled() bool

func (*Connection) ReadRequestBuilder

func (c *Connection) ReadRequestBuilder() apiModel.PlcReadRequestBuilder

func (*Connection) Serialize

func (d *Connection) Serialize() ([]byte, error)

func (*Connection) SerializeWithWriteBuffer

func (d *Connection) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*Connection) String

func (d *Connection) String() string

func (*Connection) SubscriptionRequestBuilder

func (c *Connection) SubscriptionRequestBuilder() apiModel.PlcSubscriptionRequestBuilder

func (*Connection) UnsubscriptionRequestBuilder

func (c *Connection) UnsubscriptionRequestBuilder() apiModel.PlcUnsubscriptionRequestBuilder

func (*Connection) WriteRequestBuilder

func (c *Connection) WriteRequestBuilder() apiModel.PlcWriteRequestBuilder

type Discoverer

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

func NewDiscoverer

func NewDiscoverer(_options ...options.WithOption) *Discoverer

func (*Discoverer) Close

func (d *Discoverer) Close() error

func (*Discoverer) Discover

func (d *Discoverer) Discover(ctx context.Context, callback func(event apiModel.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error

type Driver

type Driver struct {
	_default.DefaultDriver
	// contains filtered or unexported fields
}

func (*Driver) Close

func (m *Driver) Close() error

func (*Driver) DiscoverWithContext

func (m *Driver) DiscoverWithContext(ctx context.Context, callback func(event apiModel.PlcDiscoveryItem), discoveryOptions ...options.WithDiscoveryOption) error

func (*Driver) GetConnectionWithContext

func (m *Driver) GetConnectionWithContext(ctx context.Context, transportUrl url.URL, transports map[string]transports.Transport, driverOptions map[string][]string) <-chan plc4go.PlcConnectionConnectResult

func (*Driver) SetAwaitDisconnectComplete

func (m *Driver) SetAwaitDisconnectComplete(awaitComplete bool)

func (*Driver) SetAwaitSetupComplete

func (m *Driver) SetAwaitSetupComplete(awaitComplete bool)

func (*Driver) SupportsDiscovery

func (m *Driver) SupportsDiscovery() bool

type DriverContext

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

func NewDriverContext

func NewDriverContext(_ Configuration) DriverContext

func (*DriverContext) Serialize

func (d *DriverContext) Serialize() ([]byte, error)

func (*DriverContext) SerializeWithWriteBuffer

func (d *DriverContext) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*DriverContext) String

func (d *DriverContext) String() string

type MMIMonitorTag

type MMIMonitorTag interface {
	SubscriptionTag

	GetUnitAddress() readWriteModel.UnitAddress
	GetApplication() *readWriteModel.ApplicationIdContainer
}

MMIMonitorTag can be used to monitor mmi tags

func NewMMIMonitorTag

func NewMMIMonitorTag(unitAddress readWriteModel.UnitAddress, application *readWriteModel.ApplicationIdContainer, numElements uint16) MMIMonitorTag

type MessageCodec

type MessageCodec struct {
	_default.DefaultCodec
	// contains filtered or unexported fields
}

func NewMessageCodec

func NewMessageCodec(transportInstance transports.TransportInstance, _options ...options.WithOption) *MessageCodec

func (*MessageCodec) Connect

func (m *MessageCodec) Connect() error

func (*MessageCodec) ConnectWithContext

func (m *MessageCodec) ConnectWithContext(ctx context.Context) error

func (*MessageCodec) Disconnect

func (m *MessageCodec) Disconnect() error

func (*MessageCodec) GetCodec

func (m *MessageCodec) GetCodec() spi.MessageCodec

func (*MessageCodec) Receive

func (m *MessageCodec) Receive() (spi.Message, error)

func (*MessageCodec) Send

func (m *MessageCodec) Send(message spi.Message) error

func (*MessageCodec) Serialize

func (d *MessageCodec) Serialize() ([]byte, error)

func (*MessageCodec) SerializeWithWriteBuffer

func (d *MessageCodec) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*MessageCodec) String

func (d *MessageCodec) String() string

type Reader

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

func NewReader

func NewReader(tpduGenerator *AlphaGenerator, messageCodec *MessageCodec, tm transactions.RequestTransactionManager, _options ...options.WithOption) *Reader

func (*Reader) Read

func (m *Reader) Read(ctx context.Context, readRequest apiModel.PlcReadRequest) <-chan apiModel.PlcReadRequestResult

type RequestTransaction deprecated

type RequestTransaction interface {
	transactions.RequestTransaction
}

Deprecated: don't use it in productive code

type SALMonitorTag

type SALMonitorTag interface {
	SubscriptionTag

	GetUnitAddress() readWriteModel.UnitAddress
	GetApplication() *readWriteModel.ApplicationIdContainer
}

SALMonitorTag can be used to monitor sal tags

func NewSALMonitorTag

func NewSALMonitorTag(unitAddress readWriteModel.UnitAddress, application *readWriteModel.ApplicationIdContainer, numElements uint16) SALMonitorTag

type SALTag

type SALTag interface {
	Tag

	GetBridgeAddresses() []readWriteModel.BridgeAddress
	GetApplication() readWriteModel.ApplicationIdContainer
	GetSALCommand() string
}

SALTag can be used to send SAL commands

func NewSALTag

func NewSALTag(bridgeAddresses []readWriteModel.BridgeAddress, application readWriteModel.ApplicationIdContainer, salCommand string, numElements uint16) SALTag

type StatusRequestType

type StatusRequestType uint8
const (
	StatusRequestTypeBinaryState StatusRequestType = iota
	StatusRequestTypeLevel
)

func (StatusRequestType) String

func (i StatusRequestType) String() string

type StatusTag

type StatusTag interface {
	Tag

	GetBridgeAddresses() []readWriteModel.BridgeAddress
	GetStatusRequestType() StatusRequestType
	GetStartingGroupAddressLabel() *byte
	GetApplication() readWriteModel.ApplicationIdContainer
}

StatusTag can be used to query status using a P-to-MP-StatusRequest command

func NewStatusTag

func NewStatusTag(bridgeAddresses []readWriteModel.BridgeAddress, statusRequestType StatusRequestType, startingGroupAddressLabel *byte, application readWriteModel.ApplicationIdContainer, numElements uint16) StatusTag

type Subscriber

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

func NewSubscriber

func NewSubscriber(addSubscriber func(subscriber *Subscriber), _options ...options.WithOption) *Subscriber

func (*Subscriber) Serialize

func (d *Subscriber) Serialize() ([]byte, error)

func (*Subscriber) SerializeWithWriteBuffer

func (d *Subscriber) SerializeWithWriteBuffer(ctx context.Context, writeBuffer utils.WriteBuffer) error

func (*Subscriber) String

func (d *Subscriber) String() string

func (*Subscriber) Subscribe

func (*Subscriber) Unregister

func (s *Subscriber) Unregister(registration apiModel.PlcConsumerRegistration)

func (*Subscriber) Unsubscribe

func (s *Subscriber) Unsubscribe(ctx context.Context, unsubscriptionRequest apiModel.PlcUnsubscriptionRequest) <-chan apiModel.PlcUnsubscriptionRequestResult

type SubscriptionEvent

type SubscriptionEvent struct {
	*spiModel.DefaultPlcSubscriptionEvent
	// contains filtered or unexported fields
}

func NewSubscriptionEvent

func NewSubscriptionEvent(
	tags map[string]apiModel.PlcTag,
	types map[string]apiModel.PlcSubscriptionType,
	intervals map[string]time.Duration,
	responseCodes map[string]apiModel.PlcResponseCode,
	address map[string]string,
	sources map[string]string,
	values map[string]apiValues.PlcValue,
	_options ...options.WithOption,
) SubscriptionEvent

func (SubscriptionEvent) GetAddress

func (m SubscriptionEvent) GetAddress(name string) string

func (SubscriptionEvent) GetSource

func (m SubscriptionEvent) GetSource(name string) string

type SubscriptionHandle

type SubscriptionHandle struct {
	*spiModel.DefaultPlcSubscriptionHandle
	// contains filtered or unexported fields
}

func NewSubscriptionHandle

func NewSubscriptionHandle(subscriber *Subscriber, tagName string, tag any, subscriptionType apiModel.PlcSubscriptionType, interval time.Duration) *SubscriptionHandle

type SubscriptionTag

type SubscriptionTag interface {
	Tag
	apiModel.PlcSubscriptionTag
}

type Tag

type Tag interface {
	apiModel.PlcTag

	GetTagType() TagType
}

type TagHandler

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

func NewTagHandler

func NewTagHandler() TagHandler

func (TagHandler) ParseQuery

func (m TagHandler) ParseQuery(query string) (apiModel.PlcQuery, error)

func (TagHandler) ParseTag

func (m TagHandler) ParseTag(tagAddress string) (apiModel.PlcTag, error)

type TagType

type TagType uint8
const (
	STATUS    TagType = iota
	CAL_RESET         /* TODO: implement me*/
	CAL_RECALL
	CAL_IDENTIFY
	CAL_GETSTATUS
	CAL_WRITE           /* TODO: implement me*/
	CAL_IDENTIFY_REPLY  /* TODO: implement me*/
	CAL_STATUS          /* TODO: implement me*/
	CAL_STATUS_EXTENDED /* TODO: implement me*/
	SAL
	SAL_MONITOR
	MMI_STATUS_MONITOR
	UNIT_INFO
)

func (TagType) GetName

func (i TagType) GetName() string

func (TagType) String

func (i TagType) String() string

type UnitInfoQuery

type UnitInfoQuery interface {
	apiModel.PlcQuery

	GetUnitAddress() readWriteModel.UnitAddress
	GetAttribute() *readWriteModel.Attribute
}

UnitInfoQuery can be used to get information about unit(s)

func NewUnitInfoQuery

func NewUnitInfoQuery(unitAddress readWriteModel.UnitAddress, attribute *readWriteModel.Attribute, numElements uint16) UnitInfoQuery

type ValueHandler

type ValueHandler struct {
	spiValues.DefaultValueHandler
}

func NewValueHandler

func NewValueHandler(_options ...options.WithOption) ValueHandler

func (ValueHandler) NewPlcValue

func (m ValueHandler) NewPlcValue(tag apiModel.PlcTag, value any) (apiValues.PlcValue, error)

type Writer

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

func NewWriter

func NewWriter(tpduGenerator *AlphaGenerator, messageCodec *MessageCodec, tm transactions.RequestTransactionManager, _options ...options.WithOption) *Writer

func (*Writer) Write

func (m *Writer) Write(ctx context.Context, writeRequest apiModel.PlcWriteRequest) <-chan apiModel.PlcWriteRequestResult

Jump to

Keyboard shortcuts

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