diff --git a/FMNetwork.cpp b/FMNetwork.cpp index 590a793..bc394c2 100644 --- a/FMNetwork.cpp +++ b/FMNetwork.cpp @@ -30,7 +30,7 @@ const unsigned int BUFFER_LENGTH = 500U; CFMNetwork::CFMNetwork(const std::string& localAddress, unsigned int localPort, const std::string& gatewayAddress, unsigned int gatewayPort, unsigned int sampleRate, bool debug) : m_socket(localAddress, localPort), m_addr(), -m_addrLen(), +m_addrLen(0U), m_sampleRate(sampleRate), m_debug(debug), m_enabled(false), @@ -41,7 +41,8 @@ m_pollTimer(1000U, 5U) assert(!gatewayAddress.empty()); assert(sampleRate > 0U); - CUDPSocket::lookup(gatewayAddress, gatewayPort, m_addr, m_addrLen); + if (CUDPSocket::lookup(gatewayAddress, gatewayPort, m_addr, m_addrLen) != 0) + m_addrLen = 0U; int error; m_incoming = ::src_new(SRC_SINC_FASTEST, 1, &error); @@ -59,11 +60,16 @@ CFMNetwork::~CFMNetwork() bool CFMNetwork::open() { + if (m_addrLen == 0U) { + LogError("Unable to resolve the address of the FM Gateway"); + return false; + } + LogMessage("Opening FM network connection"); m_pollTimer.start(); - return m_socket.open(); + return m_socket.open(m_addr); } bool CFMNetwork::writeData(float* data, unsigned int nSamples) diff --git a/Makefile b/Makefile index 6582ae6..adf0143 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ CC = cc CXX = c++ -CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -LIBS = -lpthread -LDFLAGS = -g +CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -I/usr/local/include +LIBS = -lpthread -lsamplerate -lutil +LDFLAGS = -g -L/usr/local/lib OBJECTS = AMBEFEC.o AX25Control.o AX25Network.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 \ diff --git a/Makefile.Pi b/Makefile.Pi index 4a757ad..055d450 100644 --- a/Makefile.Pi +++ b/Makefile.Pi @@ -3,7 +3,7 @@ CC = cc CXX = c++ CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DRASPBERRY_PI -I/usr/local/include -LIBS = -lwiringPi -lwiringPiDev -lpthread +LIBS = -lwiringPi -lwiringPiDev -lpthread -lsamplerate -lutil LDFLAGS = -g -L/usr/local/lib OBJECTS = AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o \ diff --git a/Makefile.Pi.Adafruit b/Makefile.Pi.Adafruit index 19ddbae..5301a2a 100644 --- a/Makefile.Pi.Adafruit +++ b/Makefile.Pi.Adafruit @@ -4,7 +4,7 @@ CC = cc CXX = c++ CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DHD44780 -DADAFRUIT_DISPLAY -I/usr/local/include -LIBS = -lwiringPi -lwiringPiDev -lpthread +LIBS = -lwiringPi -lwiringPiDev -lpthread -lsamplerate -lutil LDFLAGS = -g -L/usr/local/lib OBJECTS = AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o \ diff --git a/Makefile.Pi.HD44780 b/Makefile.Pi.HD44780 index f05b28d..906fc66 100644 --- a/Makefile.Pi.HD44780 +++ b/Makefile.Pi.HD44780 @@ -3,7 +3,7 @@ CC = cc CXX = c++ CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DHD44780 -I/usr/local/include -LIBS = -lwiringPi -lwiringPiDev -lpthread +LIBS = -lwiringPi -lwiringPiDev -lpthread -lsamplerate -lutil LDFLAGS = -g -L/usr/local/lib OBJECTS = AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o \ diff --git a/Makefile.Pi.OLED b/Makefile.Pi.OLED index a4a2e66..45b22ef 100644 --- a/Makefile.Pi.OLED +++ b/Makefile.Pi.OLED @@ -3,7 +3,7 @@ CC = cc CXX = c++ CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DOLED -I/usr/local/include -LIBS = -lArduiPi_OLED -lwiringPi -lpthread +LIBS = -lArduiPi_OLED -lwiringPi -lpthread -lsamplerate -lutil LDFLAGS = -g -L/usr/local/lib OBJECTS = AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o \ diff --git a/Makefile.Pi.PCF8574 b/Makefile.Pi.PCF8574 index 7d8afa5..13291e4 100644 --- a/Makefile.Pi.PCF8574 +++ b/Makefile.Pi.PCF8574 @@ -4,7 +4,7 @@ CC = cc CXX = c++ CFLAGS = -g -O3 -Wall -std=c++0x -pthread -DHAVE_LOG_H -DHD44780 -DPCF8574_DISPLAY -I/usr/local/include -LIBS = -lwiringPi -lwiringPiDev -lpthread +LIBS = -lwiringPi -lwiringPiDev -lpthread -lsamplerate -lutil LDFLAGS = -g -L/usr/local/lib OBJECTS = AMBEFEC.o AX25Control.o AX25Network.o BCH.o BPTC19696.o CASTInfo.o Conf.o CRC.o Display.o DMRControl.o DMRCSBK.o DMRData.o \