Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewListener ¶
func NewListener(in <-chan []byte, d serial.TypeDeserializer, r serial.TypeRegistrar, errHandler any, handlers ...interface{}) (bus.Listener, error)
NewListener creates a Listener that reads from the in channel, deserializes to a value and passes the value to a ListenerMuxer.
Types ¶
type MultiSender ¶
type MultiSender struct { Chans map[string]chan<- []byte serial.TypeSerializer }
MultiSender allows one message to be sent to multiple channels.
func NewMultiSender ¶
func NewMultiSender(s serial.TypeSerializer) *MultiSender
func (*MultiSender) Add ¶
func (ms *MultiSender) Add(key string, to interface{}) error
Add a chan<- []byte to the MultiSender and associate it with the key. If to is not of type chan<- []byte, an error is returned.
func (*MultiSender) AddCh ¶
func (ms *MultiSender) AddCh(key string, ch chan<- []byte)
AddCh adds a chan<- []byte to the MultiSender and associate it with the key.
func (*MultiSender) Delete ¶
func (ms *MultiSender) Delete(key string)
Delete a channel by key from the MultiSender.
func (*MultiSender) Send ¶
func (ms *MultiSender) Send(msg interface{}, keys ...string) error
Send a message to the keys provided. If no keys are provided, the message will be sent to all channels.
type Receiver ¶
type Receiver struct { In <-chan []byte Out chan<- interface{} serial.TypeDeserializer serial.TypeRegistrar // contains filtered or unexported fields }
Receiver takes serialized messages off a serial bus, deserializes them and places the deserialized objects on an interface channel.
func (*Receiver) RegisterType ¶
func (*Receiver) Run ¶
func (r *Receiver) Run()
Run starts the Receiver. It must be running to receive messages.
func (*Receiver) SetErrorHandler ¶
SetErrorHandler to errHandler if ErrHandler is currently nil.