From 851b658298afb9bafeda98ffbfa2ade612c656be Mon Sep 17 00:00:00 2001 From: Christoph Berg Date: Sun, 2 Jun 2019 22:17:11 +0200 Subject: New upstream version 2.1.0~rc6+repack --- TransceiverBase.cpp | 33 +++++++++++++++++++++++++-------- 1 file changed, 25 insertions(+), 8 deletions(-) (limited to 'TransceiverBase.cpp') diff --git a/TransceiverBase.cpp b/TransceiverBase.cpp index ef77d51e..43a88a4e 100644 --- a/TransceiverBase.cpp +++ b/TransceiverBase.cpp @@ -19,10 +19,10 @@ void TransceiverBase::start (unsigned sequence_number) noexcept QString message; try { + last_sequence_number_ = sequence_number; may_update u {this, true}; shutdown (); startup (); - last_sequence_number_ = sequence_number; } catch (std::exception const& e) { @@ -46,6 +46,7 @@ void TransceiverBase::set (TransceiverState const& s, QString message; try { + last_sequence_number_ = sequence_number; may_update u {this, true}; bool was_online {requested_.online ()}; if (!s.online () && was_online) @@ -115,7 +116,6 @@ void TransceiverBase::set (TransceiverState const& s, // record what actually changed requested_.ptt (actual_.ptt ()); } - last_sequence_number_ = sequence_number; } catch (std::exception const& e) { @@ -133,10 +133,27 @@ void TransceiverBase::set (TransceiverState const& s, void TransceiverBase::startup () { - Q_EMIT resolution (do_start ()); - do_post_start (); - actual_.online (true); - requested_.online (true); + QString message; + try + { + actual_.online (true); + requested_.online (true); + auto res = do_start (); + do_post_start (); + Q_EMIT resolution (res); + } + catch (std::exception const& e) + { + message = e.what (); + } + catch (...) + { + message = unexpected; + } + if (!message.isEmpty ()) + { + offline (message); + } } void TransceiverBase::shutdown () @@ -163,8 +180,8 @@ void TransceiverBase::shutdown () } do_stop (); do_post_stop (); - actual_.online (false); - requested_.online (false); + actual_ = TransceiverState {}; + requested_ = TransceiverState {}; } void TransceiverBase::stop () noexcept -- cgit v1.2.3