git-svn-id: https://svn.code.sf.net/p/freetel/code@1084 01035d8c-6547-0410-b346-abe4f...
authorwittend99 <wittend99@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 29 Nov 2012 22:18:52 +0000 (22:18 +0000)
committerwittend99 <wittend99@01035d8c-6547-0410-b346-abe4f91aad63>
Thu, 29 Nov 2012 22:18:52 +0000 (22:18 +0000)
14 files changed:
fdmdv2/build/fdmdv2.mk
fdmdv2/build/fdmdv2.project
fdmdv2/build/fdmdv2.txt
fdmdv2/build/fdmdv2.workspace
fdmdv2/build/wxcrafter.xrc [new file with mode: 0644]
fdmdv2/src/FDMDV2.fbp
fdmdv2/src/dlg_audiooptions.cpp
fdmdv2/src/dlg_comports.cpp
fdmdv2/src/dlg_comports.h
fdmdv2/src/fdmdv2_main.cpp
fdmdv2/src/fdmdv2_main.h
fdmdv2/src/topFrame.cpp
fdmdv2/src/topFrame.h
fdmdv2/tests/pa_enum/pa_enum.mk

index 05ae05746f1d7061dbf83bd1e99213b742f09cd3..6f14343993e9d7e226e46a125001048a6c876687 100644 (file)
@@ -13,7 +13,7 @@ CurrentFileName        :=
 CurrentFilePath        :=\r
 CurrentFileFullPath    :=\r
 User                   :=wittend\r
-Date                   :=11/25/2012\r
+Date                   :=11/29/2012\r
 CodeLitePath           :="D:\bin\CodeLite"\r
 LinkerName             :=g++\r
 SharedObjectLinkerName :=g++ -shared -fPIC\r
