Skip to content

Commit a6aae2d

Browse files
committed
beast outline
1 parent 60f47ab commit a6aae2d

File tree

9 files changed

+63
-7
lines changed

9 files changed

+63
-7
lines changed

Application/Receiver.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,9 @@ std::unique_ptr<AIS::Model> &Receiver::addModel(int m)
272272
case 7:
273273
models.push_back(std::unique_ptr<AIS::Model>(new AIS::ModelBaseStation()));
274274
break;
275+
case 8:
276+
models.push_back(std::unique_ptr<AIS::Model>(new AIS::ModelBeast()));
277+
break;
275278
default:
276279
throw std::runtime_error("Model not implemented in this version. Check in later.");
277280
}
@@ -294,17 +297,21 @@ void Receiver::setupModel(int &group)
294297
case Format::BASESTATION:
295298
addModel(7);
296299
break;
300+
case Format::BEAST:
301+
addModel(8);
302+
break;
297303
default:
298304
addModel(2);
299305
break;
300306
}
301307
}
308+
302309
// ensure some basic compatibility between model and device
303310
for (const auto &m : models)
304311
{
305312
if ((m->getClass() == AIS::ModelClass::TXT && device->getFormat() != Format::TXT) ||
306313
(m->getClass() != AIS::ModelClass::TXT && device->getFormat() == Format::TXT) ||
307-
(m->getClass() == AIS::ModelClass::BASESTATION && device->getFormat() != Format::BASESTATION) )
314+
(m->getClass() == AIS::ModelClass::BASESTATION && (device->getFormat() != Format::BASESTATION && device->getFormat() != Format::BEAST) ) )
308315
throw std::runtime_error("Decoding model and input format not consistent.");
309316
}
310317

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -789,11 +789,11 @@ set(CPP
789789
Device/FileRAW.cpp Device/HACKRF.cpp Device/UDP.cpp Device/RTLTCP.cpp Device/ZMQ.cpp Device/SoapySDR.cpp Device/SpyServer.cpp Library/Message.cpp Library/NMEA.cpp
790790
Library/Utilities.cpp Library/TCP.cpp JSON/JSON.cpp IO/Network.cpp IO/HTTPServer.cpp JSON/StringBuilder.cpp JSON/Parser.cpp Library/Logger.cpp
791791
Device/AIRSPY.cpp Device/Serial.cpp IO/HTTPClient.cpp Application/WebDB.cpp
792-
DSP/DSP.cpp Device/N2KsktCAN.cpp Library/Basestation.cpp
792+
DSP/DSP.cpp Device/N2KsktCAN.cpp Library/Basestation.cpp Library/Beast.cpp
793793
IO/MsgOut.cpp IO/N2KStream.cpp Library/N2K.cpp IO/N2KInterface.cpp Protocol/Protocol.cpp)
794794

795795
set(HEADER
796-
Application/AIS-catcher.h Application/Prometheus.h Application/Config.h Application/WebDB.h Library/Logger.h Application/WebViewer.h Application/Receiver.h Tracking/Ships.h Tracking/DB.h DBMS/PostgreSQL.h IO/HTTPClient.h Application/MapTiles.h
796+
Application/AIS-catcher.h Application/Prometheus.h Application/Config.h Application/WebDB.h Library/Logger.h Application/WebViewer.h Application/Receiver.h Tracking/Ships.h Tracking/DB.h DBMS/PostgreSQL.h IO/HTTPClient.h Application/MapTiles.h Library/Beast.h
797797
Device/Device.h Device/FileWAV.h Device/RTLTCP.h Device/UDP.h DSP/Demod.h DSP/Filters.h Library/AIS.h Library/Message.h Library/NMEA.h Library/ZIP.h Library/Signals.h Device/SoapySDR.h Library/JSONAIS.h JSON/JSON.h Library/Basestation.h Library/ADSB.h
798798
Device/AIRSPY.h Library/FIFO.h Device/N2KsktCAN.h Device/HACKRF.h Device/SDRPLAY.h DSP/DSP.h DSP/Model.h Tracking/History.h Tracking/Statistics.h Library/Common.h Library/Stream.h Device/SpyServer.h Library/Keys.h JSON/StringBuilder.h JSON/Parser.h Tracking/PlaneDB.h
799799
Device/Serial.h IO/N2KInterface.h Library/N2K.h IO/N2KStream.h Device/AIRSPYHF.h Device/FileRAW.h Device/RTLSDR.h Device/ZMQ.h DSP/FFT.h IO/MsgOut.h IO/Network.h IO/HTTPServer.h Library/Utilities.h Library/TCP.h Protocol/Protocol.h)

