use of com.eveningoutpost.dexdrip.watch.thinjam.messages.GlucoseTx in project xDrip by NightscoutFoundation.
the class BlueJayService method sendGlucose.
public void sendGlucose() {
val last = BgReading.last();
if (last != null && msSince(last.timestamp) < Constants.HOUR_IN_MS) {
val info = BlueJayInfo.getInfo(BlueJay.getMac());
if (Math.abs(info.lastReadingTime - last.timestamp) > Constants.MINUTE_IN_MS * 3) {
val glucoseTx = new GlucoseTx(last);
if (glucoseTx.isValid()) {
val item = new QueueMe().setBytes(glucoseTx.getBytes()).expireInSeconds(60).setDescription("Glucose to watch");
item.setProcessor(new AuthReplyProcessor(new ReplyProcessor(I.connection) {
@Override
public void process(byte[] bytes) {
UserError.Log.d(TAG, "Glucose Incoming reply processor: " + HexDump.dumpHexString(bytes));
info.displayUpdated();
}
}).setTag(item));
item.queue();
doQueue();
} else {
UserError.Log.d(TAG, "GlucoseTX wasn't valid so not sending.");
}
} else {
UserError.Log.d(TAG, "Watch already has recent reading");
// watch reading too close to the reading we were going to send
}
}
}
use of com.eveningoutpost.dexdrip.watch.thinjam.messages.GlucoseTx in project xDrip-plus by jamorham.
the class BlueJayService method sendGlucose.
public void sendGlucose() {
val last = BgReading.last();
if (last != null && msSince(last.timestamp) < Constants.HOUR_IN_MS) {
val info = BlueJayInfo.getInfo(BlueJay.getMac());
if (Math.abs(info.lastReadingTime - last.timestamp) > Constants.MINUTE_IN_MS * 3) {
val glucoseTx = new GlucoseTx(last);
if (glucoseTx.isValid()) {
val item = new QueueMe().setBytes(glucoseTx.getBytes()).expireInSeconds(60).setDescription("Glucose to watch");
item.setProcessor(new AuthReplyProcessor(new ReplyProcessor(I.connection) {
@Override
public void process(byte[] bytes) {
UserError.Log.d(TAG, "Glucose Incoming reply processor: " + HexDump.dumpHexString(bytes));
info.displayUpdated();
}
}).setTag(item));
item.queue();
doQueue();
} else {
UserError.Log.d(TAG, "GlucoseTX wasn't valid so not sending.");
}
} else {
UserError.Log.d(TAG, "Watch already has recent reading");
// watch reading too close to the reading we were going to send
}
}
}
Aggregations