| 93 | } |
| 94 | |
| 95 | void decodeDataRecord() override |
| 96 | { |
| 97 | /* Check the ID. */ |
| 98 | |
| 99 | if (readRaw32() != VICTOR9K_DATA_RECORD) |
| 100 | return; |
| 101 | |
| 102 | /* Read data. */ |
| 103 | |
| 104 | auto bytes = decode(readRawBits((VICTOR9K_SECTOR_LENGTH + 4) * 10)) |
| 105 | .slice(0, VICTOR9K_SECTOR_LENGTH + 4); |
| 106 | ByteReader br(bytes); |
| 107 | |
| 108 | _sector->data = br.read(VICTOR9K_SECTOR_LENGTH); |
| 109 | uint16_t gotChecksum = sumBytes(_sector->data); |
| 110 | uint16_t wantChecksum = br.read_le16(); |
| 111 | _sector->status = |
| 112 | (gotChecksum == wantChecksum) ? Sector::OK : Sector::BAD_CHECKSUM; |
| 113 | } |
| 114 | }; |
| 115 | |
| 116 | std::unique_ptr<Decoder> createVictor9kDecoder(const DecoderProto& config) |