From 5c78df550e9eaa25547bda48bb749471e36dd297 Mon Sep 17 00:00:00 2001 From: lgomez Date: Fri, 23 Feb 2024 15:46:31 -0600 Subject: [PATCH] -Add rate config for messages --- .../windhoverlabs/yamcs/gdl90/GDL90Link.java | 59 ++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/windhoverlabs/yamcs/gdl90/GDL90Link.java b/src/main/java/com/windhoverlabs/yamcs/gdl90/GDL90Link.java index 00b9a0a..d5e15a1 100644 --- a/src/main/java/com/windhoverlabs/yamcs/gdl90/GDL90Link.java +++ b/src/main/java/com/windhoverlabs/yamcs/gdl90/GDL90Link.java @@ -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)); @@ -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) { @@ -472,7 +529,7 @@ private void initGDL90Timers() { } }, 100, - 200, + 1000 / AHRSRate, TimeUnit.MILLISECONDS); }