Adapting interfaces

This commit is contained in:
2025-11-29 17:42:42 +01:00
parent ea46430b71
commit 848d2758d7
11 changed files with 264 additions and 564 deletions

View File

@@ -130,11 +130,7 @@ func (a *App) OpenProject(projectInfo ProjectInfo) error {
// Load all peripherals of the project
projectPeripherals := a.projectInfo.PeripheralsInfo
for key, value := range projectPeripherals {
hostFinder, err := a.hardwareManager.GetFinder(value.ProtocolName)
if err != nil {
return fmt.Errorf("unable to find the finder '%s': %w", value.ProtocolName, err)
}
_, err = hostFinder.RegisterPeripheral(a.ctx, value)
_, err = a.hardwareManager.RegisterPeripheral(a.ctx, value)
if err != nil {
return fmt.Errorf("unable to register the peripheral S/N '%s': %w", key, err)
}
@@ -147,11 +143,7 @@ func (a *App) CloseCurrentProject() error {
// Unregistrer all peripherals of the project
projectPeripherals := a.projectInfo.PeripheralsInfo
for key, value := range projectPeripherals {
hostFinder, err := a.hardwareManager.GetFinder(value.ProtocolName)
if err != nil {
return fmt.Errorf("unable to find the finder '%s': %w", value.ProtocolName, err)
}
err = hostFinder.UnregisterPeripheral(a.ctx, value)
err := a.hardwareManager.UnregisterPeripheral(a.ctx, value)
if err != nil {
return fmt.Errorf("unable to unregister the peripheral S/N '%s': %w", key, err)
}