DSP/Model.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,4 +835,25 @@ namespace AIS
835835
{
836836
return Model::Get();
837837
}
838+
839+
void ModelBeast::buildModel(char CH1, char CH2, int sample_rate, bool timerOn, Device::Device *dev)
840+
{
841+
setName("ADSB input");
842+
device = dev;
843+
*device >> model >> outputADSB;
844+
}
845+
846+
Setting &ModelBeast::Set(std::string option, std::string arg)
847+
{
848+
Util::Convert::toUpper(option);
849+
850+
Model::Set(option, arg);
851+
852+
return *this;
853+
}
854+
855+
std::string ModelBeast::Get()
856+
{
857+
return Model::Get();
858+
}
838859
}

DSP/Model.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include "NMEA.h"
2626
#include "N2K.h"
2727
#include "Basestation.h"
28+
#include "Beast.h"
2829

2930
#include "DSP.h"
3031
#include "Demod.h"
@@ -310,4 +311,14 @@ namespace AIS
310311
ModelClass getClass() { return ModelClass::BASESTATION; }
311312
};
312313

314+
class ModelBeast : public Model
315+
{
316+
Beast model;
317+
318+
public:
319+
void buildModel(char, char, int, bool, Device::Device *);
320+
Setting &Set(std::string option, std::string arg);
321+
std::string Get();
322+
ModelClass getClass() { return ModelClass::BASESTATION; }
323+
};
313324
}

Device/RTLTCP.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ namespace Device
7676

7777
Device::Play();
7878

79-
if (getFormat() != Format::TXT && getFormat() != Format::BASESTATION)
79+
if (getFormat() != Format::TXT && getFormat() != Format::BASESTATION && getFormat() != Format::BEAST)
8080
{
8181
fifo.Init(BUFFER_SIZE);
8282
}
@@ -208,6 +208,9 @@ namespace Device
208208
case PROTOCOL::BASESTATION:
209209
setFormat(Format::BASESTATION);
210210
break;
211+
case PROTOCOL::BEAST:
212+
setFormat(Format::BEAST);
213+
break;
211214
default:
212215
throw std::runtime_error("RTLTCP: unsupported protocol: " + arg);
213216
}

Library/Common.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ enum class Format
6464
TXT,
6565
N2K,
6666
BASESTATION,
67+
BEAST,
6768
UNKNOWN
6869
};
6970

@@ -76,7 +77,8 @@ enum class PROTOCOL
7677
MQTT,
7778
WS,
7879
WSMQTT,
79-
BASESTATION
80+
BASESTATION,
81+
BEAST
8082
};
8183

8284
enum class Type

Library/Utilities.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ namespace Util
218218
format = Format::TXT;
219219
else if (str == "BASESTATION")
220220
format = Format::BASESTATION;
221+
else if (str == "BEAST")
222+
format = Format::BEAST;
221223
else
222224
return false;
223225

@@ -298,6 +300,10 @@ namespace Util
298300
{
299301
protocol = PROTOCOL::BASESTATION;
300302
}
303+
else if (arg == "BEAST")
304+
{
305+
protocol = PROTOCOL::BEAST;
306+
}
301307
else
302308
return false;
303309