@@ -41,8 +41,8 @@ LinkOptions            :=  -mwindows $(shell wx-config --debug=yes --libs --unic
 IncludePath            :=  $(IncludeSwitch). $(IncludeSwitch)/bin/MinGW-4.6.1/msys/1.0/local/include $(IncludeSwitch)../../codec2-dev/src $(IncludeSwitch)/bin/Projects/Audio/libsndfile/include \r
 IncludePCH             := \r
 RcIncludePath          := \r
-Libs                   := $(LibrarySwitch)sndfile-1 $(LibrarySwitch)codec2 $(LibrarySwitch)portaudio $(LibrarySwitch)portaudiocpp $(LibrarySwitch)samplerate \r
-ArLibs                 :=  "libsndfile-1.dll" "codec2" "libportaudio.a" "libportaudiocpp.a" "libsamplerate.a\r
+Libs                   := $(LibrarySwitch)sndfile-1 $(LibrarySwitch)codec2 $(LibrarySwitch)portaudio $(LibrarySwitch)portaudiocpp $(LibrarySwitch)samplerate.dll $(LibrarySwitch)ctb-0.16 \r
+ArLibs                 :=  "libsndfile-1.dll" "codec2" "libportaudio.a" "libportaudiocpp.a" "libsamplerate.dll.a" "ctb-0.16.dll\r
 LibPath                := $(LibraryPathSwitch). $(LibraryPathSwitch)d:/Projects/Radio/codec2-dev/src/.libs $(LibraryPathSwitch)d:/bin/MinGW-4.6.1/msys/1.0/local/lib $(LibraryPathSwitch)d:/Projects/Audio/libsndfile/lib \r
 \r
 ##\r
@@ -52,8 +52,8 @@ LibPath                := $(LibraryPathSwitch). $(LibraryPathSwitch)d:/Projects/
 AR       := ar rcus\r
 CXX      := g++\r
 CC       := gcc\r
-CXXFLAGS :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1066\"  $(Preprocessors)\r
-CFLAGS   :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1066\"  $(Preprocessors)\r
+CXXFLAGS :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
+CFLAGS   :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
 \r
 \r
 ##\r
@@ -65,7 +65,7 @@ PATH:=$(WXWIN)\lib\gcc_dll;$(PATH)
 WXCFG:=gcc_dll\mswu\r
 UNIT_TEST_PP_SRC_DIR:=D:\bin\UnitTest++-1.3\r
 Objects=$(IntermediateDirectory)/src_dlg_comports$(ObjectSuffix) $(IntermediateDirectory)/src_fdmdv2_main$(ObjectSuffix) $(IntermediateDirectory)/src_fdmdv2_plot$(ObjectSuffix) $(IntermediateDirectory)/src_topFrame$(ObjectSuffix) $(IntermediateDirectory)/src_fdmdv2_plot_scatter$(ObjectSuffix) $(IntermediateDirectory)/src_fdmdv2_plot_spectrum$(ObjectSuffix) $(IntermediateDirectory)/src_fdmdv2_pa_wrapper$(ObjectSuffix) $(IntermediateDirectory)/src_fdmdv2_plot_scalar$(ObjectSuffix) $(IntermediateDirectory)/src_fdmdv2_hdw_ports$(ObjectSuffix) $(IntermediateDirectory)/src_fdmdv2_plot_waterfall_linux$(ObjectSuffix) \\r
-       $(IntermediateDirectory)/src_dlg_audiooptions$(ObjectSuffix) $(IntermediateDirectory)/src_dlg_filter$(ObjectSuffix) \r
+       $(IntermediateDirectory)/src_dlg_audiooptions$(ObjectSuffix) $(IntermediateDirectory)/src_dlg_filter$(ObjectSuffix) $(IntermediateDirectory)/src_varicode$(ObjectSuffix) \r
 \r
 ##\r
 ## Main Build Targets \r
@@ -184,6 +184,14 @@ $(IntermediateDirectory)/src_dlg_filter$(DependSuffix): ../src/dlg_filter.cpp
 $(IntermediateDirectory)/src_dlg_filter$(PreprocessSuffix): ../src/dlg_filter.cpp\r
        @$(CXX) $(CXXFLAGS) $(IncludePCH) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_dlg_filter$(PreprocessSuffix) "D:/Projects/Radio/fdmdv2/src/dlg_filter.cpp"\r
 \r
+$(IntermediateDirectory)/src_varicode$(ObjectSuffix): ../src/varicode.c $(IntermediateDirectory)/src_varicode$(DependSuffix)\r
+       $(CC) $(SourceSwitch) "D:/Projects/Radio/fdmdv2/src/varicode.c" $(CFLAGS) $(ObjectSwitch)$(IntermediateDirectory)/src_varicode$(ObjectSuffix) $(IncludePath)\r
+$(IntermediateDirectory)/src_varicode$(DependSuffix): ../src/varicode.c\r
+       @$(CC) $(CFLAGS) $(IncludePath) -MG -MP -MT$(IntermediateDirectory)/src_varicode$(ObjectSuffix) -MF$(IntermediateDirectory)/src_varicode$(DependSuffix) -MM "D:/Projects/Radio/fdmdv2/src/varicode.c"\r
+\r
+$(IntermediateDirectory)/src_varicode$(PreprocessSuffix): ../src/varicode.c\r
+       @$(CC) $(CFLAGS) $(IncludePath) $(PreprocessOnlySwitch) $(OutputSwitch) $(IntermediateDirectory)/src_varicode$(PreprocessSuffix) "D:/Projects/Radio/fdmdv2/src/varicode.c"\r
+\r
 \r
 -include $(IntermediateDirectory)/*$(DependSuffix)\r
 ##\r
@@ -226,6 +234,9 @@ clean:
        $(RM) $(IntermediateDirectory)/src_dlg_filter$(ObjectSuffix)\r
        $(RM) $(IntermediateDirectory)/src_dlg_filter$(DependSuffix)\r
        $(RM) $(IntermediateDirectory)/src_dlg_filter$(PreprocessSuffix)\r
+       $(RM) $(IntermediateDirectory)/src_varicode$(ObjectSuffix)\r
+       $(RM) $(IntermediateDirectory)/src_varicode$(DependSuffix)\r
+       $(RM) $(IntermediateDirectory)/src_varicode$(PreprocessSuffix)\r
        $(RM) $(OutputFile)\r
        $(RM) $(OutputFile).exe\r
        $(RM) "D:\Projects\Radio\fdmdv2\build\.build-debug\fdmdv2"\r
index 5c5379e073f98e6c8605ce6eb4653556371006e9..c501bcca985a42eefba756b44cb055f101092c60 100644 (file)
@@ -20,6 +20,7 @@
     <File Name="../src/fdmdv2_plot_waterfall_linux.cpp"/>
     <File Name="../src/dlg_audiooptions.cpp"/>
     <File Name="../src/dlg_filter.cpp"/>
+    <File Name="../src/varicode.c"/>
   </VirtualDirectory>
   <VirtualDirectory Name="include">
     <File Name="../src/dlg_comports.h"/>
@@ -44,6 +45,8 @@
     <File Name="../src/fdmdv2_plot_waterfall_linux.h"/>
     <File Name="../src/dlg_audiooptions.h"/>
     <File Name="../src/dlg_filter.h"/>
+    <File Name="../src/varicode.h"/>
+    <File Name="../src/varicode_table.h"/>
   </VirtualDirectory>
   <VirtualDirectory Name="resources">
     <File Name="../src/FDMDV2.fbp"/>
@@ -75,7 +78,8 @@
         <Library Value="codec2"/>
         <Library Value="libportaudio.a"/>
         <Library Value="libportaudiocpp.a"/>
-        <Library Value="libsamplerate.a"/>
+        <Library Value="libsamplerate.dll.a"/>
+        <Library Value="ctb-0.16.dll"/>
       </Linker>
       <ResourceCompiler Options="$(shell wx-config --rcflags)" Required="no"/>
       <General OutputFile="$(IntermediateDirectory)/$(ProjectName)" IntermediateDirectory="./Debug" Command="./$(ProjectName)" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="no"/>
         <Library Value="libportaudio.a"/>
         <Library Value="libportaudiocpp.a"/>
         <Library Value="libsamplerate.dll.a"/>
+        <Library Value="ctb-0.16.dll"/>
       </Linker>
       <ResourceCompiler Options="$(shell wx-config --rcflags)" Required="no"/>
       <General OutputFile="$(IntermediateDirectory)/freeDV" IntermediateDirectory="./Release" Command="./freeDV" CommandArguments="" UseSeparateDebugArgs="no" DebugArguments="" WorkingDirectory="$(IntermediateDirectory)" PauseExecWhenProcTerminates="no"/>
index 68313f1d0b7dd2fcbe7cbf7e10ac08da80597bb7..858e45e8483d6c60302290ef4c873131170b5656 100644 (file)
@@ -1 +1 @@
-./Debug/src_dlg_comports.o ./Debug/src_fdmdv2_main.o ./Debug/src_fdmdv2_plot.o ./Debug/src_topFrame.o ./Debug/src_fdmdv2_plot_scatter.o ./Debug/src_fdmdv2_plot_spectrum.o ./Debug/src_fdmdv2_pa_wrapper.o ./Debug/src_fdmdv2_plot_scalar.o ./Debug/src_fdmdv2_hdw_ports.o ./Debug/src_fdmdv2_plot_waterfall_linux.o  ./Debug/src_dlg_audiooptions.o ./Debug/src_dlg_filter.o  \r
+./Debug/src_dlg_comports.o ./Debug/src_fdmdv2_main.o ./Debug/src_fdmdv2_plot.o ./Debug/src_topFrame.o ./Debug/src_fdmdv2_plot_scatter.o ./Debug/src_fdmdv2_plot_spectrum.o ./Debug/src_fdmdv2_pa_wrapper.o ./Debug/src_fdmdv2_plot_scalar.o ./Debug/src_fdmdv2_hdw_ports.o ./Debug/src_fdmdv2_plot_waterfall_linux.o  ./Debug/src_dlg_audiooptions.o ./Debug/src_dlg_filter.o ./Debug/src_varicode.o  \r
index 8cea0b7016ab73529d46c80b1d1cb3966e77ae86..4d780b9d625554fe268ede60157f3812884f7c48 100644 (file)
@@ -5,18 +5,24 @@
     <![CDATA[]]>
   </Environment>
   <Project Name="pa_enum" Path="../tests/pa_enum/pa_enum.project" Active="No"/>
+  <Project Name="dialogTest" Path="dialogTest.project" Active="No"/>
+  <Project Name="bigButtonRig" Path="../../../code/SerialPortControl/bigButtonRig/bigButtonRig.project" Active="No"/>
   <BuildMatrix>
     <WorkspaceConfiguration Name="Debug" Selected="yes">
       <Project Name="fdmdv2" ConfigName="Debug"/>
       <Project Name="rawbits" ConfigName="Debug"/>
       <Project Name="pa_enum" ConfigName="Debug"/>
       <Project Name="appWithDlg" ConfigName="Debug"/>
+      <Project Name="dialogTest" ConfigName="Debug"/>
+      <Project Name="bigButtonRig" ConfigName="Debug"/>
     </WorkspaceConfiguration>
-    <WorkspaceConfiguration Name="Release" Selected="no">
+    <WorkspaceConfiguration Name="Release" Selected="yes">
       <Project Name="fdmdv2" ConfigName="Release"/>
       <Project Name="rawbits" ConfigName="Release"/>
       <Project Name="pa_enum" ConfigName="Release"/>
       <Project Name="appWithDlg" ConfigName="Release"/>
+      <Project Name="dialogTest" ConfigName="Release"/>
+      <Project Name="bigButtonRig" ConfigName="Release"/>
     </WorkspaceConfiguration>
   </BuildMatrix>
 </CodeLite_Workspace>
diff --git a/fdmdv2/build/wxcrafter.xrc b/fdmdv2/build/wxcrafter.xrc
new file mode 100644 (file)
index 0000000..3961d4b
--- /dev/null
@@ -0,0 +1,180 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<resource xmlns="http://www.wxwindows.org/wxxrc" version="2.3.0.1">
+  <object class="wxDialog" name="PTTDialog">
+    <title>Hardware PTT</title>
+    <centered>1</centered>
+    <style>wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</style>
+    <size>450,300</size>
+    <object class="wxBoxSizer">
+      <orient>wxVERTICAL</orient>
+      <object class="sizeritem" name="staticBoxSizer28">
+        <flag>wxEXPAND|wxALIGN_CENTER_VERTICAL</flag>
+        <border>5</border>
+        <object class="wxStaticBoxSizer" name="staticBoxSizer28">
+          <sizeritem>
+            <object class="spacer"/>
+          </sizeritem>
+          <orient>wxVERTICAL</orient>
+          <label>Audio Tone</label>
+          <object class="sizeritem">
+            <flag>wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL</flag>
+            <border>5</border>
+            <object class="wxCheckBox" name="m_ckPTTRtChan">
+              <style/>
+              <label>PTT tone on right audio channel</label>
+              <checked>0</checked>
+            </object>
+          </object>
+        </object>
+      </object>
+      <object class="sizeritem" name="staticBoxSizer17">
+        <flag>wxEXPAND</flag>
+        <border>5</border>
+        <option>1</option>
+        <object class="wxStaticBoxSizer" name="staticBoxSizer17">
+          <sizeritem>
+            <object class="spacer"/>
+          </sizeritem>
+          <orient>wxVERTICAL</orient>
+          <label>Hardware PTT Settings</label>
+          <object class="sizeritem" name="staticBoxSizer31">
+            <flag>wxEXPAND</flag>
+            <border>5</border>
+            <object class="wxStaticBoxSizer" name="staticBoxSizer31">
+              <sizeritem>
+                <object class="spacer"/>
+              </sizeritem>
+              <orient>wxVERTICAL</orient>
+              <label>PTT Port</label>
+              <object class="sizeritem">
+                <flag>wxALIGN_CENTER</flag>
+                <option>1</option>
+                <object class="wxListBox" name="m_listCtrlPorts">
+                  <style>wxLB_SINGLE</style>
+                  <content/>
+                  <selection>-1</selection>
+                </object>
+              </object>
+            </object>
+          </object>
+          <object class="sizeritem" name="boxSizer19">
+            <flag>wxEXPAND</flag>
+            <border>5</border>
+            <option>1</option>
+            <object class="wxBoxSizer">
+              <orient>wxVERTICAL</orient>
+              <object class="sizeritem" name="staticBoxSizer16">
+                <flag>wxEXPAND|wxALIGN_CENTER|wxALIGN_RIGHT</flag>
+                <border>5</border>
+                <option>1</option>
+                <object class="wxStaticBoxSizer" name="staticBoxSizer16">
+                  <sizeritem>
+                    <object class="spacer"/>
+                  </sizeritem>
+                  <orient>wxHORIZONTAL</orient>
+                  <label>Signal polarity</label>
+                  <object class="sizeritem" name="gridSizer17">
+                    <flag>wxEXPAND|wxALIGN_RIGHT</flag>
+                    <border>5</border>
+                    <option>1</option>
+                    <object class="wxGridSizer">
+                      <cols>2</cols>
+                      <rows>3</rows>
+                      <vgap>0</vgap>
+                      <hgap>0</hgap>
+                      <object class="sizeritem">
+                        <flag>wxALIGN_CENTER</flag>
+                        <border>10</border>
+                        <object class="wxCheckBox" name="m_ckUseSerialPTT">
+                          <style/>
+                          <label>Use Serial Port PTT</label>
+                          <checked>0</checked>
+                        </object>
+                      </object>
+                      <object class="spacer" name="Spacer">
+                        <flag/>
+                        <border>5</border>
+                      </object>
+                      <object class="sizeritem">
+                        <flag>wxALIGN_CENTER|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL</flag>
+                        <border>5</border>
+                        <object class="wxRadioButton" name="m_rbUseDTR">
+                          <style/>
+                          <label>Use DTR</label>
+                          <value>1</value>
+                        </object>
+                      </object>
+                      <object class="sizeritem">
+                        <flag>wxALIGN_CENTER|wxALIGN_RIGHT</flag>
+                        <border>5</border>
+                        <object class="wxCheckBox" name="m_ckRTSPos">
+                          <style/>
+                          <label>DTR = +V</label>
+                          <checked>0</checked>
+                        </object>
+                      </object>
+                      <object class="sizeritem">
+                        <flag>wxALIGN_CENTER|wxALIGN_RIGHT</flag>
+                        <border>5</border>
+                        <object class="wxRadioButton" name="m_rbUseRTS">
+                          <style/>
+                          <label>Use RTS</label>
+                          <tooltip>Toggle the RTS pin for PTT</tooltip>
+                          <value>1</value>
+                        </object>
+                      </object>
+                      <object class="sizeritem">
+                        <flag>wxALIGN_CENTER|wxALIGN_RIGHT</flag>
+                        <border>5</border>
+                        <object class="wxCheckBox" name="m_ckDTRPos">
+                          <tooltip>Set Polarity of the RTS line</tooltip>
+                          <style/>
+                          <label>RTS = +V</label>
+                          <checked>0</checked>
+                        </object>
+                      </object>
+                    </object>
+                  </object>
+                </object>
+              </object>
+            </object>
+          </object>
+        </object>
+      </object>
+      <object class="sizeritem" name="boxSizer12">
+        <flag>wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL</flag>
+        <border>5</border>
+        <object class="wxBoxSizer">
+          <orient>wxHORIZONTAL</orient>
+          <object class="sizeritem">
+            <flag>wxLEFT|wxRIGHT|wxTOP|wxBOTTOM</flag>
+            <border>5</border>
+            <object class="wxButton" name="m_buttonOK">
+              <label>OK</label>
+              <style/>
+              <default>1</default>
+            </object>
+          </object>
+          <object class="sizeritem">
+            <flag>wxLEFT|wxRIGHT|wxTOP|wxBOTTOM</flag>
+            <border>5</border>
+            <object class="wxButton" name="m_buttonCancel">
+              <label>Cancel</label>
+              <style/>
+              <default>0</default>
+            </object>
+          </object>
+          <object class="sizeritem">
+            <flag>wxLEFT|wxRIGHT|wxTOP|wxBOTTOM</flag>
+            <border>5</border>
+            <object class="wxButton" name="m_buttonApply">
+              <label>Apply</label>
+              <style/>
+              <default>0</default>
+            </object>
+          </object>
+        </object>
+      </object>
+    </object>
+  </object>
+</resource>
index 960234fa2fa4f37c7e762efb21c86447356d5e2e..4348f1fd1bafedc9b2b0aedb95c152581f1baabe 100644 (file)
                                                 <property name="minimize_button">0</property>\r
                                                 <property name="minimum_size"></property>\r
                                                 <property name="moveable">1</property>\r
-                                                <property name="name">m_btnTogTX</property>\r
+                                                <property name="name">m_btnTogPTT</property>\r
                                                 <property name="pane_border">1</property>\r
                                                 <property name="pane_position"></property>\r
                                                 <property name="pane_size"></property>\r
index db3d1948b397ad303e985e711e7ac5c31dc4c269..5687f3818e1fd9690c8e0e67632755392f15b714 100644 (file)
@@ -386,9 +386,12 @@ void AudioOptsDialog::OnInitDialog( wxInitDialogEvent& event )
     ExchangeData(EXCHANGE_DATA_IN);
 }
 
+//-------------------------------------------------------------------------
+// OnInitDialog()
+//
 // helper function to look up name of devNum, and if it exists write
 // name to textCtrl.  Used to trap dissapearing devices.
-
+//-------------------------------------------------------------------------
 int AudioOptsDialog::setTextCtrlIfDevNumValid(wxTextCtrl *textCtrl, wxListCtrl *listCtrl, int devNum)
 {
     int i, aDevNum, found_devNum;
@@ -415,7 +418,6 @@ int AudioOptsDialog::setTextCtrlIfDevNumValid(wxTextCtrl *textCtrl, wxListCtrl *
     }
 }
 
-
 //-------------------------------------------------------------------------
 // ExchangeData()
 //-------------------------------------------------------------------------
@@ -639,7 +641,7 @@ void AudioOptsDialog::OnDeviceSelect(wxListEvent& event)
 */
 
 //-------------------------------------------------------------------------
-// DisplaySupportedSampleRates()
+// buildListOfSupportedSampleRates()
 //-------------------------------------------------------------------------
 int AudioOptsDialog:: buildListOfSupportedSampleRates(wxComboBox *cbSampleRate, int devNum, int in_out)
 {
@@ -705,7 +707,7 @@ int AudioOptsDialog:: buildListOfSupportedSampleRates(wxComboBox *cbSampleRate,
 }
 
 //-------------------------------------------------------------------------
-// GetAPIInfo()
+// showAPIInfo()
 //-------------------------------------------------------------------------
 void AudioOptsDialog::showAPIInfo()
 {
@@ -839,11 +841,10 @@ void AudioOptsDialog::populateParams(AudioInfoDisplay ai)
 
 //-------------------------------------------------------------------------
 // OnDeviceSelect()
-//-------------------------------------------------------------------------
-
+//
 // helper function to set up "Device:" and "Sample Rate:" fields when
 // we click on a line in the list of devices box
-
+//-------------------------------------------------------------------------
 void AudioOptsDialog::OnDeviceSelect(wxComboBox *cbSampleRate, 
                                      wxTextCtrl *textCtrl, 
                                      int        *devNum, 
@@ -924,10 +925,13 @@ void AudioOptsDialog::OnTxOutDeviceSelect(wxListEvent& evt)
                    AUDIO_OUT);
 }
 
+//-------------------------------------------------------------------------
+// plotDeviceInputForAFewSecs()
+//
 // opens a record device and plots the input speech for a few seconds.  This is "modal" using
 // synchronous portaudio functions, so the GUI will not respond until after test sample has been
 // taken
-
+//-------------------------------------------------------------------------
 void AudioOptsDialog::plotDeviceInputForAFewSecs(int devNum, PlotScalar *plotScalar) {
     PaStreamParameters  inputParameters;
     PaStream           *stream = NULL;
@@ -1012,10 +1016,13 @@ void AudioOptsDialog::plotDeviceInputForAFewSecs(int devNum, PlotScalar *plotSca
     src_delete(src);
 }
 
+//-------------------------------------------------------------------------
+// plotDeviceOutputForAFewSecs()
+//
 // opens a play device and plays a tone for a few seconds.  This is "modal" using
 // synchronous portaudio functions, so the GUI will not respond until after test sample has been
 // taken.  Also plots a pretty picture like the record versions
-
+//-------------------------------------------------------------------------
 void AudioOptsDialog::plotDeviceOutputForAFewSecs(int devNum, PlotScalar *plotScalar) {
     PaStreamParameters  outputParameters;
     PaStream           *stream = NULL;
index 51f40fa3d8327dda6c4606c81c228bca65a67135..27753ae92d18901f7982c6e131fb15618b29e828 100644 (file)
 //
 //==========================================================================
 #include "dlg_comports.h"
-#include "fdmdv2_hdw_ports.h"
+#include "fdmdv2_main.h"
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
 // Class ComPortsDlg
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
 ComPortsDlg::ComPortsDlg(wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style) : wxDialog(parent, id, title, pos, size, style)
 {
-    this->SetSizeHints(wxDefaultSize, wxDefaultSize);
-    this->SetSizeHints(wxDefaultSize, wxDefaultSize);
-    wxStaticText* m_staticText8;
-    wxStaticText* m_staticText9;
-    wxStaticText* m_staticText91;
-    wxStaticText* m_staticText911;
-    wxStaticText* m_staticText912;
-    wxStaticText* m_staticText913;
-    wxStdDialogButtonSizer* m_sdbSizer5;
-
-    wxBoxSizer* bSizer30;
-    bSizer30 = new wxBoxSizer(wxVERTICAL);
-
-    wxGridSizer* gSizer3;
-    gSizer3 = new wxGridSizer(8, 2, 0, 0);
-
-    m_staticText8 = new wxStaticText(this, wxID_ANY, _("Available Ports:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-    m_staticText8->Wrap(-1);
-    gSizer3->Add(m_staticText8, 0, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
-
-    m_listCtrlPorts = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
-    gSizer3->Add(m_listCtrlPorts, 2, wxALL|wxEXPAND, 2);
-
 /*
-    m_staticText9 = new wxStaticText(this, wxID_ANY, _("Use Port:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-    m_staticText9->Wrap(-1);
-    gSizer3->Add(m_staticText9, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
-
-    m_textRigCtrlPort = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
-    gSizer3->Add(m_textRigCtrlPort, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2);
+    if(!bBitmapLoaded) 
+    {
+        // We need to initialise the default bitmap handler
+        wxXmlResource::Get()->AddHandler(new wxBitmapXmlHandler);
+        wxC9ED9InitBitmapResources();
+        bBitmapLoaded = true;
+    }
+*/
+    wxBoxSizer* mainSizer = new wxBoxSizer(wxVERTICAL);
+    this->SetSizer(mainSizer);
+    
+/*    
+    wxStaticBoxSizer* staticBoxSizer28 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Audio Tone")), wxVERTICAL);
+    mainSizer->Add(staticBoxSizer28, 1, wxEXPAND|wxALIGN_CENTER_VERTICAL, 5);
+    m_ckPTTRtChan = new wxCheckBox(this, wxID_ANY, _("PTT tone on right audio channel"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_ckPTTRtChan->SetValue(false);
+    staticBoxSizer28->Add(m_ckPTTRtChan, 0, wxALIGN_CENTER|wxALIGN_CENTER_VERTICAL, 5);
 */
 
-    m_staticText91 = new wxStaticText(this, wxID_ANY, _("Buad Rate:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-    m_staticText91->Wrap(-1);
-    gSizer3->Add(m_staticText91, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
-
-    m_listCtrlBaudrates = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxDefaultSize);
-    gSizer3->Add(m_listCtrlBaudrates, 2, wxALL|wxEXPAND, 2);
-
-    m_staticText911 = new wxStaticText(this, wxID_ANY, _("Data Bits:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-    m_staticText911->Wrap(-1);
-    gSizer3->Add(m_staticText911, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
-
-    m_textRigCtrlDatabits = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
-    gSizer3->Add(m_textRigCtrlDatabits, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2);
-
-    m_staticText912 = new wxStaticText(this, wxID_ANY, _("Stop Bits:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-    m_staticText912->Wrap(-1);
-    gSizer3->Add(m_staticText912, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
-
-    m_textRigCtrlStopbits = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
-    gSizer3->Add(m_textRigCtrlStopbits, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2);
-    m_staticText913 = new wxStaticText(this, wxID_ANY, _("Parity:"), wxDefaultPosition, wxDefaultSize, wxALIGN_RIGHT);
-    m_staticText913->Wrap(-1);
-    gSizer3->Add(m_staticText913, 1, wxALIGN_CENTER_VERTICAL|wxALIGN_RIGHT|wxALL, 2);
+    wxStaticBoxSizer* staticBoxSizer17 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Hardware PTT Settings")), wxVERTICAL);
+    mainSizer->Add(staticBoxSizer17, 1, wxEXPAND, 5);
+    wxStaticBoxSizer* staticBoxSizer31 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("PTT Port")), wxVERTICAL);
+    staticBoxSizer17->Add(staticBoxSizer31, 1, wxEXPAND, 5);
 
-    m_textRigCtrlParity = new wxTextCtrl(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
-    gSizer3->Add(m_textRigCtrlParity, 1, wxALIGN_CENTER_VERTICAL|wxALL, 2);
+    m_ckUseSerialPTT = new wxCheckBox(this, wxID_ANY, _("Use Serial Port PTT"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_ckUseSerialPTT->SetValue(false);
+    staticBoxSizer31->Add(m_ckUseSerialPTT, 0, wxALIGN_LEFT, 20);
 
-    bSizer30->Add(gSizer3, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 5);
+    wxArrayString m_listCtrlPortsArr;
+    m_listCtrlPorts = new wxListBox(this, wxID_ANY, wxDefaultPosition, wxSize(-1,45), m_listCtrlPortsArr, wxLB_SINGLE);
+    staticBoxSizer31->Add(m_listCtrlPorts, 1, wxALIGN_CENTER, 0);
 
-//    wxStaticBoxSizer* polaritySizer;
-//    polaritySizer = new wxStaticBoxSizer(new wxStaticBox(this, wxID_ANY, _("")), wxHORIZONTAL);
-//    gSizer3->Add(polaritySizer, 0, wxALIGN_CENTER|wxALL, 1);
+    wxBoxSizer* boxSizer19 = new wxBoxSizer(wxVERTICAL);
+    staticBoxSizer17->Add(boxSizer19, 1, wxEXPAND, 5);
+    wxStaticBoxSizer* staticBoxSizer16 = new wxStaticBoxSizer( new wxStaticBox(this, wxID_ANY, _("Signal polarity")), wxHORIZONTAL);
+    boxSizer19->Add(staticBoxSizer16, 1, wxEXPAND|wxALIGN_CENTER|wxALIGN_RIGHT, 5);
 
-    m_rbUseRTS = new wxRadioButton( this, wxID_ANY, wxT("Use RTS"), wxDefaultPosition, wxDefaultSize, 0 );
-    gSizer3->Add(m_rbUseRTS, 0, wxALIGN_CENTER|wxALL, 1);
+    wxGridSizer* gridSizer17 = new wxGridSizer(2, 2, 0, 0);
+    staticBoxSizer16->Add(gridSizer17, 1, wxEXPAND|wxALIGN_RIGHT, 5);
 
-    m_ckRTSPos = new wxCheckBox( this, wxID_ANY, wxT("RTS = +V"), wxDefaultPosition, wxDefaultSize, 0 );
-    gSizer3->Add(m_ckRTSPos, 0, wxALIGN_CENTER|wxALL, 1);
+/*
+    m_ckUseSerialPTT = new wxCheckBox(this, wxID_ANY, _("Use Serial Port PTT"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_ckUseSerialPTT->SetValue(false);
+    gridSizer17->Add(m_ckUseSerialPTT, 0, wxALIGN_CENTER, 10);
+    gridSizer17->Add(0, 0, 0, 0, 5);
+*/
+    m_rbUseDTR = new wxRadioButton(this, wxID_ANY, _("Use DTR"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_rbUseDTR->SetValue(1);
+    gridSizer17->Add(m_rbUseDTR, 0, wxALIGN_CENTER|wxALIGN_RIGHT|wxALIGN_CENTER_VERTICAL, 5);
 
-    m_rbUseDTR = new wxRadioButton( this, wxID_ANY, wxT("Use DTR"), wxDefaultPosition, wxDefaultSize, 0 );
-    gSizer3->Add(m_rbUseDTR, 0, wxALIGN_CENTER|wxALL, 1);
+    m_ckRTSPos = new wxCheckBox(this, wxID_ANY, _("DTR = +V"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_ckRTSPos->SetValue(false);
+    gridSizer17->Add(m_ckRTSPos, 0, wxALIGN_CENTER|wxALIGN_RIGHT, 5);
 
-    m_ckDTRPos = new wxCheckBox( this, wxID_ANY, wxT("DTR = +V"), wxDefaultPosition, wxDefaultSize, 0 );
-    gSizer3->Add(m_ckDTRPos, 0, wxALIGN_CENTER|wxALL, 1);
+    m_rbUseRTS = new wxRadioButton(this, wxID_ANY, _("Use RTS"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_rbUseRTS->SetToolTip(_("Toggle the RTS pin for PTT"));
+    m_rbUseRTS->SetValue(1);
+    gridSizer17->Add(m_rbUseRTS, 0, wxALIGN_CENTER|wxALIGN_RIGHT, 5);
 
+    m_ckDTRPos = new wxCheckBox(this, wxID_ANY, _("RTS = +V"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_ckDTRPos->SetValue(false);
+    m_ckDTRPos->SetToolTip(_("Set Polarity of the RTS line"));
+    gridSizer17->Add(m_ckDTRPos, 0, wxALIGN_CENTER|wxALIGN_RIGHT, 5);
 
-    m_sdbSizer5 = new wxStdDialogButtonSizer();
-    m_sdbSizer5OK = new wxButton(this, wxID_OK);
-    m_sdbSizer5->AddButton(m_sdbSizer5OK);
-    m_sdbSizer5Apply = new wxButton(this, wxID_APPLY);
-    m_sdbSizer5->AddButton(m_sdbSizer5Apply);
-    m_sdbSizer5Cancel = new wxButton(this, wxID_CANCEL);
-    m_sdbSizer5->AddButton(m_sdbSizer5Cancel);
-    m_sdbSizer5->Realize();
+    wxBoxSizer* boxSizer12 = new wxBoxSizer(wxHORIZONTAL);
+    mainSizer->Add(boxSizer12, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM|wxALIGN_CENTER_HORIZONTAL, 5);
 
-    bSizer30->Add(m_sdbSizer5, 0, wxEXPAND, 5);
+    m_buttonOK = new wxButton(this, wxID_OK, _("OK"), wxDefaultPosition, wxSize(-1,-1), 0);
+    m_buttonOK->SetDefault();
 
-    this->SetSizer(bSizer30);
-    this->Layout();
+    boxSizer12->Add(m_buttonOK, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
+    m_buttonCancel = new wxButton(this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxSize(-1,-1), 0);
+    boxSizer12->Add(m_buttonCancel, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
 
-    this->Centre(wxBOTH);
-    this->Centre(wxBOTH);
+    m_buttonApply = new wxButton(this, wxID_APPLY, _("Apply"), wxDefaultPosition, wxSize(-1,-1), 0);
+    boxSizer12->Add(m_buttonApply, 0, wxLEFT|wxRIGHT|wxTOP|wxBOTTOM, 5);
 
-    // Connect Events
-    this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(ComPortsDlg::OnInitDialog));
-    m_sdbSizer5Apply->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this);
-    m_sdbSizer5Cancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this);
-    m_sdbSizer5OK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this);
-    m_listCtrlPorts->Connect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(ComPortsDlg::OnPortItemSelected), NULL, this);
-    m_listCtrlBaudrates->Connect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(ComPortsDlg::OnBaudrateItemSelected), NULL, this);
-/*
-    void    OnApply(wxCommandEvent& event);
-    void    OnRTSClick(wxCommandEvent& event);
-    void    OnRTSPosClick(wxCommandEvent& event);
-    void    OnDTRClick(wxCommandEvent& event);
-    void    OnDTRPosClick(wxCommandEvent& event);
-*/
+    SetSizeHints(450,300);
+    if ( GetSizer() ) 
+    {
+         GetSizer()->Fit(this);
+    }
+    Centre(wxBOTH);
+
+    // Connect events
+    this->Connect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(ComPortsDlg::OnInitDialog), NULL, this);
+//    m_ckPTTRtChan->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::PTTAudioClick), NULL, this);
+    m_listCtrlPorts->Connect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(ComPortsDlg::PTTPortSlelcted), NULL, this);
+    m_ckUseSerialPTT->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::PTTUseSerialClicked), NULL, this);
+    m_rbUseDTR->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler(ComPortsDlg::UseDTRCliched), NULL, this);
+    m_ckRTSPos->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::DTRVPlusClicked), NULL, this);
+    m_rbUseRTS->Connect(wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler(ComPortsDlg::UseRTSClicked), NULL, this);
+    m_ckDTRPos->Connect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::RTSVPlusClicked), NULL, this);
+    m_buttonOK->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this);
+    m_buttonCancel->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this);
+    m_buttonApply->Connect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this);
 }
 
 //-------------------------------------------------------------------------
@@ -145,12 +132,17 @@ ComPortsDlg::ComPortsDlg(wxWindow* parent, wxWindowID id, const wxString& title,
 ComPortsDlg::~ComPortsDlg()
 {
     // Disconnect Events
-    this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(ComPortsDlg::OnInitDialog));
-    m_listCtrlPorts->Disconnect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(ComPortsDlg::OnPortItemSelected), NULL, this);
-    m_listCtrlBaudrates->Disconnect(wxEVT_COMMAND_LIST_ITEM_SELECTED, wxListEventHandler(ComPortsDlg::OnBaudrateItemSelected), NULL, this);
-    m_sdbSizer5Apply->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this);
-    m_sdbSizer5Cancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this);
-    m_sdbSizer5OK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this);
+    this->Disconnect(wxEVT_INIT_DIALOG, wxInitDialogEventHandler(ComPortsDlg::OnInitDialog), NULL, this);
+//    m_ckPTTRtChan->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::PTTAudioClick), NULL, this);
+    m_listCtrlPorts->Disconnect(wxEVT_COMMAND_LISTBOX_SELECTED, wxCommandEventHandler(ComPortsDlg::PTTPortSlelcted), NULL, this);
+    m_ckUseSerialPTT->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::PTTUseSerialClicked), NULL, this);
+    m_rbUseDTR->Disconnect(wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler(ComPortsDlg::UseDTRCliched), NULL, this);
+    m_ckRTSPos->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::DTRVPlusClicked), NULL, this);
+    m_rbUseRTS->Disconnect(wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler(ComPortsDlg::UseRTSClicked), NULL, this);
+    m_ckDTRPos->Disconnect(wxEVT_COMMAND_CHECKBOX_CLICKED, wxCommandEventHandler(ComPortsDlg::RTSVPlusClicked), NULL, this);
+    m_buttonOK->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnOK), NULL, this);
+    m_buttonCancel->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnCancel), NULL, this);
+    m_buttonApply->Disconnect(wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler(ComPortsDlg::OnApply), NULL, this);
 }
 
 //-------------------------------------------------------------------------
