renaming Finders and Peripherals to Providers and Endpoints

This commit is contained in:
2025-11-30 18:57:20 +01:00
parent 7f60f7b8d7
commit 1c8607800a
25 changed files with 1102 additions and 1102 deletions

View File

@@ -77,7 +77,7 @@ func (a *App) CreateProject() error {
Avatar: "appicon.png",
Comments: "Write your comments here",
},
make(map[string]hardware.PeripheralInfo),
make(map[string]hardware.EndpointInfo),
}
// The project isn't saved for now
@@ -127,12 +127,12 @@ func (a *App) OpenProject(projectInfo ProjectInfo) error {
// Send an event with the project data
runtime.EventsEmit(a.ctx, "LOAD_PROJECT", projectInfo.ShowInfo)
// Load all peripherals of the project
projectPeripherals := a.projectInfo.PeripheralsInfo
for key, value := range projectPeripherals {
_, err = a.hardwareManager.RegisterPeripheral(a.ctx, value)
// Load all endpoints of the project
projectEndpoints := a.projectInfo.EndpointsInfo
for key, value := range projectEndpoints {
_, err = a.hardwareManager.RegisterEndpoint(a.ctx, value)
if err != nil {
return fmt.Errorf("unable to register the peripheral S/N '%s': %w", key, err)
return fmt.Errorf("unable to register the endpoint S/N '%s': %w", key, err)
}
}
return nil
@@ -140,12 +140,12 @@ func (a *App) OpenProject(projectInfo ProjectInfo) error {
// CloseCurrentProject closes the current project
func (a *App) CloseCurrentProject() error {
// Unregister all peripherals of the project
projectPeripherals := a.hardwareManager.SavedPeripherals
for key, value := range projectPeripherals {
err := a.hardwareManager.UnregisterPeripheral(a.ctx, value)
// Unregister all endpoints of the project
projectEndpoints := a.hardwareManager.SavedEndpoints
for key, value := range projectEndpoints {
err := a.hardwareManager.UnregisterEndpoint(a.ctx, value)
if err != nil {
return fmt.Errorf("unable to unregister the peripheral S/N '%s': %w", key, err)
return fmt.Errorf("unable to unregister the endpoint S/N '%s': %w", key, err)
}
}
@@ -197,7 +197,7 @@ func (a *App) SaveProject() (string, error) {
log.Debug().Str("file", "project").Str("newProjectSave", a.projectSave).Msg("projectSave is null, getting a new one")
}
// Get hardware info
a.projectInfo.PeripheralsInfo = a.hardwareManager.SavedPeripherals
a.projectInfo.EndpointsInfo = a.hardwareManager.SavedEndpoints
// Marshal the project
data, err := yaml.Marshal(a.projectInfo)
if err != nil {
@@ -238,6 +238,6 @@ type ProjectMetaData struct {
// ProjectInfo defines all the information for a lighting project
type ProjectInfo struct {
ShowInfo ShowInfo `yaml:"show"` // Show information
PeripheralsInfo map[string]hardware.PeripheralInfo `yaml:"peripherals"` // Peripherals information
ShowInfo ShowInfo `yaml:"show"` // Show information
EndpointsInfo map[string]hardware.EndpointInfo `yaml:"endpoints"` // Endpoints information
}