kradio4 r778
|
00001 /*************************************************************************** 00002 rds_decoder_0a.h - description 00003 ------------------- 00004 begin : Feb 2009 00005 copyright : (C) 2009 Ernst Martin Witte 00006 email : emw-kradio@nocabal.de 00007 ***************************************************************************/ 00008 00009 /*************************************************************************** 00010 * * 00011 * This program is free software; you can redistribute it and/or modify * 00012 * it under the terms of the GNU General Public License as published by * 00013 * the Free Software Foundation; either version 2 of the License, or * 00014 * (at your option) any later version. * 00015 * * 00016 ***************************************************************************/ 00017 00018 #ifndef KRADIO_V4LRADIO_RDS_DECODER_2AB_H 00019 #define KRADIO_V4LRADIO_RDS_DECODER_2AB_H 00020 00021 #ifdef HAVE_CONFIG_H 00022 #include <config.h> 00023 #endif 00024 00025 #include <kdemacros.h> 00026 00027 #include "rds_type_decoder.h" 00028 00029 #include <QtCore/QString> 00030 00031 #ifndef max 00032 #define max(a,b) ((a) > (b) ? (a) : (b)) 00033 #endif 00034 00035 #define RDS_2AB_POS_BLOCK RDS_BLK_B 00036 #define RDS_2AB_POS_SHIFT 0 00037 #define RDS_2AB_POS_MASK 0x000F 00038 00039 #define RDS_2AB_AB_FLAG_BLOCK RDS_BLK_B 00040 #define RDS_2AB_AB_FLAG_MASK 0x0010 00041 00042 #define RDS_RADIOTEXT_A_MAX_LEN 64 00043 #define RDS_RADIOTEXT_B_MAX_LEN 32 00044 #define RDS_RADIOTEXT_MAX_LEN (max(RDS_RADIOTEXT_A_MAX_LEN, RDS_RADIOTEXT_B_MAX_LEN)) 00045 00046 enum RDS_2AB_State { RDS_2AB_WAIT4GRP, RDS_2AB_COMPLETE }; 00047 00048 class KDE_EXPORT RDS_Type2AB_Decoder : public RDSTypeDecoder 00049 { 00050 public: 00051 RDS_Type2AB_Decoder(bool type_A_not_B); 00052 00053 virtual void addGroup(const RDSGroup &g); 00054 virtual bool isComplete() const; 00055 00056 const QString &getRadioText() const; 00057 00058 protected: 00059 void addChar(char c); 00060 void clear(); 00061 void complete(); 00062 00063 char m_radioText[RDS_RADIOTEXT_MAX_LEN+1]; 00064 QString m_radioTextComplete; 00065 00066 unsigned int m_next_expected_position; 00067 unsigned int m_max_len; 00068 bool m_type_A_not_B; 00069 00070 RDS_2AB_State m_state; 00071 mutable bool m_workaround_completed; 00072 }; 00073 00074 00075 00076 00077 #endif 00078