@@ -170,49 +162,17 @@ void ComPortsDlg::populatePortList()
     int i = 0;
     wxListItem inf;
     wxString buf;
-    long idx;
-    long baudrates[] = { 110, 300, 1200, 2400, 9600, 19200, 38400, 57600, 115200 };
     
     m_listCtrlPorts->Clear();
-    m_listCtrlBaudrates->Clear();
-    for(i = 0; i < 9; i++)
-    {
-        buf.Printf("%u", baudrates[i]);
-        m_listCtrlBaudrates->Append(buf);
-    }
-        
-#ifdef  __WXMSW__
-#define PREDICATE   
-    for(i = 1; i <= 32; i++)
-    {
-        buf.Printf("COM%u:", i);
-        idx = m_listCtrlPorts->Append(buf);
-    }
-    for(i = 33; i <= 128; i++)
-    {
-        buf.Printf("\\\\.\\com%u:", i);
-        idx = m_listCtrlPorts->Append(buf);
-    }
-
-#endif
+    std::vector<std::string>result;
+    wxArrayString aStr;
 
-#ifdef  __WXGTK__
-    for(i = 0; i < 32; i++)
-    {
-        buf.Printf("/dev/ttyS%u", i);
-        idx = m_listCtrlPorts->Append(buf);
-    }
-    for(i = 0; i < 32; i++)
+    ctb::GetAvailablePorts(result, false);
+    for(int i = 0; i < result.size(); i++) 
     {
-        buf.Printf("/dev/ttyUSB%u", i);
-        idx = m_listCtrlPorts->Append(buf);
+        aStr.Add(result[i], 1);
     }
