Wideband autonomous SDR analysis engine forked from sdr-visual-suite
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.

48 líneas
1.1KB

  1. package pipeline
  2. import (
  3. "strings"
  4. "sdr-wideband-suite/internal/config"
  5. )
  6. func ResolveProfile(cfg config.Config, name string) (config.ProfileConfig, bool) {
  7. name = strings.ToLower(strings.TrimSpace(name))
  8. for _, p := range cfg.Profiles {
  9. if strings.ToLower(strings.TrimSpace(p.Name)) == name {
  10. return p, true
  11. }
  12. }
  13. return config.ProfileConfig{}, false
  14. }
  15. func MergeProfile(cfg *config.Config, profile config.ProfileConfig) {
  16. if cfg == nil {
  17. return
  18. }
  19. if profile.Name != "" {
  20. cfg.Pipeline.Profile = profile.Name
  21. }
  22. if profile.Pipeline != nil {
  23. cfg.Pipeline = *profile.Pipeline
  24. if profile.Name != "" {
  25. cfg.Pipeline.Profile = profile.Name
  26. }
  27. }
  28. if profile.Surveillance != nil {
  29. cfg.Surveillance = *profile.Surveillance
  30. }
  31. if profile.Refinement != nil {
  32. cfg.Refinement = *profile.Refinement
  33. }
  34. if profile.Resources != nil {
  35. cfg.Resources = *profile.Resources
  36. }
  37. if cfg.Surveillance.AnalysisFFTSize > 0 {
  38. cfg.FFTSize = cfg.Surveillance.AnalysisFFTSize
  39. }
  40. if cfg.Surveillance.FrameRate > 0 {
  41. cfg.FrameRate = cfg.Surveillance.FrameRate
  42. }
  43. }