17#ifndef GNSS_SDR_BIT_SYNCHRONIZER_H
18#define GNSS_SDR_BIT_SYNCHRONIZER_H
153 last_prompt_(0.0f, 0.0f),
157 stable_best_count_(0),
159 has_last_prompt_(false),
160 has_last_sign_(false),
161 has_last_best_bin_(false)
163 hist_.assign(
bins(), 0);
195 bool update(
const std::complex<float>& prompt,
bool tracking_quality_ok);
290 void best_bin_and_count(
int& best_bin,
int& best_count)
const;
293 std::vector<int> hist_;
295 std::int64_t total_events_;
296 std::int64_t epoch_count_;
298 std::complex<float> last_prompt_;
303 int stable_best_count_;
306 bool has_last_prompt_;
308 bool has_last_best_bin_;
bool is_edge_epoch(std::int64_t k) const
Predict whether a given epoch index corresponds to a bit edge.
void reset()
Reset the synchronizer state.
std::int64_t get_total_events() const
Total number of detected transition events accumulated into the histogram.
bool update(const std::complex< float > &prompt, bool tracking_quality_ok)
Update the synchronizer once per epoch.
HistogramBitSynchronizer(const Config &cfg)
Construct a histogram bit synchronizer with the provided configuration.
const std::vector< int > & get_histogram() const
Access the internal histogram (read-only).
bool locked() const
Query whether the synchronizer has achieved lock.
int epochs_until_next_edge() const
Return the number of epochs until the next predicted navigation bit edge.
int bins() const
Return the number of histogram bins.
int edge_phase() const
Get the estimated bit edge phase bin.
std::int64_t get_epoch_count() const
Total number of epochs processed by update().
Configuration parameters for HistogramBitSynchronizer.
int min_events_for_lock
Minimum number of detected transition events required before lock evaluation.
double dominance_ratio
Required dominance ratio of the winning histogram bin.
int epoch_ms
Time interval between successive calls to update(), in milliseconds.
float min_prompt_mag
Minimum magnitude of the prompt correlator output.
int stable_best_required
Required stability of the dominant histogram bin (consecutive evaluations).
int bit_period_ms
Navigation data bit period in milliseconds.
bool use_phase_dot_detector
Select the transition detection method.