int getTimes(int n, int depth) { if (n == 1) return 0; if (n % 2 == 0) return getTimes(n/2, depth + 1); else { return min(getTimes(n + 1, depth + 1), getTimes(n - 1, depth + 1)); } }
void show_movies(){ List_Movies list; char times[5][5]; int i=0; list=getMovies(); getTimes(times); for(; i<CANT_MOVIES; i++){ printf("%s - %s\n", list.movies_list[i].id, list.movies_list[i].name); } printf("\n"); printf("Available times:\n"); for(i=0; i<5; i++){ printf("%s ", times[i]); } printf("\n"); }
// Set the properties of events from begin to end. void LinearParameterPattern:: setEventProperties(iterator begin, iterator end, Result *result) const { const int value1 = result->m_parameters[0]; const int value2 = result->m_parameters[1]; const StartAndDuration times = getTimes (begin, end); const timeT startTime = times.first; const timeT duration = times.second; const double valueChange = value2 - value1; for (iterator i = begin; i != end; ++i) { const timeT relativeTime = (*i)->getAbsoluteTime() - startTime; const double timeRatio = double(relativeTime)/double(duration); const int value = value1 + int(getValueDelta(valueChange, timeRatio)); result->m_situation->setValue(*i, value); } }
void FileNetcdf::writeTimes() { std::vector<double> times = getTimes(); if(times.size() != getNumTime()) { std::stringstream ss; ss << "The times specified for NetCDF file '" << getFilename() << "' has " << times.size() << " elements, but the time dimension is " << getNumTime() << ". Putting missing values."; Util::warning(ss.str()); times = std::vector<double>(getNumTime(), Util::MV); } // Convert missing for(int i = 0; i < times.size(); i++) { if(!Util::isValid(times[i])) times[i] = NC_FILL_FLOAT; } if(!hasVar("time")) { int dTime = getDim("time"); int id; int status = ncredef(mFile); handleNetcdfError(status, "could not put into define mode"); status = nc_def_var(mFile, "time", NC_DOUBLE, 1, &dTime, &id); handleNetcdfError(status, "creating time variable"); status = ncendef(mFile); handleNetcdfError(status, "could not put into data mode"); } int vTime = getVar("time"); double timesArr[getNumTime()]; for(int t = 0; t < getNumTime(); t++) { timesArr[t] = times[t]; } int status = nc_put_var_double(mFile, vTime, timesArr); handleNetcdfError(status, "could not write times"); setAttribute(vTime, "long_name", "time"); setAttribute(vTime, "standard_name", "time"); setAttribute(vTime, "units", "seconds since 1970-01-01 00:00:00 +00:00"); }
/** Set value of a TimeSeriesProperty from input workspace * @brief AddSampleLog::setTimeSeriesData * @param run_obj * @param property_name * @param value_is_int */ void AddSampleLog::setTimeSeriesData(Run &run_obj, const std::string &property_name, bool value_is_int) { // get input and MatrixWorkspace_sptr data_ws = getProperty("TimeSeriesWorkspace"); int ws_index = getProperty("WorkspaceIndex"); if (ws_index < 0 || ws_index > static_cast<int>(data_ws->getNumberHistograms())) throw std::runtime_error("Input workspace index is out of range"); // get meta data bool epochtime(false); std::string timeunit; getMetaData(data_ws, epochtime, timeunit); bool is_second = timeunit == "Second"; // convert the data in workspace to time series property value std::vector<DateAndTime> time_vec = getTimes(data_ws, ws_index, epochtime, is_second, run_obj); if (value_is_int) { // integer property TimeSeriesProperty<int> *int_prop = dynamic_cast<TimeSeriesProperty<int> *>( run_obj.getProperty(property_name)); std::vector<int> value_vec = getIntValues(data_ws, ws_index); int_prop->addValues(time_vec, value_vec); } else { // double property TimeSeriesProperty<double> *int_prop = dynamic_cast<TimeSeriesProperty<double> *>( run_obj.getProperty(property_name)); std::vector<double> value_vec = getDblValues(data_ws, ws_index); int_prop->addValues(time_vec, value_vec); } return; }
int compute(){ //Assuming that the processes form a square int n_procs_row = sqrt(number_of_processes); int n_procs_col = n_procs_row; if (n_procs_col * n_procs_row != number_of_processes) { std::cerr << "number of proccessors must be a perfect square!" << std::endl; MPI_Abort(MPI_COMM_WORLD, 1); } int n_dims = 2; int dims[n_dims] = {n_procs_row, n_procs_col}; int periods[n_dims] = {0, 0}; int repeat = 0; //create comm_groups MPI_Comm comm_cart; MPI_Cart_create(MPI_COMM_WORLD, n_dims, dims, periods, repeat, &comm_cart); int m_block = m / n_procs_row; int n_block = n / n_procs_col; int k_block = k / n_procs_col; if (m_block * n_procs_row != m) { std::cerr << "m must be dividable by n_procs_row" << std::endl; MPI_Abort(MPI_COMM_WORLD, 1); } if (n_block * n_procs_col != n) { std::cerr << "n must be dividable by n_procs_col" << std::endl; MPI_Abort(MPI_COMM_WORLD, 1); } if (k_block * n_procs_col != k) { std::cerr << "k must be dividable by n_procs_col" << std::endl; MPI_Abort(MPI_COMM_WORLD, 1); } double * A_local = (double *) calloc(m_block * n_block, sizeof(double)); double * B_local = (double *) calloc(n_block * k_block, sizeof(double)); double * C_local = (double *) calloc(m_block * k_block, sizeof(double)); double * A = (double *) calloc(m * n, sizeof(double)); double * B = (double *) calloc(n * k, sizeof(double)); initMatrices(A_local, B_local, C_local, m_block, n_block, comm_cart); /** testing the scatter function */ if(rank == 0){ double * A_1 = (double *) calloc(n * k, sizeof(double)); double * B_1 = (double *) calloc(n * k, sizeof(double)); double * C_1 = (double *) calloc(n * k, sizeof(double)); initMatrices(A_1, B_1, C_1, n, n, comm_cart); distributeSquareMatrix(A_1, n, C_1); } gatherMatrix(m_block, n_block, A_local, m, n, A); gatherMatrix(n_block, k_block, B_local, n, k, B); /*if (rank == 3) { std::cout << "A" << std::endl; printMatrix(m_block,m_block, A_local); std::cout << "B" << std::endl; printMatrix(m_block,m_block, B_local); std::cout << "C" << std::endl; printMatrix(m_block,m_block, C_local); }*/ double start_time, end_time; start_time = MPI_Wtime(); summa(comm_cart, m_block, n_block, k_block, A_local, B_local, C_local); end_time = MPI_Wtime(); getTimes(start_time, end_time); double * C = (double *) calloc(m * n, sizeof(double)); double * C_naive = (double *) calloc(m * n, sizeof(double)); gatherMatrix(m_block, k_block, C_local, m, k, C); if (rank == 0) { multMatricesLineByLine(m, n, k, A, B, C_naive); double eps = validate(n, k, C, C_naive); if (eps > 1e-4) { std::cerr << "ERROR: Invalid matrix -> eps = " << eps << std::endl; MPI_Abort(MPI_COMM_WORLD, 1); } else { std::cout << "Valid matrix" << std::endl; } } }
void CSplitRepeaterApp::createThread() { CSplitRepeaterThread* thread = new CSplitRepeaterThread; wxString callsign, gateway; DSTAR_MODE mode; ACK_TYPE ack; bool restriction, rpt1Validation; getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); wxLogInfo(wxT("Callsign set to \"%s\", gateway set to \"%s\", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), restriction, rpt1Validation); wxString gatewayAddress, localAddress; unsigned int gatewayPort, localPort; getNetwork(gatewayAddress, gatewayPort, localAddress, localPort); wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort); if (!gatewayAddress.IsEmpty() && gatewayPort > 0U && localPort > 0U) { CSplitRepeaterProtocolHandler* handler = new CSplitRepeaterProtocolHandler(localAddress, localPort); bool res = handler->open(); if (!res) wxLogError(wxT("Cannot open the protocol handler")); else thread->setProtocolHandler(handler); thread->setGateway(gatewayAddress, gatewayPort); } unsigned int timeout, ackTime; getTimes(timeout, ackTime); thread->setTimes(timeout, ackTime); wxLogInfo(wxT("Timeout set to %u secs, ack time set to %u ms"), timeout, ackTime); unsigned int beaconTime; wxString beaconText; bool beaconVoice; TEXT_LANG language; getBeacon(beaconTime, beaconText, beaconVoice, language); thread->setBeacon(beaconTime, beaconText, beaconVoice, language); wxLogInfo(wxT("Beacon set to %u mins, text set to \"%s\", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language)); wxString receiver1Address; unsigned int receiver1Port; getReceiver1(receiver1Address, receiver1Port); if (!receiver1Address.IsEmpty() && receiver1Port > 0U) { wxLogInfo(wxT("Receiver 1 set to %s:%u"), receiver1Address.c_str(), receiver1Port); bool res = thread->setReceiver1(receiver1Address, receiver1Port); if (!res) wxLogError(wxT("The IP address is invalid")); } wxString receiver2Address; unsigned int receiver2Port; getReceiver2(receiver2Address, receiver2Port); if (!receiver2Address.IsEmpty() && receiver2Port > 0U) { wxLogInfo(wxT("Receiver 2 set to %s:%u"), receiver2Address.c_str(), receiver2Port); bool res = thread->setReceiver2(receiver2Address, receiver2Port); if (!res) wxLogError(wxT("The IP address is invalid")); } wxString transmitter1Address; unsigned int transmitter1Port; getTransmitter1(transmitter1Address, transmitter1Port); if (!transmitter1Address.IsEmpty() && transmitter1Port > 0U) { wxLogInfo(wxT("Transmitter 1 set to %s:%u"), transmitter1Address.c_str(), transmitter1Port); bool res = thread->setTransmitter1(transmitter1Address, transmitter1Port); if (!res) wxLogError(wxT("The IP address is invalid")); } wxString transmitter2Address; unsigned int transmitter2Port; getTransmitter2(transmitter2Address, transmitter2Port); if (!transmitter2Address.IsEmpty() && transmitter2Port > 0U) { wxLogInfo(wxT("Transmitter 2 set to %s:%u"), transmitter2Address.c_str(), transmitter2Port); bool res = thread->setTransmitter2(transmitter2Address, transmitter2Port); if (!res) wxLogError(wxT("The IP address is invalid")); } bool enabled; wxString rpt1Callsign, rpt2Callsign; wxString shutdown, startup; wxString status1, status2, status3, status4, status5; wxString command1, command1Line, command2, command2Line; wxString command3, command3Line, command4, command4Line; getControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line); thread->setControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line); wxLogInfo(wxT("Control: enabled: %d, RPT1: %s, RPT2: %s, shutdown: %s, startup: %s, status1: %s, status2: %s, status3: %s, status4: %s, status5: %s, command1: %s = %s, command2: %s = %s, command3: %s = %s, command4: %s = %s"), enabled, rpt1Callsign.c_str(), rpt2Callsign.c_str(), shutdown.c_str(), startup.c_str(), status1.c_str(), status2.c_str(), status3.c_str(), status4.c_str(), status5.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command3.c_str(), command3Line.c_str(), command4.c_str(), command4Line.c_str()); wxFileName wlFilename(wxFileName::GetHomeDir(), WHITELIST_FILE_NAME); bool exists = wlFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(wlFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open white list file - %s"), wlFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the white list"), list->getCount()); thread->setWhiteList(list); } } wxFileName blFilename(wxFileName::GetHomeDir(), BLACKLIST_FILE_NAME); exists = blFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(blFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the black list"), list->getCount()); thread->setBlackList(list); } } // Convert the worker class into a thread m_thread = new CSplitRepeaterThreadHelper(thread); m_thread->start(); }
void CAnalogueRepeaterApp::createThread() { CAnalogueRepeaterThread* thread = new CAnalogueRepeaterThread; wxString openId, closeId, beacon1, beacon2; unsigned int speed, freq; wxFloat32 level1, level2; AUDIO_SOURCE openIdSource, closeIdSource, beacon1Source, beacon2Source; getCallsign(openIdSource, openId, closeIdSource, closeId, beacon1Source, beacon1, beacon2Source, beacon2, speed, freq, level1, level2); wxLogInfo(wxT("Open ID source: %d, value: \"%s\", close ID source: %d, value: \"%s\", beacon 1 source: %d, value: \"%s\", beacon 2 source: %d, value: \"%s\", speed: %u WPM, freq: %u Hz, level1: %.3f, level2: %.3f"), int(openIdSource), openId.c_str(), int(closeIdSource), closeId.c_str(), int(beacon1Source), beacon1.c_str(), int(beacon2Source), beacon2.c_str(), speed, freq, level1, level2); IFixedAudioSource* openIdAudio = NULL; IFixedAudioSource* closeIdAudio = NULL; IFixedAudioSource* beacon1Audio = NULL; IFixedAudioSource* beacon2Audio = NULL; switch (openIdSource) { case AS_CW_KEYER: openIdAudio = new CCWKeyer(openId, speed, freq, ANALOGUE_RADIO_SAMPLE_RATE); break; case AS_WAV_FILE: { CWAVFileStore* audio = new CWAVFileStore; bool res = audio->load(openId, ANALOGUE_RADIO_SAMPLE_RATE); if (!res) delete audio; else openIdAudio = audio; } break; } switch (closeIdSource) { case AS_CW_KEYER: closeIdAudio = new CCWKeyer(closeId, speed, freq, ANALOGUE_RADIO_SAMPLE_RATE); break; case AS_WAV_FILE: { CWAVFileStore* audio = new CWAVFileStore; bool res = audio->load(closeId, ANALOGUE_RADIO_SAMPLE_RATE); if (!res) delete audio; else closeIdAudio = audio; } break; } switch (beacon1Source) { case AS_CW_KEYER: beacon1Audio = new CCWKeyer(beacon1, speed, freq, ANALOGUE_RADIO_SAMPLE_RATE); break; case AS_WAV_FILE: { CWAVFileStore* audio = new CWAVFileStore; bool res = audio->load(beacon1, ANALOGUE_RADIO_SAMPLE_RATE); if (!res) delete audio; else beacon1Audio = audio; } break; } switch (beacon2Source) { case AS_CW_KEYER: beacon2Audio = new CCWKeyer(beacon2, speed, freq, ANALOGUE_RADIO_SAMPLE_RATE); break; case AS_WAV_FILE: { CWAVFileStore* audio = new CWAVFileStore; bool res = audio->load(beacon2, ANALOGUE_RADIO_SAMPLE_RATE); if (!res) delete audio; else beacon2Audio = audio; } break; } thread->setCallsign(openIdAudio, closeIdAudio, beacon1Audio, beacon2Audio, level1, level2); wxString radioAck, extAck, batteryAck; unsigned int ack, minimum; wxFloat32 level; AUDIO_SOURCE radioAckSource, extAckSource, batteryAckSource; getAck(radioAckSource, radioAck, extAckSource, extAck, batteryAckSource, batteryAck, speed, freq, level, ack, minimum); wxLogInfo(wxT("Radio ack source: %d, radio ack: \"%s\", network ack source: %d, network ack: \"%s\", battery ack source: %d, battery ack: \"%s\", speed: %u WPM, freq: %u Hz, level: %.3f, ack: %u ms, minimum: %u ms"), int(radioAckSource), radioAck.c_str(), int(extAckSource), extAck.c_str(), int(batteryAckSource), batteryAck.c_str(), speed, freq, level, ack, minimum); IFixedAudioSource* radioAckAudio = NULL; IFixedAudioSource* extAckAudio = NULL; IFixedAudioSource* batteryAckAudio = NULL; switch (radioAckSource) { case AS_CW_KEYER: radioAckAudio = new CCWKeyer(radioAck, speed, freq, ANALOGUE_RADIO_SAMPLE_RATE); break; case AS_WAV_FILE: { CWAVFileStore* audio = new CWAVFileStore; bool res = audio->load(radioAck, ANALOGUE_RADIO_SAMPLE_RATE); if (!res) delete audio; else radioAckAudio = audio; } break; } switch (extAckSource) { case AS_CW_KEYER: extAckAudio = new CCWKeyer(extAck, speed, freq, ANALOGUE_RADIO_SAMPLE_RATE); break; case AS_WAV_FILE: { CWAVFileStore* audio = new CWAVFileStore; bool res = audio->load(extAck, ANALOGUE_RADIO_SAMPLE_RATE); if (!res) delete audio; else extAckAudio = audio; } break; } switch (batteryAckSource) { case AS_CW_KEYER: batteryAckAudio = new CCWKeyer(batteryAck, speed, freq, ANALOGUE_RADIO_SAMPLE_RATE); break; case AS_WAV_FILE: { CWAVFileStore* audio = new CWAVFileStore; bool res = audio->load(extAck, ANALOGUE_RADIO_SAMPLE_RATE); if (!res) delete audio; else batteryAckAudio = audio; } break; } thread->setAck(radioAckAudio, extAckAudio, batteryAckAudio, level, ack, minimum); unsigned int callsignTime, timeout, lockoutTime, hangTime, latchTime; getTimes(callsignTime, timeout, lockoutTime, hangTime, latchTime); thread->setTimes(callsignTime, timeout, lockoutTime, hangTime, latchTime); wxLogInfo(wxT("Times set to: callsign time: %u secs, timeout: %u secs, lockout time: %u secs, hang time: %u secs, latch time: %u secs"), callsignTime, timeout, lockoutTime, hangTime, latchTime); bool tbEnable, ctcssInternal; wxFloat32 tbThreshold, ctcssFreq, ctcssThresh, ctcssLevel; unsigned int ctcssHangTime; ANALOGUE_CTCSS_OUTPUT ctcssOutput; getTones(tbEnable, tbThreshold, ctcssFreq, ctcssInternal, ctcssThresh, ctcssLevel, ctcssHangTime, ctcssOutput); thread->setTones(tbEnable, tbThreshold, ctcssFreq, ctcssInternal, ctcssThresh, ctcssLevel, ctcssHangTime, ctcssOutput); wxLogInfo(wxT("Tones set to: toneburst enable: %u, threshold: %.3f, CTCSS freq: %.1f Hz, internal: %u, threshold: %.3f, level: %.3f, hang time: %u ms, output: %d"), tbEnable, tbThreshold, ctcssFreq, ctcssInternal, ctcssThresh, ctcssLevel, ctcssHangTime * 20U, ctcssOutput); ANALOGUE_CALLSIGN_START callsignAtStart; unsigned int callsignStartDelay; bool callsignAtEnd; ANALOGUE_TIMEOUT_TYPE timeoutType; ANALOGUE_CALLSIGN_HOLDOFF callsignHoldoff; getFeel(callsignAtStart, callsignStartDelay, callsignAtEnd, timeoutType, callsignHoldoff); thread->setFeel(callsignAtStart, callsignStartDelay, callsignAtEnd, timeoutType, callsignHoldoff); wxLogInfo(wxT("Feel set to: callsignAtStart: %d, callsignStartDelay: %u s, callsignAtEnd: %u, timeoutType: %d, callsignHoldoff: %d"), callsignAtStart, callsignStartDelay, callsignAtEnd, timeoutType, callsignHoldoff); wxString readDevice, writeDevice; unsigned int audioDelay; bool deEmphasis, preEmphasis, vogad; getRadio(readDevice, writeDevice, audioDelay, deEmphasis, preEmphasis, vogad); wxLogInfo(wxT("Radio soundcard set to %s:%s, delay: %u ms, de-emphasis: %d, pre-emphasis %d, vogad: %d"), readDevice.c_str(), writeDevice.c_str(), audioDelay * 20U, int(deEmphasis), int(preEmphasis), int(vogad)); if (!readDevice.IsEmpty() && !writeDevice.IsEmpty()) { CSoundCardReaderWriter* soundcard = new CSoundCardReaderWriter(readDevice, writeDevice, ANALOGUE_RADIO_SAMPLE_RATE, ANALOGUE_RADIO_BLOCK_SIZE); soundcard->setCallback(thread, SOUNDCARD_RADIO); bool res = soundcard->open(); if (!res) wxLogError(wxT("Cannot open the radio sound card")); else thread->setRadio(soundcard, audioDelay, deEmphasis, preEmphasis, vogad); } wxString type; unsigned int pttDelay, squelchDelay, cfg; bool pttInvert, squelchInvert; getController(type, cfg, pttDelay, squelchDelay, pttInvert, squelchInvert); wxLogInfo(wxT("Controller set to %s, config: %u, ptt delay: %u ms, squelch delay: %u ms, ptt invert: %d, squelch invert: %d"), type.c_str(), cfg, pttDelay * 20U, squelchInvert * 20U, pttInvert, squelchInvert); CExternalController* controller = NULL; wxString port; if (type.StartsWith(wxT("Velleman K8055 - "), &port)) { unsigned long num; port.ToULong(&num); controller = new CExternalController(new CK8055Controller(num), pttInvert, squelchInvert); } else if (type.StartsWith(wxT("Serial - "), &port)) { controller = new CExternalController(new CSerialLineController(port, cfg), pttInvert, squelchInvert); } else if (type.StartsWith(wxT("Arduino - "), &port)) { controller = new CExternalController(new CArduinoController(port), pttInvert, squelchInvert); #if defined(GPIO) } else if (type.IsSameAs(wxT("GPIO"))) { controller = new CExternalController(new CGPIOController(cfg), pttInvert, squelchInvert); #endif } else { controller = new CExternalController(new CDummyController, pttInvert, squelchInvert); } bool res = controller->open(); if (!res) wxLogError(wxT("Cannot open the hardware interface - %s"), type.c_str()); else thread->setController(controller, pttDelay, squelchDelay); ANALOGUE_EXTERNAL_MODE mode; wxString device; SERIALPIN txPin, rxPin; bool background; getExternal(mode, readDevice, writeDevice, audioDelay, deEmphasis, preEmphasis, vogad, device, txPin, rxPin, background); wxLogInfo(wxT("External mode: %d, soundcard set to %s:%s, delay: %u ms, de-emphasis: %d, pre-emphasis %d, vogad: %u, interface set to %s, tx %d, rx %d, background: %d"), mode, readDevice.c_str(), writeDevice.c_str(), audioDelay * 20U, int(deEmphasis), int(preEmphasis), int(vogad), device.c_str(), txPin, rxPin, int(background)); if (mode != AEM_DISABLED) { CSoundCardReaderWriter* soundcard = new CSoundCardReaderWriter(readDevice, writeDevice, ANALOGUE_RADIO_SAMPLE_RATE, ANALOGUE_RADIO_BLOCK_SIZE); soundcard->setCallback(thread, SOUNDCARD_EXTERNAL); bool res = soundcard->open(); if (!res) { wxLogError(wxT("Cannot open the external sound card")); } else { // This works even for an empty device name CNetworkController* controller = new CNetworkController(device, txPin, rxPin); res = controller->open(); if (!res) wxLogError(wxT("Cannot open serial port - %s"), device.c_str()); else thread->setExternal(mode, soundcard, audioDelay, deEmphasis, preEmphasis, vogad, controller, background); } } bool out1, out2, out3, out4; getOutputs(out1, out2, out3, out4); thread->setOutputs(out1, out2, out3, out4); m_frame->setOutputs(out1, out2, out3, out4); wxLogInfo(wxT("Output 1: %d, output 2: %d, output 3: %d, output 4: %d"), out1, out2, out3, out4); bool dtmfRadio, dtmfExternal; wxString dtmfShutdown, dtmfStartup, dtmfTimeout, dtmfTimeReset, dtmfOutput1, dtmfOutput2, dtmfOutput3, dtmfOutput4; wxString dtmfCommand1, dtmfCommand1Line, dtmfCommand2, dtmfCommand2Line; wxFloat32 dtmfThreshold; getDTMF(dtmfRadio, dtmfExternal, dtmfShutdown, dtmfStartup, dtmfTimeout, dtmfTimeReset, dtmfCommand1, dtmfCommand1Line, dtmfCommand2, dtmfCommand2Line, dtmfOutput1, dtmfOutput2, dtmfOutput3, dtmfOutput4, dtmfThreshold); thread->setDTMF(dtmfRadio, dtmfExternal, dtmfShutdown, dtmfStartup, dtmfTimeout, dtmfTimeReset, dtmfCommand1, dtmfCommand1Line, dtmfCommand2, dtmfCommand2Line, dtmfOutput1, dtmfOutput2, dtmfOutput3, dtmfOutput4, dtmfThreshold); wxLogInfo(wxT("DTMF: Radio: %d, External: %d, Shutdown: %s, Startup: %s, Timeout: %s, Time Reset: %s, Command1: %s = %s, Command2: %s = %s, Output1: %s, Output2: %s, Output3: %s, Output4: %s, Threshold: %f"), dtmfRadio, dtmfExternal, dtmfShutdown.c_str(), dtmfStartup.c_str(), dtmfTimeout.c_str(), dtmfTimeReset.c_str(), dtmfCommand1.c_str(), dtmfCommand1Line.c_str(), dtmfCommand2.c_str(), dtmfCommand2Line.c_str(), dtmfOutput1.c_str(), dtmfOutput2.c_str(), dtmfOutput3.c_str(), dtmfOutput4.c_str(), dtmfThreshold); unsigned int activeHangTime; getActiveHang(activeHangTime); thread->setActiveHang(activeHangTime); wxLogInfo(wxT("Active Hang: time: %u"), activeHangTime); // Convert the worker class into a thread m_thread = new CAnalogueRepeaterThreadHelper(thread); m_thread->start(); }
void CGMSKRepeaterApp::createThread() { wxString callsign, gateway; DSTAR_MODE mode; ACK_TYPE ack; bool restriction, rpt1Validation; getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); IGMSKRepeaterThread* thread = NULL; switch (mode) { case MODE_RXONLY: thread = new CGMSKRepeaterRXThread; break; case MODE_TXONLY: thread = new CGMSKRepeaterTXThread; break; case MODE_TXANDRX: thread = new CGMSKRepeaterTXRXThread; break; default: thread = new CGMSKRepeaterTRXThread; break; } thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); wxLogInfo(wxT("Callsign set to \"%s\", gateway set to \"%s\", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), restriction, rpt1Validation); wxString gatewayAddress, localAddress; unsigned int gatewayPort, localPort; getNetwork(gatewayAddress, gatewayPort, localAddress, localPort); wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort); if (!gatewayAddress.IsEmpty()) { CRepeaterProtocolHandler* handler = new CRepeaterProtocolHandler(gatewayAddress, gatewayPort, localAddress, localPort); bool res = handler->open(); if (!res) wxLogError(wxT("Cannot open the protocol handler")); else thread->setProtocolHandler(handler); } unsigned int timeout, ackTime; getTimes(timeout, ackTime); thread->setTimes(timeout, ackTime); wxLogInfo(wxT("Timeout set to %u secs, ack time set to %u ms"), timeout, ackTime); unsigned int beaconTime; wxString beaconText; bool beaconVoice; TEXT_LANG language; getBeacon(beaconTime, beaconText, beaconVoice, language); if (mode == MODE_GATEWAY) beaconTime = 0U; thread->setBeacon(beaconTime, beaconText, beaconVoice, language); wxLogInfo(wxT("Beacon set to %u mins, text set to \"%s\", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language)); GMSK_MODEM_TYPE modemType; unsigned int modemAddress; getModem(modemType, modemAddress); #if defined(WIN32) IGMSKModem* modem = NULL; switch (modemType) { case GMT_LIBUSB: wxLogInfo(wxT("GMSK modem: type: LibUsb, address: 0x%04X"), modemAddress); modem = new CGMSKModemLibUsb(modemAddress); break; case GMT_WINUSB: wxLogInfo(wxT("GMSK modem: type: WinUSB, address: 0x%04X"), modemAddress); modem = new CGMSKModemWinUSB(modemAddress); break; default: wxLogError(wxT("Unknown GMSK Modem type - %d"), int(modemType)); break; } #else wxLogInfo(wxT("GMSK modem: type: LibUsb, address: 0x%04X"), modemAddress); IGMSKModem* modem = new CGMSKModemLibUsb(modemAddress); #endif if (modem != NULL) { bool res = modem->open(); if (!res) wxLogError(wxT("Cannot open the GMSK modem")); else thread->setModem(modem); } wxString controllerType; unsigned int activeHangTime; getController(controllerType, activeHangTime); wxLogInfo(wxT("Controller set to %s, active hang time: %u ms"), controllerType.c_str(), activeHangTime); CExternalController* controller = NULL; wxString port; if (controllerType.StartsWith(wxT("Velleman K8055 - "), &port)) { unsigned long num; port.ToULong(&num); controller = new CExternalController(new CK8055Controller(num), false, false); } else if (controllerType.IsSameAs(wxT("Raspberry Pi"))) { controller = new CExternalController(new CRaspberryController, false, false); } else { controller = new CExternalController(new CDummyController, false, false); } bool res = controller->open(); if (!res) wxLogError(wxT("Cannot open the hardware interface - %s"), controllerType.c_str()); else thread->setController(controller, activeHangTime); bool out1, out2, out3, out4; getOutputs(out1, out2, out3, out4); thread->setOutputs(out1, out2, out3, out4); m_frame->setOutputs(out1, out2, out3, out4); wxLogInfo(wxT("Output 1 = %d, output 2 = %d, output 3 = %d, output 4 = %d"), out1, out2, out3, out4); bool enabled; wxString rpt1Callsign, rpt2Callsign; wxString shutdown, startup; wxString status1, status2, status3, status4, status5; wxString command1, command1Line, command2, command2Line; wxString command3, command3Line, command4, command4Line; wxString output1, output2, output3, output4; getControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4); thread->setControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4); wxLogInfo(wxT("Control: enabled: %d, RPT1: %s, RPT2: %s, shutdown: %s, startup: %s, status1: %s, status2: %s, status3: %s, status4: %s, status5: %s, command1: %s = %s, command2: %s = %s, command3: %s = %s, command4: %s = %s, output1: %s, output2: %s, output3: %s, output4: %s"), enabled, rpt1Callsign.c_str(), rpt2Callsign.c_str(), shutdown.c_str(), startup.c_str(), status1.c_str(), status2.c_str(), status3.c_str(), status4.c_str(), status5.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command3.c_str(), command3Line.c_str(), command4.c_str(), command4Line.c_str(), output1.c_str(), output2.c_str(), output3.c_str(), output4.c_str()); bool logging; getLogging(logging); thread->setLogging(logging, m_audioDir); m_frame->setLogging(logging); wxLogInfo(wxT("Frame logging set to %d, in %s"), int(logging), m_audioDir.c_str()); wxFileName wlFilename(wxFileName::GetHomeDir(), WHITELIST_FILE_NAME); bool exists = wlFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(wlFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open white list file - %s"), wlFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the white list"), list->getCount()); thread->setWhiteList(list); } } wxFileName blFilename(wxFileName::GetHomeDir(), BLACKLIST_FILE_NAME); exists = blFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(blFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the black list"), list->getCount()); thread->setBlackList(list); } } // Convert the worker class into a thread m_thread = new CGMSKRepeaterThreadHelper(thread); m_thread->start(); }
void CDVRPTRRepeaterApp::createThread() { wxString callsign, gateway; DSTAR_MODE mode; ACK_TYPE ack; bool restriction, rpt1Validation; getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); IDVRPTRRepeaterThread* thread = NULL; switch (mode) { case MODE_RXONLY: thread = new CDVRPTRRepeaterRXThread; break; case MODE_TXONLY: thread = new CDVRPTRRepeaterTXThread; break; case MODE_TXANDRX: thread = new CDVRPTRRepeaterTXRXThread; break; default: thread = new CDVRPTRRepeaterTRXThread; break; } thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); wxLogInfo(wxT("Callsign set to \"%s\", gateway set to \"%s\", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), restriction, rpt1Validation); wxString gatewayAddress, localAddress; unsigned int gatewayPort, localPort; getNetwork(gatewayAddress, gatewayPort, localAddress, localPort); wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort); if (!gatewayAddress.IsEmpty()) { CRepeaterProtocolHandler* handler = new CRepeaterProtocolHandler(gatewayAddress, gatewayPort, localAddress, localPort); bool res = handler->open(); if (!res) wxLogError(wxT("Cannot open the protocol handler")); else thread->setProtocolHandler(handler); } unsigned int timeout, ackTime; getTimes(timeout, ackTime); thread->setTimes(timeout, ackTime); wxLogInfo(wxT("Timeout set to %u secs, ack time set to %u ms"), timeout, ackTime); unsigned int beaconTime; wxString beaconText; bool beaconVoice; TEXT_LANG language; getBeacon(beaconTime, beaconText, beaconVoice, language); if (mode == MODE_GATEWAY) beaconTime = 0U; thread->setBeacon(beaconTime, beaconText, beaconVoice, language); wxLogInfo(wxT("Beacon set to %u mins, text set to \"%s\", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language)); DVRPTR_VERSION modemVersion; CONNECTION_TYPE modemType; wxString modemUSBPort, modemAddress, modemUSBPath; bool rxInvert, txInvert, channel; unsigned int modemPort, modLevel, txDelay; getModem(modemVersion, modemType, modemUSBPort, modemAddress, modemPort, rxInvert, txInvert, channel, modLevel, txDelay); wxLogInfo(wxT("DV-RPTR modem: version: %d, type: %d, USB port: %s, address: %s:%u, RX invert: %d, TX invert: %d, channel: %s, mod level: %u%%, TX delay: %u ms"), int(modemVersion), int(modemType), modemUSBPort.c_str(), modemAddress.c_str(), modemPort, int(rxInvert), int(txInvert), channel ? wxT("B") : wxT("A"), modLevel, txDelay); if (modemType == CT_USB) { if (!modemUSBPort.IsEmpty()) { getModem(modemUSBPath); if (!modemUSBPath.IsEmpty()) wxLogInfo(wxT("DV-RPTR modem: path: %s"), modemUSBPath.c_str()); IDVRPTRController* controller = NULL; switch (modemVersion) { case DVRPTR_V1: controller = new CDVRPTRControllerV1(modemUSBPort, modemUSBPath, rxInvert, txInvert, channel, modLevel, txDelay); break; case DVRPTR_V2: controller = new CDVRPTRControllerV2(modemUSBPort, modemUSBPath, txInvert, modLevel, mode == MODE_DUPLEX || mode == MODE_TXANDRX, callsign); break; default: wxLogError(wxT("Unknown DV-RPTR modem version - %d"), int(modemVersion)); break; } if (controller != NULL) { bool res = controller->open(); if (!res) { wxLogError(wxT("Cannot open the DV-RPTR modem")); } else { thread->setModem(controller); setModem(controller->getPath()); } } } } else if (modemType == CT_NETWORK) { if (!modemAddress.IsEmpty()) { CDVRPTRControllerV2* controller = new CDVRPTRControllerV2(modemAddress, modemPort, txInvert, modLevel, mode == MODE_DUPLEX || mode == MODE_TXANDRX, callsign); bool res = controller->open(); if (!res) wxLogError(wxT("Cannot open the DV-RPTR modem")); else thread->setModem(controller); } } wxString controllerType; unsigned int activeHangTime; getController(controllerType, activeHangTime); wxLogInfo(wxT("Controller set to %s, active hang time: %u ms"), controllerType.c_str(), activeHangTime); CExternalController* controller = NULL; wxString port; if (controllerType.StartsWith(wxT("Velleman K8055 - "), &port)) { unsigned long num; port.ToULong(&num); controller = new CExternalController(new CK8055Controller(num), false, false); } else if (controllerType.IsSameAs(wxT("Raspberry Pi"))) { controller = new CExternalController(new CRaspberryController, false, false); } else { controller = new CExternalController(new CDummyController, false, false); } bool res = controller->open(); if (!res) wxLogError(wxT("Cannot open the hardware interface - %s"), controllerType.c_str()); else thread->setController(controller, activeHangTime); bool out1, out2, out3, out4; getOutputs(out1, out2, out3, out4); thread->setOutputs(out1, out2, out3, out4); m_frame->setOutputs(out1, out2, out3, out4); wxLogInfo(wxT("Output 1 = %d, output 2 = %d, output 3 = %d, output 4 = %d"), out1, out2, out3, out4); bool enabled; wxString rpt1Callsign, rpt2Callsign; wxString shutdown, startup; wxString status1, status2, status3, status4, status5; wxString command1, command1Line, command2, command2Line; wxString command3, command3Line, command4, command4Line; wxString output1, output2, output3, output4; getControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4); thread->setControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4); wxLogInfo(wxT("Control: enabled: %d, RPT1: %s, RPT2: %s, shutdown: %s, startup: %s, status1: %s, status2: %s, status3: %s, status4: %s, status5: %s, command1: %s = %s, command2: %s = %s, command3: %s = %s, command4: %s = %s, output1: %s, output2: %s, output3: %s, output4: %s"), enabled, rpt1Callsign.c_str(), rpt2Callsign.c_str(), shutdown.c_str(), startup.c_str(), status1.c_str(), status2.c_str(), status3.c_str(), status4.c_str(), status5.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command3.c_str(), command3Line.c_str(), command4.c_str(), command4Line.c_str(), output1.c_str(), output2.c_str(), output3.c_str(), output4.c_str()); bool logging; getLogging(logging); thread->setLogging(logging, m_audioDir); m_frame->setLogging(logging); wxLogInfo(wxT("Frame logging set to %d, in %s"), int(logging), m_audioDir.c_str()); wxFileName wlFilename(wxFileName::GetHomeDir(), WHITELIST_FILE_NAME); bool exists = wlFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(wlFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open white list file - %s"), wlFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the white list"), list->getCount()); thread->setWhiteList(list); } } wxFileName blFilename(wxFileName::GetHomeDir(), BLACKLIST_FILE_NAME); exists = blFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(blFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the black list"), list->getCount()); thread->setBlackList(list); } } // Convert the worker class into a thread m_thread = new CDVRPTRRepeaterThreadHelper(thread); m_thread->start(); }
int integerReplacement(int n) { return getTimes(n, 0); }
void CDVAPNodeApp::createThread() { wxString callsign, gateway; DSTAR_MODE mode; ACK_TYPE ack; bool restriction, rpt1Validation; getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); IDVAPNodeThread* thread = NULL; switch (mode) { case MODE_RXONLY: thread = new CDVAPNodeRXThread; break; case MODE_TXONLY: thread = new CDVAPNodeTXThread; break; default: thread = new CDVAPNodeTRXThread; break; } thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); wxLogInfo(wxT("Callsign set to \"%s\", gateway set to \"%s\", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), restriction, rpt1Validation); wxString gatewayAddress, localAddress; unsigned int gatewayPort, localPort; getNetwork(gatewayAddress, gatewayPort, localAddress, localPort); wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort); if (!gatewayAddress.IsEmpty()) { CRepeaterProtocolHandler* handler = new CRepeaterProtocolHandler(gatewayAddress, gatewayPort, localAddress, localPort); bool res = handler->open(); if (!res) wxLogError(wxT("Cannot open the protocol handler")); else thread->setProtocolHandler(handler); } unsigned int timeout, ackTime; getTimes(timeout, ackTime); thread->setTimes(timeout, ackTime); wxLogInfo(wxT("Timeout set to %u secs, ack time set to %u ms"), timeout, ackTime); unsigned int beaconTime; wxString beaconText; bool beaconVoice; TEXT_LANG language; getBeacon(beaconTime, beaconText, beaconVoice, language); thread->setBeacon(beaconTime, beaconText, beaconVoice, language); wxLogInfo(wxT("Beacon set to %u mins, text set to \"%s\", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language)); wxString dvapPort; unsigned int dvapFrequency; int dvapPower, dvapSquelch, dvapOffset; getDVAP(dvapPort, dvapFrequency, dvapPower, dvapSquelch, dvapOffset); wxLogInfo(wxT("DVAP: port: %s, frequency: %u Hz, power: %d dBm, squelch: %d dBm, offset: %d Hz"), dvapPort.c_str(), dvapFrequency, dvapPower, dvapSquelch, dvapOffset); if (!dvapPort.IsEmpty()) { CDVAPController* dvap = new CDVAPController(dvapPort, dvapFrequency, dvapPower, dvapSquelch, dvapOffset); bool res = dvap->open(); if (!res) wxLogError(wxT("Unable to open the DVAP")); else thread->setDVAP(dvap); } bool logging; getLogging(logging); thread->setLogging(logging, ::wxGetHomeDir()); m_frame->setLogging(logging); wxLogInfo(wxT("Frame logging set to %d, in %s"), int(logging), ::wxGetHomeDir().c_str()); wxFileName wlFilename(wxFileName::GetHomeDir(), WHITELIST_FILE_NAME); bool exists = wlFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(wlFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open white list file - %s"), wlFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the white list"), list->getCount()); thread->setWhiteList(list); } } wxFileName blFilename(wxFileName::GetHomeDir(), BLACKLIST_FILE_NAME); exists = blFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(blFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the black list"), list->getCount()); thread->setBlackList(list); } } // Convert the worker class into a thread m_thread = new CDVAPNodeThreadHelper(thread); m_thread->start(); }
void CSoundCardRepeaterApp::createThread() { wxString callsign, gateway; DSTAR_MODE mode; ACK_TYPE ack; bool restriction, rpt1Validation; getCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); switch (mode) { case MODE_RXONLY: m_thread = new CSoundCardRepeaterRXThread; break; case MODE_TXONLY: m_thread = new CSoundCardRepeaterTXThread; break; case MODE_TXANDRX: m_thread = new CSoundCardRepeaterTXRXThread; break; default: m_thread = new CSoundCardRepeaterTRXThread; break; } m_thread->setCallsign(callsign, gateway, mode, ack, restriction, rpt1Validation); wxLogInfo(wxT("Callsign set to \"%s\", gateway set to \"%s\", mode: %d, ack: %d, restriction: %d, RPT1 validation: %d"), callsign.c_str(), gateway.c_str(), int(mode), int(ack), restriction, rpt1Validation); wxString gatewayAddress, localAddress; unsigned int gatewayPort, localPort; getNetwork(gatewayAddress, gatewayPort, localAddress, localPort); wxLogInfo(wxT("Gateway set to %s:%u, local set to %s:%u"), gatewayAddress.c_str(), gatewayPort, localAddress.c_str(), localPort); if (!gatewayAddress.IsEmpty()) { CRepeaterProtocolHandler* handler = new CRepeaterProtocolHandler(gatewayAddress, gatewayPort, localAddress, localPort); bool res = handler->open(); if (!res) wxLogError(wxT("Cannot open the protocol handler")); else m_thread->setProtocolHandler(handler); } unsigned int timeout, ackTime, hangTime; getTimes(timeout, ackTime, hangTime); m_thread->setTimes(timeout, ackTime, hangTime); wxLogInfo(wxT("Timeout set to %u secs, Ack time set to %u ms, Hang time set to %u ms"), timeout, ackTime, hangTime); unsigned int beaconTime; wxString beaconText; bool beaconVoice; TEXT_LANG language; getBeacon(beaconTime, beaconText, beaconVoice, language); m_thread->setBeacon(beaconTime, beaconText, beaconVoice, language); wxLogInfo(wxT("Beacon set to %u mins, text set to \"%s\", voice set to %d, language set to %d"), beaconTime / 60U, beaconText.c_str(), int(beaconVoice), int(language)); wxString readDevice, writeDevice; bool rxInvert, txInvert; wxFloat32 rxLevel, txLevel, squelchLevel; SQUELCH_MODE squelchMode; getRadio(readDevice, writeDevice, rxLevel, txLevel, squelchMode, squelchLevel, rxInvert, txInvert); wxLogInfo(wxT("Soundcard set to %s:%s, levels: %.2f:%.2f, GMSK Inversion set to %d:%d, squelch: mode: %d level: %.2f"), readDevice.c_str(), writeDevice.c_str(), rxLevel, txLevel, rxInvert, txInvert, int(squelchMode), squelchLevel); if (!readDevice.IsEmpty() && !writeDevice.IsEmpty()) { #if defined(__WINDOWS__) CSoundCardReaderWriter* soundcard = new CSoundCardReaderWriter(readDevice, writeDevice, DSTAR_RADIO_SAMPLE_RATE, DSTAR_RADIO_BLOCK_SIZE); #else CSoundCardReaderWriter* soundcard = new CSoundCardReaderWriter(readDevice, writeDevice, DSTAR_RADIO_SAMPLE_RATE, 64U); #endif soundcard->setCallback(m_thread, 0U); bool res = soundcard->open(); if (!res) wxLogError(wxT("Cannot open the sound card")); else m_thread->setSoundCard(soundcard, rxLevel, txLevel, squelchMode, squelchLevel, rxInvert, txInvert); } wxString type; unsigned int cfg; int pttDelay; bool pttInvert; getController(type, cfg, pttDelay, pttInvert); wxLogInfo(wxT("Controller set to %s, config: %u, ptt delay: %d ms, PTT Inversion set to %d"), type.c_str(), cfg, pttDelay * 20, pttInvert); CExternalController* controller = NULL; wxString port; if (type.StartsWith(wxT("Velleman K8055 - "), &port)) { unsigned long num; port.ToULong(&num); controller = new CExternalController(new CK8055Controller(num), pttInvert, false); } else if (type.StartsWith(wxT("URI USB - "), &port)) { unsigned long num; port.ToULong(&num); controller = new CExternalController(new CURIUSBController(num, false), pttInvert, false); } else if (type.StartsWith(wxT("Serial - "), &port)) { controller = new CExternalController(new CSerialController(port, cfg), pttInvert, false); } else { controller = new CExternalController(new CDummyController, pttInvert, false); } bool res = controller->open(); if (!res) wxLogError(wxT("Cannot open the hardware interface - %s"), type.c_str()); else m_thread->setController(controller, pttDelay); bool out1, out2, out3, out4; getOutputs(out1, out2, out3, out4); m_thread->setOutputs(out1, out2, out3, out4); m_frame->setOutputs(out1, out2, out3, out4); wxLogInfo(wxT("Output 1 = %d, output 2 = %d, output 3 = %d, output 4 = %d"), out1, out2, out3, out4); bool enabled; wxString rpt1Callsign, rpt2Callsign; wxString shutdown, startup; wxString status1, status2, status3, status4, status5; wxString command1, command1Line, command2, command2Line; wxString command3, command3Line, command4, command4Line; wxString output1, output2, output3, output4; getControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4); m_thread->setControl(enabled, rpt1Callsign, rpt2Callsign, shutdown, startup, status1, status2, status3, status4, status5, command1, command1Line, command2, command2Line, command3, command3Line, command4, command4Line, output1, output2, output3, output4); wxLogInfo(wxT("Control: enabled: %d, RPT1: %s, RPT2: %s, shutdown: %s, startup: %s, status1: %s, status2: %s, status3: %s, status4: %s, status5: %s, command1: %s = %s, command2: %s = %s, command3: %s = %s, command4: %s = %s, output1: %s, output2: %s, output3: %s, output4: %s"), enabled, rpt1Callsign.c_str(), rpt2Callsign.c_str(), shutdown.c_str(), startup.c_str(), status1.c_str(), status2.c_str(), status3.c_str(), status4.c_str(), status5.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command1.c_str(), command1Line.c_str(), command2.c_str(), command2Line.c_str(), command3.c_str(), command3Line.c_str(), command4.c_str(), command4Line.c_str(), output1.c_str(), output2.c_str(), output3.c_str(), output4.c_str()); unsigned int activeHangTime; getActiveHang(activeHangTime); m_thread->setActiveHang(activeHangTime); wxLogInfo(wxT("Active Hang: time: %u"), activeHangTime); bool logging; getLogging(logging); m_thread->setLogging(logging, ::wxGetHomeDir()); m_frame->setLogging(logging); wxLogInfo(wxT("Frame logging set to %d, in %s"), int(logging), ::wxGetHomeDir().c_str()); wxFileName wlFilename(wxFileName::GetHomeDir(), WHITELIST_FILE_NAME); bool exists = wlFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(wlFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open white list file - %s"), wlFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the white list"), list->getCount()); m_thread->setWhiteList(list); } } wxFileName blFilename(wxFileName::GetHomeDir(), BLACKLIST_FILE_NAME); exists = blFilename.FileExists(); if (exists) { CCallsignList* list = new CCallsignList(blFilename.GetFullPath()); bool res = list->load(); if (!res) { wxLogError(wxT("Unable to open black list file - %s"), blFilename.GetFullPath().c_str()); delete list; } else { wxLogInfo(wxT("%u callsigns loaded into the black list"), list->getCount()); m_thread->setBlackList(list); } } m_thread->start(); }