Wideband autonomous SDR analysis engine forked from sdr-visual-suite
25개 이상의 토픽을 선택하실 수 없습니다. Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
599B

  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. res, err := decoder.Run(cmd, iqPath, sampleRate)
  19. if err != nil {
  20. return
  21. }
  22. b, _ := json.MarshalIndent(res, "", " ")
  23. path := filepath.Join(dir, "decode.json")
  24. _ = writeFile(path, b)
  25. files["decode"] = "decode.json"
  26. }