1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-12-25 20:22:10 -05:00
sdrangel/plugins/channelrx/demodbfm/rdsdecoder.h

64 lines
2.5 KiB
C
Raw Normal View History

2015-12-10 21:58:35 -05:00
///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2015 F4EXB //
// written by Edouard Griffiths //
// //
// This program is free software; you can redistribute it and/or modify //
// it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or //
// //
// This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. //
// //
// You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. //
///////////////////////////////////////////////////////////////////////////////////
#ifndef PLUGINS_CHANNEL_BFM_RDSDECODER_H_
#define PLUGINS_CHANNEL_BFM_RDSDECODER_H_
class RDSDecoder
{
public:
RDSDecoder();
~RDSDecoder();
2015-12-13 03:45:29 -05:00
bool frameSync(bool bit);
unsigned int *getGroup() { return m_group; }
bool synced() const { return m_sync == SYNC; }
2015-12-10 21:58:35 -05:00
float m_qua;
2015-12-10 21:58:35 -05:00
protected:
unsigned int calc_syndrome(unsigned long message, unsigned char mlen);
void enter_sync(unsigned int sync_block_number);
void enter_no_sync();
private:
unsigned long m_reg;
enum { NO_SYNC, SYNC } m_sync;
bool m_presync;
unsigned long m_lastseenOffsetCounter;
unsigned long m_bitCounter;
unsigned char m_lastseenOffset;
unsigned int m_blockBitCounter;
unsigned int m_wrongBlocksCounter;
unsigned int m_blocksCounter;
unsigned int m_groupGoodBlocksCounter;
unsigned char m_blockNumber;
bool m_groupAssemblyStarted;
bool m_goodBlock;
unsigned int m_group[4];
/* see page 59, Annex C, table C.1 in the standard
* offset word C' has been put at the end */
static const unsigned int offset_pos[5];
static const unsigned int offset_word[5];
static const unsigned int syndrome[5];
};
#endif /* PLUGINS_CHANNEL_BFM_RDSDECODER_H_ */