From b256886a5cb9f2ae3ebda70a2045b19ed9f4233e Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 3 Dec 2017 22:23:08 +0100 Subject: api: add status check for modules --- tracker-hatire/ftnoir_tracker_hat.cpp | 20 ++++++++++---------- tracker-hatire/ftnoir_tracker_hat.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) (limited to 'tracker-hatire') diff --git a/tracker-hatire/ftnoir_tracker_hat.cpp b/tracker-hatire/ftnoir_tracker_hat.cpp index 6e1b6586..29381eaa 100644 --- a/tracker-hatire/ftnoir_tracker_hat.cpp +++ b/tracker-hatire/ftnoir_tracker_hat.cpp @@ -43,27 +43,27 @@ void hatire::get_info( int *tps ) *tps=frame_cnt; frame_cnt=0; } -void hatire::start_tracker(QFrame*) +module_status hatire::start_tracker(QFrame*) { - CptError=0; - frame_cnt=0; + CptError=0; + frame_cnt=0; t.Log("Starting Tracker"); serial_result ret = t.init_serial_port(); + t.start(); + switch (ret.code) { case result_ok: - break; + return status_ok(); case result_error: - QMessageBox::warning(0, tr("Error"), ret.error, QMessageBox::Ok,QMessageBox::NoButton); - break; + return error(ret.error); case result_open_error: - QMessageBox::warning(0, tr("Error"), tr("Unable to open ComPort: %1").arg(ret.error), QMessageBox::Ok,QMessageBox::NoButton); - break; + return error(tr("Unable to open ComPort: %1").arg(ret.error)); + default: + return error("Unknown error"); } - - t.start(); } void hatire::serial_info() diff --git a/tracker-hatire/ftnoir_tracker_hat.h b/tracker-hatire/ftnoir_tracker_hat.h index fa8b8448..45b3f250 100644 --- a/tracker-hatire/ftnoir_tracker_hat.h +++ b/tracker-hatire/ftnoir_tracker_hat.h @@ -22,7 +22,7 @@ public: hatire(); ~hatire(); - void start_tracker(QFrame*); + module_status start_tracker(QFrame*); void data(double *data); //void center(); //bool notifyZeroed(); -- cgit v1.2.3