kradio4
r778
Main Page
Classes
Files
File List
File Members
src
rds_group.h
Go to the documentation of this file.
1
/***************************************************************************
2
rds.h - description
3
-------------------
4
begin : Feb 2009
5
copyright : (C) 2009 Ernst Martin Witte, Klas Kalass
6
email : emw-kradio@nocabal.de, klas@kde.org
7
***************************************************************************/
8
9
/***************************************************************************
10
* *
11
* This program is free software; you can redistribute it and/or modify *
12
* it under the terms of the GNU General Public License as published by *
13
* the Free Software Foundation; either version 2 of the License, or *
14
* (at your option) any later version. *
15
* *
16
***************************************************************************/
17
18
#ifndef KRADIO_V4LRADIO_RDS_GROUP_H
19
#define KRADIO_V4LRADIO_RDS_GROUP_H
20
21
#ifdef HAVE_CONFIG_H
22
#include <config.h>
23
#endif
24
25
#include <kdemacros.h>
26
27
#define RDS_BLK_A 0
28
#define RDS_BLK_B 1
29
#define RDS_BLK_C 2
30
#define RDS_BLK_D 3
31
#define RDS_BLK_C_ 4
32
#define RDS_BLK_E 5
33
#define RDS_BLK_E_ 6
34
#define RDS_BLK_RESERVED 7
35
#define RDS_BLK_MAXCOUNT 8
36
37
#define RDS_PI_BLOCK RDS_BLK_A
38
#define RDS_PI_SHIFT 0
39
#define RDS_PI_MASK 0xFFFF
40
41
#define RDS_GRP_BLOCK RDS_BLK_B
42
#define RDS_GRP_SHIFT 11
43
#define RDS_GRP_MASK 0xF800
44
45
#define RDS_TP_BLOCK RDS_BLK_B
46
#define RDS_TP_SHIFT 10
47
#define RDS_TP_MASK 0x0400
48
49
#define RDS_PTY_BLOCK RDS_BLK_B
50
#define RDS_PTY_SHIFT 5
51
#define RDS_PTY_MASK 0x03E0
52
53
#define RDS_0A_POS_BLOCK RDS_BLK_B
54
#define RDS_0A_POS_SHIFT 0
55
#define RDS_0A_POS_MASK 0x0003
56
57
58
enum
RDSGroupType
{
59
GROUP_0A
= 0,
GROUP_0B
,
60
GROUP_1A
,
GROUP_1B
,
61
GROUP_2A
,
GROUP_2B
,
62
GROUP_3A
,
GROUP_3B
,
63
GROUP_4A
,
GROUP_4B
,
64
GROUP_5A
,
GROUP_5B
,
65
GROUP_6A
,
GROUP_6B
,
66
GROUP_7A
,
GROUP_7B
,
67
GROUP_8A
,
GROUP_8B
,
68
GROUP_9A
,
GROUP_9B
,
69
GROUP_10A
,
GROUP_10B
,
70
GROUP_11A
,
GROUP_11B
,
71
GROUP_12A
,
GROUP_12B
,
72
GROUP_13A
,
GROUP_13B
,
73
GROUP_14A
,
GROUP_14B
,
74
GROUP_15A
,
GROUP_15B
,
75
GROUP_TYPE_COUNT
76
};
77
78
class
KDE_EXPORT
RDSGroup
79
{
80
public
:
81
RDSGroup
();
82
virtual
~
RDSGroup
();
83
84
virtual
int
addRawData(
const
unsigned
char
*rawdata,
int
size) = 0;
85
virtual
void
clear();
86
virtual
bool
isComplete()
const
= 0;
87
88
int
getPI
()
const
{
return
m_pi_code; }
89
int
getTP
()
const
{
return
m_tp; }
90
int
getPTY
()
const
{
return
m_pty; }
91
int
getGroupType
()
const
{
return
m_group_code; }
92
93
unsigned
short
getBlock
(
unsigned
int
block_nr)
94
const
{
return
(block_nr <=
RDS_BLK_D
) ? m_rawdata[block_nr] : 0; }
95
96
double
statsBlockErrorRate()
const
;
97
double
statsGroupErrorRate()
const
;
98
99
protected
:
100
void
statsAccountGroupError(
int
nGroups,
int
nErrors);
101
void
statsAccountBlockError(
int
nGroups,
int
nErrors);
102
void
decode();
103
104
unsigned
short
m_rawdata[
RDS_BLK_MAXCOUNT
];
105
106
int
m_pty
;
107
int
m_group_code
;
108
bool
m_tp
;
109
int
m_pi_code
;
110
111
int
m_stats_group_count
;
112
int
m_stats_group_errors
;
113
int
m_stats_block_count
;
114
int
m_stats_block_errors
;
115
};
116
117
118
119
120
#endif
121
RDSGroup
Definition:
rds_group.h:78
GROUP_12A
Definition:
rds_group.h:71
GROUP_9B
Definition:
rds_group.h:68
GROUP_2A
Definition:
rds_group.h:61
GROUP_11B
Definition:
rds_group.h:70
GROUP_8B
Definition:
rds_group.h:67
RDSGroup::m_tp
bool m_tp
Definition:
rds_group.h:108
GROUP_13A
Definition:
rds_group.h:72
GROUP_6A
Definition:
rds_group.h:65
RDSGroup::m_pty
int m_pty
Definition:
rds_group.h:106
GROUP_0B
Definition:
rds_group.h:59
RDS_BLK_D
#define RDS_BLK_D
Definition:
rds_group.h:30
GROUP_3A
Definition:
rds_group.h:62
RDSGroup::getBlock
unsigned short getBlock(unsigned int block_nr) const
Definition:
rds_group.h:93
GROUP_0A
Definition:
rds_group.h:59
GROUP_4A
Definition:
rds_group.h:63
RDSGroupType
RDSGroupType
Definition:
rds_group.h:58
GROUP_8A
Definition:
rds_group.h:67
GROUP_3B
Definition:
rds_group.h:62
GROUP_7A
Definition:
rds_group.h:66
GROUP_10B
Definition:
rds_group.h:69
RDSGroup::getPTY
int getPTY() const
Definition:
rds_group.h:90
GROUP_5A
Definition:
rds_group.h:64
GROUP_2B
Definition:
rds_group.h:61
GROUP_15B
Definition:
rds_group.h:74
RDS_BLK_MAXCOUNT
#define RDS_BLK_MAXCOUNT
Definition:
rds_group.h:35
GROUP_7B
Definition:
rds_group.h:66
GROUP_4B
Definition:
rds_group.h:63
GROUP_1B
Definition:
rds_group.h:60
RDSGroup::m_stats_group_count
int m_stats_group_count
Definition:
rds_group.h:111
RDSGroup::m_stats_group_errors
int m_stats_group_errors
Definition:
rds_group.h:112
GROUP_15A
Definition:
rds_group.h:74
RDSGroup::getPI
int getPI() const
Definition:
rds_group.h:88
GROUP_14B
Definition:
rds_group.h:73
RDSGroup::getTP
int getTP() const
Definition:
rds_group.h:89
RDSGroup::m_pi_code
int m_pi_code
Definition:
rds_group.h:109
GROUP_11A
Definition:
rds_group.h:70
GROUP_5B
Definition:
rds_group.h:64
RDSGroup::getGroupType
int getGroupType() const
Definition:
rds_group.h:91
GROUP_10A
Definition:
rds_group.h:69
RDSGroup::m_stats_block_count
int m_stats_block_count
Definition:
rds_group.h:113
GROUP_TYPE_COUNT
Definition:
rds_group.h:75
GROUP_13B
Definition:
rds_group.h:72
GROUP_1A
Definition:
rds_group.h:60
GROUP_9A
Definition:
rds_group.h:68
RDSGroup::m_stats_block_errors
int m_stats_block_errors
Definition:
rds_group.h:114
GROUP_12B
Definition:
rds_group.h:71
GROUP_6B
Definition:
rds_group.h:65
GROUP_14A
Definition:
rds_group.h:73
RDSGroup::m_group_code
int m_group_code
Definition:
rds_group.h:107
Generated by
1.8.11