-#endif
-
-#ifdef __WXOSX__
-#define MAXPORTS    20
-#endif
-
+    m_listCtrlPorts->Append(aStr);
 }
 
 //-------------------------------------------------------------------------
@@ -227,15 +187,16 @@ void ComPortsDlg::ExchangeData(int inout)
     
     if(inout == EXCHANGE_DATA_IN)
     {
+//        m_ckUsePTTRtChan->SetValue(wxGetApp().m_boolUseTonePTT);
+        m_ckUseSerialPTT->SetValue(wxGetApp().m_boolUseSerialPTT);
         str = wxGetApp().m_strRigCtrlPort;
         m_listCtrlPorts->SetStringSelection(str);
-
         str = wxGetApp().m_strRigCtrlBaud;
-        m_listCtrlBaudrates->SetStringSelection(str);
 
-        m_textRigCtrlDatabits->SetValue(wxGetApp().m_strRigCtrlDatabits);
-        m_textRigCtrlStopbits->SetValue(wxGetApp().m_strRigCtrlStopbits);
-        m_textRigCtrlParity->SetValue(wxGetApp().m_strRigCtrlParity);
+//        m_listCtrlBaudrates->SetStringSelection(str);
+//        m_textRigCtrlDatabits->SetValue(wxGetApp().m_strRigCtrlDatabits);
+//        m_textRigCtrlStopbits->SetValue(wxGetApp().m_strRigCtrlStopbits);
+//        m_textRigCtrlParity->SetValue(wxGetApp().m_strRigCtrlParity);
 
         m_rbUseRTS->SetValue(wxGetApp().m_boolUseRTS);
         m_ckRTSPos->SetValue(wxGetApp().m_boolRTSPos);
@@ -244,41 +205,37 @@ void ComPortsDlg::ExchangeData(int inout)
     }
     if(inout == EXCHANGE_DATA_OUT)
     {
+        wxGetApp().m_boolUseSerialPTT           = m_ckUseSerialPTT->IsChecked();
+//        wxGetApp().m_boolUseTonePTT             = m_ckUsePTTRtChan->IsChecked();
         wxGetApp().m_strRigCtrlPort             = m_listCtrlPorts->GetStringSelection();
-        wxGetApp().m_strRigCtrlBaud             = m_listCtrlBaudrates->GetStringSelection();
-
-        wxGetApp().m_strRigCtrlDatabits         = m_textRigCtrlDatabits->GetValue();
-        wxGetApp().m_strRigCtrlStopbits         = m_textRigCtrlStopbits->GetValue();
-        wxGetApp().m_strRigCtrlParity           = m_textRigCtrlParity->GetValue();
-
-        wxGetApp().m_boolUseRTS                  = m_rbUseRTS->GetValue();
-        wxGetApp().m_boolRTSPos                  = m_ckRTSPos->GetValue();
-        wxGetApp().m_boolUseDTR                  = m_rbUseDTR->GetValue();
-        wxGetApp().m_boolDTRPos                  = m_ckDTRPos->GetValue();
-
-        pConfig->Write(wxT("/Rig/Port"),        wxGetApp().m_strRigCtrlPort);
-        pConfig->Write(wxT("/Rig/Baud"),        wxGetApp().m_strRigCtrlBaud);
-        pConfig->Write(wxT("/Rig/DataBits"),    wxGetApp().m_strRigCtrlDatabits);
-        pConfig->Write(wxT("/Rig/StopBits"),    wxGetApp().m_strRigCtrlStopbits);
-        pConfig->Write(wxT("/Rig/Parity"),      wxGetApp().m_strRigCtrlParity);
+        wxGetApp().m_boolUseRTS                 = m_rbUseRTS->GetValue();
+        wxGetApp().m_boolRTSPos                 = m_ckRTSPos->IsChecked();
+        wxGetApp().m_boolUseDTR                 = m_rbUseDTR->GetValue();
+        wxGetApp().m_boolDTRPos                 = m_ckDTRPos->IsChecked();
+        
+        pConfig->Write(wxT("/Rig/UseRTS"),                  wxGetApp().m_boolUseRTS);
+        pConfig->Write(wxT("/Rig/RTSPolarity"),             wxGetApp().m_boolRTSPos);
+        pConfig->Write(wxT("/Rig/UseDTR"),                  wxGetApp().m_boolUseDTR);
+        pConfig->Write(wxT("/Rig/DTRPolarity"),             wxGetApp().m_boolDTRPos);
+        pConfig->Write(wxT("/Rig/UseTonePTT"),              wxGetApp().m_boolUseTonePTT);
+        pConfig->Write(wxT("/Rig/UseSerialPTT"),            wxGetApp().m_boolUseSerialPTT);
+
+//        wxGetApp().m_strRigCtrlBaud             = m_listCtrlBaudrates->GetStringSelection();
+//        wxGetApp().m_strRigCtrlDatabits         = m_textRigCtrlDatabits->GetValue();
+//        wxGetApp().m_strRigCtrlStopbits         = m_textRigCtrlStopbits->GetValue();
+//        wxGetApp().m_strRigCtrlParity           = m_textRigCtrlParity->GetValue();
+
+//        pConfig->Write(wxT("/Rig/Port"),        wxGetApp().m_strRigCtrlPort);
+//        pConfig->Write(wxT("/Rig/Baud"),        wxGetApp().m_strRigCtrlBaud);
+//        pConfig->Write(wxT("/Rig/DataBits"),    wxGetApp().m_strRigCtrlDatabits);
+//        pConfig->Write(wxT("/Rig/StopBits"),    wxGetApp().m_strRigCtrlStopbits);
+//        pConfig->Write(wxT("/Rig/Parity"),      wxGetApp().m_strRigCtrlParity);
         //m_textRigCtrlFlowControl
-
-        pConfig->Write(wxT("/Rig/UseRTS"),      wxGetApp().m_boolUseRTS);
-        pConfig->Write(wxT("/Rig/RTSPolarity"), wxGetApp().m_boolRTSPos);
-        pConfig->Write(wxT("/Rig/UseDTR"),      wxGetApp().m_boolUseDTR);
-        pConfig->Write(wxT("/Rig/DTRPolarity"), wxGetApp().m_boolDTRPos);
-
         pConfig->Flush();
     }
     delete wxConfigBase::Set((wxConfigBase *) NULL);
 }
 /*
-    void    OnApply(wxCommandEvent& event);
-    void    OnRTSClick(wxCommandEvent& event);
-    void    OnRTSPosClick(wxCommandEvent& event);
-    void    OnDTRClick(wxCommandEvent& event);
-    void    OnDTRPosClick(wxCommandEvent& event);
-*/
 //-------------------------------------------------------------------------
 // OnPortItemSelected()
 //-------------------------------------------------------------------------
