Files
dmxconnect/hardware/MIDIPeripheral.go

65 lines
1.7 KiB
Go
Raw Normal View History

package hardware
import (
"context"
"github.com/rs/zerolog/log"
)
// MIDIPeripheral contains the data of a MIDI peripheral
type MIDIPeripheral struct {
2025-01-26 12:01:31 +01:00
info PeripheralInfo // The peripheral info
location int // The location of the peripheral
settings map[string]interface{} // The settings of the peripheral
}
// NewMIDIPeripheral creates a new MIDI peripheral
2025-01-26 12:01:31 +01:00
func NewMIDIPeripheral(peripheralData PeripheralInfo) (*MIDIPeripheral, error) {
log.Trace().Str("file", "MIDIPeripheral").Str("name", peripheralData.Name).Str("s/n", peripheralData.SerialNumber).Msg("MIDI peripheral created")
return &MIDIPeripheral{
2025-01-26 12:01:31 +01:00
info: peripheralData,
settings: peripheralData.Settings,
}, nil
}
// Connect connects the MIDI peripheral
func (p *MIDIPeripheral) Connect(ctx context.Context) error {
return nil
}
// Disconnect disconnects the MIDI peripheral
func (p *MIDIPeripheral) Disconnect() error {
return nil
}
// Activate activates the MIDI peripheral
func (p *MIDIPeripheral) Activate(ctx context.Context) error {
return nil
}
// Deactivate deactivates the MIDI peripheral
func (p *MIDIPeripheral) Deactivate(ctx context.Context) error {
return nil
}
2025-01-26 12:01:31 +01:00
// SetSettings sets a specific setting for this peripheral
func (p *MIDIPeripheral) SetSettings(settings map[string]interface{}) error {
p.settings = settings
return nil
}
// SetDeviceProperty - not implemented for this kind of peripheral
func (p *MIDIPeripheral) SetDeviceProperty(context.Context, uint32, uint32, byte) error {
return nil
}
// GetSettings gets the peripheral settings
func (p *MIDIPeripheral) GetSettings() map[string]interface{} {
return p.settings
}
// GetInfo gets the peripheral information
func (p *MIDIPeripheral) GetInfo() PeripheralInfo {
2025-01-26 12:01:31 +01:00
return p.info
}