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,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{