diff --git a/NXDNGateway/APRSWriter.cpp b/NXDNGateway/APRSWriter.cpp index fc1fc2c..cb67049 100644 --- a/NXDNGateway/APRSWriter.cpp +++ b/NXDNGateway/APRSWriter.cpp @@ -37,7 +37,7 @@ m_desc(), m_aprsAddress(), m_aprsPort(port), m_aprsSocket() -#if !defined(_WIN32) && !defined(_WIN64) +#if defined(USE_GPSD) ,m_gpsdEnabled(false), m_gpsdAddress(), m_gpsdPort(), @@ -76,7 +76,7 @@ void CAPRSWriter::setStaticLocation(float latitude, float longitude, int height) void CAPRSWriter::setGPSDLocation(const std::string& address, const std::string& port) { -#if !defined(_WIN32) && !defined(_WIN64) +#if defined(USE_GPSD) assert(!address.empty()); assert(!port.empty()); @@ -88,7 +88,7 @@ void CAPRSWriter::setGPSDLocation(const std::string& address, const std::string& bool CAPRSWriter::open() { -#if !defined(_WIN32) && !defined(_WIN64) +#if defined(USE_GPSD) if (m_gpsdEnabled) { int ret = ::gps_open(m_gpsdAddress.c_str(), m_gpsdPort.c_str(), &m_gpsdData); if (ret != 0) { @@ -127,7 +127,7 @@ void CAPRSWriter::clock(unsigned int ms) { m_idTimer.clock(ms); -#if !defined(_WIN32) && !defined(_WIN64) +#if defined(USE_GPSD) if (m_gpsdEnabled) { if (m_idTimer.hasExpired()) { sendIdFrameMobile(); @@ -141,7 +141,7 @@ void CAPRSWriter::clock(unsigned int ms) m_idTimer.setTimeout(20U * 60U); m_idTimer.start(); } -#if !defined(_WIN32) && !defined(_WIN64) +#if defined(USE_GPSD) } #endif } @@ -150,7 +150,7 @@ void CAPRSWriter::close() { m_aprsSocket.close(); -#if !defined(_WIN32) && !defined(_WIN64) +#if defined(USE_GPSD) if (m_gpsdEnabled) { ::gps_stream(&m_gpsdData, WATCH_DISABLE, NULL); ::gps_close(&m_gpsdData); @@ -222,6 +222,7 @@ void CAPRSWriter::sendIdFrameFixed() write(output); } +#if defined(USE_GPSD) void CAPRSWriter::sendIdFrameMobile() { if (!::gps_waiting(&m_gpsdData, 0)) @@ -311,4 +312,4 @@ void CAPRSWriter::sendIdFrameMobile() write(output); } - +#endif diff --git a/NXDNGateway/APRSWriter.h b/NXDNGateway/APRSWriter.h index 461d945..df51adc 100644 --- a/NXDNGateway/APRSWriter.h +++ b/NXDNGateway/APRSWriter.h @@ -70,7 +70,7 @@ private: in_addr m_aprsAddress; unsigned int m_aprsPort; CUDPSocket m_aprsSocket; -#if !defined(_WIN32) && !defined(_WIN64) +#if defined(USE_GPSD) bool m_gpsdEnabled; std::string m_gpsdAddress; std::string m_gpsdPort; diff --git a/NXDNGateway/Makefile b/NXDNGateway/Makefile index d9bc000..24cba48 100644 --- a/NXDNGateway/Makefile +++ b/NXDNGateway/Makefile @@ -1,6 +1,12 @@ CC = gcc CXX = g++ + +# Use the following CFLAGS if you don't want to use gpsd. CFLAGS = -g -O3 -Wall -std=c++0x -pthread + +# Use the following CFLAGS if you do want to use gpsd. +CFLAGS = -g -O3 -Wall -DUSE_GPSD -std=c++0x -pthread + LIBS = -lpthread -lgps LDFLAGS = -g