wxBoxSizer* bSizer30;
bSizer30 = new wxBoxSizer(wxVERTICAL);
+ //------------------------------
+ // Txt Msg Text Box
+ //------------------------------
+
+ wxStaticBoxSizer* sbSizer_callSign;
+ wxStaticBox *sb_textMsg = new wxStaticBox(this, wxID_ANY, _("Txt Msg"));
+ sbSizer_callSign = new wxStaticBoxSizer(sb_textMsg, wxVERTICAL);
+
+ m_txtCtrlCallSign = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
+ m_txtCtrlCallSign->SetToolTip(_("Txt Msg you can send along with Voice"));
+ sbSizer_callSign->Add(m_txtCtrlCallSign, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3);
+
+ bSizer30->Add(sbSizer_callSign,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
+#ifdef __WXMSW__
+ //------------------------------
+ // debug console, for WIndows build make console pop up for debug messages
+ //------------------------------
+
+ wxStaticBoxSizer* sbSizer_console;
+ wxStaticBox *sb_console = new wxStaticBox(this, wxID_ANY, _("Debug"));
+ sbSizer_console = new wxStaticBoxSizer(sb_console, wxHORIZONTAL);
+
+ m_ckboxDebugConsole = new wxCheckBox(this, wxID_ANY, _("Show Console"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+ sbSizer_console->Add(m_ckboxDebugConsole, 0, wxALIGN_LEFT, 0);
+
+ bSizer30->Add(sbSizer_console,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+#endif
+
+ //------------------------------
+ // FreeDV 700 Options
+ //------------------------------
+
+ wxStaticBoxSizer* sbSizer_freedv700;
+ wxStaticBox *sb_freedv700 = new wxStaticBox(this, wxID_ANY, _("FreeDV 700 Options"));
+ sbSizer_freedv700 = new wxStaticBoxSizer(sb_freedv700, wxHORIZONTAL);
+
+ m_ckboxFreeDV700txClip = new wxCheckBox(this, wxID_ANY, _("Clipping"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+ sbSizer_freedv700->Add(m_ckboxFreeDV700txClip, 0, wxALIGN_LEFT, 0);
+ m_ckboxFreeDV700Combine = new wxCheckBox(this, wxID_ANY, _("Diversity Combine for plots"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+ sbSizer_freedv700->Add(m_ckboxFreeDV700Combine, 0, wxALIGN_LEFT, 0);
+
+ bSizer30->Add(sbSizer_freedv700,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+
//------------------------------
// Test Frames/Channel simulation check box
//------------------------------
bSizer30->Add(sbSizer_tone,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
- //------------------------------
- // FreeDV 700 Options
- //------------------------------
-
- wxStaticBoxSizer* sbSizer_freedv700;
- wxStaticBox *sb_freedv700 = new wxStaticBox(this, wxID_ANY, _("FreeDV 700 Options"));
- sbSizer_freedv700 = new wxStaticBoxSizer(sb_freedv700, wxHORIZONTAL);
-
- m_ckboxFreeDV700txClip = new wxCheckBox(this, wxID_ANY, _("Clipping"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
- sbSizer_freedv700->Add(m_ckboxFreeDV700txClip, 0, wxALIGN_LEFT, 0);
- m_ckboxFreeDV700Combine = new wxCheckBox(this, wxID_ANY, _("Diversity Combine for plots"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
- sbSizer_freedv700->Add(m_ckboxFreeDV700Combine, 0, wxALIGN_LEFT, 0);
-
- bSizer30->Add(sbSizer_freedv700,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
-
- //------------------------------
- // Txt Msg Text Box
- //------------------------------
-
- wxStaticBoxSizer* sbSizer_callSign;
- wxStaticBox *sb_textMsg = new wxStaticBox(this, wxID_ANY, _("Txt Msg"));
- sbSizer_callSign = new wxStaticBoxSizer(sb_textMsg, wxVERTICAL);
-
- m_txtCtrlCallSign = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
- m_txtCtrlCallSign->SetToolTip(_("Txt Msg you can send along with Voice"));
- sbSizer_callSign->Add(m_txtCtrlCallSign, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 3);
-
- bSizer30->Add(sbSizer_callSign,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
-
+#ifdef __EXPERIMENTAL_UDP__
//------------------------------
// Txt Encoding
//------------------------------
sbSizer_udp->Add(m_txt_udp_port, 0, wxALIGN_CENTER_HORIZONTAL, 5);
bSizer30->Add(sbSizer_udp,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
+#endif
//------------------------------
// OK - Cancel - Apply Buttons
m_sdbSizer5Apply = new wxButton(this, wxID_APPLY);
bSizer31->Add(m_sdbSizer5Apply, 0, wxALL, 2);
- bSizer30->Add(bSizer31, 0, wxALIGN_RIGHT|wxALL, 0);
+ bSizer30->Add(bSizer31, 0, wxALIGN_CENTER_HORIZONTAL, 0);
this->SetSizer(bSizer30);
this->Layout();
m_ckboxFreeDV700txClip->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700txClip), NULL, this);
m_ckboxFreeDV700Combine->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700Combine), NULL, this);
+#ifdef __WXMSW__
+ m_ckboxDebugConsole->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnDebugConsole), NULL, this);
+#endif
+
event_in_serial = 0;
event_out_serial = 0;
}
m_ckboxFreeDV700txClip->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700txClip), NULL, this);
m_ckboxFreeDV700Combine->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnFreeDV700Combine), NULL, this);
+
+#ifdef __WXMSW__
+ m_ckboxDebugConsole->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxScrollEventHandler(OptionsDlg::OnDebugConsole), NULL, this);
+#endif
}
m_ckboxAttnCarrierEn->SetValue(wxGetApp().m_attn_carrier_en);
m_txtAttnCarrier->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_attn_carrier));
+#ifdef __EXPERIMENTAL_UDP__
m_ckbox_events->SetValue(wxGetApp().m_events);
m_txt_spam_timer->SetValue(wxString::Format(wxT("%i"),wxGetApp().m_events_spam_timer));
m_rb_textEncoding2->SetValue(true);
#endif
m_ckboxEnableChecksum->SetValue(wxGetApp().m_enable_checksum);
+#endif
m_ckboxFreeDV700txClip->SetValue(wxGetApp().m_FreeDV700txClip);
m_ckboxFreeDV700Combine->SetValue(wxGetApp().m_FreeDV700Combine);
+
+#ifdef __WXMSW__
+ m_ckboxDebugConsole->SetValue(wxGetApp().m_debug_console);
+#endif
}
if(inout == EXCHANGE_DATA_OUT)
m_txtAttnCarrier->GetValue().ToLong(&attn_carrier);
wxGetApp().m_attn_carrier = (int)attn_carrier;
+#ifdef __EXPERIMENTAL_UDP__
wxGetApp().m_events = m_ckbox_events->GetValue();
long spam_timer;
m_txt_spam_timer->GetValue().ToLong(&spam_timer);
wxGetApp().m_textEncoding = 2;
#endif
wxGetApp().m_enable_checksum = m_ckboxEnableChecksum->GetValue();
+#endif
wxGetApp().m_FreeDV700txClip = m_ckboxFreeDV700txClip->GetValue();
wxGetApp().m_FreeDV700Combine = m_ckboxFreeDV700Combine->GetValue();
+#ifdef __WXMSW__
+ wxGetApp().m_debug_console = m_ckboxDebugConsole->GetValue();
+#endif
+
if (storePersistent) {
pConfig->Write(wxT("/Data/CallSign"), wxGetApp().m_callSign);
#ifdef SHORT_VARICODE
pConfig->Write(wxT("/Noise/noise_snr"), wxGetApp().m_noise_snr);
+#ifdef __WXMSW__
+ pConfig->Write(wxT("/Debug/console"), wxGetApp().m_debug_console);
+#endif
+
pConfig->Flush();
}
}
m_txt_events_out->AppendText(event_out_with_serial+"\n");
}
+
+void OptionsDlg::OnDebugConsole(wxScrollEvent& event) {
+ wxGetApp().m_debug_console = m_ckboxDebugConsole->GetValue();
+#ifdef __WXMSW__
+ // somewhere to send printfs while developing, causes conmsole to pop up on Windows
+ if (wxGetApp().m_debug_console) {
+ int ret = AllocConsole();
+ freopen("CONOUT$", "w", stdout);
+ freopen("CONOUT$", "w", stderr);
+ fprintf(stderr, "AllocConsole: %d m_debug_console: %d\n", ret, wxGetApp().m_debug_console);
+ }
+#endif
+}
public:
OptionsDlg( wxWindow* parent,
wxWindowID id = wxID_ANY, const wxString& title = _("Options"),
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(600,660),
+ const wxPoint& pos = wxDefaultPosition,
+#ifdef __WXMSW__
+ /* we add debug console check box for windows */
+ const wxSize& size = wxSize(600,330),
+#else
+ const wxSize& size = wxSize(600,300),
+#endif
long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~OptionsDlg();
void OnAttnCarrierEn(wxScrollEvent& event);
void OnFreeDV700txClip(wxScrollEvent& event);
void OnFreeDV700Combine(wxScrollEvent& event);
+ void OnDebugConsole(wxScrollEvent& event);
wxTextCtrl *m_txtCtrlCallSign; // TODO: this should be renamed to tx_txtmsg, and rename all related incl persis strge
wxCheckBox *m_ckboxTestFrame;
wxButton* m_sdbSizer5Cancel;
wxButton* m_sdbSizer5Apply;
+ wxCheckBox *m_ckboxDebugConsole;
+
unsigned int event_in_serial, event_out_serial;
private:
//-------------------------------------------------------------------------
void ComPortsDlg::populatePortList()
{
+
+ /* populate Hamlib serial rate combo box */
+
+ wxString serialRates[] = {"auto", "300", "1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200"};
+ fprintf(stderr, "populating serial rates...\n");
+ for(int i=0; i<WXSIZEOF(serialRates); i++) {
+ m_cbSerialRate->Append(serialRates[i]);
+ }
+
#ifdef __WXMSW__
m_listCtrlPorts->Clear();
m_cbSerialPort->Clear();
m_cbSerialPort->Append("/dev/ttyS0");
m_cbSerialPort->Append("/dev/ttyS1");
- /* populate Hamlib serial rate combo box */
-
- wxString serialRates[] = {"auto", "300", "1200", "2400", "4800", "9600", "19200", "38400", "57600", "115200"};
- for(int i=0; i<WXSIZEOF(serialRates); i++) {
- m_cbSerialRate->Append(serialRates[i]);
- }
-
m_cbCtlDevicePath->Clear();
m_cbCtlDevicePath->Append("/dev/ttyUSB0");
m_cbCtlDevicePath->Append("/dev/ttyUSB1");
m_cbCtlDevicePath->Append("/dev/ttyS1");
#endif
#endif
+
+
}
//-------------------------------------------------------------------------
SetVendorName(wxT("CODEC2-Project"));
SetAppName(wxT("FreeDV")); // not needed, it's the default value
- // DR - this is wrong define so won't be used on windows build, should be __WXMSW__
- // So registry will be used for Win32
-#ifdef _WXMSW_
+#ifdef FILE_RATHER_THAN_REGISTRY
// Force use of file-based configuration persistance on Windows platforma
wxConfig *pConfig = new wxConfig();
wxFileConfig *pFConfig = new wxFileConfig(wxT("FreeDV"), wxT("CODEC2-Project"), wxT("FreeDV.conf"), wxT("FreeDV.conf"), wxCONFIG_USE_LOCAL_FILE | wxCONFIG_USE_RELATIVE_PATH);
wxGetApp().m_FreeDV700txClip = (float)pConfig->Read(wxT("/FreeDV700/txClip"), t);
wxGetApp().m_FreeDV700Combine = 1;
wxGetApp().m_noise_snr = (float)pConfig->Read(wxT("/Noise/noise_snr"), 2);
+
+ wxGetApp().m_debug_console = (float)pConfig->Read(wxT("/Debug/console"), f);
wxGetApp().m_attn_carrier_en = 0;
wxGetApp().m_attn_carrier = 0;
g_modal = false;
+#ifdef __EXPERIMENTAL_UDP__
// Start UDP listener thread
m_UDPThread = NULL;
startUDPThread();
+#endif
optionsDlg = new OptionsDlg(NULL);
m_schedule_restore = false;
vk_state = VK_IDLE;
+ // Init optional Windows debug console so we can see all those printfs
+
+#ifdef __WXMSW__
+ if (wxGetApp().m_debug_console) {
+ // somewhere to send printfs while developing
+ int ret = AllocConsole();
+ freopen("CONOUT$", "w", stdout);
+ freopen("CONOUT$", "w", stderr);
+ fprintf(stderr, "AllocConsole: %d m_debug_console: %d\n", ret, wxGetApp().m_debug_console);
+ }
+#endif
+
//ftest = fopen("ftest.raw", "wb");
//assert(ftest != NULL);
}
optionsDlg = NULL;
}
+#ifdef __EXPERIMENTAL_UDP__
stopUDPThread();
+#endif
/* TOOD(Joel): the ownership of m_hamlib is probably wrong. */
if (wxGetApp().m_hamlib) delete wxGetApp().m_hamlib;
pConfig->Write(wxT("/FreeDV700/txClip"), wxGetApp().m_FreeDV700txClip);
pConfig->Write(wxT("/Noise/noise_snr"), wxGetApp().m_noise_snr);
+ pConfig->Write(wxT("/Debug/console"), wxGetApp().m_debug_console);
+
int mode;
if (m_rb1600->GetValue())
mode = 0;
s.Printf("%s", m_callsign);
m_txtCtrlCallSign->SetValue(s);
+#ifdef __UDP_EXPERIMENTAL__
char s1[MAX_CALLSIGN];
sprintf(s1,"rx_txtmsg %s", m_callsign);
processTxtEvent(s1);
m_checksumGood++;
s.Printf("%d", m_checksumGood);
m_txtChecksumGood->SetLabel(s);
+#endif
}
else {
+#ifdef __UDP_EXPERIMENTAL__
m_checksumBad++;
s.Printf("%d", m_checksumBad);
m_txtChecksumBad->SetLabel(s);
+#endif
}
}
m_schedule_restore = false;
}
+#ifdef __UDP_EXPERIMENTAL__
// Light Spam Timer LED if at least one timer is running
int i;
for(i=0; i<MAX_EVENT_RULES; i++)
if (spamTimer[i].IsRunning())
optionsDlg->SetSpamTimerLight(true);
+#endif
// Blink file playback status line
// rx-> tx transition, swap to Mic In page to monitor speech
wxGetApp().m_rxNbookCtrl = m_auiNbookCtrl->GetSelection();
m_auiNbookCtrl->ChangeSelection(m_auiNbookCtrl->GetPageIndex((wxWindow *)m_panelSpeechIn));
+#ifdef __UDP_EXPERIMENTAL__
char e[80]; sprintf(e,"ptt"); processTxtEvent(e);
+#endif
}
g_tx = m_btnTogPTT->GetValue();
wxString s;
s.Printf("%s", m_callsign);
m_txtCtrlCallSign->SetValue(s);
+#ifdef __UDP__EXPERIMENTAL__
m_checksumGood = m_checksumBad = 0;
m_txtChecksumGood->SetLabel(_("0"));
m_txtChecksumBad->SetLabel(_("0"));
+#endif
}
void MainFrame::OnBerReset(wxCommandEvent& event)
m_pcallsign = m_callsign;
memset(m_callsign, 0, sizeof(m_callsign));
+#ifdef __UDP_EXPERIMENTAL__
m_checksumGood = m_checksumBad = 0;
wxString s;
s.Printf("%d", m_checksumGood);
m_txtChecksumGood->SetLabel(s);
s.Printf("%d", m_checksumBad);
m_txtChecksumBad->SetLabel(s);
+#endif
m_maxLevel = 0;
m_textLevel->SetLabel(wxT(""));
m_plotTimer.Start(_REFRESH_TIMER_PERIOD, wxTIMER_CONTINUOUS);
#endif // _USE_TIMER
}
+#ifdef __UDP_EXPERIMENTAL__
char e[80]; sprintf(e,"start"); processTxtEvent(e);
+#endif
}
// Stop was pressed or start up failed
// Stop Running -------------------------------------------------
//
+#ifdef __UDP_EXPERIMENTAL__
optionsDlg->SetSpamTimerLight(false);
+#endif
#ifdef _USE_TIMER
m_plotTimer.Stop();
m_rb1400->Enable();
m_rb2000->Enable();
#endif
+#ifdef __UDP_EXPERIMENTAL__
char e[80]; sprintf(e,"stop"); processTxtEvent(e);
+#endif
}
}
}
void MainFrame::startUDPThread(void) {
- printf("starting UDP thread!\n");
+ fprintf(stderr, "starting UDP thread!\n");
m_UDPThread = new UDPThread;
m_UDPThread->mf = this;
if (m_UDPThread->Create() != wxTHREAD_NO_ERROR ) {
int m_tone_freq_hz;
int m_tone_amplitude;
+ // Windows debug console
+ bool m_debug_console;
protected:
};
/* Reset debug output. */
rig_set_debug(RIG_DEBUG_VERBOSE);
- m_rig = NULL;
+ m_rig = NULL;
}
Hamlib::~Hamlib() {
}
bool Hamlib::ptt(bool press) {
- if(!m_rig)
- return false;
+ fprintf(stderr,"Hamlib::ptt: %d\n", press);
+
+ if(!m_rig)
+ return false;
/* TODO(Joel): make ON_DATA and ON configurable. */
ptt_t on = press ? RIG_PTT_ON : RIG_PTT_OFF;
/* TODO(Joel): what should the VFO option be? */
- return rig_set_ptt(m_rig, RIG_VFO_CURR, on) == RIG_OK;
+ int status = rig_set_ptt(m_rig, RIG_VFO_CURR, on) == RIG_OK;
+ fprintf(stderr,"Hamlib::ptt: rig_set_ptt returned: %d\n", status);
+ return status;
}
void Hamlib::close(void) {
- if(m_rig) {
- rig_close(m_rig);
- rig_cleanup(m_rig);
- m_rig = NULL;
- }
+ if(m_rig) {
+ rig_close(m_rig);
+ rig_cleanup(m_rig);
+ m_rig = NULL;
+ }
}
bSizer15->Add(m_txtCtrlCallSign, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL|wxEXPAND, 5);
lowerSizer->Add(bSizer15, 1, wxEXPAND, 5);
+#ifdef __EXPERIMENTAL_UDP__
wxStaticBoxSizer* sbSizer_Checksum = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Checksums")), wxHORIZONTAL);
wxStaticText *goodLabel = new wxStaticText(this, wxID_ANY, wxT("Good: "), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE);
sbSizer_Checksum->Add(m_txtChecksumBad, 0, 0, 1);
lowerSizer->Add(sbSizer_Checksum, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+#endif
//=====================================================
// These are the buttons that autosend the userid (?)