Skip to content

Commit ff16fbe

Browse files
committed
In Range field and minor updates
1 parent d144507 commit ff16fbe

15 files changed

Lines changed: 9973 additions & 9892 deletions

File tree

Application/WebDB.cpp

Lines changed: 9883 additions & 9880 deletions
Large diffs are not rendered by default.

Application/version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#pragma once
22

3-
#define VERSION_DESCRIBE "v0.61-470-g3bcfa8a6"
4-
#define VERSION_URL_TAG "v0_61_470_g3bcfa8a6"
3+
#define VERSION_DESCRIBE "1746615957"
4+
#define VERSION_URL_TAG "1746615957"

HTML/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@
893893
class="mapcard-content-row shipcard-content-row shipcard-max-only">
894894
<div><span>Country</span><span id="shipcard_country"></span></div>
895895
<div><span>Sender</span><span id="shipcard_type"></span></div>
896+
<div><span>In Range</span><span id="shipcard_received_stations"></span></div>
896897
</div>
897898

898899
<div onclick="shipcardselect(this)" data-context-type="ship"
@@ -1109,7 +1110,7 @@
11091110
<div class="bottombar"></div>
11101111

11111112
<script src="custom/plugins.js"></script>
1112-
<script src="script.js?hash=e31140785eb05ea48ce169a3ed446670"></script>
1113+
<script src="script.js?hash=468121a35def74cec0f91f47c132213f"></script>
11131114

11141115

11151116
<div class="overlay" onclick="toggleInfoPanel()"></div>

HTML/index_local.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,7 @@
893893
class="mapcard-content-row shipcard-content-row shipcard-max-only">
894894
<div><span>Country</span><span id="shipcard_country"></span></div>
895895
<div><span>Sender</span><span id="shipcard_type"></span></div>
896+
<div><span>In Range</span><span id="shipcard_received_stations"></span></div>
896897
</div>
897898

898899
<div onclick="shipcardselect(this)" data-context-type="ship"
@@ -1109,7 +1110,7 @@
11091110
<div class="bottombar"></div>
11101111

11111112
<script src="custom/plugins.js"></script>
1112-
<script src="script.js?hash=e31140785eb05ea48ce169a3ed446670"></script>
1113+
<script src="script.js?hash=468121a35def74cec0f91f47c132213f"></script>
11131114

11141115

11151116
<div class="overlay" onclick="toggleInfoPanel()"></div>

HTML/script.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2667,7 +2667,8 @@ async function fetchShips(noDoubleFetch = true) {
26672667
"flags",
26682668
"validated",
26692669
"channels",
2670-
"altitude"
2670+
"altitude",
2671+
"received_stations"
26712672
];
26722673

26732674
shipsDB = {};
@@ -5127,7 +5128,7 @@ function populateShipcard() {
51275128
setShipcardValidation(ship.validated);
51285129

51295130
// verbatim copies
5130-
["destination", "mmsi", "count", "imo"].forEach((e) => (document.getElementById("shipcard_" + e).innerHTML = ship[e]));
5131+
["destination", "mmsi", "count", "imo", "received_stations"].forEach((e) => (document.getElementById("shipcard_" + e).innerHTML = ship[e]));
51315132

51325133
// round and add units
51335134
[

IO/MsgOut.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ namespace IO
149149
}
150150
break;
151151
case MessageFormat::JSON_NMEA:
152-
std::cout << data[i].getNMEAJSON(tag.mode, tag.level, tag.ppm, tag.status, tag.hardware, tag.version, tag.driver) << std::endl;
152+
std::cout << data[i].getNMEAJSON(tag.mode, tag.level, tag.ppm, tag.status, tag.hardware, tag.version, tag.driver, include_sample_start) << std::endl;
153153
break;
154154
default:
155155
break;

IO/MsgOut.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ namespace IO
238238
private:
239239
MessageFormat level;
240240
AIS::Filter filter;
241+
bool include_sample_start = false;
241242

242243
public:
243244
virtual ~MessageToScreen() {}
@@ -257,6 +258,9 @@ namespace IO
257258
StreamIn<AIS::Message>::setGroupsIn(Util::Parse::Integer(arg));
258259
StreamIn<AIS::GPS>::setGroupsIn(Util::Parse::Integer(arg));
259260
}
261+
else if (option == "INCLUDE_SAMPLE_START") {
262+
include_sample_start = Util::Parse::Switch(arg);
263+
}
260264
else if (!filter.SetOption(option, arg))
261265
{
262266
throw std::runtime_error("Message output - unknown option: " + option);
@@ -271,6 +275,7 @@ namespace IO
271275
JSON::StringBuilder builder;
272276
std::string json;
273277
AIS::Filter filter;
278+
bool include_sample_start = false;
274279

275280
public:
276281
JSONtoScreen(const std::vector<std::vector<std::string>> *map, int d) : builder(map, d) {}
@@ -288,6 +293,9 @@ namespace IO
288293
StreamIn<JSON::JSON>::setGroupsIn(Util::Parse::Integer(arg));
289294
StreamIn<AIS::GPS>::setGroupsIn(Util::Parse::Integer(arg));
290295
}
296+
else if (option == "INCLUDE_SAMPLE_START") {
297+
include_sample_start = Util::Parse::Switch(arg);
298+
}
291299
else if (!filter.SetOption(option, arg))
292300
{
293301
throw std::runtime_error("JSON output - unknown option: " + option);

Library/Common.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ const int ETA_HOUR_UNDEFINED = 24;
160160
const int ETA_MINUTE_UNDEFINED = 60;
161161
const int IMO_UNDEFINED = 0;
162162
const int ANGLE_UNDEFINED = -1;
163+
const int RECEIVED_STATIONS_UNDEFINED = -1;
163164

164165
const float LEVEL_UNDEFINED = 1024;
165166
const float PPM_UNDEFINED = 1024;

Library/JSONAIS.cpp

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,48 @@ namespace AIS
341341
}
342342
}
343343

