summaryrefslogtreecommitdiffstats
path: root/src/OutputUHD.h
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2015-06-12 21:28:11 +0200
committerMatthias P. Braendli <matthias.braendli@mpb.li>2015-06-12 21:28:11 +0200
commite102d9a74cbcfc503e1635a80f928d35335d76fd (patch)
tree73ef165b1d29d97202883d28c78aa80f1f33b2e8 /src/OutputUHD.h
parent7ac0d2877fd4bccc3b28653e086849b49b655ace (diff)
downloaddabmod-e102d9a74cbcfc503e1635a80f928d35335d76fd.tar.gz
dabmod-e102d9a74cbcfc503e1635a80f928d35335d76fd.tar.bz2
dabmod-e102d9a74cbcfc503e1635a80f928d35335d76fd.zip
Move GPS check out of UHDWorker
Diffstat (limited to 'src/OutputUHD.h')
-rw-r--r--src/OutputUHD.h59
1 files changed, 27 insertions, 32 deletions
diff --git a/src/OutputUHD.h b/src/OutputUHD.h
index bc01223..633de04 100644
--- a/src/OutputUHD.h
+++ b/src/OutputUHD.h
@@ -50,6 +50,7 @@ DESCRIPTION:
#include <boost/thread/thread.hpp>
#include <boost/thread/barrier.hpp>
#include <boost/shared_ptr.hpp>
+#include <boost/atomic.hpp>
#include <list>
#include <string>
@@ -94,7 +95,7 @@ struct fct_discontinuity_error : public std::exception
enum refclk_lock_loss_behaviour_t { CRASH, IGNORE };
struct UHDWorkerData {
- bool running;
+ boost::atomic<bool> running;
bool failed_due_to_fct;
#if FAKE_UHD == 0
@@ -123,10 +124,6 @@ struct UHDWorkerData {
// If we want to check for the gps_fixtype sensor
bool check_gpsfix;
- // After how much time without fix we abort
- int max_gps_holdover; // seconds
-
-
// muting set by remote control
bool muting;
@@ -171,42 +168,18 @@ class UHDWorker {
double pps_offset;
double last_pps;
- // GPS Fix check variables
- int num_checks_without_gps_fix;
- struct timespec first_gps_fix_check;
- struct timespec last_gps_fix_check;
- struct timespec time_last_frame;
- boost::packaged_task<bool> gps_fix_pt;
- boost::unique_future<bool> gps_fix_future;
- boost::thread gps_fix_task;
-
- // Transmit timeout
- static const double tx_timeout = 20.0;
-
- // Wait time in seconds to get fix
- static const int initial_gps_fix_wait = 60;
-
- // Interval for checking the GPS at runtime
- static const double gps_fix_check_interval = 10.0; // seconds
-
-
- void process();
- void process_errhandler();
-
void print_async_metadata(const struct UHDWorkerFrameData *frame);
void handle_frame(const struct UHDWorkerFrameData *frame);
void tx_frame(const struct UHDWorkerFrameData *frame);
- void check_gps();
-
- void set_usrp_time_gps();
-
- void initial_gps_check();
struct UHDWorkerData *uwd;
boost::thread uhd_thread;
uhd::tx_streamer::sptr myTxStream;
+
+ void process();
+ void process_errhandler();
};
/* This structure is used as initial configuration for OutputUHD */
@@ -278,6 +251,7 @@ class OutputUHD: public ModOutput, public RemoteControllable {
boost::shared_ptr<boost::barrier> mySyncBarrier;
UHDWorker worker;
bool first_run;
+ bool gps_fix_verified;
struct UHDWorkerData uwd;
int activebuffer;
@@ -294,6 +268,27 @@ class OutputUHD: public ModOutput, public RemoteControllable {
int myTFDurationMs; // TF duration in milliseconds
std::vector<complexf> myDelayBuf;
size_t lastLen;
+
+ // GPS Fix check variables
+ int num_checks_without_gps_fix;
+ struct timespec first_gps_fix_check;
+ struct timespec last_gps_fix_check;
+ struct timespec time_last_frame;
+ boost::packaged_task<bool> gps_fix_pt;
+ boost::unique_future<bool> gps_fix_future;
+ boost::thread gps_fix_task;
+
+ // Wait time in seconds to get fix
+ static const int initial_gps_fix_wait = 60;
+
+ // Interval for checking the GPS at runtime
+ static const double gps_fix_check_interval = 10.0; // seconds
+
+ void check_gps();
+
+ void set_usrp_time();
+
+ void initial_gps_check();
};
#endif // HAVE_OUTPUT_UHD