Add the configuration for the Icom modes.

pull/1/head
Jonathan Naylor 8 years ago
parent cb7886c8ee
commit 030c99cd46

@ -149,6 +149,8 @@ const wxString KEY_SPLIT_TXNAME = wxT("splitTXName");
const wxString KEY_SPLIT_RXNAME = wxT("splitRXName");
const wxString KEY_SPLIT_TIMEOUT = wxT("splitTimeout");
const wxString KEY_ICOM_PORT = wxT("icomPort");
const wxString DEFAULT_CALLSIGN = wxT("GB3IN C");
const wxString DEFAULT_GATEWAY = wxEmptyString;
@ -261,6 +263,8 @@ const wxString DEFAULT_SPLIT_TXNAME = wxEmptyString;
const wxString DEFAULT_SPLIT_RXNAME = wxEmptyString;
const unsigned int DEFAULT_SPLIT_TIMEOUT = 0U;
const wxString DEFAULT_ICOM_PORT = wxEmptyString;
#if defined(__WINDOWS__)
CDStarRepeaterConfig::CDStarRepeaterConfig(wxConfigBase* config, const wxString& dir, const wxString& configName, const wxString& name) :
@ -383,7 +387,8 @@ m_splitLocalAddress(DEFAULT_SPLIT_LOCALADDRESS),
m_splitLocalPort(DEFAULT_SPLIT_LOCALPORT),
m_splitTXNames(),
m_splitRXNames(),
m_splitTimeout(DEFAULT_SPLIT_TIMEOUT)
m_splitTimeout(DEFAULT_SPLIT_TIMEOUT),
m_icomPort(DEFAULT_ICOM_PORT)
{
wxASSERT(config != NULL);
wxASSERT(!dir.IsEmpty());
@ -689,6 +694,8 @@ m_splitTimeout(DEFAULT_SPLIT_TIMEOUT)
m_config->Read(m_name + KEY_SPLIT_TIMEOUT, &temp, long(DEFAULT_SPLIT_TIMEOUT));
m_splitTimeout = (unsigned int)temp;
m_config->Read(m_name + KEY_ICOM_PORT, &m_icomPort, DEFAULT_ICOM_PORT);
}
CDStarRepeaterConfig::~CDStarRepeaterConfig()
@ -816,7 +823,8 @@ m_splitLocalAddress(DEFAULT_SPLIT_LOCALADDRESS),
m_splitLocalPort(DEFAULT_SPLIT_LOCALPORT),
m_splitTXNames(),
m_splitRXNames(),
m_splitTimeout(DEFAULT_SPLIT_TIMEOUT)
m_splitTimeout(DEFAULT_SPLIT_TIMEOUT),
m_icomPort(DEFAULT_ICOM_PORT)
{
wxASSERT(!dir.IsEmpty());
@ -1148,6 +1156,8 @@ m_splitTimeout(DEFAULT_SPLIT_TIMEOUT)
} else if (key.IsSameAs(KEY_SOUNDCARD_TXTAIL)) {
val.ToULong(&temp2);
m_soundCardTXTail = (unsigned int)temp2;
} else if (key.IsSameAs(KEY_ICOM_PORT)) {
m_icomPort = val;
} else if (key.IsSameAs(KEY_SPLIT_LOCALADDRESS)) {
m_splitLocalAddress = val;
} else if (key.IsSameAs(KEY_SPLIT_LOCALPORT)) {
@ -1588,6 +1598,16 @@ void CDStarRepeaterConfig::setSplit(const wxString& localAddress, unsigned int l
m_splitTimeout = timeout;
}
void CDStarRepeaterConfig::getIcom(wxString& port) const
{
port = m_icomPort;
}
void CDStarRepeaterConfig::setIcom(const wxString& port)
{
m_icomPort = port;
}
bool CDStarRepeaterConfig::write()
{
#if defined(__WINDOWS__)
@ -1712,6 +1732,8 @@ bool CDStarRepeaterConfig::write()
m_config->Write(m_name + KEY_SOUNDCARD_TXDELAY, long(m_soundCardTXDelay));
m_config->Write(m_name + KEY_SOUNDCARD_TXTAIL, long(m_soundCardTXTail));
m_config->Write(m_name + KEY_ICOM_PORT, m_icomPort);
m_config->Write(m_name + KEY_SPLIT_LOCALADDRESS, m_splitLocalAddress);
m_config->Write(m_name + KEY_SPLIT_LOCALPORT, long(m_splitLocalPort));
@ -1875,8 +1897,10 @@ bool CDStarRepeaterConfig::write()
buffer.Printf(wxT("%s=%u"), KEY_SOUNDCARD_TXDELAY.c_str(), m_soundCardTXDelay); file.AddLine(buffer);
buffer.Printf(wxT("%s=%u"), KEY_SOUNDCARD_TXTAIL.c_str(), m_soundCardTXTail); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_SPLIT_LOCALADDRESS.c_str(), m_splitLocalAddress.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%u"), KEY_SPLIT_LOCALPORT.c_str(), m_splitLocalPort); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_ICOM_PORT.c_str(), m_icomPort.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%s"), KEY_SPLIT_LOCALADDRESS.c_str(), m_splitLocalAddress.c_str()); file.AddLine(buffer);
buffer.Printf(wxT("%s=%u"), KEY_SPLIT_LOCALPORT.c_str(), m_splitLocalPort); file.AddLine(buffer);
for (unsigned int i = 0U; i < m_splitTXNames.GetCount(); i++) {
wxString name;

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2015 by Jonathan Naylor G4KLX
* Copyright (C) 2011-2015,2018 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -95,6 +95,9 @@ public:
void getSplit(wxString& localAddress, unsigned int& localPort, wxArrayString& transmitterNames, wxArrayString& receiverNames, unsigned int& timeout) const;
void setSplit(const wxString& localAddress, unsigned int localPort, const wxArrayString& transmitterNames, const wxArrayString& receiverNames, unsigned int timeout);
void getIcom(wxString& port) const;
void setIcom(const wxString& port);
bool write();
private:
@ -238,6 +241,9 @@ private:
wxArrayString m_splitTXNames;
wxArrayString m_splitRXNames;
unsigned int m_splitTimeout;
// Icom Access Point/Terminal Mode
wxString m_icomPort;
};
#endif

