// Hamlib for CAT PTT
//----------------------------------------------------------------------
-#ifdef PREV__
wxStaticBoxSizer* staticBoxSizer18 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Hamlib Settings")), wxHORIZONTAL);
-
- /* Use Hamlib for PTT checkbox. */
-
- m_ckUseHamlibPTT = new wxCheckBox(this, wxID_ANY, _("Use Hamlib PTT"), wxDefaultPosition, wxSize(-1, -1), 0);
- m_ckUseHamlibPTT->SetValue(false);
- staticBoxSizer18->Add(m_ckUseHamlibPTT, 0, wxALIGN_CENTER_VERTICAL, 0);
-
- /* Hamlib Rig Type combobox. */
-
- staticBoxSizer18->Add(new wxStaticText(this, wxID_ANY, _("Rig Model:"), wxDefaultPosition, wxDefaultSize, 0),
- 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 20);
- m_cbRigName = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(250, -1), 0, NULL, wxCB_DROPDOWN);
- /* TODO(Joel): this is a hack. At the least, need to guarantee that m_hamLib
- * exists. */
- wxGetApp().m_hamlib->populateComboBox(m_cbRigName);
- m_cbRigName->SetSelection(wxGetApp().m_intHamlibRig);
- staticBoxSizer18->Add(m_cbRigName, 0, wxALIGN_CENTER_VERTICAL, 0);
-
- /* Hamlib Serial Port combobox. */
-
- staticBoxSizer18->Add(new wxStaticText(this, wxID_ANY, _("Serial Device:"), wxDefaultPosition, wxDefaultSize, 0),
- 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 20);
- m_cbSerialPort = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(140, -1), 0, NULL, wxCB_DROPDOWN);
- staticBoxSizer18->Add(m_cbSerialPort, 0, wxALIGN_CENTER_VERTICAL, 0);
-
- /* Hamlib Serial Rate combobox. */
-
- staticBoxSizer18->Add(new wxStaticText(this, wxID_ANY, _("Serial Rate:"), wxDefaultPosition, wxDefaultSize, 0),
- 0, wxALIGN_CENTER_VERTICAL | wxLEFT, 20);
- m_cbSerialRate = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(140, -1), 0, NULL, wxCB_DROPDOWN);
- staticBoxSizer18->Add(m_cbSerialRate, 0, wxALIGN_CENTER_VERTICAL, 0);
-
- mainSizer->Add(staticBoxSizer18, 0, wxEXPAND, 5);
-#endif
-
- wxStaticBoxSizer* staticBoxSizer18 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Hamlib Settings")), wxHORIZONTAL);
- wxGridSizer* gridSizerhl = new wxGridSizer(4, 2, 0, 0);
+ wxGridSizer* gridSizerhl = new wxGridSizer(5, 2, 0, 0);
staticBoxSizer18->Add(gridSizerhl, 1, wxEXPAND|wxALIGN_LEFT, 5);
/* Use Hamlib for PTT checkbox. */
m_cbSerialRate = new wxComboBox(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(140, -1), 0, NULL, wxCB_DROPDOWN);
gridSizerhl->Add(m_cbSerialRate, 0, wxALIGN_CENTER_VERTICAL, 0);
+ gridSizerhl->Add(new wxStaticText(this, wxID_ANY, _("Serial Params:"), wxDefaultPosition, wxDefaultSize, 0),
+ 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT, 20);
+ m_cbSerialParams = new wxStaticText(this, wxID_ANY, _(""), wxDefaultPosition, wxDefaultSize, 0);
+ gridSizerhl->Add(m_cbSerialParams, 0, wxALIGN_CENTER_VERTICAL, 0);
+
mainSizer->Add(staticBoxSizer18, 0, wxEXPAND, 5);
//----------------------------------------------------------------------
}
else {
wxString hamlib_serial_config;
- hamlib_serial_config.sprintf("Serial config: %d, %d, %d",
+ hamlib_serial_config.sprintf(" %d, %d, %d",
hamlib->get_serial_rate(),
hamlib->get_data_bits(),
hamlib->get_stop_bits());
- wxMessageBox(hamlib_serial_config, wxT("Hamlib Serial Config"), wxOK | wxICON_INFORMATION, this);
+ m_cbSerialParams->SetLabel(hamlib_serial_config);
}
// toggle PTT
#if defined(__WXGTK__) || defined(__WXOSX__)
ctrlport = m_cbCtlDevicePath->GetValue();
#endif
+ fprintf(stderr, "opening serial port\n");
+
bool success = serialport->openport(ctrlport.c_str(),
m_rbUseRTS->GetValue(),
m_ckRTSPos->IsChecked(),
m_rbUseDTR->GetValue(),
m_ckDTRPos->IsChecked());
+ fprintf(stderr, "serial port open\n");
+
if (!success) {
wxMessageBox("Couldn't open serial port", wxT("Error"), wxOK | wxICON_ERROR, this);
}
serialport->ptt(true);
wxSleep(1);
serialport->ptt(false);
+
+ fprintf(stderr, "closing serial port\n");
+ serialport->closeport();
+ fprintf(stderr, "serial port closed\n");
}
}
//-------------------------------------------------------------------------
int MainApp::OnExit()
{
+ fprintf(stderr, "MainApp::OnExit\n");
if (m_plugIn) {
#ifdef __WXMSW__
FreeLibrary((HMODULE)m_plugInHandle);
int w;
int h;
+ fprintf(stderr, "MainFrame::~MainFrame()\n");
//fclose(ftest);
#ifdef __WXMSW__
fclose(g_logfile);
if (wxGetApp().m_hamlib) delete wxGetApp().m_hamlib;
if (wxGetApp().m_serialport) delete wxGetApp().m_serialport;
- //MainApp *pApp = wxGetApp();
wxConfigBase *pConfig = wxConfigBase::Get();
if(pConfig)
{
if (!IsIconized()) {
GetClientSize(&w, &h);
-
- // big hack - for some reason height shrinks by this much
- // every time FreeDV runs! I have no idea why
-
- h += 23;
-
GetPosition(&x, &y);
printf("x = %d y = %d w = %d h = %d\n", x,y,w,h);
pConfig->Write(wxT("/MainFrame/left"), (long) x);
//-------------------------------------------------------------------------
void MainFrame::OnCloseFrame(wxCloseEvent& event)
{
+ fprintf(stderr, "MainFrame::OnCloseFrame()\n");
Pa_Terminate();
Destroy();
}
//-------------------------------------------------------------------------
void MainFrame::OnExit(wxCommandEvent& event)
{
+ fprintf(stderr, "MainFrame::OnExit\n");
wxUnusedVar(event);
#ifdef _USE_TIMER
m_plotTimer.Stop();
{
m_RxRunning = false;
- fprintf(g_logfile, "waiting for thread to stop");
+ fprintf(stderr, "waiting for thread to stop\n");
m_txRxThread->m_run = 0;
m_txRxThread->Wait();
- fprintf(g_logfile, "thread stopped");
+ fprintf(stderr, "thread stopped\n");
m_rxInPa->stop();
m_rxInPa->streamClose();