Files
dmxconnect/hardware/MIDIPeripheral.go

59 lines
1.5 KiB
Go
Raw Normal View History

2024-12-15 13:45:46 +01:00
package hardware
import (
"context"
"github.com/rs/zerolog/log"
)
2024-12-29 13:09:46 +01:00
2024-12-15 13:45:46 +01:00
// MIDIPeripheral contains the data of a MIDI peripheral
type MIDIPeripheral struct {
2024-12-26 14:55:55 +01:00
name string // The name of the peripheral
location int // The location of the peripheral
serialNumber string // The S/N of the peripheral
2024-12-15 13:45:46 +01:00
}
// NewMIDIPeripheral creates a new MIDI peripheral
2024-12-26 14:55:55 +01:00
func NewMIDIPeripheral(name string, location int, serialNumber string) *MIDIPeripheral {
2024-12-29 13:09:46 +01:00
log.Trace().Str("file", "MIDIPeripheral").Str("name", name).Str("s/n", serialNumber).Int("location", location).Msg("MIDI peripheral created")
2024-12-15 13:45:46 +01:00
return &MIDIPeripheral{
2024-12-26 14:55:55 +01:00
name: name,
location: location,
serialNumber: serialNumber,
2024-12-15 13:45:46 +01:00
}
}
// Connect connects the MIDI peripheral
func (p *MIDIPeripheral) Connect(ctx context.Context) error {
2024-12-15 13:45:46 +01:00
return nil
}
// Disconnect disconnects the MIDI peripheral
func (p *MIDIPeripheral) Disconnect(ctx context.Context) error {
2024-12-15 13:45:46 +01:00
return nil
}
// Activate activates the MIDI peripheral
func (p *MIDIPeripheral) Activate(ctx context.Context) error {
2024-12-15 13:45:46 +01:00
return nil
}
// Deactivate deactivates the MIDI peripheral
func (p *MIDIPeripheral) Deactivate(ctx context.Context) error {
2024-12-15 13:45:46 +01:00
return nil
}
// SetDeviceProperty - not implemented for this kind of peripheral
func (p *MIDIPeripheral) SetDeviceProperty(context.Context, uint32, uint32, byte) error {
2024-12-15 13:45:46 +01:00
return nil
}
// GetInfo gets the peripheral information
func (p *MIDIPeripheral) GetInfo() PeripheralInfo {
return PeripheralInfo{
Name: p.name,
ProtocolName: "MIDI",
2024-12-26 14:55:55 +01:00
SerialNumber: p.serialNumber,
2024-12-15 13:45:46 +01:00
}
}