25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

76 satır
1.6KB

  1. package main
  2. import (
  3. "sync"
  4. "time"
  5. "github.com/gorilla/websocket"
  6. "sdr-visual-suite/internal/config"
  7. "sdr-visual-suite/internal/demod/gpudemod"
  8. "sdr-visual-suite/internal/detector"
  9. "sdr-visual-suite/internal/sdr"
  10. )
  11. type SpectrumDebug struct {
  12. Thresholds []float64 `json:"thresholds,omitempty"`
  13. NoiseFloor float64 `json:"noise_floor,omitempty"`
  14. Scores []map[string]any `json:"scores,omitempty"`
  15. }
  16. type SpectrumFrame struct {
  17. Timestamp int64 `json:"ts"`
  18. CenterHz float64 `json:"center_hz"`
  19. SampleHz int `json:"sample_rate"`
  20. FFTSize int `json:"fft_size"`
  21. Spectrum []float64 `json:"spectrum_db"`
  22. Signals []detector.Signal `json:"signals"`
  23. Debug *SpectrumDebug `json:"debug,omitempty"`
  24. }
  25. type client struct {
  26. conn *websocket.Conn
  27. send chan []byte
  28. done chan struct{}
  29. closeOnce sync.Once
  30. }
  31. type hub struct {
  32. mu sync.Mutex
  33. clients map[*client]struct{}
  34. frameCnt int64
  35. lastLogTs time.Time
  36. }
  37. type gpuStatus struct {
  38. mu sync.RWMutex
  39. Available bool `json:"available"`
  40. Active bool `json:"active"`
  41. Error string `json:"error"`
  42. }
  43. type signalSnapshot struct {
  44. mu sync.RWMutex
  45. signals []detector.Signal
  46. }
  47. type sourceManager struct {
  48. mu sync.RWMutex
  49. src sdr.Source
  50. newSource func(cfg config.Config) (sdr.Source, error)
  51. }
  52. type extractionManager struct {
  53. mu sync.Mutex
  54. runner *gpudemod.BatchRunner
  55. }
  56. type dspUpdate struct {
  57. cfg config.Config
  58. det *detector.Detector
  59. window []float64
  60. dcBlock bool
  61. iqBalance bool
  62. useGPUFFT bool
  63. }