344+
void JSONAIS::ProcessRadio(const AIS::Message &msg, int start, int len)
345+
{
346+
unsigned radio_value = msg.getUint(start, len);
347+
348+
if (radio_value != 0 && len == 19)
349+
{
350+
json.Add(AIS::KEY_RADIO, (int)radio_value);
351+
352+
unsigned sync_state = (radio_value >> 17) & 0x03;
353+
json.Add(AIS::KEY_SYNC_STATE, (int)sync_state);
354+
355+
unsigned slot_timeout = (radio_value >> 14) & 0x07;
356+
json.Add(AIS::KEY_SLOT_TIMEOUT, (int)slot_timeout);
357+
358+
unsigned sub_msg = radio_value & 0x3FFF;
359+
360+
if (slot_timeout == 0)
361+
{
362+
json.Add(AIS::KEY_SLOT_OFFSET, (int)sub_msg);
363+
}
364+
else if (slot_timeout == 1)
365+
{
366+
unsigned utc_hour = (sub_msg >> 9) & 0x1F; // 5 bits (13-9)
367+
unsigned utc_minute = (sub_msg >> 2) & 0x7F; // 7 bits (8-2)
368+
369+
json.Add(AIS::KEY_UTC_HOUR, (int)utc_hour);
370+
json.Add(AIS::KEY_UTC_MINUTE, (int)utc_minute);
371+
}
372+
else if (slot_timeout == 2 || slot_timeout == 4 || slot_timeout == 6)
373+
{
374+
json.Add(AIS::KEY_SLOT_NUMBER, (int)sub_msg);
375+
}
376+
else if (slot_timeout == 3 || slot_timeout == 5 || slot_timeout == 7)
377+
{
378+
json.Add(AIS::KEY_RECEIVED_STATIONS, (int)sub_msg);
379+
}
380+
}
381+
else
382+
{
383+
json.Add(AIS::KEY_RADIO, 0);
384+
}
385+
}
344386
void JSONAIS::ProcessMsg(const AIS::Message &msg, TAG &tag)
345387
{
346388

@@ -388,6 +430,7 @@ namespace AIS
388430
case 1:
389431
case 2:
390432
case 3:
433+
{
391434
E(msg, AIS::KEY_STATUS, 38, 4, AIS::KEY_STATUS_TEXT, &JSON_MAP_STATUS);
392435
TURN(msg, AIS::KEY_TURN, 42, 8);
393436
UL(msg, AIS::KEY_SPEED, 50, 10, 0.1f, 0, 1023);
@@ -400,8 +443,10 @@ namespace AIS
400443
E(msg, AIS::KEY_MANEUVER, 143, 2);
401444
X(msg, AIS::KEY_SPARE, 145, 3);
402445
B(msg, AIS::KEY_RAIM, 148, 1);
403-
U(msg, AIS::KEY_RADIO, 149, MIN(19, MAX(msg.getLength() - 149, 0)));
446+
447+
ProcessRadio(msg, 149, MAX(MIN(19, msg.getLength() - 149),0));
404448
break;
449+
}
405450
case 4:
406451
case 11:
407452
TIMESTAMP(msg, AIS::KEY_TIMESTAMP, 38, 40, timestamp);
@@ -417,7 +462,8 @@ namespace AIS
417462
E(msg, AIS::KEY_EPFD, 134, 4, AIS::KEY_EPFD_TEXT, &JSON_MAP_EPFD);
418463
X(msg, AIS::KEY_SPARE, 138, 10);
419464
B(msg, AIS::KEY_RAIM, 148, 1);
420-
U(msg, AIS::KEY_RADIO, 149, 19);
465+
466+
ProcessRadio(msg, 149, MAX(MIN(19, msg.getLength() - 149),0));
421467
break;
422468
case 5:
423469
U(msg, AIS::KEY_AIS_VERSION, 38, 2);

Library/JSONAIS.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ namespace AIS {
4343
protected:
4444
void ProcessMsg8Data(const AIS::Message& msg);
4545
void ProcessMsg6Data(const AIS::Message& msg);
46+
void ProcessRadio(const AIS::Message &msg, int start, int len);
4647

4748

4849
void U(const AIS::Message& msg, int p, int start, int len, unsigned undefined = ~0);

0 commit comments

Comments
 (0)