load peripheral settings in front

This commit is contained in:
2025-01-25 11:06:03 +01:00
parent 3fbf4b5df4
commit 6941c06661
7 changed files with 107 additions and 26 deletions

View File

@@ -8,18 +8,21 @@ import (
// MIDIPeripheral contains the data of a MIDI peripheral
type MIDIPeripheral struct {
name string // The name of the peripheral
location int // The location of the peripheral
serialNumber string // The S/N of the peripheral
name string // The name of the peripheral
location int // The location of the peripheral
serialNumber string // The S/N of the peripheral
settings map[string]interface{} // The settings of the peripheral
}
// NewMIDIPeripheral creates a new MIDI peripheral
func NewMIDIPeripheral(name string, location int, serialNumber string) *MIDIPeripheral {
log.Trace().Str("file", "MIDIPeripheral").Str("name", name).Str("s/n", serialNumber).Int("location", location).Msg("MIDI peripheral created")
settings := make(map[string]interface{})
return &MIDIPeripheral{
name: name,
location: location,
serialNumber: serialNumber,
settings: settings,
}
}
@@ -48,6 +51,11 @@ func (p *MIDIPeripheral) SetDeviceProperty(context.Context, uint32, uint32, byte
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 {
return PeripheralInfo{