public KeepAliveTxMessage(int time) { this.time = time; data = ByteBuffer.allocate(2); data.put(new byte[]{(byte) opcode, (byte) this.time}); byteSequence = data.order(ByteOrder.LITTLE_ENDIAN).array(); UserError.Log.d(TAG, "New KeepAliveRequestTxMessage: " + JoH.bytesToHex(byteSequence)); } }
public AuthChallengeTxMessage(byte[] challenge) { challengeHash = challenge; data = ByteBuffer.allocate(9); data.put(opcode); data.put(challengeHash); byteSequence = data.array(); UserError.Log.d(TAG,"AuthChallengeTX: "+ JoH.bytesToHex(byteSequence)); } }
public SensorTxMessage() { data = ByteBuffer.allocate(3); data.put(opcode); data.put(crc); byteSequence = data.array(); UserError.Log.d(TAG, "SensorTx dbg: " + JoH.bytesToHex(byteSequence)); } }
public KeepAliveTxMessage(int time) { this.time = time; data = ByteBuffer.allocate(2); data.put(new byte[]{(byte) opcode, (byte) this.time}); byteSequence = data.order(ByteOrder.LITTLE_ENDIAN).array(); UserError.Log.d(TAG, "New KeepAliveRequestTxMessage: " + JoH.bytesToHex(byteSequence)); } }
public BackFillTxMessage(int startDexTime, int endDexTime) { init(opcode, length); data.put((byte) 0x5); data.put((byte) 0x2); data.put((byte) 0x0); data.putInt(startDexTime); data.putInt(endDexTime); data.put(new byte[6]); appendCRC(); UserError.Log.d(TAG, "BackfillTxMessage dbg: " + JoH.bytesToHex(byteSequence)); }
public BackFillTxMessage(int startDexTime, int endDexTime) { init(opcode, length); data.put((byte) 0x5); data.put((byte) 0x2); data.put((byte) 0x0); data.putInt(startDexTime); data.putInt(endDexTime); data.put(new byte[6]); appendCRC(); UserError.Log.d(TAG, "BackfillTxMessage dbg: " + JoH.bytesToHex(byteSequence)); }
@Override public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { Log.d(TAG, "Descriptor written to: " + descriptor.getUuid() + " getvalue: " + JoH.bytesToHex(descriptor.getValue()) + " status: " + status); if (status == BluetoothGatt.GATT_SUCCESS) { Bluetooth_CMD.poll_queue(); } else { Log.e(TAG, "Got gatt descriptor write failure: " + status); Bluetooth_CMD.retry_last_command(status); } }
@Override public void onDescriptorWrite(BluetoothGatt gatt, BluetoothGattDescriptor descriptor, int status) { Log.d(TAG, "Descriptor written to: " + descriptor.getUuid() + " getvalue: " + JoH.bytesToHex(descriptor.getValue()) + " status: " + status); if (status == BluetoothGatt.GATT_SUCCESS) { Bluetooth_CMD.poll_queue(); } else { Log.e(TAG, "Got gatt descriptor write failure: " + status); Bluetooth_CMD.retry_last_command(status); } }
BaseAuthChallengeTxMessage(final byte[] challenge) { init(opcode, 9); data.put(challenge); byteSequence = data.array(); UserError.Log.d(TAG, "BaseAuthChallengeTX: " + JoH.bytesToHex(byteSequence)); } }
public CalibrateTxMessage(int glucose, int dexTime) { init(opcode, length); this.glucose = glucose; data.putShort((short) glucose); data.putInt(dexTime); appendCRC(); UserError.Log.d(TAG, "CalibrateGlucoseTxMessage dbg: " + JoH.bytesToHex(byteSequence)); }
ResetTxMessage() { init(opcode, 3); UserError.Log.d(TAG, "ResetTx dbg: " + JoH.bytesToHex(byteSequence)); } }
ResetTxMessage() { init(opcode, 3); UserError.Log.d(TAG, "ResetTx dbg: " + JoH.bytesToHex(byteSequence)); } }
private synchronized void checkImmediateSend() { if (immediateSend != null) { Log.d(TAG, "Sending immediate data: " + JoH.bytesToHex(immediateSend)); sendBtMessage(immediateSend); immediateSend = null; } }
public GlucoseTxMessage() { init(opcode, 3); UserError.Log.d(TAG, "GlucoseTx dbg: " + JoH.bytesToHex(byteSequence)); } }
public GlucoseTxMessage() { init(opcode, 3); UserError.Log.d(TAG, "GlucoseTx dbg: " + JoH.bytesToHex(byteSequence)); } }
public static boolean setStoredFirmwareBytes(String transmitterId, byte[] data, boolean from_bluetooth) { if (from_bluetooth) UserError.Log.e(TAG, "Store: VersionRX dbg: " + JoH.bytesToHex(data)); if (transmitterId.length() != 6) return false; if (data.length < 10) return false; if (JoH.ratelimit("store-firmware-bytes", 60)) { PersistentStore.setBytes("g5-firmware-" + transmitterId, data); } return true; }
public static boolean setStoredFirmwareBytes(String transmitterId, byte[] data, boolean from_bluetooth) { if (from_bluetooth) UserError.Log.e(TAG, "Store: VersionRX dbg: " + JoH.bytesToHex(data)); if (transmitterId.length() != 6) return false; if (data.length < 10) return false; if (JoH.ratelimit("store-firmware-bytes", 60)) { PersistentStore.setBytes(G5_FIRMWARE_MARKER + transmitterId, data); } return true; }
@Test public void create() { final Calendar cal = Calendar.getInstance(); cal.set(2018, Calendar.NOVEMBER, 29, 22, 45, 59); TimeTx packet = new TimeTx(cal.getTimeInMillis()); String result = JoH.bytesToHex(packet.byteSequence); System.out.println(result); assertWithMessage("TimeTx creation invalid").that(result).isEqualTo("C0030100E2070B1D162D3B"); }
private synchronized void sendAuthRequestTxMessage(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { Log.e(TAG, "Sending new AuthRequestTxMessage to " + getUUIDName(characteristic.getUuid()) + " ..."); authRequest = new AuthRequestTxMessage(getTokenSize()); Log.i(TAG, "AuthRequestTX: " + JoH.bytesToHex(authRequest.byteSequence)); characteristic.setValue(authRequest.byteSequence); if (gatt != null) { gatt.writeCharacteristic(characteristic); } else { Log.e(TAG, "Cannot send AuthRequestTx as supplied gatt is null!"); } }
private synchronized void sendAuthRequestTxMessage(BluetoothGatt gatt, BluetoothGattCharacteristic characteristic) { Log.e(TAG, "Sending new AuthRequestTxMessage to " + getUUIDName(characteristic.getUuid()) + " ..."); authRequest = new AuthRequestTxMessage(getTokenSize()); Log.i(TAG, "AuthRequestTX: " + JoH.bytesToHex(authRequest.byteSequence)); characteristic.setValue(authRequest.byteSequence); if (gatt != null) { gatt.writeCharacteristic(characteristic); } else { Log.e(TAG, "Cannot send AuthRequestTx as supplied gatt is null!"); } }