@ -21,6 +21,7 @@
#include "CCITTChecksum.h"
#include "DStarDefines.h"
#include "Timer.h"
#include "Utils.h"
#if defined(__WINDOWS__)
#include <setupapi.h>
@ -186,7 +187,7 @@ void* CDVMegaController::Entry()
break;
case RTM_HEADER:
// CUtils::dump(wxT("RT_HEADER"), m_buffer, length);
CUtils::dump(wxT("RT_HEADER"), m_buffer, length);
if (length == 7U) {
if (m_buffer[4U] == DVRPTR_NAK)
wxLogWarning(wxT("Received a header NAK from the DVMEGA"));
@ -212,7 +213,7 @@ void* CDVMegaController::Entry()
break;
case RTM_DATA:
// CUtils::dump(wxT("RT_DATA"), m_buffer, length);
CUtils::dump(wxT("RT_DATA"), m_buffer, length);
if (length == 7U) {
if (m_buffer[4U] == DVRPTR_NAK)
wxLogWarning(wxT("Received a data NAK from the DVMEGA"));
@ -231,7 +232,7 @@ void* CDVMegaController::Entry()
break;
case RTM_EOT: {
// wxLogMessage(wxT("RT_EOT"));
wxLogMessage(wxT("RT_EOT"));
wxMutexLocker locker(m_mutex);
unsigned char data[2U];
@ -244,7 +245,7 @@ void* CDVMegaController::Entry()
break;
case RTM_RXLOST: {
// wxLogMessage(wxT("RT_LOST"));
wxLogMessage(wxT("RT_LOST"));
wxMutexLocker locker(m_mutex);
unsigned char data[2U];

@ -181,6 +181,7 @@
<ClCompile Include="DStarRepeaterConfigDVRPTR3Set.cpp" />
<ClCompile Include="DStarRepeaterConfigFrame.cpp" />
<ClCompile Include="DStarRepeaterConfigGMSKSet.cpp" />
<ClCompile Include="DStarRepeaterConfigIcomSet.cpp" />
<ClCompile Include="DStarRepeaterConfigMMDVMSet.cpp" />
<ClCompile Include="DStarRepeaterConfigModemSet.cpp" />
<ClCompile Include="DStarRepeaterConfigNetworkSet.cpp" />
@ -205,6 +206,7 @@
<ClInclude Include="DStarRepeaterConfigDVRPTR3Set.h" />
<ClInclude Include="DStarRepeaterConfigFrame.h" />
<ClInclude Include="DStarRepeaterConfigGMSKSet.h" />
<ClInclude Include="DStarRepeaterConfigIcomSet.h" />
<ClInclude Include="DStarRepeaterConfigMMDVMSet.h" />
<ClInclude Include="DStarRepeaterConfigModemSet.h" />
<ClInclude Include="DStarRepeaterConfigNetworkSet.h" />

@ -74,6 +74,9 @@
<ClCompile Include="DStarRepeaterConfigTimesSet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="DStarRepeaterConfigIcomSet.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DStarRepeaterConfigActiveHangSet.h">
@ -142,5 +145,8 @@
<ClInclude Include="DStarRepeaterConfigTimesSet.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="DStarRepeaterConfigIcomSet.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

@ -0,0 +1,82 @@
/*
* Copyright (C) 2011-2015,2018 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include "DStarRepeaterConfigIcomSet.h"
#include "SerialPortSelector.h"
const unsigned int BORDER_SIZE = 5U;
const unsigned int CONTROL_WIDTH1 = 150U;
const unsigned int PORT_LENGTH = 5U;
CDStarRepeaterConfigIcomSet::CDStarRepeaterConfigIcomSet(wxWindow* parent, int id, const wxString& port) :
wxDialog(parent, id, wxString(_("Icom Settings"))),
m_port(NULL)
{
wxBoxSizer* topSizer = new wxBoxSizer(wxVERTICAL);
wxFlexGridSizer* sizer = new wxFlexGridSizer(2);
wxStaticText* portLabel = new wxStaticText(this, -1, _("Port"));
sizer->Add(portLabel, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_port = new wxChoice(this, -1, wxDefaultPosition, wxSize(CONTROL_WIDTH1, -1));
sizer->Add(m_port, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
wxArrayString ports = CSerialPortSelector::getDevices();
for (unsigned int i = 0U; i < ports.GetCount(); i++)
m_port->Append(ports.Item(i));
bool found = m_port->SetStringSelection(port);
if (!found)
m_port->SetSelection(0);
topSizer->Add(sizer);
topSizer->Add(CreateButtonSizer(wxOK | wxCANCEL), 0, wxALL | wxALIGN_RIGHT, BORDER_SIZE);
SetAutoLayout(true);
topSizer->Fit(this);
topSizer->SetSizeHints(this);
SetSizer(topSizer);
}
CDStarRepeaterConfigIcomSet::~CDStarRepeaterConfigIcomSet()
{
}
bool CDStarRepeaterConfigIcomSet::Validate()
{
if (m_port->GetCurrentSelection() == wxNOT_FOUND)
return false;
return true;
}
wxString CDStarRepeaterConfigIcomSet::getPort() const
{
int n = m_port->GetCurrentSelection();
if (n == wxNOT_FOUND)
return wxEmptyString;
return m_port->GetStringSelection();
}

@ -0,0 +1,40 @@
/*
* Copyright (C) 2011-2015,2018 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef DStarRepeaterConfigIcomSet_H
#define DStarRepeaterConfigIcomSet_H
#include "DStarRepeaterConfigDefs.h"
#include "DStarDefines.h"
#include <wx/wx.h>
class CDStarRepeaterConfigIcomSet : public wxDialog {
public:
CDStarRepeaterConfigIcomSet(wxWindow* parent, int id, const wxString& port);
virtual ~CDStarRepeaterConfigIcomSet();
virtual bool Validate();
virtual wxString getPort() const;
private:
wxChoice* m_port;
};
#endif

@ -1,5 +1,5 @@
/*
* Copyright (C) 2011-2015 by Jonathan Naylor G4KLX
* Copyright (C) 2011-2015,2018 by Jonathan Naylor G4KLX
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -25,6 +25,7 @@
#include "DStarRepeaterConfigMMDVMSet.h"
#include "DStarRepeaterConfigGMSKSet.h"
#include "DStarRepeaterConfigDVAPSet.h"
#include "DStarRepeaterConfigIcomSet.h"
#include "DStarRepeaterConfigSplitSet.h"
enum {
@ -36,7 +37,8 @@ BEGIN_EVENT_TABLE(CDStarRepeaterConfigModemSet, wxPanel)
END_EVENT_TABLE()
const unsigned int BORDER_SIZE = 5U;
const unsigned int CONTROL_WIDTH = 130U;
const unsigned int CONTROL_WIDTH1 = 210U;
const unsigned int CONTROL_WIDTH2 = 130U;
CDStarRepeaterConfigModemSet::CDStarRepeaterConfigModemSet(wxWindow* parent, int id, const wxString& title, CDStarRepeaterConfig* config, const wxString& type) :
wxPanel(parent, id),
@ -51,7 +53,7 @@ m_type(NULL)
wxStaticText* typeLabel = new wxStaticText(this, -1, _("Type"));
sizer->Add(typeLabel, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
m_type = new wxChoice(this, -1, wxDefaultPosition, wxSize(CONTROL_WIDTH, -1));
m_type = new wxChoice(this, -1, wxDefaultPosition, wxSize(CONTROL_WIDTH1, -1));
m_type->Append(wxT("DVAP"));
m_type->Append(wxT("DVMEGA"));
m_type->Append(wxT("DV-RPTR V1"));
@ -61,12 +63,13 @@ m_type(NULL)
m_type->Append(wxT("MMDVM"));
m_type->Append(wxT("Sound Card"));
m_type->Append(wxT("Split"));
m_type->Append(wxT("Icom Access Point/Terminal Mode"));
sizer->Add(m_type, 0, wxALL | wxALIGN_LEFT, BORDER_SIZE);
wxStaticText* dummy = new wxStaticText(this, -1, wxEmptyString);
sizer->Add(dummy, 0, wxALL, BORDER_SIZE);
wxButton* configure = new wxButton(this, Button_Configure, _("Configure..."), wxDefaultPosition, wxSize(CONTROL_WIDTH, -1));
wxButton* configure = new wxButton(this, Button_Configure, _("Configure..."), wxDefaultPosition, wxSize(CONTROL_WIDTH2, -1));
sizer->Add(configure, 0, wxALL, BORDER_SIZE);
if (type.IsEmpty()) {
@ -268,5 +271,15 @@ void CDStarRepeaterConfigModemSet::onConfigure(wxCommandEvent& event)
m_config->setSplit(localAddress, localPort, transmitterNames, receiverNames, timeout);
}
}
} else if (type.IsSameAs(wxT("Icom Access Point/Terminal Mode"))) {
wxString port;
m_config->getIcom(port);
CDStarRepeaterConfigIcomSet modem(this, -1, port);
if (modem.ShowModal() == wxID_OK) {
if (modem.Validate()) {
port = modem.getPort();
m_config->setIcom(port);
}
}
}
}

@ -2,8 +2,8 @@ OBJECTS = DStarRepeaterConfigActiveHangSet.o DStarRepeaterConfigAnnouncementSet.
DStarRepeaterConfigCallsignSet.o DStarRepeaterConfigControl1Set.o DStarRepeaterConfigControl2Set.o \
DStarRepeaterConfigControllerSet.o DStarRepeaterConfigDVAPSet.o DStarRepeaterConfigDVMegaSet.o DStarRepeaterConfigDVRPTR1Set.o \
DStarRepeaterConfigDVRPTR2Set.o DStarRepeaterConfigDVRPTR3Set.o DStarRepeaterConfigFrame.o DStarRepeaterConfigGMSKSet.o \
DStarRepeaterConfigMMDVMSet.o DStarRepeaterConfigModemSet.o DStarRepeaterConfigNetworkSet.o DStarRepeaterConfigSoundCardSet.o \
DStarRepeaterConfigSplitSet.o DStarRepeaterConfigTimesSet.o
DStarRepeaterConfigIcomSet.o DStarRepeaterConfigMMDVMSet.o DStarRepeaterConfigModemSet.o DStarRepeaterConfigNetworkSet.o \
DStarRepeaterConfigSoundCardSet.o DStarRepeaterConfigSplitSet.o DStarRepeaterConfigTimesSet.o
all: dstarrepeaterconfig

Loading…
Cancel
Save

Powered by TurnKey Linux.