Merge remote-tracking branch 'upstream/master'

This commit is contained in:
SASANO Takayoshi 2020-06-30 19:41:27 +09:00
commit 974251485d
19 changed files with 260 additions and 228 deletions

View file

@ -57,7 +57,7 @@ enum SECTION {
SECTION_OLED,
SECTION_LCDPROC,
SECTION_LOCK_FILE,
SECTION_MOBILE_GPS,
SECTION_GPSD,
SECTION_REMOTE_CONTROL
};
@ -283,9 +283,9 @@ m_lcdprocUTC(false),
m_lcdprocDimOnIdle(false),
m_lockFileEnabled(false),
m_lockFileName(),
m_mobileGPSEnabled(false),
m_mobileGPSAddress(),
m_mobileGPSPort(0U),
m_gpsdEnabled(false),
m_gpsdAddress(),
m_gpsdPort(),
m_remoteControlEnabled(false),
m_remoteControlPort(0U)
{
@ -367,8 +367,8 @@ bool CConf::read()
section = SECTION_LCDPROC;
else if (::strncmp(buffer, "[Lock File]", 11U) == 0)
section = SECTION_LOCK_FILE;
else if (::strncmp(buffer, "[Mobile GPS]", 12U) == 0)
section = SECTION_MOBILE_GPS;
else if (::strncmp(buffer, "[GPSD]", 6U) == 0)
section = SECTION_GPSD;
else if (::strncmp(buffer, "[Remote Control]", 16U) == 0)
section = SECTION_REMOTE_CONTROL;
else
@ -950,13 +950,13 @@ bool CConf::read()
m_lockFileEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "File") == 0)
m_lockFileName = value;
} else if (section == SECTION_MOBILE_GPS) {
} else if (section == SECTION_GPSD) {
if (::strcmp(key, "Enable") == 0)
m_mobileGPSEnabled = ::atoi(value) == 1;
m_gpsdEnabled = ::atoi(value) == 1;
else if (::strcmp(key, "Address") == 0)
m_mobileGPSAddress = value;
m_gpsdAddress = value;
else if (::strcmp(key, "Port") == 0)
m_mobileGPSPort = (unsigned int)::atoi(value);
m_gpsdPort = value;
} else if (section == SECTION_REMOTE_CONTROL) {
if (::strcmp(key, "Enable") == 0)
m_remoteControlEnabled = ::atoi(value) == 1;
@ -2071,19 +2071,19 @@ std::string CConf::getLockFileName() const
return m_lockFileName;
}
bool CConf::getMobileGPSEnabled() const
bool CConf::getGPSDEnabled() const
{
return m_mobileGPSEnabled;
return m_gpsdEnabled;
}
std::string CConf::getMobileGPSAddress() const
std::string CConf::getGPSDAddress() const
{
return m_mobileGPSAddress;
return m_gpsdAddress;
}
unsigned int CConf::getMobileGPSPort() const
std::string CConf::getGPSDPort() const
{
return m_mobileGPSPort;
return m_gpsdPort;
}
bool CConf::getRemoteControlEnabled() const

14
Conf.h
View file

@ -306,10 +306,10 @@ public:
bool getLockFileEnabled() const;
std::string getLockFileName() const;
// The Mobile GPS section
bool getMobileGPSEnabled() const;
std::string getMobileGPSAddress() const;
unsigned int getMobileGPSPort() const;
// The GPSD section
bool getGPSDEnabled() const;
std::string getGPSDAddress() const;
std::string getGPSDPort() const;
// The Remote Control section
bool getRemoteControlEnabled() const;
@ -565,9 +565,9 @@ private:
bool m_lockFileEnabled;
std::string m_lockFileName;
bool m_mobileGPSEnabled;
std::string m_mobileGPSAddress;
unsigned int m_mobileGPSPort;
bool m_gpsdEnabled;
std::string m_gpsdAddress;
std::string m_gpsdPort;
bool m_remoteControlEnabled;
unsigned int m_remoteControlPort;

103
GPSD.cpp Normal file
View file

