- PrintAndLog("recorded activity:");
- PrintAndLog(" time :rssi: who bytes");
- PrintAndLog("---------+----+----+-----------");
-
- int i = 0;
- int prev = -1;
-
- for(;;) {
- if(i >= 900) {
- break;
- }
-
- bool isResponse;
- int timestamp = *((uint32_t *)(got+i));
- if(timestamp & 0x80000000) {
- timestamp &= 0x7fffffff;
- isResponse = 1;
- } else {
- isResponse = 0;
- }
- int metric = *((uint32_t *)(got+i+4));
-
- int len = got[i+8];
-
- if(len > 100) {
- break;
- }
- if(i + len >= 900) {
- break;
- }
-
- uint8_t *frame = (got+i+9);
-
- // Break and stick with current result if buffer was not completely full
- if (frame[0] == 0x44 && frame[1] == 0x44 && frame[2] == 0x44 && frame[3] == 0x44) break;
-
- char line[1000] = "";
- int j;
- for(j = 0; j < len; j++) {
- sprintf(line+(j*3), "%02x ", frame[j]);
- }
-
- char *crc;
- if(len > 2) {
- uint8_t b1, b2;
- ComputeCrc14443(CRC_14443_B, frame, len-2, &b1, &b2);
- if(b1 != frame[len-2] || b2 != frame[len-1]) {
- crc = "**FAIL CRC**";
- } else {
- crc = "";
- }
- } else {
- crc = "(SHORT)";
- }
-
- char metricString[100];
- if(isResponse) {
- sprintf(metricString, "%3d", metric);
- } else {
- strcpy(metricString, " ");
- }
-
- PrintAndLog(" +%7d: %s: %s %s %s",
- (prev < 0 ? 0 : timestamp - prev),
- metricString,
- (isResponse ? "TAG" : " "), line, crc);
-
- prev = timestamp;
- i += (len + 9);
- }
- return 0;