I am encoding an Android application. I have a temperature data logger SL13A, and I'm trying to read the temperature from the logger, but I really do not know how to do this.
Here is a technical description: http://www.mouser.com/ds/2/588/AMS_SL13A_Datasheet_EN_v4-371531.pdf
I use the Get Temperature Command command (command code 0xAD).
My code looks like this:
NfcV nfcvTag = NfcV.get(tag);
try {
nfcvTag.connect();
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "Could not open connection!", Toast.LENGTH_SHORT).show();
return;
}
try {
byte[] comReadTemp = new byte[]{
(byte) 0x00,
(byte) 0xAD,
(byte) 0xE0,(byte) 0x36,(byte) 0x04,(byte) 0xCA,(byte) 0x01,(byte) 0x3E,(byte) 0x12,(byte) 0x01,
};
byte[] userdata = nfcvTag.transceive(comReadTemp);
tvText.setText("DATA: " + userdata.length);
} catch (IOException e) {
Toast.makeText(getApplicationContext(), "An error occurred while reading!", Toast.LENGTH_SHORT).show();
return;
}
I am not sure which flags are set, and if I entered the UID parameter correctly in the command.
And also my question: how do I get temperature bits from an answer command? The datasheet shows that the first 8 bits of the command response are flags, the next 16 bits are temperature, and the last 16 bits are CRC. But it seems that I get only 3 bytes in the response ( userdata.lengthequal to 3).
.