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.

70 satır
1.5KB

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