@@ -286,243 +243,93 @@ void ComPortsDlg::OnPortItemSelected(wxListEvent& event)
 {
     // TODO: Implement OnListItemSelected
 }
+*/
 
 //-------------------------------------------------------------------------
-// OnBaudrateItemSelected()
+// DTRVPlusClicked()
 //-------------------------------------------------------------------------
-void ComPortsDlg::OnBaudrateItemSelected(wxListEvent& event)
+void ComPortsDlg::DTRVPlusClicked(wxCommandEvent& event)
 {
-    // TODO: Implement OnListItemSelected
+    wxMessageBox(wxT("DTRVPlusClicked"));
 }
 
 //-------------------------------------------------------------------------
-// OnCancel()
+// PTTAudioClick()
 //-------------------------------------------------------------------------
-void ComPortsDlg::OnCancel(wxCommandEvent& event)
+void ComPortsDlg::PTTAudioClick(wxCommandEvent& event)
 {
-    this->EndModal(wxID_CANCEL);
 }
 
 //-------------------------------------------------------------------------
-// OnOK()
+// PTTPortSlelcted()
 //-------------------------------------------------------------------------
-void ComPortsDlg::OnOK(wxCommandEvent& event)
+void ComPortsDlg::PTTPortSlelcted(wxCommandEvent& event)
 {
-    this->EndModal(wxID_OK);
+/*
+    wxMessageBox(wxT("PTTPortSlelcted"));
+    if(event.IsChecked())
+    {
+        m_ckPTTRtChan->SetValue(false);
+        m_ckPTTRtChan->Enable(false);
+    }
+    else
+    {
+        //m_ckPTTRtChan->SetValue(false);
+        m_ckPTTRtChan->Enable(true);
+    }
+*/
 }
 
 //-------------------------------------------------------------------------
-// OnApply()
+// PTTUseSerialClicked()
 //-------------------------------------------------------------------------
-void ComPortsDlg::OnApply(wxCommandEvent& event)
+void ComPortsDlg::PTTUseSerialClicked(wxCommandEvent& event)
 {
-    ExchangeData(EXCHANGE_DATA_OUT);
 }
 
 //-------------------------------------------------------------------------
-// OnClose()
+// RTSVPlusClicked()
 //-------------------------------------------------------------------------
-void ComPortsDlg::OnClose(wxCloseEvent& event)
+void ComPortsDlg::RTSVPlusClicked(wxCommandEvent& event)
 {
-    this->EndModal(wxID_OK);
 }
 
