From c9c2a65a0a7314f1fa009c022ee5b0ac29cf8abf Mon Sep 17 00:00:00 2001 From: Jeremy Lakeman Date: Mon, 1 Aug 2016 11:40:38 +0930 Subject: [PATCH] Return unique id for each message --- .../servalproject/servaldna/meshms/MeshMSMessage.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/java/org/servalproject/servaldna/meshms/MeshMSMessage.java b/java/org/servalproject/servaldna/meshms/MeshMSMessage.java index 6cb69d13..ea175b6c 100644 --- a/java/org/servalproject/servaldna/meshms/MeshMSMessage.java +++ b/java/org/servalproject/servaldna/meshms/MeshMSMessage.java @@ -80,4 +80,14 @@ public class MeshMSMessage { this.ackOffset = ack_offset; } + public long getId(){ + switch (type){ + default: + return offset; + case MESSAGE_RECEIVED: + return -offset; + case ACK_RECEIVED: + return 0; + } + } }