X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=altoslib%2FAltosTelemetryRecordRaw.java;h=f94789bb57adb08d936bf26ba9806eeeb199ca12;hb=f6661cc015e1a92450dc3eede97d66005f69cc72;hp=43d0f17a4562456d54eeba072e01a20c6437cb1e;hpb=69e6df07976a56b49e07c242cd6e5b2cbd2a578d;p=fw%2Faltos diff --git a/altoslib/AltosTelemetryRecordRaw.java b/altoslib/AltosTelemetryRecordRaw.java index 43d0f17a..f94789bb 100644 --- a/altoslib/AltosTelemetryRecordRaw.java +++ b/altoslib/AltosTelemetryRecordRaw.java @@ -15,17 +15,14 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -package org.altusmetrum.AltosLib; - -import java.lang.*; -import java.text.*; -import java.util.HashMap; +package org.altusmetrum.altoslib_1; public class AltosTelemetryRecordRaw extends AltosTelemetryRecord { int[] bytes; int serial; int tick; int type; + int rssi; long received_time; @@ -49,25 +46,32 @@ public class AltosTelemetryRecordRaw extends AltosTelemetryRecord { return AltosLib.uint32(bytes, off + 1); } + public int int32(int off) { + return AltosLib.int32(bytes, off + 1); + } + public String string(int off, int l) { return AltosLib.string(bytes, off + 1, l); } - public AltosTelemetryRecordRaw(int[] in_bytes) { + public AltosTelemetryRecordRaw(int[] in_bytes, int in_rssi) { bytes = in_bytes; serial = uint16(0); tick = uint16(2); type = uint8(4); + rssi = in_rssi; } public AltosRecord update_state(AltosRecord previous) { AltosRecord next; - if (previous != null) - next = new AltosRecord(previous); + + if (previous != null && previous.serial == serial) + next = previous.clone(); else - next = new AltosRecord(); + next = new AltosRecordNone(); next.serial = serial; next.tick = tick; + next.rssi = rssi; return next; }