From 65155c7010e08f149b474287541b7461414bf571 Mon Sep 17 00:00:00 2001 From: Bryan Biedenkapp Date: Fri, 30 Jun 2023 16:09:38 -0400 Subject: [PATCH] fix detection of mode for command windows; fix detection of valid subscriber; --- src/monitor/InhibitSubscriberWnd.h | 14 ++++++++++++-- src/monitor/PageSubscriberWnd.h | 14 ++++++++++++-- src/monitor/RadioCheckSubscriberWnd.h | 14 ++++++++++++-- src/monitor/TransmitWndBase.h | 6 ++---- src/monitor/UninhibitSubscriberWnd.h | 14 ++++++++++++-- 5 files changed, 50 insertions(+), 12 deletions(-) diff --git a/src/monitor/InhibitSubscriberWnd.h b/src/monitor/InhibitSubscriberWnd.h index 090fe131..83909bf4 100644 --- a/src/monitor/InhibitSubscriberWnd.h +++ b/src/monitor/InhibitSubscriberWnd.h @@ -96,9 +96,19 @@ private: m_subscriberLabel.setGeometry(FPoint(2, 4), FSize(25, 1)); m_subscriber.setGeometry(FPoint(28, 4), FSize(20, 1)); } - m_subscriber.setRange(1, 16777211); + m_subscriber.setRange(0, 16777211); m_subscriber.setValue(1); m_subscriber.setShadow(false); + m_subscriber.addCallback("changed", [&]() { + if (m_subscriber.getValue() >= 1 && m_subscriber.getValue() <= 16777211) { + m_txButton.setEnable(true); + } + else { + m_txButton.setEnable(false); + } + + redraw(); + }); } m_subscriberLabel.redraw(); @@ -136,7 +146,7 @@ private: int ret = RESTClient::send(m_selectedCh.address(), m_selectedCh.port(), m_selectedCh.password(), HTTP_PUT, method, req, g_debug); if (ret != network::rest::http::HTTPPayload::StatusType::OK) { - ::LogError(LOG_HOST, "failed to send request to %s:%u", m_selectedCh.address().c_str(), m_selectedCh.port()); + ::LogError(LOG_HOST, "failed to send request %s to %s:%u", method.c_str(), m_selectedCh.address().c_str(), m_selectedCh.port()); } } }; diff --git a/src/monitor/PageSubscriberWnd.h b/src/monitor/PageSubscriberWnd.h index 39103c61..9ff92f79 100644 --- a/src/monitor/PageSubscriberWnd.h +++ b/src/monitor/PageSubscriberWnd.h @@ -96,9 +96,19 @@ private: m_subscriberLabel.setGeometry(FPoint(2, 4), FSize(25, 1)); m_subscriber.setGeometry(FPoint(28, 4), FSize(20, 1)); } - m_subscriber.setRange(1, 16777211); + m_subscriber.setRange(0, 16777211); m_subscriber.setValue(1); m_subscriber.setShadow(false); + m_subscriber.addCallback("changed", [&]() { + if (m_subscriber.getValue() >= 1 && m_subscriber.getValue() <= 16777211) { + m_txButton.setEnable(true); + } + else { + m_txButton.setEnable(false); + } + + redraw(); + }); } m_subscriberLabel.redraw(); @@ -136,7 +146,7 @@ private: int ret = RESTClient::send(m_selectedCh.address(), m_selectedCh.port(), m_selectedCh.password(), HTTP_PUT, method, req, g_debug); if (ret != network::rest::http::HTTPPayload::StatusType::OK) { - ::LogError(LOG_HOST, "failed to send request to %s:%u", m_selectedCh.address().c_str(), m_selectedCh.port()); + ::LogError(LOG_HOST, "failed to send request %s to %s:%u", method.c_str(), m_selectedCh.address().c_str(), m_selectedCh.port()); } } }; diff --git a/src/monitor/RadioCheckSubscriberWnd.h b/src/monitor/RadioCheckSubscriberWnd.h index f6144240..5b6fd660 100644 --- a/src/monitor/RadioCheckSubscriberWnd.h +++ b/src/monitor/RadioCheckSubscriberWnd.h @@ -96,9 +96,19 @@ private: m_subscriberLabel.setGeometry(FPoint(2, 4), FSize(25, 1)); m_subscriber.setGeometry(FPoint(28, 4), FSize(20, 1)); } - m_subscriber.setRange(1, 16777211); + m_subscriber.setRange(0, 16777211); m_subscriber.setValue(1); m_subscriber.setShadow(false); + m_subscriber.addCallback("changed", [&]() { + if (m_subscriber.getValue() >= 1 && m_subscriber.getValue() <= 16777211) { + m_txButton.setEnable(true); + } + else { + m_txButton.setEnable(false); + } + + redraw(); + }); } m_subscriberLabel.redraw(); @@ -136,7 +146,7 @@ private: int ret = RESTClient::send(m_selectedCh.address(), m_selectedCh.port(), m_selectedCh.password(), HTTP_PUT, method, req, g_debug); if (ret != network::rest::http::HTTPPayload::StatusType::OK) { - ::LogError(LOG_HOST, "failed to send request to %s:%u", m_selectedCh.address().c_str(), m_selectedCh.port()); + ::LogError(LOG_HOST, "failed to send request %s to %s:%u", method.c_str(), m_selectedCh.address().c_str(), m_selectedCh.port()); } } }; diff --git a/src/monitor/TransmitWndBase.h b/src/monitor/TransmitWndBase.h index 192765ea..8fce28b8 100644 --- a/src/monitor/TransmitWndBase.h +++ b/src/monitor/TransmitWndBase.h @@ -118,10 +118,11 @@ protected: try { if (rsp["fixedMode"].get()) { - m_mode = rsp["state"].is(); m_hideModeSelect = true; } + m_mode = rsp["state"].get(); + bool dmrCC = rsp["dmrCC"].get(); bool p25CC = rsp["p25CC"].get(); bool nxdnCC = rsp["nxdnCC"].get(); @@ -267,7 +268,6 @@ protected: /* stub */ } -private: FButton m_txButton{"Transmit", this}; FButton m_closeButton{"Close", this}; @@ -277,8 +277,6 @@ private: FRadioButton m_modeNXDN{"NXDN", &m_digModeGroup}; FLabel m_dmrSlotLabel{"DMR Slot: ", this}; - -protected: FSpinBox m_dmrSlot{this}; }; diff --git a/src/monitor/UninhibitSubscriberWnd.h b/src/monitor/UninhibitSubscriberWnd.h index c00702ff..0b8440ce 100644 --- a/src/monitor/UninhibitSubscriberWnd.h +++ b/src/monitor/UninhibitSubscriberWnd.h @@ -96,9 +96,19 @@ private: m_subscriberLabel.setGeometry(FPoint(2, 4), FSize(25, 1)); m_subscriber.setGeometry(FPoint(28, 4), FSize(20, 1)); } - m_subscriber.setRange(1, 16777211); + m_subscriber.setRange(0, 16777211); m_subscriber.setValue(1); m_subscriber.setShadow(false); + m_subscriber.addCallback("changed", [&]() { + if (m_subscriber.getValue() >= 1 && m_subscriber.getValue() <= 16777211) { + m_txButton.setEnable(true); + } + else { + m_txButton.setEnable(false); + } + + redraw(); + }); } m_subscriberLabel.redraw(); @@ -136,7 +146,7 @@ private: int ret = RESTClient::send(m_selectedCh.address(), m_selectedCh.port(), m_selectedCh.password(), HTTP_PUT, method, req, g_debug); if (ret != network::rest::http::HTTPPayload::StatusType::OK) { - ::LogError(LOG_HOST, "failed to send request to %s:%u", m_selectedCh.address().c_str(), m_selectedCh.port()); + ::LogError(LOG_HOST, "failed to send request %s to %s:%u", method.c_str(), m_selectedCh.address().c_str(), m_selectedCh.port()); } } };