Files
dmxconnect/hardware/OS2LPeripheral.go

59 lines
1.6 KiB
Go
Raw Normal View History

2024-12-23 17:22:37 +01:00
package hardware
2024-12-29 13:09:46 +01:00
import (
"github.com/rs/zerolog/log"
)
2024-12-23 17:22:37 +01:00
// OS2LPeripheral contains the data of an OS2L peripheral
type OS2LPeripheral struct {
name string // The name of the peripheral
serialNumber string // The serial number of the peripheral
}
// NewOS2LPeripheral creates a new OS2L peripheral
func NewOS2LPeripheral(name string, serialNumber string) *OS2LPeripheral {
2024-12-29 13:09:46 +01:00
log.Trace().Str("file", "OS2LPeripheral").Str("name", name).Str("s/n", serialNumber).Msg("OS2L peripheral created")
2024-12-23 17:22:37 +01:00
return &OS2LPeripheral{
name: name,
serialNumber: serialNumber,
}
}
// Connect connects the MIDI peripheral
func (p *OS2LPeripheral) Connect() error {
2024-12-29 13:09:46 +01:00
log.Info().Str("file", "OS2LPeripheral").Msg("OS2L peripheral connected")
2024-12-23 17:22:37 +01:00
return nil
}
// Disconnect disconnects the MIDI peripheral
func (p *OS2LPeripheral) Disconnect() error {
2024-12-29 13:09:46 +01:00
log.Info().Str("file", "OS2LPeripheral").Msg("OS2L peripheral disconnected")
2024-12-23 17:22:37 +01:00
return nil
}
// Activate activates the MIDI peripheral
func (p *OS2LPeripheral) Activate() error {
2024-12-29 13:09:46 +01:00
log.Info().Str("file", "OS2LPeripheral").Msg("OS2L peripheral activated")
2024-12-23 17:22:37 +01:00
return nil
}
// Deactivate deactivates the MIDI peripheral
func (p *OS2LPeripheral) Deactivate() error {
2024-12-29 13:09:46 +01:00
log.Info().Str("file", "OS2LPeripheral").Msg("OS2L peripheral deactivated")
2024-12-23 17:22:37 +01:00
return nil
}
// SetDeviceProperty - not implemented for this kind of peripheral
func (p *OS2LPeripheral) SetDeviceProperty(uint32, uint32, byte) error {
return nil
}
// GetInfo gets the peripheral information
func (p *OS2LPeripheral) GetInfo() PeripheralInfo {
return PeripheralInfo{
Name: p.name,
SerialNumber: p.serialNumber,
ProtocolName: "OS2L",
}
}