@ -0,0 +1,103 @@
/*
* Copyright (C) 2018,2020 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 "GPSD.h"
#if defined(USE_GPSD)
#include <cstdio>
#include <cassert>
#include <cstring>
#include <cmath>
CGPSD::CGPSD(const std::string& address, const std::string& port, CDMRNetwork* network) :
m_gpsdAddress(address),
m_gpsdPort(port),
m_network(network),
m_gpsdData(),
m_idTimer(1000U, 60U)
{
assert(!address.empty());
assert(!port.empty());
assert(network != NULL);
}
CGPSD::~CGPSD()
{
}
bool CGPSD::open()
{
int ret = ::gps_open(m_gpsdAddress.c_str(), m_gpsdPort.c_str(), &m_gpsdData);
if (ret != 0) {
LogError("Error when opening access to gpsd - %d - %s", errno, ::gps_errstr(errno));
return false;
}
::gps_stream(&m_gpsdData, WATCH_ENABLE | WATCH_JSON, NULL);
LogMessage("Connected to GPSD");
m_idTimer.start();
return true;
}
void CGPSD::clock(unsigned int ms)
{
m_idTimer.clock(ms);
if (m_idTimer.hasExpired()) {
sendReport();
m_idTimer.start();
}
}
void CGPSD::close()
{
::gps_stream(&m_gpsdData, WATCH_DISABLE, NULL);
::gps_close(&m_gpsdData);
}
void CGPSD::sendReport()
{
if (!::gps_waiting(&m_gpsdData, 0))
return;
#if GPSD_API_MAJOR_VERSION >= 7
if (::gps_read(&m_gpsdData, NULL, 0) <= 0)
return;
#else
if (::gps_read(&m_gpsdData) <= 0)
return;
#endif
if (m_gpsdData.status != STATUS_FIX)
return;
bool latlonSet = (m_gpsdData.set & LATLON_SET) == LATLON_SET;
if (!latlonSet)
return;
float latitude = float(m_gpsdData.fix.latitude);
float longitude = float(m_gpsdData.fix.longitude);
m_network->writeHomePosition(latitude, longitude);
}
#endif

View file

@ -1,5 +1,5 @@
/*
* Copyright (C) 2018 by Jonathan Naylor G4KLX
* Copyright (C) 2018,2020 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
@ -16,32 +16,22 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef MobileGPS_H
#define MobileGPS_H
#ifndef GPSD_H
#define GPSD_H
#if defined(USE_GPSD)
#include "DMRNetwork.h"
#include "UDPSocket.h"
#include "Timer.h"
#include <string>
#if !defined(_WIN32) && !defined(_WIN64)
#include <netdb.h>
#include <sys/time.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <unistd.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <errno.h>
#else
#include <winsock.h>
#endif
#include <gps.h>
class CMobileGPS {
class CGPSD {
public:
CMobileGPS(const std::string& address, unsigned int port, CDMRNetwork* network);
~CMobileGPS();
CGPSD(const std::string& address, const std::string& port, CDMRNetwork* network);
~CGPSD();
bool open();
@ -50,14 +40,15 @@ public:
void close();
private:
CTimer m_idTimer;
in_addr m_address;
unsigned int m_port;
CUDPSocket m_socket;
CDMRNetwork* m_network;
std::string m_gpsdAddress;
std::string m_gpsdPort;
CDMRNetwork* m_network;
struct gps_data_t m_gpsdData;
CTimer m_idTimer;
bool pollGPS();
void sendReport();
};
#endif
#endif

View file

@ -288,10 +288,10 @@ UTC=0
Enable=0
File=/tmp/MMDVM_Active.lck
[Mobile GPS]
[GPSD]
Enable=0
Address=127.0.0.1
Port=7834
Port=2947
[Remote Control]
Enable=0

View file

@ -161,7 +161,9 @@ m_id(0U),
m_cwCallsign(),
m_lockFileEnabled(false),
m_lockFileName(),
m_mobileGPS(NULL),
#if defined(USE_GPSD)
m_gpsd(NULL),
#endif
m_remoteControl(NULL),
m_fixedMode(false)
{
@ -1004,8 +1006,10 @@ int CMMDVMHost::run()
if (m_pocsagNetwork != NULL)
m_pocsagNetwork->clock(ms);
if (m_mobileGPS != NULL)
m_mobileGPS->clock(ms);
#if defined(USE_GPSD)
if (m_gpsd != NULL)
m_gpsd->clock(ms);
#endif
m_cwIdTimer.clock(ms);
if (m_cwIdTimer.isRunning() && m_cwIdTimer.hasExpired()) {
@ -1082,10 +1086,12 @@ int CMMDVMHost::run()
m_display->close();
delete m_display;
if (m_mobileGPS != NULL) {
m_mobileGPS->close();
delete m_mobileGPS;
#if defined(USE_GPSD)
if (m_gpsd != NULL) {
m_gpsd->close();
delete m_gpsd;
}
#endif
if (m_ump != NULL) {
m_ump->close();
@ -1392,23 +1398,25 @@ bool CMMDVMHost::createDMRNetwork()
return false;
}
bool mobileGPSEnabled = m_conf.getMobileGPSEnabled();
if (mobileGPSEnabled) {
std::string mobileGPSAddress = m_conf.getMobileGPSAddress();
unsigned int mobileGPSPort = m_conf.getMobileGPSPort();
#if defined(USE_GPSD)
bool gpsdEnabled = m_conf.getGPSDEnabled();
if (gpsdEnabled) {
std::string gpsdAddress = m_conf.getGPSDAddress();
std::string gpsdPort = m_conf.getGPSDPort();
LogInfo("Mobile GPS Parameters");
LogInfo(" Address: %s", mobileGPSAddress.c_str());
LogInfo(" Port: %u", mobileGPSPort);
LogInfo("GPSD Parameters");
LogInfo(" Address: %s", gpsdAddress.c_str());
LogInfo(" Port: %s", gpsdPort.c_str());
m_mobileGPS = new CMobileGPS(address, port, m_dmrNetwork);
m_gpsd = new CGPSD(gpsdAddress, gpsdPort, m_dmrNetwork);
ret = m_mobileGPS->open();
ret = m_gpsd->open();
if (!ret) {
delete m_mobileGPS;
m_mobileGPS = NULL;
delete m_gpsd;
m_gpsd = NULL;
}
}
#endif
m_dmrNetwork->enable(true);

View file

@ -34,11 +34,11 @@
#include "P25Network.h"
#include "DMRNetwork.h"
#include "DMRLookup.h"
#include "MobileGPS.h"
#include "Display.h"
#include "Timer.h"
#include "Modem.h"
#include "Conf.h"
#include "GPSD.h"
#include "UMP.h"
#include <string>
@ -102,7 +102,9 @@ private:
std::string m_cwCallsign;
bool m_lockFileEnabled;
std::string m_lockFileName;
CMobileGPS* m_mobileGPS;
#if defined(USE_GPSD)
CGPSD* m_gpsd;
#endif
CRemoteControl* m_remoteControl;
bool m_fixedMode;

View file

@ -183,13 +183,13 @@
<ClInclude Include="DStarSlowData.h" />
<ClInclude Include="Golay2087.h" />
<ClInclude Include="Golay24128.h" />
<ClInclude Include="GPSD.h" />
<ClInclude Include="Hamming.h" />
<ClInclude Include="DMRLookup.h" />
<ClInclude Include="I2CController.h" />
<ClInclude Include="LCDproc.h" />
<ClInclude Include="Log.h" />
<ClInclude Include="MMDVMHost.h" />
<ClInclude Include="MobileGPS.h" />
<ClInclude Include="Modem.h" />
<ClInclude Include="ModemSerialPort.h" />
<ClInclude Include="Mutex.h" />
@ -281,12 +281,12 @@
<ClCompile Include="DStarSlowData.cpp" />
<ClCompile Include="Golay2087.cpp" />
<ClCompile Include="Golay24128.cpp" />
<ClCompile Include="GPSD.cpp" />
<ClCompile Include="Hamming.cpp" />
<ClCompile Include="I2CController.cpp" />
<ClCompile Include="LCDproc.cpp" />
<ClCompile Include="Log.cpp" />
<ClCompile Include="MMDVMHost.cpp" />
<ClCompile Include="MobileGPS.cpp" />
<ClCompile Include="Modem.cpp" />
<ClCompile Include="ModemSerialPort.cpp" />
<ClCompile Include="Mutex.cpp" />

View file

@ -278,9 +278,6 @@
<ClInclude Include="I2CController.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="MobileGPS.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="NullModem.h">
<Filter>Header Files</Filter>
</ClInclude>
@ -305,6 +302,9 @@
<ClInclude Include="NXDNKenwoodNetwork.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="GPSD.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="BPTC19696.cpp">
@ -547,9 +547,6 @@
<ClCompile Include="I2CController.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="MobileGPS.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="NullModem.cpp">
<Filter>Source Files</Filter>
</ClCompile>
@ -574,5 +571,8 @@
<ClCompile Include="NXDNKenwoodNetwork.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="GPSD.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

View file

@ -2,14 +2,21 @@
CC = cc
CXX = c++
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
CFLAGS = -g -O3 -Wall -std=c++0x -pthread
LIBS = -lpthread
# Use the following CFLAGS and LIBS if you do want to use gpsd.
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread
#LIBS = -lpthread -lgps
LDFLAGS = -g
OBJECTS = \
AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \
DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \
DStarSlowData.o Golay2087.o Golay24128.o Hamming.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \
DStarSlowData.o Golay2087.o Golay24128.o GPSD.o Hamming.o I2CController.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o \
NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o \
NXDNKenwoodNetwork.o NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o \
P25Network.o P25NID.o P25Trellis.o P25Utils.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o \
@ -27,6 +34,10 @@ RemoteCommand: Log.o RemoteCommand.o UDPSocket.o
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
install:
install -m 755 MMDVMHost /usr/local/bin/
install -m 755 RemoteCommand /usr/local/bin/
clean:
$(RM) MMDVMHost RemoteCommand *.o *.d *.bak *~ GitVersion.h

View file

@ -2,14 +2,20 @@
CC = gcc
CXX = g++
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DRASPBERRY_PI -I/usr/local/include
LIBS = -lwiringPi -lwiringPiDev -lpthread
# Use the following CFLAGS and LIBS if you do want to use gpsd.
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DRASPBERRY_PI -I/usr/local/include
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps
LDFLAGS = -g -L/usr/local/lib
OBJECTS = \
AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \
DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \
DStarSlowData.o Golay2087.o Golay24128.o Hamming.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \
DStarSlowData.o Golay2087.o Golay24128.o GPSD.o Hamming.o I2CController.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o \
NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o \
NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o \
P25Trellis.o P25Utils.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o \
@ -27,6 +33,10 @@ RemoteCommand: Log.o RemoteCommand.o UDPSocket.o
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
install:
install -m 755 MMDVMHost /usr/local/bin/
install -m 755 RemoteCommand /usr/local/bin/
clean:
$(RM) MMDVMHost RemoteCommand *.o *.d *.bak *~ GitVersion.h

View file

@ -3,14 +3,20 @@
CC = gcc
CXX = g++
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include
LIBS = -lwiringPi -lwiringPiDev -lpthread
# Use the following CFLAGS and LIBS if you do want to use gpsd.
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps
LDFLAGS = -g -L/usr/local/lib
OBJECTS = \
AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \
DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \
DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \
DStarSlowData.o Golay2087.o Golay24128.o GPSD.o Hamming.o HD44780.o I2CController.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o \
NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o \
NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o \
P25Trellis.o P25Utils.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o \
@ -28,6 +34,10 @@ RemoteCommand: Log.o RemoteCommand.o UDPSocket.o
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
install:
install -m 755 MMDVMHost /usr/local/bin/
install -m 755 RemoteCommand /usr/local/bin/
clean:
$(RM) MMDVMHost RemoteCommand *.o *.d *.bak *~ GitVersion.h

View file

@ -2,14 +2,21 @@
CC = gcc
CXX = g++
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHD44780 -I/usr/local/include
LIBS = -lwiringPi -lwiringPiDev -lpthread
# Use the following CFLAGS and LIBS if you do want to use gpsd.
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DHD44780 -I/usr/local/include
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps
LDFLAGS = -g -L/usr/local/lib
OBJECTS = \
AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \
DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \
DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \
DStarSlowData.o Golay2087.o Golay24128.o GPSD.o Hamming.o HD44780.o I2CController.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o \
NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o \
NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o \
P25Trellis.o P25Utils.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o \
@ -27,6 +34,10 @@ RemoteCommand: Log.o RemoteCommand.o UDPSocket.o
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
install:
install -m 755 MMDVMHost /usr/local/bin/
install -m 755 RemoteCommand /usr/local/bin/
clean:
$(RM) MMDVMHost RemoteCommand *.o *.d *.bak *~ GitVersion.h

View file

@ -2,14 +2,21 @@
CC = gcc
CXX = g++
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DOLED -I/usr/local/include
LIBS = -lArduiPi_OLED -lwiringPi -lpthread
# Use the following CFLAGS and LIBS if you do want to use gpsd.
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DOLED -I/usr/local/include
#LIBS = -lArduiPi_OLED -lwiringPi -lpthread -lgps
LDFLAGS = -g -L/usr/local/lib
OBJECTS = \
AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \
DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \
DStarSlowData.o Golay2087.o Golay24128.o Hamming.o I2CController.o OLED.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \
DStarSlowData.o Golay2087.o Golay24128.o GPSD.o Hamming.o I2CController.o OLED.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o \
NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o \
NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o \
P25Trellis.o P25Utils.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o \
@ -27,6 +34,10 @@ RemoteCommand: Log.o RemoteCommand.o UDPSocket.o
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
install:
install -m 755 MMDVMHost /usr/local/bin/
install -m 755 RemoteCommand /usr/local/bin/
clean:
$(RM) MMDVMHost RemoteCommand *.o *.d *.bak *~ GitVersion.h

View file

@ -3,14 +3,21 @@
CC = gcc
CXX = g++
# Use the following CFLAGS and LIBS if you don't want to use gpsd.
CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include
LIBS = -lwiringPi -lwiringPiDev -lpthread
# Use the following CFLAGS and LIBS if you do want to use gpsd.
#CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include
#LIBS = -lwiringPi -lwiringPiDev -lpthread -lgps
LDFLAGS = -g -L/usr/local/lib
OBJECTS = \
AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \
DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \
DStarSlowData.o Golay2087.o Golay24128.o Hamming.o HD44780.o I2CController.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o \
DStarSlowData.o Golay2087.o Golay24128.o GPSD.o Hamming.o HD44780.o I2CController.o LCDproc.o Log.o MMDVMHost.o Modem.o ModemSerialPort.o Mutex.o \
NetworkInfo.o Nextion.o NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o \
NXDNLayer3.o NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o \
P25Trellis.o P25Utils.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o \
@ -28,6 +35,10 @@ RemoteCommand: Log.o RemoteCommand.o UDPSocket.o
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
install:
install -m 755 MMDVMHost /usr/local/bin/
install -m 755 RemoteCommand /usr/local/bin/
clean:
$(RM) MMDVMHost RemoteCommand *.o *.d *.bak *~ GitVersion.h

View file

@ -1,39 +0,0 @@
# This makefile is for Solaris using gcc
CC = gcc
CXX = g++
CFLAGS = -g -O3 -Wall -std=c++0x -pthread
LIBS = -lpthread -lsocket
LDFLAGS = -g
OBJECTS = \
AMBEFEC.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o DMRDataHeader.o DMREMB.o DMREmbeddedData.o DMRFullLC.o \
DMRLookup.o DMRLC.o DMRNetwork.o DMRShortLC.o DMRSlot.o DMRSlotType.o DMRAccessControl.o DMRTA.o DMRTrellis.o DStarControl.o DStarHeader.o DStarNetwork.o \
DStarSlowData.o Golay2087.o Golay24128.o Hamming.o LCDproc.o Log.o MMDVMHost.o MobileGPS.o Modem.o ModemSerialPort.o Mutex.o NetworkInfo.o Nextion.o \
NullDisplay.o NullModem.o NXDNAudio.o NXDNControl.o NXDNConvolution.o NXDNCRC.o NXDNFACCH1.o NXDNIcomNetwork.o NXDNKenwoodNetwork.o NXDNLayer3.o \
NXDNLICH.o NXDNLookup.o NXDNNetwork.o NXDNSACCH.o NXDNUDCH.o P25Audio.o P25Control.o P25Data.o P25LowSpeedData.o P25Network.o P25NID.o P25Trellis.o \
P25Utils.o POCSAGControl.o POCSAGNetwork.o QR1676.o RemoteControl.o RS129.o RS241213.o RSSIInterpolator.o SerialController.o SerialPort.o SHA256.o \
StopWatch.o Sync.o TFTSerial.o TFTSurenoo.o Thread.o Timer.o UDPSocket.o UMP.o UserDB.o UserDBebtry.o Utils.o YSFControl.o YSFConvolution.o YSFFICH.o \
YSFNetwork.o YSFPayload.o
all: MMDVMHost RemoteCommand
MMDVMHost: GitVersion.h $(OBJECTS)
$(CXX) $(OBJECTS) $(CFLAGS) $(LIBS) -o MMDVMHost
RemoteCommand: Log.o RemoteCommand.o UDPSocket.o
$(CXX) Log.o RemoteCommand.o UDPSocket.o $(CFLAGS) $(LIBS) -o RemoteCommand
%.o: %.cpp
$(CXX) $(CFLAGS) -c -o $@ $<
clean:
$(RM) MMDVMHost RemoteCommand *.o *.d *.bak *~ GitVersion.h
# Export the current git version if the index file exists, else 000...
GitVersion.h:
ifneq ("$(wildcard .git/index)","")
echo "const char *gitversion = \"$(shell git rev-parse HEAD)\";" > $@
else
echo "const char *gitversion = \"0000000000000000000000000000000000000000\";" > $@
endif

View file

@ -1,101 +0,0 @@
/*
* Copyright (C) 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 "MobileGPS.h"
#include <cstdio>
#include <cassert>
#include <cstring>
#include <cmath>
CMobileGPS::CMobileGPS(const std::string& address, unsigned int port, CDMRNetwork* network) :
m_idTimer(1000U, 60U),
m_address(),
m_port(port),
m_socket(),
m_network(network)
{
assert(!address.empty());
assert(port > 0U);
assert(network != NULL);
m_address = CUDPSocket::lookup(address);
}
CMobileGPS::~CMobileGPS()
{
}
bool CMobileGPS::open()
{
bool ret = m_socket.open();
if (!ret)
return false;
m_idTimer.start();
return true;
}
void CMobileGPS::clock(unsigned int ms)
{
m_idTimer.clock(ms);
if (m_idTimer.hasExpired()) {
pollGPS();
m_idTimer.start();
}
sendReport();
}
void CMobileGPS::close()
{
m_socket.close();
}
bool CMobileGPS::pollGPS()
{
return m_socket.write((unsigned char*)"MMDVMHost", 9U, m_address, m_port);
}
void CMobileGPS::sendReport()
{
// Grab GPS data if it's available
unsigned char buffer[200U];
in_addr address;
unsigned int port;
int ret = m_socket.read(buffer, 200U, address, port);
if (ret <= 0)
return;
buffer[ret] = '\0';
// Parse the GPS data
char* pLatitude = ::strtok((char*)buffer, ",\n"); // Latitude
char* pLongitude = ::strtok(NULL, ",\n"); // Longitude
if (pLatitude == NULL || pLongitude == NULL)
return;
float latitude = float(::atof(pLatitude));
float longitude = float(::atof(pLongitude));
m_network->writeHomePosition(latitude, longitude);
}

View file

@ -240,7 +240,8 @@ void COLED::setIdleInt()
// m_display.print("Idle");
// m_display.setTextSize(1);
m_display.startscrolldiagright(0x00,0x0f); //the MMDVM logo scrolls the whole screen
if (m_displayScroll && m_displayLogoScreensaver)
m_display.startscrolldiagright(0x00,0x0f); //the MMDVM logo scrolls the whole screen
m_display.display();
unsigned char info[100U];
@ -568,7 +569,8 @@ void COLED::writeCWInt()
m_display.setTextSize(1);
m_display.display();
m_display.startscrollright(0x02,0x0f);
if (m_displayScroll)
m_display.startscrollright(0x02,0x0f);
}
void COLED::clearCWInt()
@ -581,14 +583,16 @@ void COLED::clearCWInt()
m_display.setTextSize(1);
m_display.display();
m_display.startscrollleft(0x02,0x0f);
if (m_displayScroll)
m_display.startscrollleft(0x02,0x0f);
}
void COLED::close()
{
m_display.clearDisplay();
m_display.fillRect(0, 0, m_display.width(), 16, BLACK);
m_display.startscrollright(0x00,0x01);
if (m_displayScroll)
m_display.startscrollright(0x00,0x01);
m_display.setCursor(0,00);
m_display.setTextSize(2);
m_display.print("-CLOSE-");

View file

@ -19,6 +19,6 @@
#if !defined(VERSION_H)
#define VERSION_H
const char* VERSION = "20200608";
const char* VERSION = "20200630";
#endif