Fix so we don't crash on unrecognized frame.
git-svn-id: http://op25.osmocom.org/svn/trunk@156 65a5c917-d112-43f1-993d-58c26a4786be
This commit is contained in:
parent
89d1872cbc
commit
42d5e3a660
|
@ -126,7 +126,7 @@ op25_decoder_ff::correlated()
|
||||||
return (errs <= 4);
|
return (errs <= 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
data_unit_sptr
|
||||||
op25_decoder_ff::identified()
|
op25_decoder_ff::identified()
|
||||||
{
|
{
|
||||||
static const size_t NID[] = {
|
static const size_t NID[] = {
|
||||||
|
@ -145,8 +145,7 @@ 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);
|
||||||
yank(d_frame_hdr, NID, NID_SZ, b, 0);
|
yank(d_frame_hdr, NID, NID_SZ, b, 0);
|
||||||
b = bch.decode(b);
|
b = bch.decode(b);
|
||||||
bool identified(b != zeroes);
|
if(b != zeroes) {
|
||||||
if(identified) {
|
|
||||||
b = bch.encode(b);
|
b = bch.encode(b);
|
||||||
yank_back(b, 0, d_frame_hdr, NID, NID_SZ);
|
yank_back(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);
|
||||||
|
@ -154,7 +153,7 @@ op25_decoder_ff::identified()
|
||||||
data_unit_sptr null;
|
data_unit_sptr null;
|
||||||
d_data_unit = null;
|
d_data_unit = null;
|
||||||
}
|
}
|
||||||
return identified;
|
return d_data_unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
@ -94,15 +94,15 @@ private:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests whether d_frame_header identifies a known data unit and if
|
* Tests whether d_frame_header identifies a known data unit and if
|
||||||
* so sets d_data_unit to point to an appropriate instance. This
|
* so sets d_data_unit to point to an appropriate instance and
|
||||||
* method must only be called when the frame header is larger than
|
* returns a pointer to it. This method must only be called when
|
||||||
* 114 bits in length (the minimum size for a frame containing a
|
* the frame header is larger than 114 bits in length (the minimum
|
||||||
* NID).
|
* size for a frame containing a NID).
|
||||||
*
|
*
|
||||||
* \return true if the frame header identifies a known data unit;
|
* \return A data_unit_sptr pointing to an appropriate data_unit
|
||||||
* otherwise false.
|
* instance or NULL if the frame header is unrecognized.
|
||||||
*/
|
*/
|
||||||
bool identified();
|
data_unit_sptr identified();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handle a received symbol.
|
* Handle a received symbol.
|
||||||
|
|
Reference in New Issue