Skip to content

Commit

Permalink
-Add rate config for messages
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo-gomez-windhover committed Feb 23, 2024
1 parent 5c911be commit 5c78df5
Showing 1 changed file with 58 additions and 1 deletion.
59 changes: 58 additions & 1 deletion src/main/java/com/windhoverlabs/yamcs/gdl90/GDL90Link.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ public String toString() {

private boolean realtime;

private int heartbeatRate;
private int ownShipReportRate;
private int ownShipGeoAltitudeRate;
private int AHRSRate;

static {
gftdef = new TupleDefinition();
gftdef.addColumn(new ColumnDefinition(RECTIME_CNAME, DataType.TIMESTAMP));
Expand Down Expand Up @@ -441,13 +446,65 @@ private void initPVMode() {

/** Method only relevant when in PV mode */
private void initGDL90Timers() {
// Defaults are based on
// spec:https://www.faa.gov/sites/faa.gov/files/air_traffic/technology/adsb/archival/GDL90_Public_ICD_RevA.PDF,
// https://www.foreflight.com/connect/spec/
heartbeatRate = this.config.getInt("heartbeatRate", 1);
ownShipReportRate = this.config.getInt("ownShipReportRate", 1);
ownShipGeoAltitudeRate = this.config.getInt("ownShipGeoAltitudeRate", 1);
AHRSRate = this.config.getInt("AHRSRate", 5);
scheduler.scheduleAtFixedRate(
() -> {
if (isRunningAndEnabled()) {
try {
sendHeartbeat();

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
},
100,
1000 / heartbeatRate,
TimeUnit.MILLISECONDS);

scheduler.scheduleAtFixedRate(
() -> {
if (isRunningAndEnabled()) {
try {
sendOwnshipReport();

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
},
100,
1000 / ownShipReportRate,
TimeUnit.MILLISECONDS);

scheduler.scheduleAtFixedRate(
() -> {
if (isRunningAndEnabled()) {
try {
sendOwnshipGeoAltitude();

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
},
100,
1000 / ownShipGeoAltitudeRate,
TimeUnit.MILLISECONDS);

scheduler.scheduleAtFixedRate(
() -> {
if (isRunningAndEnabled()) {
try {
sendForeFlightID();

} catch (IOException e) {
Expand All @@ -472,7 +529,7 @@ private void initGDL90Timers() {
}
},
100,
200,
1000 / AHRSRate,
TimeUnit.MILLISECONDS);
}

Expand Down

0 comments on commit 5c78df5

Please sign in to comment.