| 89 | } |
| 90 | |
| 91 | void decodeDataRecord() override |
| 92 | { |
| 93 | if (readRaw32() != BROTHER_DATA_RECORD) |
| 94 | return; |
| 95 | |
| 96 | const auto& rawbits = readRawBits(BROTHER_DATA_RECORD_ENCODED_SIZE * 8); |
| 97 | const auto& rawbytes = |
| 98 | toBytes(rawbits).slice(0, BROTHER_DATA_RECORD_ENCODED_SIZE); |
| 99 | |
| 100 | Bytes bytes; |
| 101 | ByteWriter bw(bytes); |
| 102 | BitWriter bitw(bw); |
| 103 | for (uint8_t b : rawbytes) |
| 104 | { |
| 105 | uint32_t nibble = decode_data_gcr(b); |
| 106 | bitw.push(nibble, 5); |
| 107 | } |
| 108 | bitw.flush(); |
| 109 | |
| 110 | _sector->data = bytes.slice(0, BROTHER_DATA_RECORD_PAYLOAD); |
| 111 | uint32_t realCrc = crcbrother(_sector->data); |
| 112 | uint32_t wantCrc = |
| 113 | bytes.reader().seek(BROTHER_DATA_RECORD_PAYLOAD).read_be24(); |
| 114 | _sector->status = |
| 115 | (realCrc == wantCrc) ? Sector::OK : Sector::BAD_CHECKSUM; |
| 116 | } |
| 117 | }; |
| 118 | |
| 119 | std::unique_ptr<Decoder> createBrotherDecoder(const DecoderProto& config) |
nothing calls this directly
no test coverage detected