1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
std::string
ldu1::snapshot()
{
pickle p;
p.add("duid", duid_str()); // calls a function that calls decode_lcw()
p.add("nac", nac_str()); // same for all these so these calls is
p.add("mfid", mfid_str()); // what should call the decode_lcw
p.add("tgid", tgid_str()); // see these function definitions below
p.add("source", source_str()); // for a couple of examples
return p.to_string();
}
//240 Link Control Word bits
uint16_t*
ldu1::decode_lcw()
{
const size_t LCW_BITS[] = {
410, 411, 412, 413, 414, 415, 416, 417, 418, 419, 420, 421,
422, . . . .................
};
const uint16_t LCW_BITS_SZ = sizeof(LCW_BITS) / sizeof(LCW_BITS[0]);
uint16_t * encoded_lcw = new uint16_t[240];
yank(frame_body(), LCW_BITS, LCW_BITS_SZ, encoded_lcw, 0);
int i;
printf("encoded lcw\n");
for(i=0;i<72;i++)
printf("%d",encoded_lcw[i]);
fflush(stdout);
printf("\n");
uint16_t * rs_codewords = new uint16_t[144];
decode_hamming( encoded_lcw, rs_codewords );
delete [] encoded_lcw;
uint16_t * decoded_lcw = new uint16_t[72];
decode_reed_solomon( rs_codewords, decoded_lcw );
delete [] rs_codewords;
return decoded_lcw;
printf("decoded lcw\n");
for(i=0;i<72;i++)
printf("%d",decoded_lcw[i]);
fflush(stdout);
printf("\n");
}
string
ldu1::mfid_str()
{
const size_t MFID_BITS[] = {
8, 9, 10, 11, 12, 13, 14, 15
};
const size_t MFID_BITS_SZ = sizeof(MFID_BITS) / sizeof(MFID_BITS_SZ);
uint8_t mfid = extract(decode_lcw(), MFID_BITS, MFID_BITS_SZ);
return lookup(mfid, MFIDS, MFIDS_SZ);
}
string
ldu1::tgid_str()
{
const size_t TGID_BITS[] = {
32, 33, 34, 35, 36, 37, 38, 39,
40, 41, 42, 43, 44, 45, 46, 47,
};
const size_t TGID_BITS_SZ = sizeof(TGID_BITS) / sizeof(TGID_BITS[0]);
const uint16_t tgid = extract(decode_lcw(), TGID_BITS, TGID_BITS_SZ);
ostringstream os;
os << hex << showbase << setfill('0') << setw(4) << tgid;
return os.str();
}
|