static const struct option options[] = {
{ "codec", required_argument, 0, 'c' },
+ { "config", no_argument, 0, 'C' },
{ "drivers", no_argument, 0, 'd' },
+ { "default", no_argument, 0, 'D' },
{ "gui", required_argument, 0, 'g' },
{ "help", no_argument, 0, 'h' },
{ "interface", required_argument, 0, 'i' },
{ "receiver", required_argument, 0, 'r' },
{ "text", required_argument, 0, 'x' },
{ "transmitter", required_argument, 0, 't' },
- { "config", no_argument, 0, 'C' },
{ 0, 0, 0, 0 }
};
drivers();
exit(0);
break;
+ case 'D':
+ i.fill_in();
+ break;
case 'g':
i.user_interface = driver_manager.user_interface(driver, parameter, &i);
break;
i.fill_in();
// FIX: Operator overload doesn't work here.
i.print(cout) << endl;
+ exit(0);
case 0:
break;
}
/// The main loop of the program.
#include "drivers.h"
+#include <unistd.h>
+#include <iostream>
+
+/// FIX: Make the delay at start of transmit and end of transmit adjustable.
+/// The radio in general takes some time to begin transmitting, and thus we
+/// should not send audio until that's done.
+///
+/// There is a lot to fill in for end-of-transmit.
+/// On PTT-up, we should be sending the remaining audio in the microphone
+/// device queue first, waiting for completion of its transmission, and then
+/// un-keying the transmitter.
+///
namespace FreeDV {
- static void
- ptt_digital(bool value)
+ static void key_down(Interfaces * i);
+ static void key_up(Interfaces * i);
+ static void receive(Interfaces * i);
+ static void transmit_digital(Interfaces * i);
+ static void transmit_ssb(Interfaces * i);
+
+ static bool begin_transmit = false;
+ static bool begin_receive = true;
+
+ int
+ run(Interfaces * i)
{
+ static bool ptt_digital = false;
+ static bool ptt_ssb = false;
+
+ while ( true ) {
+ if ( i->ptt_input_digital->ready() ) {
+ bool state = i->ptt_input_digital->state();
+ if ( state && !ptt_digital && !ptt_ssb ) {
+ ptt_digital = true;
+ begin_transmit = true;
+ }
+ else if ( !state && ptt_digital ) {
+ begin_receive = true;
+ ptt_digital = false;
+ }
+ }
+ if ( i->ptt_input_ssb->ready() ) {
+ bool state = i->ptt_input_ssb->state();
+ if ( state && !ptt_digital && !ptt_ssb ) {
+ ptt_ssb = true;
+ begin_transmit = true;
+ }
+ else if ( !state && ptt_ssb ) {
+ begin_receive = true;
+ ptt_ssb = false;
+ }
+ }
+ if ( begin_transmit ) {
+ key_down(i);
+ }
+ else if ( begin_receive ) {
+ key_up(i);
+ }
+ else if ( ptt_digital ) {
+ transmit_digital(i);
+ }
+ else if ( ptt_ssb ) {
+ transmit_ssb(i);
+ }
+ else {
+ receive(i);
+ }
+ usleep(10000);
+ }
}
static void
- ptt_ssb(bool value)
+ key_down(Interfaces * i)
{
+ if ( i->keying_output->ready() ) {
+ i->keying_output->key(true);
+ begin_transmit = false;
+ }
+ else {
+ std::cerr << "Keying output is stalled." << std::endl;
+ }
}
-
- int
- run(Interfaces * i)
+
+ static void
+ key_up(Interfaces * i)
+ {
+ if ( i->keying_output->ready() ) {
+ i->keying_output->key(false);
+ begin_receive = false;
+ }
+ else {
+ std::cerr << "Keying output is stalled." << std::endl;
+ }
+ }
+
+ static void
+ receive(Interfaces * i)
+ {
+ }
+
+ static void
+ transmit_digital(Interfaces * i)
+ {
+ }
+
+ static void
+ transmit_ssb(Interfaces * i)
{
- return 0;
}
}