Expand on snapshot fields. Clarify the test result op25_decoder_ff::correlated().

git-svn-id: http://op25.osmocom.org/svn/trunk@152 65a5c917-d112-43f1-993d-58c26a4786be
This commit is contained in:
stevie 2009-06-30 07:19:24 +00:00
parent 93d418d512
commit bfd78e82df
4 changed files with 109 additions and 47 deletions

View File

@ -29,6 +29,9 @@
#include <swab.h> #include <swab.h>
#include <tdu.h> #include <tdu.h>
#include <iostream>
using namespace std;
data_unit_sptr data_unit_sptr
data_unit::make_data_unit(const_bit_queue& frame_body) data_unit::make_data_unit(const_bit_queue& frame_body)
{ {

View File

@ -29,6 +29,7 @@
#include <swab.h> #include <swab.h>
#include <value_string.h> #include <value_string.h>
#include <iostream>
using namespace std; using namespace std;
hdu::hdu(const_bit_queue& frame_body) : hdu::hdu(const_bit_queue& frame_body) :
@ -49,68 +50,71 @@ hdu::duid_str() const
std::string std::string
hdu::snapshot() const hdu::snapshot() const
{ {
size_t n = 0;
ostringstream os; ostringstream os;
// Begin
os << "(d";
os << "p" << n++ << endl;
// NID = NAC+DUID
// DUID // DUID
os << "(dp0" << endl;
os << "S'duid'" << endl; os << "S'duid'" << endl;
os << "p1" << endl; os << "p" << n++ << endl;
os << "S'" << duid_str() << "'" << endl; os << "S'" << duid_str() << "'" << endl;
// NAC // NAC
os << "p2" << endl; os << "p" << n++ << endl;
os << "sS'nac'" << endl; os << "sS'nac'" << endl;
os << "p3" << endl; os << "p" << n++ << endl;
os << "S'" << nac_str() << "'" << endl; os << "S'" << nac_str() << "'" << endl;
#if 0
// MI
os << "p4" << endl;
os << "sS'mi'" << endl;
os << "p5" << endl;
os << "S'" << mi_str() << "'" << endl;
#endif
os << "p4" << endl;
os << "s." << endl;
#if 0
// Source // Source
os << "S'source'" << endl; os << "p" << n++ << endl;
os << "p5" << endl; os << "sS'source'" << endl;
os << "S''" << endl; os << "p" << n++ << endl;
os << "p6" << endl; os << "S'" << src_str() << "'" << endl;
// Dest // Dest
os << "S'dest'" << endl; os << "p" << n++ << endl;
os << "p7" << endl; os << "sS'dest'" << endl;
os << "S''" << endl; os << "p" << n++ << endl;
os << "p8" << endl; os << "S'" << dest_str() << "'" << endl;
// NID
os << "S'nid'" << endl;
os << "p9" << endl;
os << "S''" << endl;
os << "p10" << endl;
// MFID // MFID
os << "S'mfid'" << endl; os << "p" << n++ << endl;
os << "p11" << endl; os << "sS'mfid'" << endl;
os << "p" << n++ << endl;
os << "S'" << mfid_str() << "'" << endl; os << "S'" << mfid_str() << "'" << endl;
os << "p12" << endl;
// ALGID // ALGID
os << "p3" << endl; os << "p" << n++ << endl;
os << "S'algid'" << endl; os << "sS'algid'" << endl;
os << "p4" << endl; os << "p" << n++ << endl;
os << "sS'" << algid_str() << "'" << endl; os << "S'" << algid_str() << "'" << endl;
// KID // KID
os << "S'kid'" << endl; os << "p" << n++ << endl;
os << "p15" << endl; os << "sS'kid'" << endl;
os << "S''" << endl; os << "p" << n++ << endl;
os << "p16" << endl; os << "S'" << kid_str() << "'" << endl;
// MI
os << "p" << n++ << endl;
os << "sS'mi'" << endl;
os << "p" << n++ << endl;
os << "S'" << mi_str() << "'" << endl;
// TGID // TGID
os << "S'tgid'" << endl; os << "p" << n++ << endl;
os << "p19" << endl; os << "sS'tgid'" << endl;
os << "S''" << endl; os << "p" << n++ << endl;
#endif os << "S'" << tgid_str() << "'" << endl;
// End
os << "p" << n++ << endl;
os << "s." << endl;
return os.str(); return os.str();
} }
@ -203,6 +207,18 @@ hdu::algid_str() const
return lookup(algid, ALGIDS, ALGIDS_SZ); return lookup(algid, ALGIDS, ALGIDS_SZ);
} }
string
hdu::dest_str() const
{
return "ToDo";
}
string
hdu::kid_str() const
{
return "ToDo";
}
std::string std::string
hdu::mi_str() const hdu::mi_str() const
{ {
@ -226,6 +242,9 @@ hdu::mi_str() const
uint16_t octet = mi[i]; uint16_t octet = mi[i];
os << hex << setfill('0') << setw(2) << octet; os << hex << setfill('0') << setw(2) << octet;
} }
clog << os.str() << endl;
return os.str(); return os.str();
} }
@ -250,3 +269,15 @@ hdu::nac_str() const
uint32_t nac = extract(frame_body(), NAC_BITS, NAC_BITS_SZ); uint32_t nac = extract(frame_body(), NAC_BITS, NAC_BITS_SZ);
return lookup(nac, NACS, NACS_SZ); return lookup(nac, NACS, NACS_SZ);
} }
string
hdu::src_str() const
{
return "ToDo";
}
string
hdu::tgid_str() const
{
return "ToDo";
}

