diff mbox

[RFC,4/4] rds-ctl.cpp: added functionality to print RDS-TMC tuning information

Message ID d18d327782b3c3ca2aaffaee16cb91b8acdbf10a.1367943797.git.koradlow@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Konke Radlow May 7, 2013, 4:24 p.m. UTC
Signed-off-by: Konke Radlow <koradlow@gmail.com>
---
 utils/rds-ctl/rds-ctl.cpp |   28 +++++++++++++++++++++++++++-
 1 file changed, 27 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/utils/rds-ctl/rds-ctl.cpp b/utils/rds-ctl/rds-ctl.cpp
index 51536cf..445c11f 100644
--- a/utils/rds-ctl/rds-ctl.cpp
+++ b/utils/rds-ctl/rds-ctl.cpp
@@ -517,6 +517,30 @@  static void print_rds_tmc(const struct v4l2_rds *handle, uint32_t updated_fields
 	}
 }
 
+static void print_rds_tmc_tuning(const struct v4l2_rds *handle, uint32_t updated_fields)
+{
+	const struct v4l2_tmc_tuning *tuning = &handle->tmc.tuning;
+	const struct v4l2_tmc_station *station;
+	
+	if (updated_fields & V4L2_RDS_TMC_TUNING) {
+		printf("\nTMC Service provider: %s, %u alternative stations\n", handle->tmc.spn, tuning->station_cnt);
+		for (int i = 0; i < tuning->station_cnt; i++) {
+			station = &tuning->station[i];
+			printf("PI(ON %02u) = %04x, AFs: %u, mapped AFs: %u \n", i, station->pi,
+					station->afi.af_size, station->afi.mapped_af_size);
+			for (int j = 0; j < station->afi.af_size; j++)
+				printf("        AF%02d: %.1fMHz\n", j, station->afi.af[j] / 1000000.0);
+			for (int k = 0; k < station->afi.mapped_af_size; k++)
+				printf("        m_AF%02d: %.1fMHz => %.1fMHz\n", k,
+						station->afi.mapped_af_tuning[k] / 1000000.0,
+						station->afi.mapped_af[k] / 1000000.0);
+			if (station->ltn != 0 || station->msg != 0 || station-> sid != 0)
+				printf("        ltn: %02x, msg: %02x, sid: %02x\n", station->ltn,
+						station->msg, station->sid);
+		}
+	}
+}
+
 static void print_rds_statistics(const struct v4l2_rds_statistics *statistics)
 {
 	printf("\n\nRDS Statistics: \n");
@@ -636,8 +660,10 @@  static void print_rds_data(const struct v4l2_rds *handle, uint32_t updated_field
 		print_rds_af(&handle->rds_af);
 	if (params.options[OptPrintBlock])
 		printf("\n");
-	if (params.options[OptTMC])
+	if (params.options[OptTMC]) {
 		print_rds_tmc(handle, updated_fields);
+		print_rds_tmc_tuning(handle, updated_fields);
+	}
 }
 
 static void read_rds(struct v4l2_rds *handle, const int fd, const int wait_limit)