-/*
 //-------------------------------------------------------------------------
-// serial_parity_handler()
+// OnCancel()
 //-------------------------------------------------------------------------
-static void serial_parity_handler(union control *ctrl, void *dlg, void *data, int event)
+void ComPortsDlg::UseDTRCliched(wxCommandEvent& event)
 {
-    static const struct
-    {
-        const char *name;
-        int val;
-    }
-    parities[] =
-    {
-        {"None",  SER_PAR_NONE},
-        {"Odd",   SER_PAR_ODD},
-        {"Even",  SER_PAR_EVEN},
-        {"Mark",  SER_PAR_MARK},
-        {"Space", SER_PAR_SPACE},
-    };
-    int mask = ctrl->listbox.context.i;
-    int i, j;
-    Config *cfg = (Config *)data;
-
-    if (event == EVENT_REFRESH)
-    {
-        int oldparity = cfg->serparity; // preserve past reentrant calls
-        dlg_update_start(ctrl, dlg);
-        dlg_listbox_clear(ctrl, dlg);
-        for (i = 0; i < lenof(parities); i++)
-        {
-            if (mask & (1 << i))
-            dlg_listbox_addwithid(ctrl, dlg, parities[i].name, parities[i].val);
-        }
-        for (i = j = 0; i < lenof(parities); i++)
-        {
-            if (mask & (1 << i))
-            {
-                if (oldparity == parities[i].val)
-                {
-                    dlg_listbox_select(ctrl, dlg, j);
-                    break;
-                }
-                j++;
-            }
-        }
-        if (i == lenof(parities))
-        {
-            // an unsupported setting was chosen
-            dlg_listbox_select(ctrl, dlg, 0);
-            oldparity = SER_PAR_NONE;
-        }
-        dlg_update_done(ctrl, dlg);
-        cfg->serparity = oldparity;
-        // restore
-    }
-    else if (event == EVENT_SELCHANGE)
-    {
-        int i = dlg_listbox_index(ctrl, dlg);
-        if (i < 0)
-        {
-            i = SER_PAR_NONE;
-        }
-        else
-        {
-            i = dlg_listbox_getid(ctrl, dlg, i);
-        }
-        cfg->serparity = i;
-    }
 }
 
 //-------------------------------------------------------------------------
-// serial_flow_handler()
+// UseRTSClicked()
 //-------------------------------------------------------------------------
-static void serial_flow_handler(union control *ctrl, void *dlg,        void *data, int event)
+void ComPortsDlg::UseRTSClicked(wxCommandEvent& event)
 {
-    static const struct
-    {
-        const char *name;
-        int val;
-    } flows[] =
-    {
-        {"None", SER_FLOW_NONE},
-        {"XON/XOFF", SER_FLOW_XONXOFF},
-        {"RTS/CTS", SER_FLOW_RTSCTS},
-        {"DSR/DTR", SER_FLOW_DSRDTR},
-    };
-    int mask = ctrl->listbox.context.i;
-    int i, j;
-    Config *cfg = (Config *)data;
-
-    if (event == EVENT_REFRESH)
-    {
-        int oldflow = cfg->serflow;    // preserve past reentrant calls
-        dlg_update_start(ctrl, dlg);
-        dlg_listbox_clear(ctrl, dlg);
-        for (i = 0; i < lenof(flows); i++)
-        {
-            if (mask & (1 << i))
-            dlg_listbox_addwithid(ctrl, dlg, flows[i].name, flows[i].val);
-        }
-        for (i = j = 0; i < lenof(flows); i++)
-        {
-            if (mask & (1 << i))
-            {
-                if (oldflow == flows[i].val)
-                {
-                    dlg_listbox_select(ctrl, dlg, j);
-                    break;
-                }
-            j++;
-            }
-        }
-        if (i == lenof(flows))
-        {
-            // an unsupported setting was chosen
-            dlg_listbox_select(ctrl, dlg, 0);
-            oldflow = SER_FLOW_NONE;
-        }
-        dlg_update_done(ctrl, dlg);
-        cfg->serflow = oldflow;               // restore
-    }
-    else if (event == EVENT_SELCHANGE)
-    {
-        int i = dlg_listbox_index(ctrl, dlg);
-        if (i < 0)
-        {
-            i = SER_FLOW_NONE;
-        }
-        else
-        {
-            i = dlg_listbox_getid(ctrl, dlg, i);
-        }
-        cfg->serflow = i;
-    }
 }
 
 //-------------------------------------------------------------------------
-// ser_setup_config_box()
+// OnApply()
 //-------------------------------------------------------------------------
-void ser_setup_config_box(struct controlbox *b, int midsession, int parity_mask, int flow_mask)
+void ComPortsDlg::OnApply(wxCommandEvent& event)
 {
-    struct controlset *s;
-    union control *c;
+    ExchangeData(EXCHANGE_DATA_OUT);
+}
 
-    if (!midsession)
-    {
-        int i;
-        extern void config_protocolbuttons_handler(union control *, void *, void *, int);
-        //
-        // Add the serial back end to the protocols list at the
-        // top of the config box.
-        //
-        s = ctrl_getset(b, "Session", "hostport", "Specify the destination you want to connect to");
-        for (i = 0; i < s->ncontrols; i++)
-        {
-            c = s->ctrls[i];
-            if (c->generic.type == CTRL_RADIO && c->generic.handler == config_protocolbuttons_handler)
-            {
-                c->radio.nbuttons++;
-                c->radio.ncolumns++;
-                c->radio.buttons = sresize(c->radio.buttons, c->radio.nbuttons, char *);
-                c->radio.buttons[c->radio.nbuttons-1] = dupstr("Serial");
-                c->radio.buttondata = sresize(c->radio.buttondata, c->radio.nbuttons, intorptr);
-                c->radio.buttondata[c->radio.nbuttons-1] = I(PROT_SERIAL);
-                if (c->radio.shortcuts)
-                {
-                    c->radio.shortcuts = sresize(c->radio.shortcuts, c->radio.nbuttons, char);
-                    c->radio.shortcuts[c->radio.nbuttons-1] = 'r';
-                }
-            }
-        }
-    }
-    //
-    // Entirely new Connection/Serial panel for serial port
-    // configuration.
-    //
-    ctrl_settitle(b, "Connection/Serial", "Options controlling local serial lines");
-    if (!midsession)
-    {
-        //
-        // We don't permit switching to a different serial port in
-        // midflight, although we do allow all other
-        // reconfiguration.
-        //
-        s = ctrl_getset(b, "Connection/Serial", "serline", "Select a serial line");
-        ctrl_editbox(s, "Serial line to connect to", 'l', 40, HELPCTX(serial_line), dlg_stdeditbox_handler, I(offsetof(Config,serline)), I(sizeof(((Config *)0)->serline)));
-    }
+//-------------------------------------------------------------------------
+// OnCancel()
+//-------------------------------------------------------------------------
+void ComPortsDlg::OnCancel(wxCommandEvent& event)
+{
+    this->EndModal(wxID_CANCEL);
+}
 
-    s = ctrl_getset(b, "Connection/Serial", "sercfg", "Configure the serial line");
-    ctrl_editbox(s, "Speed (baud)", 's', 40, HELPCTX(serial_speed), dlg_stdeditbox_handler, I(offsetof(Config,serspeed)), I(-1));
-    ctrl_editbox(s, "Data bits", 'b', 40, HELPCTX(serial_databits), dlg_stdeditbox_handler,I(offsetof(Config,serdatabits)),I(-1));
-    //
-    // Stop bits come in units of one half.
-    //
-    ctrl_editbox(s, "Stop bits", 't', 40, HELPCTX(serial_stopbits), dlg_stdeditbox_handler,I(offsetof(Config,serstopbits)),I(-2));
-    ctrl_droplist(s, "Parity", 'p', 40,          HELPCTX(serial_parity),   serial_parity_handler, I(parity_mask));
-    ctrl_droplist(s, "Flow control", 'f', 40, HELPCTX(serial_flow), serial_flow_handler,   I(flow_mask));
+//-------------------------------------------------------------------------
+// OnClose()
+//-------------------------------------------------------------------------
+void ComPortsDlg::OnOK(wxCommandEvent& event)
+{
+    ExchangeData(EXCHANGE_DATA_OUT);
+    this->EndModal(wxID_OK);
 }
-*/
+
index fb7571d1700905c0587ea6ecc83ac09e9c0b87fd..35bb1ff0ab95df7a2d523973311fabc089623ee3 100644 (file)
 #define __COMPORTS_DIALOG__
 
 #include "fdmdv2_main.h"
