mirror of
https://github.com/jwetzell/showbridge-go.git
synced 2026-04-26 21:05:30 +00:00
change namespace
This commit is contained in:
@@ -8,15 +8,15 @@ import (
|
|||||||
"github.com/jwetzell/showbridge-go/internal/config"
|
"github.com/jwetzell/showbridge-go/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ArtNetDecode struct {
|
type ArtNetPacketDecode struct {
|
||||||
config config.ProcessorConfig
|
config config.ProcessorConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ad *ArtNetDecode) Process(ctx context.Context, payload any) (any, error) {
|
func (apd *ArtNetPacketDecode) Process(ctx context.Context, payload any) (any, error) {
|
||||||
payloadBytes, ok := payload.([]byte)
|
payloadBytes, ok := payload.([]byte)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("artnet.decode processor only accepts a []byte")
|
return nil, fmt.Errorf("artnet.packet.decode processor only accepts a []byte")
|
||||||
}
|
}
|
||||||
|
|
||||||
payloadMessage, err := artnet.Decode(payloadBytes)
|
payloadMessage, err := artnet.Decode(payloadBytes)
|
||||||
@@ -28,15 +28,15 @@ func (ad *ArtNetDecode) Process(ctx context.Context, payload any) (any, error) {
|
|||||||
return payloadMessage, nil
|
return payloadMessage, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ad *ArtNetDecode) Type() string {
|
func (apd *ArtNetPacketDecode) Type() string {
|
||||||
return ad.config.Type
|
return apd.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
RegisterProcessor(ProcessorRegistration{
|
RegisterProcessor(ProcessorRegistration{
|
||||||
Type: "artnet.decode",
|
Type: "artnet.packet.decode",
|
||||||
New: func(config config.ProcessorConfig) (Processor, error) {
|
New: func(config config.ProcessorConfig) (Processor, error) {
|
||||||
return &ArtNetDecode{config: config}, nil
|
return &ArtNetPacketDecode{config: config}, nil
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -8,15 +8,15 @@ import (
|
|||||||
"github.com/jwetzell/showbridge-go/internal/config"
|
"github.com/jwetzell/showbridge-go/internal/config"
|
||||||
)
|
)
|
||||||
|
|
||||||
type ArtNetEncode struct {
|
type ArtNetPacketEncode struct {
|
||||||
config config.ProcessorConfig
|
config config.ProcessorConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ad *ArtNetEncode) Process(ctx context.Context, payload any) (any, error) {
|
func (ape *ArtNetPacketEncode) Process(ctx context.Context, payload any) (any, error) {
|
||||||
payloadPacket, ok := payload.(artnet.ArtNetPacket)
|
payloadPacket, ok := payload.(artnet.ArtNetPacket)
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, fmt.Errorf("artnet.encode processor only accepts an ArtNetPacket")
|
return nil, fmt.Errorf("artnet.packet.encode processor only accepts an ArtNetPacket")
|
||||||
}
|
}
|
||||||
|
|
||||||
payloadBytes, err := payloadPacket.MarshalBinary()
|
payloadBytes, err := payloadPacket.MarshalBinary()
|
||||||
@@ -27,15 +27,15 @@ func (ad *ArtNetEncode) Process(ctx context.Context, payload any) (any, error) {
|
|||||||
return payloadBytes, nil
|
return payloadBytes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (ad *ArtNetEncode) Type() string {
|
func (ape *ArtNetPacketEncode) Type() string {
|
||||||
return ad.config.Type
|
return ape.config.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
RegisterProcessor(ProcessorRegistration{
|
RegisterProcessor(ProcessorRegistration{
|
||||||
Type: "artnet.encode",
|
Type: "artnet.packet.encode",
|
||||||
New: func(config config.ProcessorConfig) (Processor, error) {
|
New: func(config config.ProcessorConfig) (Processor, error) {
|
||||||
return &ArtNetEncode{config: config}, nil
|
return &ArtNetPacketEncode{config: config}, nil
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user