Wideband autonomous SDR analysis engine forked from sdr-visual-suite
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

30 lignes
752B

  1. package main
  2. import "sdr-wideband-suite/internal/pipeline"
  3. type decisionSummary struct {
  4. Total int `json:"total"`
  5. RecordEnabled int `json:"record_enabled"`
  6. DecodeEnabled int `json:"decode_enabled"`
  7. Reasons map[string]int `json:"reasons,omitempty"`
  8. }
  9. func summarizeDecisions(decisions []pipeline.SignalDecision) decisionSummary {
  10. summary := decisionSummary{Reasons: map[string]int{}}
  11. summary.Total = len(decisions)
  12. for _, d := range decisions {
  13. if d.ShouldRecord {
  14. summary.RecordEnabled++
  15. }
  16. if d.ShouldAutoDecode {
  17. summary.DecodeEnabled++
  18. }
  19. reason := d.Reason
  20. if reason == "" {
  21. reason = pipeline.DecisionReasonUnspecified
  22. }
  23. summary.Reasons[reason]++
  24. }
  25. return summary
  26. }