generated from thinkode/modelRepository
Adapting interfaces
This commit is contained in:
12
project.go
12
project.go
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user