From b596ca7ee5ebb23b34b7148e9cf9395cad653a40 Mon Sep 17 00:00:00 2001 From: Tom Early Date: Sun, 2 Aug 2020 06:15:36 -0700 Subject: [PATCH] WiresX debugging --- src/cwiresxcmdhandler.cpp | 14 ++++++++------ src/cysfprotocol.cpp | 3 +-- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/cwiresxcmdhandler.cpp b/src/cwiresxcmdhandler.cpp index 1206ed3..fb9ffc5 100644 --- a/src/cwiresxcmdhandler.cpp +++ b/src/cwiresxcmdhandler.cpp @@ -49,7 +49,7 @@ CWiresxCmdHandler::CWiresxCmdHandler() CWiresxCmdHandler::~CWiresxCmdHandler() { - // kill threads + // kill thread Close(); // empty queue @@ -95,10 +95,12 @@ void CWiresxCmdHandler::Close(void) void CWiresxCmdHandler::Thread() { + std::cout << "Starting WiresX Command Handler" << std:: endl; while (keep_running) { Task(); } + std::cout << "WiresX Command Handler has stopped" << std::endl; } //////////////////////////////////////////////////////////////////////////////////////// @@ -120,7 +122,7 @@ void CWiresxCmdHandler::Task(void) // any cmd in our queue ? if ( !m_CmdQueue.empty() ) { - // yes, get the command + // yes, get a command Cmd = m_CmdQueue.front(); // check that the command is at least one second old // so that the so delayed processing of the command @@ -148,7 +150,7 @@ void CWiresxCmdHandler::Task(void) cModule = ' '; CClients *clients = g_Reflector.GetClients(); std::shared_ptrclient = clients->FindClient(Cmd.GetCallsign(), Cmd.GetIp(), PROTOCOL_YSF); - if ( client != nullptr ) + if ( client ) { cModule = client->GetReflectorModule(); } @@ -178,7 +180,7 @@ void CWiresxCmdHandler::Task(void) // change client's module CClients *clients = g_Reflector.GetClients(); std::shared_ptrclient = clients->FindClient(Cmd.GetCallsign(), Cmd.GetIp(), PROTOCOL_YSF); - if ( client != nullptr ) + if ( client ) { client->SetReflectorModule(cModule); } @@ -206,14 +208,14 @@ void CWiresxCmdHandler::Task(void) break; case WIRESX_CMD_UNKNOWN: default: - std::cout << "Wires-X non implemented command from " << Cmd.GetCallsign() << " at " << Cmd.GetIp() << std::endl; + std::cout << "Wires-X non implemented command from " << Cmd.GetCallsign() << " at " << Cmd.GetIp() << " cmd=" << Cmd.GetCmd() << " arg=" << Cmd.GetArg() << std::endl; break; } } else { // if nothing to do, sleep a bit - CTimePoint::TaskSleepFor(10); + CTimePoint::TaskSleepFor(100); } } diff --git a/src/cysfprotocol.cpp b/src/cysfprotocol.cpp index be37cc6..4d415cb 100644 --- a/src/cysfprotocol.cpp +++ b/src/cysfprotocol.cpp @@ -181,8 +181,7 @@ void CYsfProtocol::Task(void) } else if ( IsValidwirexPacket(Buffer, &Fich, &Callsign, &iWiresxCmd, &iWiresxArg) ) { - //std::cout << "YSF Wires-x frame" << std::endl; - // prepare the cmd object + std::cout << "Got a WiresX command from " << Callsign << " at " << Ip << " cmd=" <