aboutsummaryrefslogtreecommitdiffstats
path: root/src/common/main_common.c
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2017-03-04 07:12:12 +0100
committerAndreas Eversberg <jolly@eversberg.eu>2017-03-04 07:12:12 +0100
commit3fc4fc54be56310650a9f7ea1183aa71a3d3ac4d (patch)
tree500dfebbc37eda7b1c2b3184b5df010aa9f13479 /src/common/main_common.c
parent4201717f36f1236fd0de1597679f5e9411c8a7eb (diff)
main_common: Move init and cleanup function to main function
Diffstat (limited to 'src/common/main_common.c')
-rw-r--r--src/common/main_common.c34
1 files changed, 14 insertions, 20 deletions
diff --git a/src/common/main_common.c b/src/common/main_common.c
index 754f7e8..634e94c 100644
--- a/src/common/main_common.c
+++ b/src/common/main_common.c
@@ -417,8 +417,14 @@ static int get_char()
return -1;
}
-int init_common(const char *station_id, int station_id_digits)
+/* Loop through all transceiver instances of one network. */
+void main_common(int *quit, int latency, int interval, void (*myhandler)(void), const char *station_id, int station_id_digits)
{
+ int latspl;
+ sender_t *sender;
+ double last_time_call = 0, begin_time, now, sleep;
+ struct termios term, term_orig;
+ int c;
int rc;
/* init mncc */
@@ -426,7 +432,7 @@ int init_common(const char *station_id, int station_id_digits)
rc = mncc_init("/tmp/bsc_mncc");
if (rc < 0) {
fprintf(stderr, "Failed to setup MNCC socket. Quitting!\n");
- return rc;
+ return;
}
}
@@ -434,14 +440,14 @@ int init_common(const char *station_id, int station_id_digits)
rc = call_init(station_id, call_audiodev, call_samplerate, latency, station_id_digits, loopback, use_mncc_sock, send_patterns, release_on_disconnect);
if (rc < 0) {
fprintf(stderr, "Failed to create call control instance. Quitting!\n");
- return rc;
+ return;
}
#ifdef HAVE_UHD
#ifdef HAVE_SOAPY
if ((sdr_uhd == 1 && sdr_soapy == 1) || (sdr_uhd == 0 && sdr_soapy == 0)) {
fprintf(stderr, "UHD and SoapySDR drivers are compiled in. You must choose which one you want: --sdr-uhd or --sdr-soapy\n");
- return -EINVAL;
+ return;
}
#else
sdr_uhd = 1;
@@ -457,21 +463,9 @@ int init_common(const char *station_id, int station_id_digits)
#ifdef HAVE_SDR
rc = sdr_init(sdr_uhd, sdr_soapy, sdr_args, sdr_rx_gain, sdr_tx_gain, write_iq_rx_wave, write_iq_tx_wave, read_iq_rx_wave);
if (rc < 0)
- return rc;
+ return;
#endif
- return 0;
-}
-
-/* Loop through all transceiver instances of one network. */
-void main_common(int *quit, int latency, int interval, void (*myhandler)(void))
-{
- int latspl;
- sender_t *sender;
- double last_time_call = 0, begin_time, now, sleep;
- struct termios term, term_orig;
- int c;
-
/* open audio */
if (sender_open_audio())
return;
@@ -609,11 +603,11 @@ next_char:
schedp.sched_priority = 0;
sched_setscheduler(0, SCHED_OTHER, &schedp);
}
-}
-void cleanup_common(void)
-{
+ /* cleanup call control */
call_cleanup();
+
+ /* close mncc socket */
if (use_mncc_sock)
mncc_exit();
}