Wideband autonomous SDR analysis engine forked from sdr-visual-suite
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

36 linhas
742B

  1. package recorder
  2. import (
  3. "encoding/json"
  4. "path/filepath"
  5. "sdr-visual-suite/internal/decoder"
  6. )
  7. func (m *Manager) runDecodeIfConfigured(mod string, iqPath string, sampleRate int, files map[string]any, dir string) {
  8. if !m.policy.AutoDecode || mod == "" {
  9. return
  10. }
  11. cmd := ""
  12. if m.decodeCommands != nil {
  13. cmd = m.decodeCommands[mod]
  14. }
  15. if cmd == "" {
  16. return
  17. }
  18. audioPath := ""
  19. if v, ok := files["audio"]; ok {
  20. if name, ok := v.(string); ok {
  21. audioPath = filepath.Join(dir, name)
  22. }
  23. }
  24. res, err := decoder.Run(cmd, iqPath, sampleRate, audioPath)
  25. if err != nil {
  26. return
  27. }
  28. b, _ := json.MarshalIndent(res, "", " ")
  29. path := filepath.Join(dir, "decode.json")
  30. _ = writeFile(path, b)
  31. files["decode"] = "decode.json"
  32. }