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

@@ -23,6 +23,18 @@ func (a *App) AddPeripheral(protocolName string, peripheralID string) error {
return nil
}
// GetPeripheralSettings gets the peripheral settings
func (a *App) GetPeripheralSettings(protocolName, peripheralID string) (map[string]interface{}, error) {
// Get the device from its finder
p, found := a.hardwareManager.GetPeripheral(protocolName, peripheralID)
if !found {
log.Error().Str("file", "peripheral").Str("protocolName", protocolName).Str("periphID", peripheralID).Msg("unable to found the specified peripheral")
return nil, fmt.Errorf("unable to found the peripheral ID '%s'", peripheralID)
}
// Return the peripheral settings
return p.GetSettings(), nil
}
// RemovePeripheral adds a peripheral to the project
func (a *App) RemovePeripheral(protocolName string, peripheralID string) error {
// TODO: Disconnect the peripheral