MCPcopy Create free account
hub / github.com/davidgiven/fluxengine / decodeDataRecord

Method decodeDataRecord

arch/brother/decoder.cc:91–116  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
119std::unique_ptr<Decoder> createBrotherDecoder(const DecoderProto& config)

Callers

nothing calls this directly

Calls 9

crcbrotherFunction · 0.85
sliceMethod · 0.80
flushMethod · 0.80
read_be24Method · 0.80
readerMethod · 0.80
decode_data_gcrFunction · 0.70
toBytesFunction · 0.50
pushMethod · 0.45
seekMethod · 0.45

Tested by

no test coverage detected