generated from thinkode/modelRepository
rework on the peripherals and finders
This commit is contained in:
@@ -8,22 +8,18 @@ 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
|
||||
settings map[string]interface{} // The settings of the peripheral
|
||||
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
|
||||
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{})
|
||||
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{
|
||||
name: name,
|
||||
location: location,
|
||||
serialNumber: serialNumber,
|
||||
settings: settings,
|
||||
}
|
||||
info: peripheralData,
|
||||
settings: peripheralData.Settings,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// Connect connects the MIDI peripheral
|
||||
@@ -46,8 +42,8 @@ func (p *MIDIPeripheral) Deactivate(ctx context.Context) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetPeripheralSettings sets a specific setting for this peripheral
|
||||
func (p *MIDIPeripheral) SetPeripheralSettings(settings map[string]interface{}) error {
|
||||
// SetSettings sets a specific setting for this peripheral
|
||||
func (p *MIDIPeripheral) SetSettings(settings map[string]interface{}) error {
|
||||
p.settings = settings
|
||||
return nil
|
||||
}
|
||||
@@ -64,9 +60,5 @@ func (p *MIDIPeripheral) GetSettings() map[string]interface{} {
|
||||
|
||||
// GetInfo gets the peripheral information
|
||||
func (p *MIDIPeripheral) GetInfo() PeripheralInfo {
|
||||
return PeripheralInfo{
|
||||
Name: p.name,
|
||||
ProtocolName: "MIDI",
|
||||
SerialNumber: p.serialNumber,
|
||||
}
|
||||
return p.info
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user