View File

@ -105,6 +105,20 @@ private:
*/ */
std::string algid_str() const; std::string algid_str() const;
/**
* Returns a string describing the message destination.
*
* \return A string identifying the source.
*/
virtual std::string dest_str() const;
/**
* Returns a string describing the key id (KID).
*
* \return A string identifying the KID.
*/
virtual std::string kid_str() const;
/** /**
* Returns a string describing the manufacturer ID (MFID). * Returns a string describing the manufacturer ID (MFID).
* *
@ -115,7 +129,7 @@ private:
/** /**
* Returns a string describing the message indicator (MI). * Returns a string describing the message indicator (MI).
* *
* \return A string identifying the MI * \return A string identifying the MI.
*/ */
virtual std::string mi_str() const; virtual std::string mi_str() const;
@ -126,6 +140,19 @@ private:
*/ */
virtual std::string nac_str() const; virtual std::string nac_str() const;
/**
* Returns a string describing the message source.
*
* \return A string identifying the source.
*/
virtual std::string src_str() const;
/**
* Returns a string describing the talk group id (TGID).
*
* \return A string identifying the TGID.
*/
virtual std::string tgid_str() const;
}; };
#endif /* INCLUDED_HDU_H */ #endif /* INCLUDED_HDU_H */

View File

@ -144,7 +144,8 @@ op25_decoder_ff::identified()
itpp::BCH bch(63, 16, 11,"6 3 3 1 1 4 1 3 6 7 2 3 5 4 5 3", true); itpp::BCH bch(63, 16, 11,"6 3 3 1 1 4 1 3 6 7 2 3 5 4 5 3", true);
swab(d_frame_hdr, NID, NID_SZ, b, 0); swab(d_frame_hdr, NID, NID_SZ, b, 0);
b = bch.decode(b); b = bch.decode(b);
if(b != zeroes) { bool identified(b != zeroes);
if(identified) {
b = bch.encode(b); b = bch.encode(b);
unswab(b, 0, d_frame_hdr, NID, NID_SZ); unswab(b, 0, d_frame_hdr, NID, NID_SZ);
d_data_unit = data_unit::make_data_unit(d_frame_hdr); d_data_unit = data_unit::make_data_unit(d_frame_hdr);
@ -152,7 +153,7 @@ op25_decoder_ff::identified()
data_unit_sptr null; data_unit_sptr null;
d_data_unit = null; d_data_unit = null;
} }
return d_data_unit; return identified;
} }
void void