From 3fbc3f186f8f7817be2ecbdcc7117bd294bb7d88 Mon Sep 17 00:00:00 2001 From: "Javier S. Pedro" Date: Mon, 13 Feb 2012 20:16:32 +0100 Subject: add signal monitoring support --- fmrxd.h | 38 ++++++++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 8 deletions(-) (limited to 'fmrxd.h') diff --git a/fmrxd.h b/fmrxd.h index 5f95d6a..9473510 100644 --- a/fmrxd.h +++ b/fmrxd.h @@ -6,32 +6,49 @@ #include #include +/** The D-Bus name of this server. */ #define BUS_NAME "com.javispedro.fmrxd" #define BUS_PATH "/com/javispedro/fmrxd" #define BUS_INTERFACE BUS_NAME +/** Whether the server will shutdown when there are no more clients. */ #define SERVER_ON_DEMAND 1 +/** Seconds the server will wait before shutting down after last client exits. */ #define SERVER_LINGER_TIME 10 +/** Seconds the server will keep the radio device powered on after the last + client exits. Should be smaller than SERVER_LINGER_TIME. */ #define RADIO_LINGER_TIME 2 +/** The BlueZ device ID to power up and configure. */ #define BT_DEV_ID 0 +/** The ALSA mixer node to configure. */ #define ALSA_MIXER_NAME "hw:2" +/** The ALSA device from where to read radio audio data. */ #define ALSA_PCM_CAPTURE_NAME "hw:2,0" +/** The audio rate to use. */ #define ALSA_CAPTURE_RATE 48000 +/** The size of the global ring buffer size that prevents overruns. */ #define RING_BUFFER_SIZE (ALSA_CAPTURE_RATE) +/** Tuner device to use. */ #define TUNER_DEVICE "/dev/radio0" #define TUNER_DEVICE_ID 0 +/** Enable the wl1273 N950/N9 RDS decoding workarounds. */ #define CRAPPY_WL1273_RDS 1 -/* fmrxd.c */ +/** Poll the signal level every this many seconds. */ +#define SIGNAL_POLL_INTERVAL 10 +/** After tuning, refresh the signal level once after this many miliseconds. */ +#define SIGNAL_REFRESH_DELAY 200 + +/* fmrxd.c -- the main loop */ extern GMainLoop* main_loop; -/* server.c */ +/* server.c -- the d-bus server, audio server and client logic */ int server_start(); void server_stop(); void server_queue_stop(); @@ -40,38 +57,43 @@ size_t server_get_buffer(size_t size, void **buffer); void server_commit_buffer(size_t size); void server_notify_tuned(double mhz); void server_notify_stopped(); +void server_notify_signal(uint16_t signal); void server_notify_pi(uint16_t pi); void server_notify_ps(const char *ps); void server_notify_rt(const char *rt); -/* radio.c */ +/* radio.c -- enabling and disabling radio logic */ bool radio_active(); void radio_start(); void radio_stop(); void radio_queue_start(); void radio_queue_stop(); -/* bt.c */ +/* bt.c -- configuring the wl1273 multiplexer via HCI */ bool configure_bt_muxer(bool on); -/* capture.c */ +/* capture.c -- configure the ALSA mixer and capture */ bool configure_mixer(bool on); bool configure_capture(bool on); -/* tuner.c */ +/* tuner.c -- setting up the V4L tuner */ bool configure_tuner(bool on); extern int tuner_fd; bool tuner_set_frequency(double mhz); +uint16_t tuner_get_signal(); bool tuner_search(bool forward); -/* rds.c */ +/* rds.c -- RDS decoder */ bool configure_rds(bool on); void rds_reset(); - unsigned short rds_get_pi(); unsigned char rds_get_pty(); const char * rds_get_pty_text(); gchar * rds_get_ps(); gchar * rds_get_rt(); +/* signal.c -- polling signal level */ +bool configure_signal(bool on); +void signal_reset(); + #endif // FMRXD_H -- cgit v1.2.3