-#include "fdmdv2_hdw_ports.h"
+#include <wx/settings.h>
+#include <wx/xrc/xmlres.h>
+#include <wx/xrc/xh_bmp.h>
+#include <wx/dialog.h>
+#include <wx/sizer.h>
+#include <wx/statbox.h>
+#include <wx/checkbox.h>
+#include <wx/listbox.h>
+#include <wx/radiobut.h>
+#include <wx/button.h>
 
 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=--=-=-=-=
 // Class ComPortsDlg
 class ComPortsDlg : public wxDialog
 {
     public:
-        /** Constructor */
-//        ComPortsDlg(wxWindow* parent);
-//        ~ComPortsDlg();
-        ComPortsDlg( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Select Com Port"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 399,354 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
-        ~ComPortsDlg();
-
+        ComPortsDlg(wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Hardware PTT"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize(450,300), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER);
+        virtual ~ComPortsDlg();
         void    ExchangeData(int inout);
-        void    populatePortList(void);
-        //ArrayOfPorts m_serialports;
 
     protected:
-        // Handlers for events.
-        void    OnPortItemSelected(wxListEvent& event);
-        void    OnBaudrateItemSelected(wxListEvent& event);
-        void    OnCancel(wxCommandEvent& event);
-        void    OnOK(wxCommandEvent& event);
-        void    OnClose(wxCloseEvent& event);
-        void    OnInitDialog(wxInitDialogEvent& event);
-        void    OnApply(wxCommandEvent& event);
-        void    OnRTSClick(wxCommandEvent& event);
-        void    OnRTSPosClick(wxCommandEvent& event);
-        void    OnDTRClick(wxCommandEvent& event);
-        void    OnDTRPosClick(wxCommandEvent& event);
+        wxCheckBox* m_ckUsePTTRtChan;
+        wxListBox* m_listCtrlPorts;
+        wxCheckBox* m_ckUseSerialPTT;
+        wxRadioButton* m_rbUseDTR;
+        wxCheckBox* m_ckRTSPos;
+        wxRadioButton* m_rbUseRTS;
+        wxCheckBox* m_ckDTRPos;
+        wxButton* m_buttonOK;
+        wxButton* m_buttonCancel;
+        wxButton* m_buttonApply;
+
+    protected:
+        void populatePortList(void);
+        void PTTAudioClick(wxCommandEvent& event);
+        void PTTPortSlelcted(wxCommandEvent& event);
+        void PTTUseSerialClicked(wxCommandEvent& event);
+        void UseDTRCliched(wxCommandEvent& event);
+        void DTRVPlusClicked(wxCommandEvent& event);
+        void UseRTSClicked(wxCommandEvent& event);
+        void RTSVPlusClicked(wxCommandEvent& event);
+        void OnOK(wxCommandEvent& event);
+        void OnCancel(wxCommandEvent& event);
+        void OnApply(wxCommandEvent& event);
+        virtual void OnInitDialog(wxInitDialogEvent& event);
 
-        wxListBox*  m_listCtrlPorts;
-        wxTextCtrl* m_textRigCtrlPort;
-        wxListBox*  m_listCtrlBaudrates;
-        wxTextCtrl* m_textRigCtrlDatabits;
-        wxTextCtrl* m_textRigCtrlStopbits;
-        wxTextCtrl* m_textRigCtrlParity;
-        wxButton*   m_sdbSizer5OK;
-        wxButton*   m_sdbSizer5Apply;
-        wxButton*   m_sdbSizer5Cancel;
-        
-        wxRadioButton *m_rbUseRTS;
-        wxCheckBox    *m_ckRTSPos;
-        wxRadioButton *m_rbUseDTR;
-        wxCheckBox    *m_ckDTRPos;
 };
 
 #endif // __COMPORTS_DIALOG__
index 8f5efef44dde6b080b9004456033adcf696a024c..aac61501f0df41e302f354b8dc6e4d30d42de2f0 100644 (file)
@@ -160,6 +160,8 @@ bool MainApp::OnInit()
     m_textVoiceOutput.Empty();
     m_strSampleRate.Empty();
     m_strBitrate.Empty();
+    m_boolUseTonePTT   = false;
+    m_boolUseSerialPTT = true;
     // Create the main application window
     MainFrame *frame = new MainFrame(NULL);
     SetTopWindow(frame);
@@ -205,15 +207,15 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
     // note: run DebugView program to see this message under windows
     wxLogDebug("x = %d y = %d w = %d h = %d\n", x,y,w,h);
 
-    wxGetApp().m_show_wf      = pConfig->Read(wxT("/MainFrame/show_wf"),      1);
-    wxGetApp().m_show_spect   = pConfig->Read(wxT("/MainFrame/show_spect"),   1);
-    wxGetApp().m_show_scatter = pConfig->Read(wxT("/MainFrame/show_scatter"), 1);
-    wxGetApp().m_show_timing  = pConfig->Read(wxT("/MainFrame/show_timing"),  1);
-    wxGetApp().m_show_freq    = pConfig->Read(wxT("/MainFrame/show_freq"),    1);
-    wxGetApp().m_show_speech_in = pConfig->Read(wxT("/MainFrame/show_speech_in"),    1);
-    wxGetApp().m_show_speech_out = pConfig->Read(wxT("/MainFrame/show_speech_out"),    1);
-    wxGetApp().m_show_demod_in = pConfig->Read(wxT("/MainFrame/show_demod_in"),    1);
-    
+    wxGetApp().m_show_wf            = pConfig->Read(wxT("/MainFrame/show_wf"),      1);
+    wxGetApp().m_show_spect         = pConfig->Read(wxT("/MainFrame/show_spect"),   1);
+    wxGetApp().m_show_scatter       = pConfig->Read(wxT("/MainFrame/show_scatter"), 1);
+    wxGetApp().m_show_timing        = pConfig->Read(wxT("/MainFrame/show_timing"),  1);
+    wxGetApp().m_show_freq          = pConfig->Read(wxT("/MainFrame/show_freq"),    1);
+    wxGetApp().m_show_speech_in     = pConfig->Read(wxT("/MainFrame/show_speech_in"),    1);
+    wxGetApp().m_show_speech_out    = pConfig->Read(wxT("/MainFrame/show_speech_out"),    1);
+    wxGetApp().m_show_demod_in      = pConfig->Read(wxT("/MainFrame/show_demod_in"),    1);
+
     g_SquelchActive = pConfig->Read(wxT("/Audio/SquelchActive"), 1);
     g_SquelchLevel = pConfig->Read(wxT("/Audio/SquelchLevel"), (int)(SQ_DEFAULT_SNR*2));
     g_SquelchLevel /= 2.0;
@@ -299,12 +301,17 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
             g_nSoundCards = 2;
     }
 
-    wxGetApp().m_strRigCtrlPort     = pConfig->Read("/Rig/Port",                wxT("\\\\.\\com1"));
-    wxGetApp().m_strRigCtrlBaud     = pConfig->Read("/Rig/Baud",                wxT("9600"));
-    wxGetApp().m_strRigCtrlDatabits = pConfig->Read("/Rig/DataBits",            wxT("8"));
-    wxGetApp().m_strRigCtrlStopbits = pConfig->Read("/Rig/StopBits",            wxT("1"));
-    wxGetApp().m_strRigCtrlParity   = pConfig->Read("/Rig/Parity",              wxT("n"));
-
+    wxGetApp().m_strRigCtrlPort     = pConfig->Read(wxT("/Rig/Port"),           wxT("COM3"));
+    wxGetApp().m_strRigCtrlBaud     = pConfig->Read(wxT("/Rig/Baud"),           wxT("9600"));
+    wxGetApp().m_strRigCtrlDatabits = pConfig->Read(wxT("/Rig/DataBits"),       wxT("8"));
+    wxGetApp().m_strRigCtrlStopbits = pConfig->Read(wxT("/Rig/StopBits"),       wxT("1"));
+    wxGetApp().m_strRigCtrlParity   = pConfig->Read(wxT("/Rig/Parity"),         wxT("n"));
+    wxGetApp().m_boolUseTonePTT     = pConfig->ReadBool(wxT("/Rig/UseTonePTT"),     false);
+    wxGetApp().m_boolUseSerialPTT   = pConfig->ReadBool(wxT("/Rig/UseSerialPTT"),   true);
+    wxGetApp().m_boolUseRTS         = pConfig->ReadBool(wxT("/Rig/UseRTS"),         true);
+    wxGetApp().m_boolRTSPos         = pConfig->ReadBool(wxT("/Rig/RTSPolarity"),    false);
+    wxGetApp().m_boolUseDTR         = pConfig->ReadBool(wxT("/Rig/UseDTR"),         false);
+    wxGetApp().m_boolDTRPos         = pConfig->ReadBool(wxT("/Rig/DTRPolarity"),    false);
     wxGetApp().m_playFileToMicInPath = pConfig->Read("/File/playFileToMicInPath", wxT(""));
     wxGetApp().m_recFileFromRadioPath = pConfig->Read("/File/recFileFromRadioPath", wxT(""));
     wxGetApp().m_recFileFromRadioSecs = pConfig->Read("/File/recFileFromRadioSecs", 30);
@@ -331,19 +338,20 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
     m_togBtnSplit->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnSplitClickUI), NULL, this);
     m_togBtnAnalog->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnAnalogClickUI), NULL, this);
     //m_togBtnALC->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnALCClickUI), NULL, this);
-    m_btnTogTX->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnTXClickUI), NULL, this);
+    m_btnTogPTT->Connect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnTXClickUI), NULL, this);
 
     m_togBtnSplit->Disable();
     m_togRxID->Disable();
     m_togTxID->Disable();
     m_togBtnAnalog->Disable();
     //m_togBtnALC->Disable();
-    m_btnTogTX->Disable();
+    //m_btnTogPTT->Disable();
+    SetupSerialPort();
+
 
 //    m_menuItemPlayAudioFile->Enable(false);
 
     // squelch settings
-
     char sqsnr[15];
     m_sliderSQ->SetValue((int)(g_SquelchLevel*2.0));
     sprintf(sqsnr, "%4.1f", g_SquelchLevel);
@@ -399,7 +407,6 @@ MainFrame::MainFrame(wxWindow *parent) : TopFrame(parent)
     g_split = 0;
 
     // data states
-    
     g_txDataInFifo = fifo_create(MAX_CALLSIGN*VARICODE_MAX_BITS);   
     g_rxDataOutFifo = fifo_create(MAX_CALLSIGN*VARICODE_MAX_BITS);   
     varicode_decode_init(&g_varicode_dec_states);
@@ -456,6 +463,8 @@ MainFrame::~MainFrame()
         pConfig->Write(wxT("/Rig/RTSPolarity"),             wxGetApp().m_boolRTSPos);
         pConfig->Write(wxT("/Rig/UseDTR"),                  wxGetApp().m_boolUseDTR);
         pConfig->Write(wxT("/Rig/DTRPolarity"),             wxGetApp().m_boolDTRPos);
+        pConfig->Write(wxT("/Rig/UseTonePTT"),              wxGetApp().m_boolUseTonePTT);
+        pConfig->Write(wxT("/Rig/UseSerialPTT"),            wxGetApp().m_boolUseSerialPTT);
 
         pConfig->Write(wxT("/File/playFileToMicInPath"),    wxGetApp().m_playFileToMicInPath);
         pConfig->Write(wxT("/File/recFileFromRadioPath"),   wxGetApp().m_recFileFromRadioPath);
@@ -473,8 +482,10 @@ MainFrame::~MainFrame()
     m_togBtnSplit->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnSplitClickUI), NULL, this);
     m_togBtnAnalog->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnAnalogClickUI), NULL, this);
     //m_togBtnALC->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnALCClickUI), NULL, this);
