CODEC2=codec2
CODEC2_INC=-I$(CODEC2)/src
-CODEC2_LIB=$(CODEC2)/src/.libs/libcodec2.a
+CODEC2_LIB=$(CODEC2)/build_dir/src/libcodec2.a
# Sox ---------------------------------------------------
# (libmagic is rqd or later versions of Ubuntu)
# Codec 2 ----------------------------------------------------------
$(CODEC2)/.built: $(CODEC2)
- cd $(CODEC2) && ./configure && make && touch .built
+ cd $(CODEC2)/build_dir && cmake ../ && make && touch ../.built
$(CODEC2):
svn co https://freetel.svn.sourceforge.net/svnroot/freetel/codec2
wxStaticBoxSizer* sbSizer_testFrames;
sbSizer_testFrames = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Test Frames")), wxVERTICAL);
- m_ckboxTestFrame = new wxCheckBox(this, wxID_ANY, _("Enable"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
+ m_ckboxTestFrame = new wxCheckBox(this, wxID_ANY, _("Enable System Calls"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE);
sbSizer_testFrames->Add(m_ckboxTestFrame, 0, wxALIGN_LEFT, 0);
bSizer30->Add(sbSizer_testFrames,0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3);
// list of regexps
- wxStaticBoxSizer* sbSizer_regexp = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Regular Expressions to Process Events")), wxVERTICAL);
- m_txt_events_regexp = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(400,100), wxTE_MULTILINE);
- m_txt_events_regexp->SetToolTip(_("Enter regular expressions to process events"));
- sbSizer_regexp->Add(m_txt_events_regexp, 1, wxEXPAND, 5);
+ wxStaticBoxSizer* sbSizer_regexp = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("Regular Expressions to Process Events")), wxHORIZONTAL);
+ m_txt_events_regexp_match = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,100), wxTE_MULTILINE);
+ m_txt_events_regexp_match->SetToolTip(_("Enter regular expressions to match events"));
+ sbSizer_regexp->Add(m_txt_events_regexp_match, 1, wxEXPAND, 5);
+ m_txt_events_regexp_replace = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize(200,100), wxTE_MULTILINE);
+ m_txt_events_regexp_replace->SetToolTip(_("Enter regular expressions to replace events"));
+ sbSizer_regexp->Add(m_txt_events_regexp_replace, 1, wxEXPAND, 5);
sbSizer_events->Add(sbSizer_regexp, 1, wxEXPAND, 5);
// log of events and responses
m_sdbSizer5Cancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnCancel), NULL, this);
m_sdbSizer5OK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(OptionsDlg::OnOK), NULL, this);
+
+ event_in_serial = 0;
+ event_out_serial = 0;
}
//-------------------------------------------------------------------------
m_ckboxTestFrame->SetValue(wxGetApp().m_testFrames);
m_ckbox_events->SetValue(wxGetApp().m_events);
- m_txt_events_regexp->SetValue(wxGetApp().m_events_regexp);
+ m_txt_events_regexp_match->SetValue(wxGetApp().m_events_regexp_match);
+ m_txt_events_regexp_replace->SetValue(wxGetApp().m_events_regexp_replace);
if (wxGetApp().m_textEncoding == 1)
m_rb_textEncoding1->SetValue(true);
wxGetApp().m_testFrames = m_ckboxTestFrame->GetValue();
wxGetApp().m_events = m_ckbox_events->GetValue();
- wxGetApp().m_events_regexp = m_txt_events_regexp->GetValue();
+ wxGetApp().m_events_regexp_match = m_txt_events_regexp_match->GetValue();
+ wxGetApp().m_events_regexp_replace = m_txt_events_regexp_replace->GetValue();
if (m_rb_textEncoding1->GetValue())
wxGetApp().m_textEncoding = 1;
pConfig->Write(wxT("/Data/CallSign"), wxGetApp().m_callSign);
pConfig->Write(wxT("/Data/TextEncoding"), wxGetApp().m_textEncoding);
pConfig->Write(wxT("/Events/enable"), wxGetApp().m_events);
- pConfig->Write(wxT("/Events/regexp"), wxGetApp().m_events_regexp);
+ pConfig->Write(wxT("/Events/regexp_match"), wxGetApp().m_events_regexp_match);
+ pConfig->Write(wxT("/Events/regexp_replace"), wxGetApp().m_events_regexp_replace);
pConfig->Flush();
}
}
{
ExchangeData(EXCHANGE_DATA_IN, false);
}
+
+
+void OptionsDlg::updateEventLog(wxString event_in, wxString event_out) {
+ wxString event_in_with_serial, event_out_with_serial;
+ event_in_with_serial.Printf(_T("[%d] %s"), event_in_serial++, event_in);
+ event_out_with_serial.Printf(_T("[%d] %s"), event_out_serial++, event_out);
+
+ m_txt_events_in->AppendText(event_in_with_serial+"\n");
+ m_txt_events_out->AppendText(event_out_with_serial+"\n");
+}
+
#define __OPTIONS_DIALOG__
#include "fdmdv2_main.h"
+#include "fdmdv2_defines.h"
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
// Class OptionsDlg
~OptionsDlg();
void ExchangeData(int inout, bool storePersistent);
+ void updateEventLog(wxString event_in, wxString event_out);
+
+ bool enableEventsChecked() {return m_ckbox_events->GetValue();}
protected:
// Handlers for events.
wxRadioButton *m_rb_textEncoding2;
wxCheckBox *m_ckbox_events;
- wxTextCtrl *m_txt_events_regexp;
+ wxTextCtrl *m_txt_events_regexp_match;
+ wxTextCtrl *m_txt_events_regexp_replace;
wxTextCtrl *m_txt_events_in;
wxTextCtrl *m_txt_events_out;
wxTextCtrl *m_txt_event_test;
wxButton* m_sdbSizer5OK;
wxButton* m_sdbSizer5Cancel;
+ unsigned int event_in_serial, event_out_serial;
+
private:
};
// Text messaging Data
#define MAX_CALLSIGN 80
-
+#define MAX_EVENT_LOG 10
+
enum
{
ID_ROTATE_LEFT = wxID_HIGHEST + 1,
wxGetApp().m_callSign = pConfig->Read("/Data/CallSign", wxT(""));
wxGetApp().m_textEncoding = pConfig->Read("/Data/TextEncoding", 1);
wxGetApp().m_events = pConfig->Read("/Events/enable", f);
- wxGetApp().m_events_regexp = pConfig->Read("/Events/regexp",
- wxT("s|onstart,mycallsign=(.*),|curl http://qso.freedv.org/cgi-bin/onstart.cgi?callsign=$1|"));
+ wxGetApp().m_events_regexp_match = pConfig->Read("/Events/regexp_match", wxT("s=(.*)"));
+ wxGetApp().m_events_regexp_replace = pConfig->Read("/Events/regexp_replace",
+ wxT("curl http://qso.freedv.org/cgi-bin/onspot.cgi?s=\\1"));
pConfig->SetPath(wxT("/"));
g_total_bits = 0;
wxGetApp().m_testFrames = false;
+ for(int i=0; i<MAX_EVENT_LOG; i++)
+ m_event_log[i][0] = 0;
+
m_modal = false;
}
pConfig->Write(wxT("/Data/CallSign"), wxGetApp().m_callSign);
pConfig->Write(wxT("/Data/TextEncoding"), wxGetApp().m_textEncoding);
pConfig->Write(wxT("/Events/enable"), wxGetApp().m_events);
- pConfig->Write(wxT("/Events/regexp"), wxGetApp().m_events_regexp);
+ pConfig->Write(wxT("/Events/regexp_match"), wxGetApp().m_events_regexp_match);
+ pConfig->Write(wxT("/Events/regexp_replace"), wxGetApp().m_events_regexp_replace);
pConfig->Write(wxT("/Filter/MicInEQEnable"), wxGetApp().m_MicInEQEnable);
pConfig->Write(wxT("/Filter/SpkOutEQEnable"), wxGetApp().m_SpkOutEQEnable);
// lets see if checksum is OK
unsigned char checksum_rx = 0;
- for(unsigned int i=0; i<strlen(m_callsign)-2; i++)
- checksum_rx += callsign[i];
+ if (strlen(m_callsign) > 2) {
+ for(unsigned int i=0; i<strlen(m_callsign)-2; i++)
+ checksum_rx += m_callsign[i];
+ }
unsigned int checksum_tx;
int ret = sscanf(&m_callsign[strlen(m_callsign)-2], "%2x", &checksum_tx);
- //printf("checksums: %2x %2x\n", checksum_tx, checksum_rx);
+ printf("m_callsign: %s checksums: %2x %2x\n", m_callsign, checksum_tx, checksum_rx);
wxString s;
if (ret && (checksum_tx == checksum_rx)) {
m_callsign[strlen(m_callsign)-2] = 0;
s.Printf("%s", m_callsign);
m_txtCtrlCallSign->SetValue(s);
+ processTxtEvent(m_callsign);
m_checksumGood++;
s.Printf("%d", m_checksumGood);
void MainFrame::OnToolsOptions(wxCommandEvent& event)
{
wxUnusedVar(event);
- OptionsDlg *dlg = new OptionsDlg(NULL);
+ optionsDlg = new OptionsDlg(NULL);
m_modal=true;
- dlg->ShowModal();
+ optionsDlg->ShowModal();
m_modal=false;
- delete dlg;
+ delete optionsDlg;
+ optionsDlg = NULL;
}
//-------------------------------------------------------------------------
}
}
+
+void MainFrame::processTxtEvent(char event[]) {
+
+ // process with regexp and issue system command
+
+ wxString event_str(event);
+ wxRegEx re(wxGetApp().m_events_regexp_match);
+ wxString regexp_replace_str(wxGetApp().m_events_regexp_replace);
+ re.Replace(&event_str, regexp_replace_str);
+ const char *event_out = event_str.ToUTF8();
+
+ wxString event_out_with_return_code;
+
+ bool enableSystem = false;
+ if (wxGetApp().m_events)
+ enableSystem = true;
+
+ // If options dialog is up current value of events checkbox overrides
+
+ if (optionsDlg != NULL) {
+ if (optionsDlg->enableEventsChecked())
+ enableSystem = true;
+ else
+ enableSystem = false;
+ }
+
+ if (enableSystem) {
+ int ret = wxExecute(event_str);
+ event_out_with_return_code.Printf(_T("%s -> process ID %d"), event_out, ret);
+ }
+ else {
+ event_out_with_return_code.Printf(_T("%s)"), event_out);
+ }
+
+ // update event log GUI if currently displayed
+
+ if (optionsDlg != NULL) {
+ optionsDlg->updateEventLog(wxString(event), event_out_with_return_code);
+ }
+}
+
+
#define SBQ_MAX_ARGS 4
void *MainFrame::designAnEQFilter(const char filterType[], float freqHz, float gaindB, float Q)
// RX side processing --------------------------------------------
//
- // assemble a mono buffer (just use left channel if stereo) and write to FIFO
+ // assemble a mono buffer and write to FIFO
assert(framesPerBuffer < MAX_FPB);
if(rptr) {
for(i = 0; i < framesPerBuffer; i++, rptr += cbData->inputChannels1)
- {
- indata[i] = *rptr;
- }
+ indata[i] = rptr[0];
if (fifo_write(cbData->infifo1, indata, framesPerBuffer)) {
//wxLogDebug("infifo1 full\n");
}
// if (statusFlags)
// printf("cb2 statusFlags: 0x%x\n", (int)statusFlags);
- // assemble a mono buffer (just use left channel) and write to FIFO
+ // assemble a mono buffer and write to FIFO
assert(framesPerBuffer < MAX_FPB);
if(rptr) {
for(i = 0; i < framesPerBuffer; i++, rptr += cbData->inputChannels2)
- {
- indata[i] = *rptr;
- }
+ indata[i] = rptr[0];
}
//#define SC2_LOOPBACK
#include <wx/sstream.h>
#include <wx/listbox.h>
#include <wx/textdlg.h>
+#include <wx/regex.h>
#include <samplerate.h>
#include "topFrame.h"
#include "dlg_ptt.h"
+#include "dlg_options.h"
#include "fdmdv2_plot.h"
#include "fdmdv2_plot_scalar.h"
#include "fdmdv2_plot_scatter.h"
wxString m_callSign;
bool m_events;
unsigned int m_textEncoding;
- wxString m_events_regexp;
+ wxString m_events_regexp_match;
+ wxString m_events_regexp_replace;
bool m_snrSlow;
unsigned int m_checksumGood;
unsigned int m_checksumBad;
+ // Events
+ char m_event_log[MAX_EVENT_LOG][MAX_CALLSIGN];
+ void processTxtEvent(char event[]);
+ class OptionsDlg *optionsDlg;
+
// level Gauge
float m_maxLevel;