generated from thinkode/modelRepository
load peripheral settings in front
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -8,16 +8,21 @@ import (
|
||||
|
||||
// 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
|
||||
name string // The name of the peripheral
|
||||
serialNumber string // The serial number of the peripheral
|
||||
settings map[string]interface{} // The settings of the peripheral
|
||||
}
|
||||
|
||||
// NewOS2LPeripheral creates a new OS2L peripheral
|
||||
func NewOS2LPeripheral(name string, serialNumber string) *OS2LPeripheral {
|
||||
log.Trace().Str("file", "OS2LPeripheral").Str("name", name).Str("s/n", serialNumber).Msg("OS2L peripheral created")
|
||||
settings := make(map[string]interface{})
|
||||
settings["ip"] = "192.168.1.1"
|
||||
settings["port"] = 9995
|
||||
return &OS2LPeripheral{
|
||||
name: name,
|
||||
serialNumber: serialNumber,
|
||||
settings: settings,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,6 +55,11 @@ func (p *OS2LPeripheral) SetDeviceProperty(context.Context, uint32, uint32, byte
|
||||
return nil
|
||||
}
|
||||
|
||||
// GetSettings gets the peripheral settings
|
||||
func (p *OS2LPeripheral) GetSettings() map[string]interface{} {
|
||||
return p.settings
|
||||
}
|
||||
|
||||
// GetInfo gets the peripheral information
|
||||
func (p *OS2LPeripheral) GetInfo() PeripheralInfo {
|
||||
return PeripheralInfo{
|
||||
|
||||
@@ -16,10 +16,10 @@ type Peripheral interface {
|
||||
|
||||
// PeripheralInfo represents a peripheral information
|
||||
type PeripheralInfo struct {
|
||||
Name string `yaml:"name"` // Name of the peripheral
|
||||
SerialNumber string `yaml:"sn"` // S/N of the peripheral
|
||||
ProtocolName string `yaml:"protocol"` // Protocol name of the peripheral
|
||||
Settings []interface{} `yaml:"settings"` // Number of DMX universes handled by the peripheral
|
||||
Name string `yaml:"name"` // Name of the peripheral
|
||||
SerialNumber string `yaml:"sn"` // S/N of the peripheral
|
||||
ProtocolName string `yaml:"protocol"` // Protocol name of the peripheral
|
||||
Settings map[string]interface{} `yaml:"settings"` // Number of DMX universes handled by the peripheral
|
||||
}
|
||||
|
||||
// PeripheralFinder represents how compatible peripheral drivers are implemented
|
||||
|
||||
Reference in New Issue
Block a user