-    m_btnTogTX->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnTXClickUI), NULL, this);
-
+    m_btnTogPTT->Disconnect(wxEVT_UPDATE_UI, wxUpdateUIEventHandler(MainFrame::OnTogBtnTXClickUI), NULL, this);
+    
+    CloseSerialPort();
+    
     if (m_RxRunning)
     {
         stopRxStream();
@@ -815,16 +826,29 @@ void MainFrame::OnCheckSNRClick(wxCommandEvent& event)
 //-------------------------------------------------------------------------
 void MainFrame::OnTogBtnTXClick(wxCommandEvent& event)
 {
-    if (g_tx) {
+    if (g_tx) 
+    {
         // tx-> rx transition, swap to Waterfall
         m_auiNbookCtrl->ChangeSelection(0); 
     }
-    else {
+    else 
+    {
         // rx-> tx transition, swap to Mic In page to monitor speech
         m_auiNbookCtrl->ChangeSelection(4); // is there a way to avoid hard coding this?
     }
-    g_tx = m_btnTogTX->GetValue();
-
+    g_tx = m_btnTogPTT->GetValue();
+    
+    if(event.IsChecked()) 
+    {
+        m_serialPort->SetLineState(ctb::LinestateRts);
+       // m_btnTogPTT->SetLabel(wxT("PTT"));
+    } 
+    else 
+    {
+        m_serialPort->ClrLineState(ctb::LinestateRts);
+       // m_btnTogPTT->SetLabel(wxT("PTT"));
+    }
+    
     // reset level gauge
     m_maxLevel = 0;
     m_textLevel->SetLabel(wxT(""));
@@ -1210,7 +1234,7 @@ void MainFrame::OnExit(wxCommandEvent& event)
     m_togTxID->Disable();
     m_togBtnAnalog->Disable();
     //m_togBtnALC->Disable();
-    m_btnTogTX->Disable();
+    m_btnTogPTT->Disable();
 }
 
 //-------------------------------------------------------------------------
@@ -1272,6 +1296,8 @@ void MainFrame::OnToolsComCfg(wxCommandEvent& event)
     if(rv == wxID_OK)
     {
         dlg->ExchangeData(EXCHANGE_DATA_OUT);
+        CloseSerialPort();
+        SetupSerialPort();
     }
     delete dlg;
 }
@@ -1360,7 +1386,7 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event)
         //m_togRxID->Enable();
         //m_togTxID->Enable();
         m_togBtnAnalog->Enable();
-        m_btnTogTX->Enable();
+        m_btnTogPTT->Enable();
         m_togBtnOnOff->SetLabel(wxT("Stop"));
 
         // init modem and codec states
@@ -1416,7 +1442,7 @@ void MainFrame::OnTogBtnOnOff(wxCommandEvent& event)
         m_togRxID->Disable();
         m_togTxID->Disable();
         m_togBtnAnalog->Disable();
-        m_btnTogTX->Disable();
+        m_btnTogPTT->Disable();
         m_togBtnOnOff->SetLabel(wxT("Start"));
     }
 }
@@ -2384,3 +2410,53 @@ void fdmdv2_clickTune(float freq) {
     }
 }
 
+//----------------------------------------------------------------
+// SetupSerialPort()
+//----------------------------------------------------------------
+void MainFrame::SetupSerialPort(void)
+{
+/*
+    wxString            m_strRigCtrlBaud;
+    wxString            m_strRigCtrlDatabits;
+    wxString            m_strRigCtrlStopbits;
+    wxString            m_strRigCtrlParity;
+    bool                m_boolUseSerialPTT;
+    bool                m_boolUseTonePTT;
+    bool                m_boolUseRTS;
+    bool                m_boolRTSPos;
+    bool                m_boolUseDTR;
+    bool                m_boolDTRPos;
+*/
+    long baudrate;
+    
+    wxGetApp().m_strRigCtrlBaud.ToLong(&baudrate, 10);
+    if(!wxGetApp().m_strRigCtrlPort.IsEmpty())
+    {
+        wxString protocol = wxGetApp().m_strRigCtrlDatabits + wxGetApp().m_strRigCtrlParity + wxGetApp().m_strRigCtrlStopbits; //"8N1";
+        m_serialPort = new ctb::SerialPort();
+        if(m_serialPort->Open(wxGetApp().m_strRigCtrlPort.c_str(), baudrate, protocol.c_str(), ctb::SerialPort::NoFlowControl ) >= 0 ) 
+        {
+            m_device = m_serialPort;
+        }
+        m_btnTogPTT->Enable(true);
+        //m_btnTogPTT->SetLabel(wxT("Rx"));
+    }
+    else
+    {
+        wxMessageBox(wxT("You must select a Serial port to Open!"), wxT("Error"), wxOK);
+    }
+}
+
+//----------------------------------------------------------------
+// CloseSerialPort()
+//----------------------------------------------------------------
+void MainFrame::CloseSerialPort(void)
+{
+    if(m_serialPort->IsOpen())
+    {
+        m_serialPort->Close();
+        m_device = NULL; 
+        //m_btnTogPTT->SetLabel(wxT("PTT"));
+        m_btnTogPTT->Enable(false);
+    }
+}
index 38f27ae1ad379560976f9fd8c1feee3cd8331828..3dd8c5c10684877e43c9de0bc87ce2750fd54352 100644 (file)
 #include "fdmdv.h"
 #include "fifo.h"
 
+#include "ctb-0.16/ctb.h"
+#include "ctb-0.16/portscan.h"
+#include "ctb-0.16/serportx.h"
+#include "ctb-0.16/serport.h"
+
 #include "topFrame.h"
 #include "dlg_comports.h"
 #include "fdmdv2_plot.h"
@@ -124,6 +129,8 @@ class MainApp : public wxApp
         wxString            m_strRigCtrlDatabits;
         wxString            m_strRigCtrlStopbits;
         wxString            m_strRigCtrlParity;
+        bool                m_boolUseSerialPTT;
+        bool                m_boolUseTonePTT;
         bool                m_boolUseRTS;
         bool                m_boolRTSPos;
         bool                m_boolUseDTR;
@@ -261,6 +268,9 @@ class MainFrame : public TopFrame
         
         txRxThread*             m_txRxThread;
 
+        void SetupSerialPort(void);
+        void CloseSerialPort(void);
+
 #ifdef _USE_TIMER
         wxTimer                 m_plotTimer;
 #endif
@@ -291,7 +301,10 @@ class MainFrame : public TopFrame
     void initPortAudioDevice(PortAudioWrap *pa, int inDevice, int outDevice, 
                              int soundCard, int sampleRate, int inputChannels);
 
- protected:
+    protected:
+
+        ctb::IOBase*            m_device;
+        ctb::SerialPort*        m_serialPort;
 
         void setsnrBeta(bool snrSlow);
 
@@ -305,7 +318,7 @@ class MainFrame : public TopFrame
         void stopRxStream();
         void abortTxStream();
         void abortRxStream();
-
+        
         void OnExit( wxCommandEvent& event );
         void OnToolsAudio( wxCommandEvent& event );
         void OnToolsAudioUI( wxUpdateUIEvent& event );
@@ -352,7 +365,7 @@ class MainFrame : public TopFrame
         wxTextCtrl* m_tc;
         int         m_zoom;
         float       m_snrBeta;
-
+        
         // Callsign
         char        m_callsign[MAX_CALLSIGN];
         char       *m_pcallsign;
index ea1d98f2237f1fc1787d30afe49d4545b055ccce..4b5c89dacd4448ebc7ce840f9812a1ddc9828f8b 100644 (file)
@@ -342,9 +342,9 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
     //------------------------------
     wxBoxSizer* bSizer11;
     bSizer11 = new wxBoxSizer(wxVERTICAL);
-    m_btnTogTX = new wxToggleButton(this, wxID_ANY, _("TX"), wxDefaultPosition, wxDefaultSize, 0);
-    m_btnTogTX->SetToolTip(_("Switch between Receive and Transmit"));
-    bSizer11->Add(m_btnTogTX, 1, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
+    m_btnTogPTT = new wxToggleButton(this, wxID_ANY, _("PTT"), wxDefaultPosition, wxDefaultSize, 0);
+    m_btnTogPTT->SetToolTip(_("PTT Switch between Receive and Transmit"));
+    bSizer11->Add(m_btnTogPTT, 1, wxALIGN_CENTER|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL|wxALL, 1);
     sbSizer5->Add(bSizer11, 2, wxEXPAND, 1);
     rightSizer->Add(sbSizer5, 2, wxALIGN_CENTER|wxALL|wxEXPAND, 3);
     bSizer1->Add(rightSizer, 0, wxALL|wxEXPAND, 3);
@@ -404,7 +404,7 @@ TopFrame::TopFrame(wxWindow* parent, wxWindowID id, const wxString& title, const
 #ifdef ALC
     m_togBtnALC->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnALCClick), NULL, this);
 #endif
-    m_btnTogTX->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnTXClick), NULL, this);
+    m_btnTogPTT->Connect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnTXClick), NULL, this);
 }
 
 TopFrame::~TopFrame()
@@ -453,7 +453,7 @@ TopFrame::~TopFrame()
 #ifdef ALC
     m_togBtnALC->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnALCClick), NULL, this);
 #endif
-    m_btnTogTX->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnTXClick), NULL, this);
+    m_btnTogPTT->Disconnect(wxEVT_COMMAND_TOGGLEBUTTON_CLICKED, wxCommandEventHandler(TopFrame::OnTogBtnTXClick), NULL, this);
 
 }
 
index 70e9c5d7b129043c73d19a32b8ab8c839723ee16..faf0ecf7c62a0f36124afb21e90233dbd348a52b 100644 (file)
@@ -151,7 +151,7 @@ class TopFrame : public wxFrame
         wxToggleButton* m_togBtnSplit;
         wxToggleButton* m_togBtnAnalog;
         wxToggleButton* m_togBtnALC;
-        wxToggleButton* m_btnTogTX;
+        wxToggleButton* m_btnTogPTT;
         wxToggleButton* m_togBtnLoopRx;
         wxToggleButton* m_togBtnLoopTx;
 
index 6f61a181383be1a240c09142bdaaf67f0e582e02..0b2ab7ae763a3188af12757f9841dc46208bd349 100644 (file)
@@ -13,7 +13,7 @@ CurrentFileName        :=
 CurrentFilePath        :=\r
 CurrentFileFullPath    :=\r
 User                   :=wittend\r
-Date                   :=11/25/2012\r
+Date                   :=11/29/2012\r
 CodeLitePath           :="D:\bin\CodeLite"\r
 LinkerName             :=g++\r
 SharedObjectLinkerName :=g++ -shared -fPIC\r
@@ -52,8 +52,8 @@ LibPath                := $(LibraryPathSwitch). $(LibraryPathSwitch)/bin/MinGW-4
 AR       := ar rcus\r
 CXX      := g++\r
 CC       := gcc\r
-CXXFLAGS :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1066\"  $(Preprocessors)\r
-CFLAGS   :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1066\"  $(Preprocessors)\r
+CXXFLAGS :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
+CFLAGS   :=  -g -O0 -Wall $(shell wx-config --cxxflags --unicode=yes --debug=yes)  -DSVN_REVISION=\"1083\"  $(Preprocessors)\r
 \r
 \r
 ##\r