RS fix shipping info message

This commit is contained in:
Milos Kozak 2020-05-14 18:29:05 +02:00
parent a241a23c99
commit 47d5028eba
2 changed files with 3 additions and 11 deletions

View file

@ -174,8 +174,6 @@ public class DanaRS_Packet {
public String asciiStringFromBuff(byte[] buff, int offset, int length) {
byte[] strbuff = new byte[length];
System.arraycopy(buff, offset, strbuff, 0, length);
for (int pos = 0; pos < length; pos++)
strbuff[pos] += 65; // "A"
return new String(strbuff, StandardCharsets.UTF_8);
}

View file

@ -22,15 +22,9 @@ class DanaRS_Packet_General_Get_Shipping_Information(
failed = true
return
} else failed = false
var dataIndex = DATA_START
var dataSize = 10
danaPump.serialNumber = stringFromBuff(data, dataIndex, dataSize)
dataIndex += dataSize
dataSize = 3
danaPump.shippingDate = dateFromBuff(data, dataIndex)
dataIndex += dataSize
dataSize = 3
danaPump.shippingCountry = asciiStringFromBuff(data, dataIndex, dataSize)
danaPump.serialNumber = stringFromBuff(data, DATA_START, 10)
danaPump.shippingCountry = asciiStringFromBuff(data, DATA_START + 10, 3)
danaPump.shippingDate = dateFromBuff(data, DATA_START + 13)
aapsLogger.debug(LTag.PUMPCOMM, "Serial number: " + danaPump.serialNumber)
aapsLogger.debug(LTag.PUMPCOMM, "Shipping date: " + dateUtil.dateAndTimeString(danaPump.shippingDate))
aapsLogger.debug(LTag.PUMPCOMM, "Shipping country: " + danaPump.shippingCountry)