bool CXReflectorAppD::createThread() { CXReflectorConfig config(m_confDir, m_name); m_thread = new CXReflectorThread(m_name, m_logDir); wxString reflector, address; config.getReflector(reflector, address); m_thread->setReflector(reflector, address); wxLogInfo(wxT("Callsign set to \"%s\", address set to \"%s\""), reflector.c_str(), address.c_str()); reflector.Append(wxT(" ")); reflector.Truncate(LONG_CALLSIGN_LENGTH - 1U); reflector.Append(wxT("A")); CXReflectorReflectorHandler::add(reflector); wxLogInfo(wxT("Creating reflector 1 with callsign \"%s\""), reflector.c_str()); reflector.Truncate(LONG_CALLSIGN_LENGTH - 1U); reflector.Append(wxT("B")); CXReflectorReflectorHandler::add(reflector); wxLogInfo(wxT("Creating reflector 2 with callsign \"%s\""), reflector.c_str()); reflector.Truncate(LONG_CALLSIGN_LENGTH - 1U); reflector.Append(wxT("C")); CXReflectorReflectorHandler::add(reflector); wxLogInfo(wxT("Creating reflector 3 with callsign \"%s\""), reflector.c_str()); reflector.Truncate(LONG_CALLSIGN_LENGTH - 1U); reflector.Append(wxT("D")); CXReflectorReflectorHandler::add(reflector); wxLogInfo(wxT("Creating reflector 4 with callsign \"%s\""), reflector.c_str()); reflector.Truncate(LONG_CALLSIGN_LENGTH - 1U); reflector.Append(wxT("E")); CXReflectorReflectorHandler::add(reflector); wxLogInfo(wxT("Creating reflector 5 with callsign \"%s\""), reflector.c_str()); bool dplusEnabled; config.getDPlus(dplusEnabled); wxLogInfo(wxT("DPlus enabled set to %d"), dplusEnabled); m_thread->setDPlus(dplusEnabled); bool logEnabled; config.getMiscellaneous(logEnabled); wxLogInfo(wxT("Log enabled set to %d"), logEnabled); m_thread->setMiscellaneous(logEnabled); return true; }
bool CDVRPTRControllerV2::setConfig() { unsigned char buffer[105U]; ::memset(buffer, 0x00U, 105U); buffer[0U] = 'H'; buffer[1U] = 'E'; buffer[2U] = 'A'; buffer[3U] = 'D'; buffer[4U] = 'X'; buffer[5U] = '9'; buffer[6U] = '0'; buffer[7U] = '0'; buffer[8U] = '1'; buffer[66U] = m_txInvert ? 0x01U : 0x00U; buffer[73U] = (m_modLevel * 256U) / 100U; // CUtils::dump(wxT("Written"), buffer, 105U); int ret = m_serial.write(buffer, 105U); if (ret != 105) return false; unsigned int count = 0U; unsigned int length; RESP_TYPE_V2 resp; do { ::wxMilliSleep(10UL); resp = getResponse(m_buffer, length); if (resp != RT2_CONFIG) { count++; if (count >= MAX_RESPONSES) { wxLogError(wxT("The DV-RPTR modem is not responding to the configure command")); return false; } } } while (resp != RT2_CONFIG); // CUtils::dump(wxT("Response"), m_buffer, length); wxString firmware((char*)(m_buffer + 9U), wxConvLocal); wxLogInfo(wxT("DV-RPTR Modem Firmware version: %s"), firmware.c_str()); return true; }
bool CTimerControlAppD::init() { if (!m_name.IsEmpty()) { wxString fileBase = SCHEDULE_BASE_NAME; fileBase.Append(wxT("_")); fileBase.Append(m_name); fileBase.Replace(wxT(" "), wxT("_")); wxFileName fileName(wxFileName::GetHomeDir(), fileBase, wxT("dat")); m_fileName = fileName.GetFullPath(); } else { wxFileName fileName(wxFileName::GetHomeDir(), SCHEDULE_BASE_NAME, wxT("dat")); m_fileName = fileName.GetFullPath(); } if (!m_nolog) { wxString logBaseName = LOG_BASE_NAME; if (!m_name.IsEmpty()) { logBaseName.Append(wxT("_")); logBaseName.Append(m_name); } if (m_logDir.IsEmpty()) m_logDir = wxFileName::GetHomeDir(); wxLog* log = new CLogger(m_logDir, logBaseName); wxLog::SetActiveTarget(log); } else { new wxLogNull; } wxLogInfo(wxT("Starting ") + APPLICATION_NAME + wxT(" - ") + VERSION); // Log the SVN revsion and the version of wxWidgets and the Operating System wxLogInfo(SVNREV); wxLogInfo(wxT("Using wxWidgets %d.%d.%d on %s"), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, ::wxGetOsDescription().c_str()); return createThread(); }
bool CGMSKModemWinUSB::open() { wxASSERT(m_handle == INVALID_HANDLE_VALUE); bool res = openModem(); if (!res) { wxLogError(wxT("Cannot find the GMSK Modem with address: 0x%04X"), m_address); return false; } wxLogInfo(wxT("Found the GMSK Modem with address: 0x%04X"), m_address); wxString version; int ret; do { unsigned char buffer[GMSK_MODEM_DATA_LENGTH]; ret = io(GET_VERSION, 0xC0U, 0U, buffer, GMSK_MODEM_DATA_LENGTH); if (ret > 0) { wxString text((char*)buffer, wxConvLocal, ret); version.Append(text); } else if (ret < 0) { wxLogError(wxT("GET_VERSION returned %d"), -ret); close(); return false; } } while (ret == int(GMSK_MODEM_DATA_LENGTH)); wxLogInfo(wxT("Firmware version: %s"), version.c_str()); // Trap firmware version 0.1.00 of DUTCH*Star and complain loudly if (version.Find(wxT("DUTCH*Star")) != wxNOT_FOUND && version.Find(wxT("0.1.00")) != wxNOT_FOUND) { wxLogWarning(wxT("This modem firmware is not fully supported by the GMSK Repeater")); wxLogWarning(wxT("Please upgrade to a newer version if possible")); m_broken = true; } return true; }
void CDVRPTRClientApp::setRpt2Calls(const wxString& call, const wxSortedArrayString& list) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); // Convert the array into a comma delimited list wxString temp; size_t count = list.GetCount(); for (unsigned int i = 0U; i < count; i++) { temp += list.Item(i); temp += wxT(','); } profile->Write(KEY_RPT2_CALL, call); profile->Write(KEY_RPT2_LIST, temp); profile->Flush(); wxLogInfo(wxT("RPT2 call set to %s"), call.c_str()); wxLogInfo(wxT("RPT2 list set to %s"), temp.c_str()); delete profile; }
void CDExtraClientApp::getLastModule(unsigned int& module) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); long dummy; profile->Read(KEY_LAST_MODULE, &dummy, DEFAULT_LAST_MODULE); module = (unsigned int)dummy; wxLogInfo(wxT("Last Module set to: %u"), module); delete profile; }
void CDummyRepeaterApp::setCallsign(const wxString& callsign1, const wxString& callsign2) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Write(KEY_CALLSIGN1, callsign1); profile->Write(KEY_CALLSIGN2, callsign2); profile->Flush(); wxLogInfo(wxT("Callsign set to %s/%s"), callsign1.c_str(), callsign2.c_str()); delete profile; }
void CDVRPTRClientApp::setSoundcard(const wxString& readDevice, const wxString& writeDevice) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Write(KEY_SOUND_READ_DEVICE, readDevice); profile->Write(KEY_SOUND_WRITE_DEVICE, writeDevice); profile->Flush(); wxLogInfo(wxT("Soundcard set to %s:%s"), readDevice.c_str(), writeDevice.c_str()); delete profile; }
void CDummyRepeaterApp::getTimeout(unsigned int& timeout) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); long temp; profile->Read(KEY_TIMEOUT, &temp, DEFAULT_TIMEOUT); timeout = (unsigned int)temp; wxLogInfo(wxT("Timeout set to %u"), timeout); delete profile; }
bool CDStarRepeaterD::init() { if (!m_nolog) { wxString logBaseName = LOG_BASE_NAME; if (!m_name.IsEmpty()) { logBaseName.Append(wxT("_")); logBaseName.Append(m_name); } if (m_logDir.IsEmpty()) m_logDir = wxT(LOG_DIR); wxLog* log = new CLogger(m_logDir, logBaseName); wxLog::SetActiveTarget(log); } else { new wxLogNull; } wxString appName; if (!m_name.IsEmpty()) appName = APPLICATION_NAME + wxT(" ") + m_name; else appName = APPLICATION_NAME; appName.Replace(wxT(" "), wxT("_")); m_checker = new wxSingleInstanceChecker(appName, wxT("/tmp")); bool ret = m_checker->IsAnotherRunning(); if (ret) { wxLogError(wxT("Another copy of the D-Star Repeater is running, exiting")); return false; } wxLogInfo(wxT("Starting ") + APPLICATION_NAME + wxT(" daemon - ") + VERSION); // Log the version of wxWidgets and the Operating System wxLogInfo(wxT("Using wxWidgets %d.%d.%d on %s"), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, ::wxGetOsDescription().c_str()); return createThread(); }
void CDStarRepeaterTXRXThread::setProtocolHandler(CRepeaterProtocolHandler* handler, bool local) { wxASSERT(handler != NULL); m_protocolHandler = handler; if (local) { wxLogInfo(wxT("Reducing transmit buffering because of local connection")); for (unsigned int i = 0U; i < NETWORK_QUEUE_COUNT; i++) m_networkQueue[i]->setThreshold(LOCAL_RUN_FRAME_COUNT); } }
void CTimeServerApp::createThread() { CTimeServerThread* thread = new CTimeServerThread; wxString callsign, address; bool sendA, sendB, sendC, sendD, sendE; getGateway(callsign, sendA, sendB, sendC, sendD, sendE, address); callsign.MakeUpper(); thread->setGateway(callsign, sendA, sendB, sendC, sendD, sendE, address); wxLogInfo(wxT("Callsign set to %s, module %s%s%s%s, address: %s"), callsign.c_str(), sendA ? wxT("A") : wxT(""), sendB ? wxT("B") : wxT(""), sendC ? wxT("C") : wxT(""), sendD ? wxT("D") : wxT(""), sendE ? wxT("E") : wxT(""), address.c_str()); LANGUAGE language; FORMAT format; INTERVAL interval; getAnnouncements(language, format, interval); thread->setAnnouncements(language, format, interval); wxLogInfo(wxT("Language: %d, format: %d, interval: %d"), int(language), int(format), int(interval)); // Convert the worker class into a thread m_thread = new CTimeServerThreadHelper(thread); m_thread->start(); }
bool CTimeServerD::createThread() { CTimeServerConfig config(m_confDir, m_name); m_thread = new CTimeServerThread; wxString callsign, address; bool sendA, sendB, sendC, sendD; config.getGateway(callsign, sendA, sendB, sendC, sendD, address); callsign.MakeUpper(); m_thread->setGateway(callsign, sendA, sendB, sendC, sendD, address); wxLogInfo(wxT("Callsign set to %s, module %s%s%s%s, address: %s"), callsign.c_str(), sendA ? wxT("A") : wxT(""), sendB ? wxT("B") : wxT(""), sendC ? wxT("C") : wxT(""), sendD ? wxT("D") : wxT(""), address.c_str()); LANGUAGE language; FORMAT format; INTERVAL interval; config.getAnnouncements(language, format, interval); m_thread->setAnnouncements(language, format, interval); wxLogInfo(wxT("Language: %d, format: %d, interval: %d"), int(language), int(format), int(interval)); return true; }
int CDStarRepeaterApp::OnExit() { m_logChain->SetLog(NULL); wxLogInfo(APPLICATION_NAME + wxT(" is exiting")); m_thread->kill(); delete m_config; delete m_checker; return 0; }
int CXReflectorApp::OnExit() { m_logChain->SetLog(NULL); wxLogInfo(APPLICATION_NAME + wxT(" is exiting")); m_thread->kill(); m_thread->Wait(); delete m_thread; delete m_config; return 0; }
void CDCSClientApp::setController(const wxString& type, unsigned int audioDelay, bool squelchInvert, bool pttInvert) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Write(KEY_IFACE_TYPE, type); profile->Write(KEY_AUDIO_DELAY, long(audioDelay)); profile->Write(KEY_SQUELCH_INVERT, squelchInvert); profile->Write(KEY_PTT_INVERT, pttInvert); wxLogInfo(wxT("Interface type set to: %s, audio delay: %u ms, ptt invert: %d, squelch invert: %d"), type.c_str(), audioDelay * FRAME_TIME_MS, pttInvert, squelchInvert); delete profile; }
void CDCSClientApp::setCallsign(const wxString& callsign) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Write(KEY_CALLSIGN, callsign); profile->Flush(); wxLogInfo(wxT("Callsign set to %s"), callsign.c_str()); m_thread->setCallsign(callsign); delete profile; }
bool CDVRPTRClientApp::OnInit() { SetVendorName(VENDOR_NAME); wxFileName loggerName(wxFileName::GetHomeDir(), LOG_FILE_NAME, wxT("log")); wxLog* log = new CLogger(loggerName.GetFullPath()); wxLog::SetActiveTarget(log); m_frame = new CDVRPTRClientFrame(APPLICATION_NAME + wxT(" - ") + VERSION); m_frame->Show(); SetTopWindow(m_frame); wxLogInfo(wxT("Starting ") + APPLICATION_NAME + wxT(" - ") + VERSION); // Log the SVN revsion and the version of wxWidgets and the Operating System wxLogInfo(SVNREV); wxLogInfo(wxT("Using wxWidgets %d.%d.%d on %s"), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, ::wxGetOsDescription().c_str()); createThread(); return wxApp::OnInit(); }
void CDummyRepeaterApp::setNetwork(const wxString& gwyAddress, unsigned int gwyPort, const wxString& localAddress, unsigned int localPort) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Write(KEY_GATEWAY_ADDRESS, gwyAddress); profile->Write(KEY_GATEWAY_PORT, long(gwyPort)); profile->Write(KEY_LOCAL_ADDRESS, localAddress); profile->Write(KEY_LOCAL_PORT, long(localPort)); wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gwyAddress.c_str(), gwyPort, localAddress.c_str(), localPort); delete profile; }
void CDVRPTRClientApp::setBleep(bool on) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Write(KEY_BLEEP, on); profile->Flush(); wxLogInfo(wxT("End bleep set to %d"), int(on)); m_thread->setBleep(on); delete profile; }
void CDVRPTRClientApp::setMessage(const wxString& message) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Write(KEY_MESSAGE_TEXT, message); profile->Flush(); wxLogInfo(wxT("Message set to %s"), message.c_str()); m_thread->setMessage(message); delete profile; }
int CIRCDDBGatewayApp::OnExit() { m_logChain->SetLog(NULL); wxLogInfo(APPLICATION_NAME + wxT(" is exiting")); //m_thread->kill(); wxGetApp().GetTopWindow()->Close(); delete m_config; delete m_checker; return 0; }
void CDExtraClientApp::getStartup(wxString& reflector, unsigned int& module) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Read(KEY_STARTUP_REFLECTOR, &reflector, DEFAULT_STARTUP_REFLECTOR); long dummy; profile->Read(KEY_STARTUP_MODULE, &dummy, DEFAULT_STARTUP_MODULE); module = (unsigned int)dummy; wxLogInfo(wxT("Startup Reflector set to: %s:%u"), reflector.c_str(), module); delete profile; }
void CDVRPTRClientApp::getRpt2Calls(wxString& call, wxSortedArrayString& list) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); wxString temp; profile->Read(KEY_RPT2_CALL, &call, DEFAULT_RPT2_CALL); profile->Read(KEY_RPT2_LIST, &temp, DEFAULT_RPT2_LIST); wxLogInfo(wxT("RPT2 call set to %s"), call.c_str()); wxLogInfo(wxT("RPT2 list set to %s"), temp.c_str()); // Convert the comma delimited list to an array list.Clear(); wxStringTokenizer tokens(temp, wxT(",")); while (tokens.HasMoreTokens()) { wxString item = tokens.GetNextToken(); if (!item.IsEmpty()) list.Add(item); } delete profile; }
void CSoundCardRepeaterTXRXThread::setReader(CWAVFileReader* reader) { wxASSERT(reader != NULL); // Already busy? if (m_reader != NULL) { reader->close(); delete reader; return; } wxLogInfo(wxT("Reading from WAV file - %s"), reader->getFilename().c_str()); m_reader = reader; }
void frmMain::OnSaveDefinition(wxCommandEvent &event) { wxLogInfo(wxT("Saving object definition")); if (sqlPane->GetText().IsNull()) { wxLogError(__("There is nothing in the SQL pane to save!")); return; } wxString file; settings->Read(wxT("frmMain/LastFile"), &file, wxEmptyString); #ifdef __WXMSW__ wxFileDialog filename(this, _("Select output file"), ::wxPathOnly(file), file, _("SQL Scripts (*.sql)|*.sql|All files (*.*)|*.*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); #else wxFileDialog filename(this, _("Select output file"), ::wxPathOnly(file), file, _("SQL Scripts (*.sql)|*.sql|All files (*)|*"), wxFD_SAVE | wxFD_OVERWRITE_PROMPT); #endif // Show the dialogue if (filename.ShowModal() == wxID_OK) { // Write the file if (!FileWrite(filename.GetPath(), sqlPane->GetText())) { wxLogError(__("Could not write the file %s: Errcode=%d."), filename.GetPath().c_str(), wxSysErrorCode()); } } else { wxLogInfo(wxT("User cancelled")); } settings->Write(wxT("frmMain/LastFile"), filename.GetPath()); }
void CTimerControlApp::createThread() { m_thread = new CTimerControlThread; wxString address, password; unsigned int port; getGateway(address, port, password); m_thread->setGateway(address, port, password); wxLogInfo(wxT("Gateway set to %s:%u"), address.c_str(), port); bool delay; getDelay(delay); m_thread->setDelay(delay); wxLogInfo(wxT("Delay set to %d"), int(delay)); wxLogInfo(wxT("Schedule file is %s"), m_fileName.c_str()); m_frame->setFileName(m_fileName); m_thread->setFileName(m_fileName); m_thread->reload(); m_thread->Create(); m_thread->Run(); }
bool CDummyRepeaterApp::OnInit() { SetVendorName(VENDOR_NAME); if (!wxApp::OnInit()) return false; if (!m_noLog) { wxLog* log = new CLogger(wxFileName::GetHomeDir(), LOG_BASE_NAME); wxLog::SetActiveTarget(log); } else { new wxLogNull; } wxPoint position = wxDefaultPosition; int x, y; getPosition(x, y); if (x >= 0 && y >= 0) position = wxPoint(x, y); m_frame = new CDummyRepeaterFrame(APPLICATION_NAME + wxT(" - ") + VERSION, position); m_frame->Show(); SetTopWindow(m_frame); wxLogInfo(wxT("Starting ") + APPLICATION_NAME + wxT(" - ") + VERSION); // Log the SVN revsion and the version of wxWidgets and the Operating System wxLogInfo(SVNREV); wxLogInfo(wxT("Using wxWidgets %d.%d.%d on %s"), wxMAJOR_VERSION, wxMINOR_VERSION, wxRELEASE_NUMBER, ::wxGetOsDescription().c_str()); createThread(); return wxApp::OnInit(); }
void CDummyRepeaterApp::setController(const wxString& type, unsigned int config, bool pttInvert, bool squelchInvert) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Write(KEY_IFACE_TYPE, type); profile->Write(KEY_IFACE_CONFIG, long(config)); profile->Write(KEY_PTT_INVERT, pttInvert); profile->Write(KEY_SQUELCH_INVERT, squelchInvert); profile->Flush(); wxLogInfo(wxT("Controller set to %s, config: %u, PTT Inversion set to %d, Squelch Inversion set to %d"), type.c_str(), config, pttInvert, squelchInvert); delete profile; }
void CDummyRepeaterApp::setDongle(DONGLE_TYPE type, const wxString& device, const wxString& address, unsigned int port) const { wxConfigBase* profile = new wxConfig(APPLICATION_NAME); wxASSERT(profile != NULL); profile->Write(KEY_DONGLE_TYPE, long(type)); profile->Write(KEY_DONGLE_DEVICE, device); profile->Write(KEY_DONGLE_ADDRESS, address); profile->Write(KEY_DONGLE_PORT, long(port)); profile->Flush(); wxLogInfo(wxT("AMBE Dongle type: %d, device: %s, address: %s:%u"), int(type), device.c_str(), address.c_str(), port); delete profile; }