@@ -469,6 +475,8 @@ namespace Util
469475
return "TXT";
470476
case Format::BASESTATION:
471477
return "BASESTATION";
478+
case Format::BEAST:
479+
return "BEAST";
472480
default:
473481
break;
474482
}
@@ -495,6 +503,8 @@ namespace Util
495503
return "WSMQTT";
496504
case PROTOCOL::BASESTATION:
497505
return "BASESTATION";
506+
case PROTOCOL::BEAST:
507+
return "BEAST";
498508
}
499509
return "";
500510
}

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
SRC = Tracking/Ships.cpp Library/N2K.cpp IO/N2KInterface.cpp Device/N2KsktCAN.cpp IO/N2KStream.cpp Application/Prometheus.cpp Application/Main.cpp Application/WebViewer.cpp IO/HTTPClient.cpp DBMS/PostgreSQL.cpp Tracking/DB.cpp Application/Config.cpp Application/Receiver.cpp IO/HTTPServer.cpp DSP/DSP.cpp Library/JSONAIS.cpp JSON/Parser.cpp JSON/StringBuilder.cpp Library/Keys.cpp Library/AIS.cpp IO/Network.cpp DSP/Model.cpp Library/NMEA.cpp Library/Utilities.cpp DSP/Demod.cpp Library/Message.cpp Device/UDP.cpp Device/ZMQ.cpp Device/RTLSDR.cpp Device/AIRSPYHF.cpp Device/SoapySDR.cpp Device/AIRSPY.cpp Device/FileRAW.cpp Device/FileWAV.cpp Device/SDRPLAY.cpp Device/RTLTCP.cpp Device/HACKRF.cpp Device/Serial.cpp Library/TCP.cpp Device/SpyServer.cpp JSON/JSON.cpp Protocol/Protocol.cpp IO/MsgOut.cpp Library/Logger.cpp Library/Basestation.cpp Application/WebDB.cpp
2-
OBJ = Ships.o Main.o N2KStream.o N2K.o N2KInterface.o N2KsktCAN.o Prometheus.o Receiver.o Config.o WebViewer.o HTTPClient.o PostgreSQL.o DB.o DSP.o AIS.o Model.o Utilities.o Network.o Demod.o Serial.o RTLSDR.o HTTPServer.o AIRSPYHF.o Keys.o AIRSPY.o Parser.o StringBuilder.o FileRAW.o FileWAV.o SDRPLAY.o NMEA.o RTLTCP.o HACKRF.o ZMQ.o UDP.o SoapySDR.o TCP.o Message.o SpyServer.o JSON.o JSONAIS.o Protocol.o MsgOut.o Logger.o Basestation.o WebDB.o
1+
SRC = Tracking/Ships.cpp Library/N2K.cpp IO/N2KInterface.cpp Device/N2KsktCAN.cpp IO/N2KStream.cpp Application/Prometheus.cpp Application/Main.cpp Application/WebViewer.cpp IO/HTTPClient.cpp DBMS/PostgreSQL.cpp Tracking/DB.cpp Application/Config.cpp Application/Receiver.cpp IO/HTTPServer.cpp DSP/DSP.cpp Library/JSONAIS.cpp JSON/Parser.cpp JSON/StringBuilder.cpp Library/Keys.cpp Library/AIS.cpp IO/Network.cpp DSP/Model.cpp Library/NMEA.cpp Library/Utilities.cpp DSP/Demod.cpp Library/Message.cpp Device/UDP.cpp Device/ZMQ.cpp Device/RTLSDR.cpp Device/AIRSPYHF.cpp Device/SoapySDR.cpp Device/AIRSPY.cpp Device/FileRAW.cpp Device/FileWAV.cpp Device/SDRPLAY.cpp Device/RTLTCP.cpp Device/HACKRF.cpp Device/Serial.cpp Library/TCP.cpp Device/SpyServer.cpp JSON/JSON.cpp Protocol/Protocol.cpp IO/MsgOut.cpp Library/Logger.cpp Library/Basestation.cpp Application/WebDB.cpp Library/Beast.cpp
2+
OBJ = Ships.o Main.o N2KStream.o N2K.o N2KInterface.o N2KsktCAN.o Prometheus.o Receiver.o Config.o WebViewer.o HTTPClient.o PostgreSQL.o DB.o DSP.o AIS.o Model.o Utilities.o Network.o Demod.o Serial.o RTLSDR.o HTTPServer.o AIRSPYHF.o Keys.o AIRSPY.o Parser.o StringBuilder.o FileRAW.o FileWAV.o SDRPLAY.o NMEA.o RTLTCP.o HACKRF.o ZMQ.o UDP.o SoapySDR.o TCP.o Message.o SpyServer.o JSON.o JSONAIS.o Protocol.o MsgOut.o Logger.o Basestation.o WebDB.o Beast.o
33
INCLUDE = -I. -IDBMS/ -ITracking/ -ILibrary/ -IDSP/ -IApplication/ -IIO/ -IProtocol/
44
CC = clang
55

msvc/AIS-catcher RTLSDR.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
<ClCompile Include="..\Library\JSONAIS.cpp" />
5959
<ClCompile Include="..\Library\NMEA.cpp" />
6060
<ClCompile Include="..\Library\Basestation.cpp" />
61+
<ClCompile Include="..\Library\Beast.cpp" />
6162
<ClCompile Include="..\Library\Logger.cpp" />
6263
<ClCompile Include="..\Library\TCP.cpp" />
6364
<ClCompile Include="..\Library\Utilities.cpp" />
@@ -114,6 +115,7 @@
114115
<ClInclude Include="..\Library\TCP.h" />
115116
<ClInclude Include="..\Library\ADSB.h" />
116117
<ClInclude Include="..\Library\Basestation.h" />
118+
<ClInclude Include="..\Library\Beast.h" />
117119
<ClInclude Include="..\Library\Logger.h" />
118120
<ClInclude Include="..\Library\Utilities.h" />
119121
<ClInclude Include="..\Protocol\Protocol.h" />

0 commit comments

Comments
 (0)