# CONTROLLER2_V1 single encoders with MCP23017 switches
# CONTROLLER2_V2 dual encoders with MCP23017 switches
#
-GPIO_INCLUDE=GPIO
+#GPIO_INCLUDE=GPIO
# uncomment the line below to include Pure Signal support
-PURESIGNAL_INCLUDE=PURESIGNAL
+#PURESIGNAL_INCLUDE=PURESIGNAL
# uncomment the line below to include MIDI support
-#MIDI_INCLUDE=MIDI
+MIDI_INCLUDE=MIDI
# uncomment the line below to include USB Ozy support
# USBOZY_INCLUDE=USBOZY
# uncomment the line to below include support local CW keyer
-LOCALCW_INCLUDE=LOCALCW
+#LOCALCW_INCLUDE=LOCALCW
# uncomment the line below for SoapySDR
#SOAPYSDR_INCLUDE=SOAPYSDR
/* Copyright (C)
-* 2015 - John Melton, G0ORX/N6LYT
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*
-*/
-
-// Define maximum window size.
+ * 2015 - John Melton, G0ORX/N6LYT
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+
+// Define maximum window size.
// Standard values 800 and 480: suitable for RaspberryBi 7-inch screen
-#define MAX_DISPLAY_WIDTH 800
-#define MAX_DISPLAY_HEIGHT 480
+#define MAX_DISPLAY_WIDTH 1024 // edit
+#define MAX_DISPLAY_HEIGHT 600 // edit
-#include <gtk/gtk.h>
+#include <arpa/inet.h>
#include <gdk/gdk.h>
+#include <gtk/gtk.h>
#include <math.h>
-#include <unistd.h>
+#include <netinet/in.h>
+#include <semaphore.h>
#include <stdlib.h>
#include <string.h>
-#include <semaphore.h>
#include <sys/socket.h>
#include <sys/types.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
+#include <unistd.h>
+#include "actions.h"
#include "audio.h"
#include "band.h"
#include "bandstack.h"
-#include "main.h"
#include "channel.h"
-#include "discovered.h"
#include "configure.h"
-#include "actions.h"
+#include "discovered.h"
+#include "main.h"
#ifdef GPIO
#include "gpio.h"
#endif
-#include "wdsp.h"
+#include "button_text.h"
#include "new_menu.h"
#include "radio.h"
#include "version.h"
-#include "button_text.h"
+#include "wdsp.h"
#ifdef I2C
#include "i2c.h"
#endif
#ifdef SOAPYSDR
#include "soapy_protocol.h"
#endif
+#include "css.h"
#include "ext.h"
#include "vfo.h"
-#include "css.h"
struct utsname unameData;
gint display_width;
gint display_height;
-gint full_screen=1;
+gint full_screen = 1;
static GtkWidget *discovery_dialog;
GtkWidget *top_window;
GtkWidget *grid;
-static DISCOVERED* d;
+static DISCOVERED *d;
static GtkWidget *status;
void status_text(char *text) {
- //fprintf(stderr,"splash_status: %s\n",text);
- gtk_label_set_text(GTK_LABEL(status),text);
+ // fprintf(stderr,"splash_status: %s\n",text);
+ gtk_label_set_text(GTK_LABEL(status), text);
usleep(100000);
- while (gtk_events_pending ())
- gtk_main_iteration ();
+ while (gtk_events_pending())
+ gtk_main_iteration();
}
static gint save_cb(gpointer data) {
- radioSaveState();
- return TRUE;
+ radioSaveState();
+ return TRUE;
}
static pthread_t wisdom_thread_id;
-static int wisdom_running=0;
+static int wisdom_running = 0;
-static void* wisdom_thread(void *arg) {
- WDSPwisdom ((char *)arg);
- wisdom_running=0;
+static void *wisdom_thread(void *arg) {
+ WDSPwisdom((char *)arg);
+ wisdom_running = 0;
return NULL;
}
//
gboolean keypress_cb(GtkWidget *widget, GdkEventKey *event, gpointer data) {
- if (radio != NULL) {
- if (event->keyval == GDK_KEY_space) {
-
- fprintf(stderr, "space");
-
- if(getTune()==1) {
- setTune(0);
- }
- if(getMox()==1) {
- setMox(0);
- } else if(canTransmit() || tx_out_of_band) {
- setMox(1);
- } else {
- transmitter_set_out_of_band(transmitter);
- }
- g_idle_add(ext_vfo_update,NULL);
- return TRUE;
- }
- if (event->keyval == GDK_KEY_d ) {
- vfo_move(step,TRUE);
- return TRUE;
- }
- if (event->keyval == GDK_KEY_u ) {
- vfo_move(-step,TRUE);
- return TRUE;
- }
+ if (radio != NULL) {
+ if (event->keyval == GDK_KEY_space) {
+
+ fprintf(stderr, "space");
+
+ if (getTune() == 1) {
+ setTune(0);
+ }
+ if (getMox() == 1) {
+ setMox(0);
+ } else if (canTransmit() || tx_out_of_band) {
+ setMox(1);
+ } else {
+ transmitter_set_out_of_band(transmitter);
+ }
+ g_idle_add(ext_vfo_update, NULL);
+ return TRUE;
+ }
+ if (event->keyval == GDK_KEY_d) {
+ vfo_move(step, TRUE);
+ return TRUE;
+ }
+ if (event->keyval == GDK_KEY_u) {
+ vfo_move(-step, TRUE);
+ return TRUE;
+ }
}
-
+
return FALSE;
}
-gboolean main_delete (GtkWidget *widget) {
- if(radio!=NULL) {
+gboolean main_delete(GtkWidget *widget) {
+ if (radio != NULL) {
#ifdef GPIO
gpio_close();
#endif
#ifdef CLIENT_SERVER
- if(!radio_is_remote) {
+ if (!radio_is_remote) {
#endif
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- old_protocol_stop();
- break;
- case NEW_PROTOCOL:
- new_protocol_stop();
- break;
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ old_protocol_stop();
+ break;
+ case NEW_PROTOCOL:
+ new_protocol_stop();
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- soapy_protocol_stop();
- break;
+ case SOAPYSDR_PROTOCOL:
+ soapy_protocol_stop();
+ break;
#endif
}
#ifdef CLIENT_SERVER
static int init(void *data) {
char wisdom_directory[1024];
- g_print("%s\n",__FUNCTION__);
+ g_print("%s\n", __FUNCTION__);
audio_get_cards();
// wait for get_cards to complete
- //g_mutex_lock(&audio_mutex);
- //g_mutex_unlock(&audio_mutex);
+ // g_mutex_lock(&audio_mutex);
+ // g_mutex_unlock(&audio_mutex);
- cursor_arrow=gdk_cursor_new(GDK_ARROW);
- cursor_watch=gdk_cursor_new(GDK_WATCH);
+ cursor_arrow = gdk_cursor_new(GDK_ARROW);
+ cursor_watch = gdk_cursor_new(GDK_WATCH);
- gdk_window_set_cursor(gtk_widget_get_window(top_window),cursor_watch);
+ gdk_window_set_cursor(gtk_widget_get_window(top_window), cursor_watch);
//
// Let WDSP (via FFTW) check for wisdom file in current dir
// Depending on the WDSP version, the file is wdspWisdom or wdspWisdom00.
// sem_trywait() is not elegant, replaced this with wisdom_running variable.
//
- char *c=getcwd(wisdom_directory, sizeof(wisdom_directory));
- strcpy(&wisdom_directory[strlen(wisdom_directory)],"/");
- fprintf(stderr,"Securing wisdom file in directory: %s\n", wisdom_directory);
+ char *c = getcwd(wisdom_directory, sizeof(wisdom_directory));
+ strcpy(&wisdom_directory[strlen(wisdom_directory)], "/");
+ fprintf(stderr, "Securing wisdom file in directory: %s\n", wisdom_directory);
status_text("Checking FFTW Wisdom file ...");
- wisdom_running=1;
+ wisdom_running = 1;
pthread_create(&wisdom_thread_id, NULL, wisdom_thread, wisdom_directory);
while (wisdom_running) {
- // wait for the wisdom thread to complete, meanwhile
- // handling any GTK events.
- usleep(100000); // 100ms
- while (gtk_events_pending ()) {
- gtk_main_iteration ();
- }
- status_text(wisdom_get_status());
+ // wait for the wisdom thread to complete, meanwhile
+ // handling any GTK events.
+ usleep(100000); // 100ms
+ while (gtk_events_pending()) {
+ gtk_main_iteration();
+ }
+ status_text(wisdom_get_status());
}
- g_idle_add(ext_discovery,NULL);
+ g_idle_add(ext_discovery, NULL);
return 0;
}
static void activate_pihpsdr(GtkApplication *app, gpointer data) {
+ // gtk_init (&argc, &argv);
- //gtk_init (&argc, &argv);
-
- fprintf(stderr,"Build: %s %s\n",build_date,version);
+ fprintf(stderr, "Build: %s %s\n", build_date, version);
- fprintf(stderr,"GTK+ version %ud.%ud.%ud\n", gtk_major_version, gtk_minor_version, gtk_micro_version);
+ fprintf(stderr, "GTK+ version %ud.%ud.%ud\n", gtk_major_version,
+ gtk_minor_version, gtk_micro_version);
uname(&unameData);
- fprintf(stderr,"sysname: %s\n",unameData.sysname);
- fprintf(stderr,"nodename: %s\n",unameData.nodename);
- fprintf(stderr,"release: %s\n",unameData.release);
- fprintf(stderr,"version: %s\n",unameData.version);
- fprintf(stderr,"machine: %s\n",unameData.machine);
+ fprintf(stderr, "sysname: %s\n", unameData.sysname);
+ fprintf(stderr, "nodename: %s\n", unameData.nodename);
+ fprintf(stderr, "release: %s\n", unameData.release);
+ fprintf(stderr, "version: %s\n", unameData.version);
+ fprintf(stderr, "machine: %s\n", unameData.machine);
load_css();
- GdkScreen *screen=gdk_screen_get_default();
- if(screen==NULL) {
- fprintf(stderr,"no default screen!\n");
+ GdkScreen *screen = gdk_screen_get_default();
+ if (screen == NULL) {
+ fprintf(stderr, "no default screen!\n");
_exit(0);
}
+ display_width = gdk_screen_get_width(screen);
+ display_height = gdk_screen_get_height(screen);
- display_width=gdk_screen_get_width(screen);
- display_height=gdk_screen_get_height(screen);
-
-fprintf(stderr,"width=%d height=%d\n", display_width, display_height);
+ fprintf(stderr, "width=%d height=%d\n", display_width, display_height);
// Go to "window" mode if there is enough space on the screen.
// Do not forget extra space needed for window top bars, screen bars etc.
- if(display_width>(MAX_DISPLAY_WIDTH+10) && display_height>(MAX_DISPLAY_HEIGHT+30)) {
- display_width=MAX_DISPLAY_WIDTH;
- display_height=MAX_DISPLAY_HEIGHT;
- full_screen=0;
+ if (display_width > (MAX_DISPLAY_WIDTH + 10) &&
+ display_height > (MAX_DISPLAY_HEIGHT + 30)) {
+ display_width = MAX_DISPLAY_WIDTH;
+ display_height = MAX_DISPLAY_HEIGHT;
+ // full_screen=0;//edit (comment for full screen)
} else {
//
// Some RaspPi variants report slightly too large screen sizes
if (display_height > MAX_DISPLAY_HEIGHT) {
display_height = MAX_DISPLAY_HEIGHT;
}
- full_screen=1;
+ full_screen = 1;
}
-fprintf(stderr,"display_width=%d display_height=%d\n", display_width, display_height);
+ fprintf(stderr, "display_width=%d display_height=%d\n", display_width,
+ display_height);
- fprintf(stderr,"create top level window\n");
- top_window = gtk_application_window_new (app);
- if(full_screen) {
- fprintf(stderr,"full screen\n");
+ fprintf(stderr, "create top level window\n");
+ top_window = gtk_application_window_new(app);
+ if (full_screen) {
+ fprintf(stderr, "full screen\n");
gtk_window_fullscreen(GTK_WINDOW(top_window));
}
gtk_widget_set_size_request(top_window, display_width, display_height);
- gtk_window_set_title (GTK_WINDOW (top_window), "piHPSDR");
- gtk_window_set_position(GTK_WINDOW(top_window),GTK_WIN_POS_CENTER_ALWAYS);
- gtk_window_set_resizable(GTK_WINDOW(top_window), FALSE);
- fprintf(stderr,"setting top window icon\n");
+ gtk_window_set_title(GTK_WINDOW(top_window), "Verdure SDR V1.2");
+ gtk_window_set_position(GTK_WINDOW(top_window), GTK_WIN_POS_CENTER_ALWAYS);
+ // gtk_window_set_resizable(GTK_WINDOW(top_window), FALSE);
+ gtk_window_set_resizable(GTK_WINDOW(top_window), TRUE); // edit
+ fprintf(stderr, "setting top window icon\n");
GError *error;
- if(!gtk_window_set_icon_from_file (GTK_WINDOW(top_window), "hpsdr.png", &error)) {
- fprintf(stderr,"Warning: failed to set icon for top_window\n");
- if(error!=NULL) {
- fprintf(stderr,"%s\n",error->message);
+ if (!gtk_window_set_icon_from_file(GTK_WINDOW(top_window), "hpsdr.png",
+ &error)) {
+ fprintf(stderr, "Warning: failed to set icon for top_window\n");
+ if (error != NULL) {
+ fprintf(stderr, "%s\n", error->message);
}
}
- g_signal_connect (top_window, "delete-event", G_CALLBACK (main_delete), NULL);
- //g_signal_connect (top_window,"draw", G_CALLBACK (main_draw_cb), NULL);
+ g_signal_connect(top_window, "delete-event", G_CALLBACK(main_delete), NULL);
+ // g_signal_connect (top_window,"draw", G_CALLBACK (main_draw_cb), NULL);
//
// We want to use the space-bar as an alternative to go to TX
//
gtk_widget_add_events(top_window, GDK_KEY_PRESS_MASK);
- g_signal_connect(top_window, "key_press_event", G_CALLBACK(keypress_cb), NULL);
-
+ g_signal_connect(top_window, "key_press_event", G_CALLBACK(keypress_cb),
+ NULL);
-fprintf(stderr,"create grid\n");
+ fprintf(stderr, "create grid\n");
grid = gtk_grid_new();
gtk_widget_set_size_request(grid, display_width, display_height);
- gtk_grid_set_row_homogeneous(GTK_GRID(grid),FALSE);
- gtk_grid_set_column_homogeneous(GTK_GRID(grid),FALSE);
-fprintf(stderr,"add grid\n");
- gtk_container_add (GTK_CONTAINER (top_window), grid);
-
-fprintf(stderr,"create image\n");
- GtkWidget *image=gtk_image_new_from_file("hpsdr.png");
-fprintf(stderr,"add image to grid\n");
+ gtk_grid_set_row_homogeneous(GTK_GRID(grid), FALSE);
+ gtk_grid_set_column_homogeneous(GTK_GRID(grid), FALSE);
+ fprintf(stderr, "add grid\n");
+ gtk_container_add(GTK_CONTAINER(top_window), grid);
+
+ fprintf(stderr, "create image\n");
+ GtkWidget *image = gtk_image_new_from_file("hpsdr.png");
+ fprintf(stderr, "add image to grid\n");
gtk_grid_attach(GTK_GRID(grid), image, 0, 0, 1, 4);
-fprintf(stderr,"create pi label\n");
+ fprintf(stderr, "create pi label\n");
char build[128];
- sprintf(build,"build: %s %s",build_date, version);
- GtkWidget *pi_label=gtk_label_new("piHPSDR by John Melton g0orx/n6lyt");
- gtk_label_set_justify(GTK_LABEL(pi_label),GTK_JUSTIFY_LEFT);
+ sprintf(build, "build: %s %s", build_date, version);
+ GtkWidget *pi_label = gtk_label_new("Verdure RF Technologies");
+ gtk_label_set_justify(GTK_LABEL(pi_label), GTK_JUSTIFY_LEFT);
gtk_widget_show(pi_label);
-fprintf(stderr,"add pi label to grid\n");
- gtk_grid_attach(GTK_GRID(grid),pi_label,1,0,1,1);
+ fprintf(stderr, "add pi label to grid\n");
+ gtk_grid_attach(GTK_GRID(grid), pi_label, 1, 0, 1, 1);
-fprintf(stderr,"create build label\n");
- GtkWidget *build_date_label=gtk_label_new(build);
- gtk_label_set_justify(GTK_LABEL(build_date_label),GTK_JUSTIFY_LEFT);
+ fprintf(stderr, "create build label\n");
+ GtkWidget *build_date_label = gtk_label_new(build);
+ gtk_label_set_justify(GTK_LABEL(build_date_label), GTK_JUSTIFY_LEFT);
gtk_widget_show(build_date_label);
-fprintf(stderr,"add build label to grid\n");
- gtk_grid_attach(GTK_GRID(grid),build_date_label,1,1,1,1);
-
-fprintf(stderr,"create status\n");
- status=gtk_label_new("");
- gtk_label_set_justify(GTK_LABEL(status),GTK_JUSTIFY_LEFT);
- //gtk_widget_override_font(status, pango_font_description_from_string("FreeMono 18"));
+ fprintf(stderr, "add build label to grid\n");
+ gtk_grid_attach(GTK_GRID(grid), build_date_label, 1, 1, 1, 1);
+
+ fprintf(stderr, "create status\n");
+ status = gtk_label_new("");
+ gtk_label_set_justify(GTK_LABEL(status), GTK_JUSTIFY_LEFT);
+ // gtk_widget_override_font(status,
+ // pango_font_description_from_string("FreeMono 18"));
gtk_widget_show(status);
-fprintf(stderr,"add status to grid\n");
+ fprintf(stderr, "add status to grid\n");
gtk_grid_attach(GTK_GRID(grid), status, 1, 3, 1, 1);
- gtk_widget_show_all(top_window);
-
-fprintf(stderr,"g_idle_add: init\n");
- g_idle_add(init,NULL);
+ // gtk_widget_show_all(top_window);
+ gtk_widget_hide(top_window);
+ fprintf(stderr, "g_idle_add: init\n");
+ g_idle_add(init, NULL);
}
-int main(int argc,char **argv) {
+int main(int argc, char **argv) {
GtkApplication *pihpsdr;
int status;
char name[1024];
- sprintf(name,"org.g0orx.pihpsdr.pid%d",getpid());
+ sprintf(name, "com.verdure.sdr.pid%d", getpid());
-//fprintf(stderr,"gtk_application_new: %s\n",name);
+ // fprintf(stderr,"gtk_application_new: %s\n",name);
- pihpsdr=gtk_application_new(name, G_APPLICATION_FLAGS_NONE);
+ pihpsdr = gtk_application_new(name, G_APPLICATION_FLAGS_NONE);
g_signal_connect(pihpsdr, "activate", G_CALLBACK(activate_pihpsdr), NULL);
- status=g_application_run(G_APPLICATION(pihpsdr), argc, argv);
- fprintf(stderr,"exiting ...\n");
+ status = g_application_run(G_APPLICATION(pihpsdr), argc, argv);
+ fprintf(stderr, "exiting ...\n");
g_object_unref(pihpsdr);
return status;
}
/* Copyright (C)
-* 2015 - John Melton, G0ORX/N6LYT
-*
-* This program is free software; you can redistribute it and/or
-* modify it under the terms of the GNU General Public License
-* as published by the Free Software Foundation; either version 2
-* of the License, or (at your option) any later version.
-*
-* This program is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-* GNU General Public License for more details.
-*
-* You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-*
-*/
+ * 2015 - John Melton, G0ORX/N6LYT
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+ *
+ */
+#include <arpa/inet.h>
#include <gtk/gtk.h>
-#include <stdlib.h>
+#include <math.h>
+#include <netdb.h>
+#include <netinet/in.h>
+#include <semaphore.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <semaphore.h>
-#include <math.h>
+#include <sys/socket.h>
#include <sys/time.h>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netdb.h>
#include <wdsp.h>
#include "adc.h"
-#include "dac.h"
#include "audio.h"
+#include "dac.h"
#include "discovered.h"
//#include "discovery.h"
+#include "agc.h"
+#include "band.h"
+#include "channel.h"
#include "filter.h"
#include "main.h"
#include "mode.h"
-#include "radio.h"
-#include "receiver.h"
-#include "transmitter.h"
-#include "channel.h"
-#include "agc.h"
-#include "band.h"
-#include "property.h"
#include "new_menu.h"
#include "new_protocol.h"
#include "old_protocol.h"
+#include "property.h"
+#include "radio.h"
+#include "receiver.h"
#include "store.h"
+#include "transmitter.h"
#ifdef SOAPYSDR
#include "soapy_protocol.h"
#endif
#include "actions.h"
+#include "ext.h"
#include "gpio.h"
-#include "vfo.h"
-#include "vox.h"
#include "meter.h"
+#include "rigctl.h"
#include "rx_panadapter.h"
+#include "sliders.h"
+#include "toolbar.h"
#include "tx_panadapter.h"
+#include "vfo.h"
+#include "vox.h"
#include "waterfall.h"
#include "zoompan.h"
-#include "sliders.h"
-#include "toolbar.h"
-#include "rigctl.h"
-#include "ext.h"
#ifdef LOCALCW
#include "iambic.h"
#endif
// rather than including MIDI.h with all its internal stuff
// (e.g. enum components) we just declare the single bit thereof
// we need here to make a strict compiler happy.
-//extern void MIDIstartup();
+// extern void MIDIstartup();
#endif
#ifdef CLIENT_SERVER
#include "client_server.h"
#endif
-#define min(x,y) (x<y?x:y)
-#define max(x,y) (x<y?y:x)
+#define min(x, y) (x < y ? x : y)
+#define max(x, y) (x < y ? y : x)
#define MENU_HEIGHT (30)
#define MENU_WIDTH (64)
-#define VFO_HEIGHT (60)
-#define VFO_WIDTH (display_width-METER_WIDTH-MENU_WIDTH)
-#define METER_HEIGHT (60)
+#define VFO_HEIGHT (60) // edit default = 60
+#define VFO_WIDTH (display_width - METER_WIDTH - MENU_WIDTH)
+#define METER_HEIGHT (60) // edit default = 60
#define METER_WIDTH (200)
#define PANADAPTER_HEIGHT (105)
#define ZOOMPAN_HEIGHT (50)
gboolean midi_enabled;
#endif
-gint controller=NO_CONTROLLER;
+gint controller = NO_CONTROLLER;
GtkWidget *fixed;
static GtkWidget *vfo_panel;
static GtkWidget *audio_waterfall;
// RX and TX calibration
-long long calibration=0LL;
+long long calibration = 0LL;
/*
#ifdef GPIO
*/
gint sat_mode;
-int region=REGION_OTHER;
+int region = REGION_OTHER;
-int echo=0;
+int echo = 0;
int radio_sample_rate;
gboolean iqswap;
static gint save_timer_id;
-DISCOVERED *radio=NULL;
+DISCOVERED *radio = NULL;
#ifdef CLIENT_SERVER
-gboolean radio_is_remote=FALSE;
+gboolean radio_is_remote = FALSE;
#endif
char property_path[128];
int PS_RX_FEEDBACK;
#endif
+int buffer_size = 1024; // 64, 128, 256, 512, 1024, 2048
+int fft_size = 2048; // 1024, 2048, 4096, 8192, 16384
+int atlas_penelope = 0;
+int atlas_clock_source_10mhz = 0;
+int atlas_clock_source_128mhz = 0;
+int atlas_config = 0;
+int atlas_mic_source = 0;
+int atlas_janus = 0;
-int buffer_size=1024; // 64, 128, 256, 512, 1024, 2048
-int fft_size=2048; // 1024, 2048, 4096, 8192, 16384
-
-int atlas_penelope=0;
-int atlas_clock_source_10mhz=0;
-int atlas_clock_source_128mhz=0;
-int atlas_config=0;
-int atlas_mic_source=0;
-int atlas_janus=0;
+int classE = 0;
-int classE=0;
+int tx_out_of_band = 0;
-int tx_out_of_band=0;
+int tx_cfir = 0;
+int tx_leveler = 0;
+int alc = TXA_ALC_AV;
-int tx_cfir=0;
-int tx_leveler=0;
-int alc=TXA_ALC_AV;
+double tone_level = 0.2;
-double tone_level=0.2;
-
-int filter_board=ALEX;
-int pa_enabled=PA_ENABLED;
-int pa_power=0;
+int filter_board = ALEX;
+int pa_enabled = PA_ENABLED;
+int pa_power = 0;
int pa_trim[11];
-int updates_per_second=10;
-
-int panadapter_high=-40;
-int panadapter_low=-140;
+int updates_per_second = 10;
-int display_filled=1;
-int display_gradient=1;
-int display_detector_mode=DETECTOR_MODE_AVERAGE;
-int display_average_mode=AVERAGE_MODE_LOG_RECURSIVE;
-double display_average_time=120.0;
+int panadapter_high = -40;
+int panadapter_low = -140;
+int display_filled = 1;
+int display_gradient = 1;
+int display_detector_mode = DETECTOR_MODE_AVERAGE;
+int display_average_mode = AVERAGE_MODE_LOG_RECURSIVE;
+double display_average_time = 120.0;
-int waterfall_high=-100;
-int waterfall_low=-150;
+int waterfall_high = -100;
+int waterfall_low = -150;
-int display_zoompan=0;
-int display_sliders=0;
-int display_toolbar=0;
+int display_zoompan = 0;
+int display_sliders = 0;
+int display_toolbar = 0;
-//double volume=0.2;
-double mic_gain=0.0;
-int binaural=0;
+// double volume=0.2;
+double mic_gain = 0.0;
+int binaural = 0;
-int mic_linein=0;
-int linein_gain=16; // 0..31
-int mic_boost=0;
-int mic_bias_enabled=0;
-int mic_ptt_enabled=0;
-int mic_ptt_tip_bias_ring=0;
+int mic_linein = 0;
+int linein_gain = 16; // 0..31
+int mic_boost = 0;
+int mic_bias_enabled = 0;
+int mic_ptt_enabled = 0;
+int mic_ptt_tip_bias_ring = 0;
-//double tune_drive=10;
-//double drive=50;
+// double tune_drive=10;
+// double drive=50;
-//int drive_level=0;
-//int tune_drive_level=0;
+// int drive_level=0;
+// int tune_drive_level=0;
int receivers;
ADC adc[2];
DAC dac[2];
-//int adc_attenuation[2];
+// int adc_attenuation[2];
-int locked=0;
+int locked = 0;
-long long step=100;
+long long step = 100;
-//int rit=0;
-int rit_increment=10;
+// int rit=0;
+int rit_increment = 10;
int lt2208Dither = 0;
int lt2208Random = 0;
int attenuation = 0; // 0dB
-//unsigned long alex_rx_antenna=0;
-//unsigned long alex_tx_antenna=0;
-//unsigned long alex_attenuation=0;
-
-int cw_keys_reversed=0; // 0=disabled 1=enabled
-int cw_keyer_speed=16; // 1-60 WPM
-int cw_keyer_mode=KEYER_MODE_A;
-int cw_keyer_weight=50; // 0-100
-int cw_keyer_spacing=0; // 0=on 1=off
-int cw_keyer_internal=1; // 0=external 1=internal
-int cw_keyer_sidetone_volume=50; // 0-127
-int cw_keyer_ptt_delay=20; // 0-255ms
-int cw_keyer_hang_time=500; // ms
-int cw_keyer_sidetone_frequency=800; // Hz
-int cw_breakin=1; // 0=disabled 1=enabled
-
-int cw_is_on_vfo_freq=1; // 1= signal on VFO freq, 0= signal offset by side tone
-
-int vfo_encoder_divisor=15;
+// unsigned long alex_rx_antenna=0;
+// unsigned long alex_tx_antenna=0;
+// unsigned long alex_attenuation=0;
+
+int cw_keys_reversed = 0; // 0=disabled 1=enabled
+int cw_keyer_speed = 16; // 1-60 WPM
+int cw_keyer_mode = KEYER_MODE_A;
+int cw_keyer_weight = 50; // 0-100
+int cw_keyer_spacing = 0; // 0=on 1=off
+int cw_keyer_internal = 1; // 0=external 1=internal
+int cw_keyer_sidetone_volume = 50; // 0-127
+int cw_keyer_ptt_delay = 20; // 0-255ms
+int cw_keyer_hang_time = 500; // ms
+int cw_keyer_sidetone_frequency = 800; // Hz
+int cw_breakin = 1; // 0=disabled 1=enabled
+
+int cw_is_on_vfo_freq =
+ 1; // 1= signal on VFO freq, 0= signal offset by side tone
+
+int vfo_encoder_divisor = 15;
int protocol;
int device;
-int new_pa_board=0; // Indicates Rev.24 PA board for HERMES/ANGELIA/ORION
+int new_pa_board = 0; // Indicates Rev.24 PA board for HERMES/ANGELIA/ORION
int ozy_software_version;
int mercury_software_version;
int penelope_software_version;
unsigned int IO2;
unsigned int IO3;
int supply_volts;
-int ptt=0;
-int mox=0;
-int tune=0;
-int memory_tune=0;
-int full_tune=0;
-int have_rx_gain=0;
-int rx_gain_calibration=14;
-
-//long long displayFrequency=14250000;
-//long long ddsFrequency=14250000;
-//long long ddsOffset=0;
-
-long long frequencyB=14250000;
-int modeB=modeUSB;
-int filterB=5;
-
-int split=0;
-
-unsigned char OCtune=0;
-int OCfull_tune_time=2800; // ms
-int OCmemory_tune_time=550; // ms
+int ptt = 0;
+int mox = 0;
+int tune = 0;
+int memory_tune = 0;
+int full_tune = 0;
+int have_rx_gain = 0;
+int rx_gain_calibration = 14;
+
+// long long displayFrequency=14250000;
+// long long ddsFrequency=14250000;
+// long long ddsOffset=0;
+
+long long frequencyB = 14250000;
+int modeB = modeUSB;
+int filterB = 5;
+
+int split = 0;
+
+unsigned char OCtune = 0;
+int OCfull_tune_time = 2800; // ms
+int OCmemory_tune_time = 550; // ms
long long tune_timeout;
-int analog_meter=0;
-int smeter=RXA_S_AV;
+int analog_meter = 0;
+int smeter = RXA_S_AV;
-int local_audio=0;
-int local_microphone=0;
+int local_audio = 0;
+int local_microphone = 0;
-int eer_pwm_min=100;
-int eer_pwm_max=800;
+int eer_pwm_min = 100;
+int eer_pwm_max = 800;
-int tx_filter_low=150;
-int tx_filter_high=2850;
+int tx_filter_low = 150;
+int tx_filter_high = 2850;
static int pre_tune_mode;
static int pre_tune_cw_internal;
static int pre_tune_filter_low;
static int pre_tune_filter_high;
-int enable_tx_equalizer=0;
-int tx_equalizer[4]={0,0,0,0};
+int enable_tx_equalizer = 0;
+int tx_equalizer[4] = {0, 0, 0, 0};
-int enable_rx_equalizer=0;
-int rx_equalizer[4]={0,0,0,0};
+int enable_rx_equalizer = 0;
+int rx_equalizer[4] = {0, 0, 0, 0};
-int pre_emphasize=0;
+int pre_emphasize = 0;
-int vox_setting=0;
-int vox_enabled=0;
-double vox_threshold=0.001;
-double vox_gain=10.0;
-double vox_hang=250.0;
-int vox=0;
-int CAT_cw_is_active=0;
-int cw_key_hit=0;
-int n_adc=1;
+int vox_setting = 0;
+int vox_enabled = 0;
+double vox_threshold = 0.001;
+double vox_gain = 10.0;
+double vox_hang = 250.0;
+int vox = 0;
+int CAT_cw_is_active = 0;
+int cw_key_hit = 0;
+int n_adc = 1;
-int diversity_enabled=0;
-double div_cos=1.0; // I factor for diversity
-double div_sin=1.0; // Q factor for diversity
-double div_gain=0.0; // gain for diversity (in dB)
-double div_phase=0.0; // phase for diversity (in degrees, 0 ... 360)
+int diversity_enabled = 0;
+double div_cos = 1.0; // I factor for diversity
+double div_sin = 1.0; // Q factor for diversity
+double div_gain = 0.0; // gain for diversity (in dB)
+double div_phase = 0.0; // phase for diversity (in degrees, 0 ... 360)
-double meter_calibration=0.0;
-double display_calibration=0.0;
+double meter_calibration = 0.0;
+double display_calibration = 0.0;
-int can_transmit=0;
+int can_transmit = 0;
-gboolean duplex=FALSE;
-gboolean mute_rx_while_transmitting=FALSE;
+gboolean duplex = FALSE;
+gboolean mute_rx_while_transmitting = FALSE;
-double drive_max=100;
+double drive_max = 100;
-gboolean display_sequence_errors=TRUE;
-gint sequence_errors=0;
+gboolean display_sequence_errors = TRUE;
+gint sequence_errors = 0;
gint rx_height;
void radio_stop() {
- if(can_transmit) {
-g_print("radio_stop: TX: CloseChannel: %d\n",transmitter->id);
+ if (can_transmit) {
+ g_print("radio_stop: TX: CloseChannel: %d\n", transmitter->id);
CloseChannel(transmitter->id);
}
- set_displaying(receiver[0],0);
-g_print("radio_stop: RX0: CloseChannel: %d\n",receiver[0]->id);
+ set_displaying(receiver[0], 0);
+ g_print("radio_stop: RX0: CloseChannel: %d\n", receiver[0]->id);
CloseChannel(receiver[0]->id);
- set_displaying(receiver[1],0);
-g_print("radio_stop: RX1: CloseChannel: %d\n",receiver[1]->id);
+ set_displaying(receiver[1], 0);
+ g_print("radio_stop: RX1: CloseChannel: %d\n", receiver[1]->id);
CloseChannel(receiver[1]->id);
}
void reconfigure_radio() {
int i;
int y;
-g_print("reconfigure_radio: receivers=%d\n",receivers);
- rx_height=display_height-VFO_HEIGHT;
- if(display_zoompan) {
- rx_height-=ZOOMPAN_HEIGHT;
+ g_print("reconfigure_radio: receivers=%d\n", receivers);
+ rx_height = display_height - VFO_HEIGHT;
+ if (display_zoompan) {
+ rx_height -= ZOOMPAN_HEIGHT;
}
- if(display_sliders) {
- rx_height-=SLIDERS_HEIGHT;
+ if (display_sliders) {
+ rx_height -= SLIDERS_HEIGHT;
}
- if(display_toolbar) {
- rx_height-=TOOLBAR_HEIGHT;
+ if (display_toolbar) {
+ rx_height -= TOOLBAR_HEIGHT;
}
- y=VFO_HEIGHT;
- for(i=0;i<receivers;i++) {
- reconfigure_receiver(receiver[i],rx_height/receivers);
- gtk_fixed_move(GTK_FIXED(fixed),receiver[i]->panel,0,y);
- receiver[i]->x=0;
- receiver[i]->y=y;
- y+=rx_height/receivers;
+ y = VFO_HEIGHT;
+ for (i = 0; i < receivers; i++) {
+ reconfigure_receiver(receiver[i], rx_height / receivers);
+ gtk_fixed_move(GTK_FIXED(fixed), receiver[i]->panel, 0, y);
+ receiver[i]->x = 0;
+ receiver[i]->y = y;
+ y += rx_height / receivers;
}
- if(display_zoompan) {
- if(zoompan==NULL) {
- zoompan = zoompan_init(display_width,ZOOMPAN_HEIGHT);
- gtk_fixed_put(GTK_FIXED(fixed),zoompan,0,y);
+ if (display_zoompan) {
+ if (zoompan == NULL) {
+ zoompan = zoompan_init(display_width, ZOOMPAN_HEIGHT);
+ gtk_fixed_put(GTK_FIXED(fixed), zoompan, 0, y);
} else {
- gtk_fixed_move(GTK_FIXED(fixed),zoompan,0,y);
+ gtk_fixed_move(GTK_FIXED(fixed), zoompan, 0, y);
}
gtk_widget_show_all(zoompan);
- y+=ZOOMPAN_HEIGHT;
+ y += ZOOMPAN_HEIGHT;
} else {
- if(zoompan!=NULL) {
- gtk_container_remove(GTK_CONTAINER(fixed),zoompan);
- zoompan=NULL;
+ if (zoompan != NULL) {
+ gtk_container_remove(GTK_CONTAINER(fixed), zoompan);
+ zoompan = NULL;
}
}
- if(display_sliders) {
- if(sliders==NULL) {
- sliders = sliders_init(display_width,SLIDERS_HEIGHT);
- gtk_fixed_put(GTK_FIXED(fixed),sliders,0,y);
+ if (display_sliders) {
+ if (sliders == NULL) {
+ sliders = sliders_init(display_width, SLIDERS_HEIGHT);
+ gtk_fixed_put(GTK_FIXED(fixed), sliders, 0, y);
} else {
- gtk_fixed_move(GTK_FIXED(fixed),sliders,0,y);
+ gtk_fixed_move(GTK_FIXED(fixed), sliders, 0, y);
}
- gtk_widget_show_all(sliders); // ... this shows both C25 and Alex ATT/Preamp sliders
- att_type_changed(); // ... and this hides the „wrong“ ones.
- y+=SLIDERS_HEIGHT;
+ gtk_widget_show_all(
+ sliders); // ... this shows both C25 and Alex ATT/Preamp sliders
+ att_type_changed(); // ... and this hides the „wrong“ ones.
+ y += SLIDERS_HEIGHT;
} else {
- if(sliders!=NULL) {
- gtk_container_remove(GTK_CONTAINER(fixed),sliders);
- sliders=NULL;
+ if (sliders != NULL) {
+ gtk_container_remove(GTK_CONTAINER(fixed), sliders);
+ sliders = NULL;
}
}
- if(display_toolbar) {
- if(toolbar==NULL) {
- toolbar = toolbar_init(display_width,TOOLBAR_HEIGHT,top_window);
- gtk_fixed_put(GTK_FIXED(fixed),toolbar,0,y);
+ if (display_toolbar) {
+ if (toolbar == NULL) {
+ toolbar = toolbar_init(display_width, TOOLBAR_HEIGHT, top_window);
+ gtk_fixed_put(GTK_FIXED(fixed), toolbar, 0, y);
} else {
- gtk_fixed_move(GTK_FIXED(fixed),toolbar,0,y);
+ gtk_fixed_move(GTK_FIXED(fixed), toolbar, 0, y);
}
gtk_widget_show_all(toolbar);
} else {
- if(toolbar!=NULL) {
- gtk_container_remove(GTK_CONTAINER(fixed),toolbar);
- toolbar=NULL;
+ if (toolbar != NULL) {
+ gtk_container_remove(GTK_CONTAINER(fixed), toolbar);
+ toolbar = NULL;
}
}
- if(can_transmit) {
- if(!duplex) {
- reconfigure_transmitter(transmitter,display_width,rx_height);
+ if (can_transmit) {
+ if (!duplex) {
+ reconfigure_transmitter(transmitter, display_width, rx_height);
}
}
}
static gboolean save_cb(gpointer data) {
- radioSaveState();
- return TRUE;
+ radioSaveState();
+ return TRUE;
}
-static gboolean minimize_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+static gboolean minimize_cb(GtkWidget *widget, GdkEventButton *event,
+ gpointer data) {
gtk_window_iconify(GTK_WINDOW(top_window));
return TRUE;
}
-static gboolean menu_cb (GtkWidget *widget, GdkEventButton *event, gpointer data) {
+static gboolean menu_cb(GtkWidget *widget, GdkEventButton *event,
+ gpointer data) {
new_menu();
return TRUE;
}
static void create_visual() {
- int y=0;
+ int y = 0;
- fixed=gtk_fixed_new();
- g_object_ref(grid); // so it does not get deleted
- gtk_container_remove(GTK_CONTAINER(top_window),grid);
+ fixed = gtk_fixed_new();
+ g_object_ref(grid); // so it does not get deleted
+ gtk_container_remove(GTK_CONTAINER(top_window), grid);
gtk_container_add(GTK_CONTAINER(top_window), fixed);
-//g_print("radio: vfo_init\n");
- vfo_panel = vfo_init(VFO_WIDTH,VFO_HEIGHT,top_window);
- gtk_fixed_put(GTK_FIXED(fixed),vfo_panel,0,y);
+ // g_print("radio: vfo_init\n");
+ vfo_panel = vfo_init(VFO_WIDTH, VFO_HEIGHT, top_window);
+ gtk_fixed_put(GTK_FIXED(fixed), vfo_panel, 0, y);
-//g_print("radio: meter_init\n");
- meter = meter_init(METER_WIDTH,METER_HEIGHT,top_window);
- gtk_fixed_put(GTK_FIXED(fixed),meter,VFO_WIDTH,y);
+ // g_print("radio: meter_init\n");
+ meter = meter_init(METER_WIDTH, METER_HEIGHT, top_window);
+ gtk_fixed_put(GTK_FIXED(fixed), meter, VFO_WIDTH, y);
+ GtkWidget *minimize_b = gtk_button_new_with_label("Hide");
+ gtk_widget_override_font(
+ minimize_b, pango_font_description_from_string("FreeSans Bold 8"));
+ gtk_widget_set_size_request(minimize_b, MENU_WIDTH, MENU_HEIGHT);
+ g_signal_connect(minimize_b, "button-press-event", G_CALLBACK(minimize_cb),
+ NULL);
+ gtk_fixed_put(GTK_FIXED(fixed), minimize_b, VFO_WIDTH + METER_WIDTH, y);
+ y += MENU_HEIGHT;
- GtkWidget *minimize_b=gtk_button_new_with_label("Hide");
- gtk_widget_override_font(minimize_b, pango_font_description_from_string("FreeSans Bold 8"));
- gtk_widget_set_size_request (minimize_b, MENU_WIDTH, MENU_HEIGHT);
- g_signal_connect (minimize_b, "button-press-event", G_CALLBACK(minimize_cb), NULL) ;
- gtk_fixed_put(GTK_FIXED(fixed),minimize_b,VFO_WIDTH+METER_WIDTH,y);
- y+=MENU_HEIGHT;
+ GtkWidget *menu_b = gtk_button_new_with_label("Menu");
+ gtk_widget_override_font(
+ menu_b, pango_font_description_from_string("FreeSans Bold 8"));
+ gtk_widget_set_size_request(menu_b, MENU_WIDTH, MENU_HEIGHT);
+ g_signal_connect(menu_b, "button-press-event", G_CALLBACK(menu_cb), NULL);
+ gtk_fixed_put(GTK_FIXED(fixed), menu_b, VFO_WIDTH + METER_WIDTH, y);
+ y += MENU_HEIGHT;
- GtkWidget *menu_b=gtk_button_new_with_label("Menu");
- gtk_widget_override_font(menu_b, pango_font_description_from_string("FreeSans Bold 8"));
- gtk_widget_set_size_request (menu_b, MENU_WIDTH, MENU_HEIGHT);
- g_signal_connect (menu_b, "button-press-event", G_CALLBACK(menu_cb), NULL) ;
- gtk_fixed_put(GTK_FIXED(fixed),menu_b,VFO_WIDTH+METER_WIDTH,y);
- y+=MENU_HEIGHT;
+ // edit
+ GdkColor color_bg;
+ gdk_color_parse("black", &color_bg);
+ gtk_widget_modify_bg(GTK_WIDGET(minimize_b), GTK_STATE_NORMAL, &color_bg);
+ gtk_widget_modify_bg(GTK_WIDGET(menu_b), GTK_STATE_NORMAL, &color_bg);
+ gtk_button_set_relief(GTK_BUTTON(minimize_b), GTK_RELIEF_NONE);
+ gtk_button_set_relief(GTK_BUTTON(menu_b), GTK_RELIEF_NONE);
+ // edit
- rx_height=display_height-VFO_HEIGHT;
- if(display_zoompan) {
- rx_height-=ZOOMPAN_HEIGHT;
+ rx_height = display_height - VFO_HEIGHT;
+ if (display_zoompan) {
+ rx_height -= ZOOMPAN_HEIGHT;
}
- if(display_sliders) {
- rx_height-=SLIDERS_HEIGHT;
+ if (display_sliders) {
+ rx_height -= SLIDERS_HEIGHT;
}
- if(display_toolbar) {
- rx_height-=TOOLBAR_HEIGHT;
+ if (display_toolbar) {
+ rx_height -= TOOLBAR_HEIGHT;
}
//
// To be on the safe side, we create ALL receiver panels here
// If upon startup, we only should display one panel, we do the switch below
//
- for(int i=0;i<RECEIVERS;i++) {
+ for (int i = 0; i < RECEIVERS; i++) {
#ifdef CLIENT_SERVER
- if(radio_is_remote) {
+ if (radio_is_remote) {
receiver_create_remote(receiver[i]);
} else {
#endif
- receiver[i]=create_receiver(i, buffer_size, fft_size, display_width, updates_per_second, display_width, rx_height/RECEIVERS);
+ receiver[i] = create_receiver(i, buffer_size, fft_size, display_width,
+ updates_per_second, display_width,
+ rx_height / RECEIVERS);
setSquelch(receiver[i]);
#ifdef CLIENT_SERVER
}
#endif
- receiver[i]->x=0;
- receiver[i]->y=y;
+ receiver[i]->x = 0;
+ receiver[i]->y = y;
// Upon startup, if RIT or CTUN is active, tell WDSP.
#ifdef CLIENT_SERVER
- if(!radio_is_remote) {
+ if (!radio_is_remote) {
#endif
- set_displaying(receiver[i],1);
- set_offset(receiver[i],vfo[i].offset);
+ set_displaying(receiver[i], 1);
+ set_offset(receiver[i], vfo[i].offset);
#ifdef CLIENT_SERVER
}
#endif
- gtk_fixed_put(GTK_FIXED(fixed),receiver[i]->panel,0,y);
+ gtk_fixed_put(GTK_FIXED(fixed), receiver[i]->panel, 0, y);
g_object_ref((gpointer)receiver[i]->panel);
- y+=rx_height/RECEIVERS;
+ y += rx_height / RECEIVERS;
}
-
+
//
// Sanity check: in old protocol, all receivers must have the same sample rate
//
- if((protocol==ORIGINAL_PROTOCOL) && (RECEIVERS==2) && (receiver[0]->sample_rate!=receiver[1]->sample_rate)) {
- receiver[1]->sample_rate=receiver[0]->sample_rate;
+ if ((protocol == ORIGINAL_PROTOCOL) && (RECEIVERS == 2) &&
+ (receiver[0]->sample_rate != receiver[1]->sample_rate)) {
+ receiver[1]->sample_rate = receiver[0]->sample_rate;
}
- active_receiver=receiver[0];
+ active_receiver = receiver[0];
// TEMP
#ifdef CLIENT_SERVER
-if(!radio_is_remote) {
-#endif
- //g_print("Create transmitter\n");
- if(can_transmit) {
- double pk;
- if(duplex) {
- transmitter=create_transmitter(CHANNEL_TX, buffer_size, fft_size, updates_per_second, display_width/4, display_height/2);
- } else {
- int tx_height=display_height-VFO_HEIGHT;
- if(display_zoompan) tx_height-=ZOOMPAN_HEIGHT;
- if(display_sliders) tx_height-=SLIDERS_HEIGHT;
- if(display_toolbar) tx_height-=TOOLBAR_HEIGHT;
- transmitter=create_transmitter(CHANNEL_TX, buffer_size, fft_size, updates_per_second, display_width, tx_height);
- }
- transmitter->x=0;
- transmitter->y=VFO_HEIGHT;
+ if (!radio_is_remote) {
+#endif
+ // g_print("Create transmitter\n");
+ if (can_transmit) {
+ double pk;
+ if (duplex) {
+ transmitter = create_transmitter(CHANNEL_TX, buffer_size, fft_size,
+ updates_per_second, display_width / 4,
+ display_height / 2);
+ } else {
+ int tx_height = display_height - VFO_HEIGHT;
+ if (display_zoompan)
+ tx_height -= ZOOMPAN_HEIGHT;
+ if (display_sliders)
+ tx_height -= SLIDERS_HEIGHT;
+ if (display_toolbar)
+ tx_height -= TOOLBAR_HEIGHT;
+ transmitter =
+ create_transmitter(CHANNEL_TX, buffer_size, fft_size,
+ updates_per_second, display_width, tx_height);
+ }
+ transmitter->x = 0;
+ transmitter->y = VFO_HEIGHT;
- calcDriveLevel();
+ calcDriveLevel();
#ifdef PURESIGNAL
- if(protocol==NEW_PROTOCOL || protocol==ORIGINAL_PROTOCOL) {
- tx_set_ps_sample_rate(transmitter,protocol==NEW_PROTOCOL?192000:active_receiver->sample_rate);
- receiver[PS_TX_FEEDBACK]=create_pure_signal_receiver(PS_TX_FEEDBACK, buffer_size,protocol==ORIGINAL_PROTOCOL?active_receiver->sample_rate:192000,display_width);
- receiver[PS_RX_FEEDBACK]=create_pure_signal_receiver(PS_RX_FEEDBACK, buffer_size,protocol==ORIGINAL_PROTOCOL?active_receiver->sample_rate:192000,display_width);
- switch (protocol) {
+ if (protocol == NEW_PROTOCOL || protocol == ORIGINAL_PROTOCOL) {
+ tx_set_ps_sample_rate(transmitter, protocol == NEW_PROTOCOL
+ ? 192000
+ : active_receiver->sample_rate);
+ receiver[PS_TX_FEEDBACK] = create_pure_signal_receiver(
+ PS_TX_FEEDBACK, buffer_size,
+ protocol == ORIGINAL_PROTOCOL ? active_receiver->sample_rate
+ : 192000,
+ display_width);
+ receiver[PS_RX_FEEDBACK] = create_pure_signal_receiver(
+ PS_RX_FEEDBACK, buffer_size,
+ protocol == ORIGINAL_PROTOCOL ? active_receiver->sample_rate
+ : 192000,
+ display_width);
+ switch (protocol) {
case NEW_PROTOCOL:
pk = 0.2899;
break;
case ORIGINAL_PROTOCOL:
switch (device) {
- case DEVICE_HERMES_LITE2:
- pk = 0.2300;
- break;
- default:
- pk = 0.4067;
- break;
+ case DEVICE_HERMES_LITE2:
+ pk = 0.2300;
+ break;
+ default:
+ pk = 0.4067;
+ break;
}
+ }
+ SetPSHWPeak(transmitter->id, pk);
}
- SetPSHWPeak(transmitter->id, pk);
- }
#endif
-
- }
+ }
#ifdef CLIENT_SERVER
-}
+ }
#endif
#ifdef AUDIO_WATERFALL
- audio_waterfall=audio_waterfall_init(200,100);
- gtk_fixed_put(GTK_FIXED(fixed),audio_waterfall,0,VFO_HEIGHT+20);
+ audio_waterfall = audio_waterfall_init(200, 100);
+ gtk_fixed_put(GTK_FIXED(fixed), audio_waterfall, 0, VFO_HEIGHT + 20);
#endif
- gboolean init_gpio=FALSE;
+ gboolean init_gpio = FALSE;
#ifdef LOCALCW
- init_gpio=TRUE;
+ init_gpio = TRUE;
#endif
#ifdef PTT
- init_gpio=TRUE;
+ init_gpio = TRUE;
#endif
#ifdef GPIO
- init_gpio=TRUE;
+ init_gpio = TRUE;
#endif
- if(init_gpio) {
+ if (init_gpio) {
#ifdef GPIO
- if(gpio_init()<0) {
+ if (gpio_init() < 0) {
g_print("GPIO failed to initialize\n");
}
#endif
#ifdef LOCALCW
// init local keyer if enabled
if (cw_keyer_internal == 0) {
- g_print("Initialize keyer.....\n");
+ g_print("Initialize keyer.....\n");
keyer_update();
}
#endif
-
+
#ifdef CLIENT_SERVER
- if(!radio_is_remote) {
+ if (!radio_is_remote) {
#endif
- switch(protocol) {
+ switch (protocol) {
case ORIGINAL_PROTOCOL:
- old_protocol_init(0,display_width,receiver[0]->sample_rate);
+ old_protocol_init(0, display_width, receiver[0]->sample_rate);
break;
case NEW_PROTOCOL:
new_protocol_init(display_width);
soapy_protocol_init(FALSE);
break;
#endif
- }
+ }
#ifdef CLIENT_SERVER
}
#endif
- if(display_zoompan) {
- zoompan = zoompan_init(display_width,ZOOMPAN_HEIGHT);
- gtk_fixed_put(GTK_FIXED(fixed),zoompan,0,y);
- y+=ZOOMPAN_HEIGHT;
+ if (display_zoompan) {
+ zoompan = zoompan_init(display_width, ZOOMPAN_HEIGHT);
+ gtk_fixed_put(GTK_FIXED(fixed), zoompan, 0, y);
+ y += ZOOMPAN_HEIGHT;
}
- if(display_sliders) {
-//g_print("create sliders\n");
- sliders = sliders_init(display_width,SLIDERS_HEIGHT);
- gtk_fixed_put(GTK_FIXED(fixed),sliders,0,y);
- y+=SLIDERS_HEIGHT;
+ if (display_sliders) {
+ // g_print("create sliders\n");
+ sliders = sliders_init(display_width, SLIDERS_HEIGHT);
+ gtk_fixed_put(GTK_FIXED(fixed), sliders, 0, y);
+ y += SLIDERS_HEIGHT;
}
-
- if(display_toolbar) {
- toolbar = toolbar_init(display_width,TOOLBAR_HEIGHT,top_window);
- gtk_fixed_put(GTK_FIXED(fixed),toolbar,0,y);
- y+=TOOLBAR_HEIGHT;
+ if (display_toolbar) {
+ toolbar = toolbar_init(display_width, TOOLBAR_HEIGHT, top_window);
+ gtk_fixed_put(GTK_FIXED(fixed), toolbar, 0, y);
+ y += TOOLBAR_HEIGHT;
}
-g_print("create_visual: receivers=%d RECEIVERS=%d\n",receivers,RECEIVERS);
+ g_print("create_visual: receivers=%d RECEIVERS=%d\n", receivers, RECEIVERS);
if (receivers != RECEIVERS) {
- int r=receivers;
- receivers=RECEIVERS;
-g_print("create_visual: calling radio_change_receivers: receivers=%d r=%d\n",receivers,r);
+ int r = receivers;
+ receivers = RECEIVERS;
+ g_print(
+ "create_visual: calling radio_change_receivers: receivers=%d r=%d\n",
+ receivers, r);
radio_change_receivers(r);
}
- //gtk_widget_show_all (fixed);
- gtk_widget_show_all (top_window);
-
+ // gtk_widget_show_all (fixed);
+ gtk_widget_show_all(top_window);
}
-
+
void start_radio() {
int i;
int y;
-//g_print("start_radio: selected radio=%p device=%d\n",radio,radio->device);
- gdk_window_set_cursor(gtk_widget_get_window(top_window),gdk_cursor_new(GDK_WATCH));
+ // g_print("start_radio: selected radio=%p device=%d\n",radio,radio->device);
+ gdk_window_set_cursor(gtk_widget_get_window(top_window),
+ gdk_cursor_new(GDK_WATCH));
int rc;
- protocol=radio->protocol;
- device=radio->device;
+ protocol = radio->protocol;
+ device = radio->device;
// set the default power output and max drive value
- drive_max=100.0;
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- switch(device) {
- case DEVICE_METIS:
- pa_power=PA_1W;
- break;
- case DEVICE_HERMES:
- pa_power=PA_100W;
- break;
- case DEVICE_GRIFFIN:
- pa_power=PA_100W;
- break;
- case DEVICE_ANGELIA:
- pa_power=PA_100W;
- break;
- case DEVICE_ORION:
- pa_power=PA_100W;
- break;
- case DEVICE_HERMES_LITE:
- pa_power=PA_1W;
- break;
- case DEVICE_HERMES_LITE2:
- pa_power=PA_10W;
- break;
- case DEVICE_ORION2:
- pa_power=PA_200W;
- break;
- case DEVICE_STEMLAB:
- pa_power=PA_100W;
- break;
- }
+ drive_max = 100.0;
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ switch (device) {
+ case DEVICE_METIS:
+ pa_power = PA_1W;
break;
- case NEW_PROTOCOL:
- switch(device) {
- case NEW_DEVICE_ATLAS:
- pa_power=PA_1W;
- break;
- case NEW_DEVICE_HERMES:
- case NEW_DEVICE_HERMES2:
- pa_power=PA_100W;
- break;
- case NEW_DEVICE_ANGELIA:
- pa_power=PA_100W;
- break;
- case NEW_DEVICE_ORION:
- pa_power=PA_100W;
- break;
- case NEW_DEVICE_HERMES_LITE:
- pa_power=PA_1W;
- break;
- case NEW_DEVICE_HERMES_LITE2:
- pa_power=PA_10W;
- break;
- case NEW_DEVICE_ORION2:
- pa_power=PA_200W;
- break;
- case DEVICE_STEMLAB:
- pa_power=PA_100W;
- break;
- }
+ case DEVICE_HERMES:
+ pa_power = PA_100W;
break;
-#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- if(strcmp(radio->name,"lime")==0) {
- drive_max=64.0;
- } else if(strcmp(radio->name,"plutosdr")==0) {
- drive_max=89.0;
- }
- pa_power=PA_1W;
+ case DEVICE_GRIFFIN:
+ pa_power = PA_100W;
break;
-#endif
- }
-
- switch(pa_power) {
- case PA_1W:
- for(i=0;i<11;i++) {
- pa_trim[i]=i*100;
- }
+ case DEVICE_ANGELIA:
+ pa_power = PA_100W;
break;
- case PA_10W:
- for(i=0;i<11;i++) {
- pa_trim[i]=i;
- }
+ case DEVICE_ORION:
+ pa_power = PA_100W;
break;
- case PA_30W:
- for(i=0;i<11;i++) {
- pa_trim[i]=i*3;
- }
+ case DEVICE_HERMES_LITE:
+ pa_power = PA_1W;
break;
- case PA_50W:
- for(i=0;i<11;i++) {
- pa_trim[i]=i*5;
- }
+ case DEVICE_HERMES_LITE2:
+ pa_power = PA_10W;
break;
- case PA_100W:
- for(i=0;i<11;i++) {
- pa_trim[i]=i*10;
- }
+ case DEVICE_ORION2:
+ pa_power = PA_200W;
break;
- case PA_200W:
- for(i=0;i<11;i++) {
- pa_trim[i]=i*20;
- }
+ case DEVICE_STEMLAB:
+ pa_power = PA_100W;
break;
- case PA_500W:
- for(i=0;i<11;i++) {
- pa_trim[i]=i*50;
- }
+ }
+ break;
+ case NEW_PROTOCOL:
+ switch (device) {
+ case NEW_DEVICE_ATLAS:
+ pa_power = PA_1W;
+ break;
+ case NEW_DEVICE_HERMES:
+ case NEW_DEVICE_HERMES2:
+ pa_power = PA_100W;
+ break;
+ case NEW_DEVICE_ANGELIA:
+ pa_power = PA_100W;
+ break;
+ case NEW_DEVICE_ORION:
+ pa_power = PA_100W;
break;
+ case NEW_DEVICE_HERMES_LITE:
+ pa_power = PA_1W;
+ break;
+ case NEW_DEVICE_HERMES_LITE2:
+ pa_power = PA_10W;
+ break;
+ case NEW_DEVICE_ORION2:
+ pa_power = PA_200W;
+ break;
+ case DEVICE_STEMLAB:
+ pa_power = PA_100W;
+ break;
+ }
+ break;
+#ifdef SOAPYSDR
+ case SOAPYSDR_PROTOCOL:
+ if (strcmp(radio->name, "lime") == 0) {
+ drive_max = 64.0;
+ } else if (strcmp(radio->name, "plutosdr") == 0) {
+ drive_max = 89.0;
+ }
+ pa_power = PA_1W;
+ break;
+#endif
+ }
+
+ switch (pa_power) {
+ case PA_1W:
+ for (i = 0; i < 11; i++) {
+ pa_trim[i] = i * 100;
+ }
+ break;
+ case PA_10W:
+ for (i = 0; i < 11; i++) {
+ pa_trim[i] = i;
+ }
+ break;
+ case PA_30W:
+ for (i = 0; i < 11; i++) {
+ pa_trim[i] = i * 3;
+ }
+ break;
+ case PA_50W:
+ for (i = 0; i < 11; i++) {
+ pa_trim[i] = i * 5;
+ }
+ break;
+ case PA_100W:
+ for (i = 0; i < 11; i++) {
+ pa_trim[i] = i * 10;
+ }
+ break;
+ case PA_200W:
+ for (i = 0; i < 11; i++) {
+ pa_trim[i] = i * 20;
+ }
+ break;
+ case PA_500W:
+ for (i = 0; i < 11; i++) {
+ pa_trim[i] = i * 50;
+ }
+ break;
}
//
// have_rx_gain determines whether we have "ATT" or "RX Gain" Sliders
// It is set for HermesLite (and RadioBerry, for that matter)
//
- have_rx_gain=0;
+ have_rx_gain = 0;
switch (protocol) {
- case ORIGINAL_PROTOCOL:
- switch (device) {
- case DEVICE_HERMES_LITE:
- case DEVICE_HERMES_LITE2:
- have_rx_gain=1;
- rx_gain_calibration=14;
- break;
- default:
- have_rx_gain=0;
- rx_gain_calibration=0;
- break;
- }
- break;
- case NEW_PROTOCOL:
- switch (device) {
- case NEW_DEVICE_HERMES_LITE:
- case NEW_DEVICE_HERMES_LITE2:
- have_rx_gain=1;
- rx_gain_calibration=14;
- break;
- default:
- have_rx_gain=0;
- rx_gain_calibration=0;
- break;
- }
- break;
+ case ORIGINAL_PROTOCOL:
+ switch (device) {
+ case DEVICE_HERMES_LITE:
+ case DEVICE_HERMES_LITE2:
+ have_rx_gain = 1;
+ rx_gain_calibration = 14;
+ break;
+ default:
+ have_rx_gain = 0;
+ rx_gain_calibration = 0;
+ break;
+ }
+ break;
+ case NEW_PROTOCOL:
+ switch (device) {
+ case NEW_DEVICE_HERMES_LITE:
+ case NEW_DEVICE_HERMES_LITE2:
+ have_rx_gain = 1;
+ rx_gain_calibration = 14;
+ break;
+ default:
+ have_rx_gain = 0;
+ rx_gain_calibration = 0;
+ break;
+ }
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- have_rx_gain=1;
- rx_gain_calibration=10;
- break;
+ case SOAPYSDR_PROTOCOL:
+ have_rx_gain = 1;
+ rx_gain_calibration = 10;
+ break;
#endif
- default:
- have_rx_gain=0;
- break;
+ default:
+ have_rx_gain = 0;
+ break;
}
//
// can_transmit decides whether we have a transmitter.
//
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- case NEW_PROTOCOL:
- can_transmit=1;
- break;
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ case NEW_PROTOCOL:
+ can_transmit = 1;
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- can_transmit=(radio->info.soapy.tx_channels!=0);
- g_print("start_radio: can_transmit=%d tx_channels=%d\n",can_transmit,(int)radio->info.soapy.tx_channels);
- break;
+ case SOAPYSDR_PROTOCOL:
+ can_transmit = (radio->info.soapy.tx_channels != 0);
+ g_print("start_radio: can_transmit=%d tx_channels=%d\n", can_transmit,
+ (int)radio->info.soapy.tx_channels);
+ break;
#endif
}
-//
-// A semaphore for safely writing to the props file
-//
+ //
+ // A semaphore for safely writing to the props file
+ //
g_mutex_init(&property_mutex);
-//
-// Create text for the top line of the piHPSDR window
-//
- char text[1024];
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- case NEW_PROTOCOL:
-#ifdef USBOZY
- if(device==DEVICE_OZY) {
- sprintf(text,"%s (%s) on USB /dev/ozy\n", radio->name, protocol==ORIGINAL_PROTOCOL?"Protocol 1":"Protocol 2");
- } else {
-#endif
- sprintf(text,"Starting %s (%s v%d.%d)",
- radio->name,
- protocol==ORIGINAL_PROTOCOL?"Protocol 1":"Protocol 2",
- radio->software_version/10,
- radio->software_version%10);
+ //
+ // Create text for the top line of the piHPSDR window
+ //
+ char text[1024];
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ case NEW_PROTOCOL:
#ifdef USBOZY
- }
+ if (device == DEVICE_OZY) {
+ sprintf(text, "%s (%s) on USB /dev/ozy\n", radio->name,
+ protocol == ORIGINAL_PROTOCOL ? "Protocol 1" : "Protocol 2");
+ } else {
#endif
- break;
+ sprintf(text, "Starting %s (%s v%d.%d)", radio->name,
+ protocol == ORIGINAL_PROTOCOL ? "Protocol 1" : "Protocol 2",
+ radio->software_version / 10, radio->software_version % 10);
+#ifdef USBOZY
}
-
+#endif
+ break;
+ }
char p[32];
char version[32];
char ip[32];
char iface[64];
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- strcpy(p,"Protocol 1");
- sprintf(version,"v%d.%d)",
- radio->software_version/10,
- radio->software_version%10);
- sprintf(mac,"%02X:%02X:%02X:%02X:%02X:%02X",
- radio->info.network.mac_address[0],
- radio->info.network.mac_address[1],
- radio->info.network.mac_address[2],
- radio->info.network.mac_address[3],
- radio->info.network.mac_address[4],
- radio->info.network.mac_address[5]);
- sprintf(ip,"%s", inet_ntoa(radio->info.network.address.sin_addr));
- sprintf(iface,"%s", radio->info.network.interface_name);
- break;
- case NEW_PROTOCOL:
- strcpy(p,"Protocol 2");
- sprintf(version,"v%d.%d)",
- radio->software_version/10,
- radio->software_version%10);
- sprintf(mac,"%02X:%02X:%02X:%02X:%02X:%02X",
- radio->info.network.mac_address[0],
- radio->info.network.mac_address[1],
- radio->info.network.mac_address[2],
- radio->info.network.mac_address[3],
- radio->info.network.mac_address[4],
- radio->info.network.mac_address[5]);
- sprintf(ip,"%s", inet_ntoa(radio->info.network.address.sin_addr));
- sprintf(iface,"%s", radio->info.network.interface_name);
- break;
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ strcpy(p, "Protocol 1");
+ sprintf(version, "v%d.%d)", radio->software_version / 10,
+ radio->software_version % 10);
+ sprintf(
+ mac, "%02X:%02X:%02X:%02X:%02X:%02X",
+ radio->info.network.mac_address[0], radio->info.network.mac_address[1],
+ radio->info.network.mac_address[2], radio->info.network.mac_address[3],
+ radio->info.network.mac_address[4], radio->info.network.mac_address[5]);
+ sprintf(ip, "%s", inet_ntoa(radio->info.network.address.sin_addr));
+ sprintf(iface, "%s", radio->info.network.interface_name);
+ break;
+ case NEW_PROTOCOL:
+ strcpy(p, "Protocol 2");
+ sprintf(version, "v%d.%d)", radio->software_version / 10,
+ radio->software_version % 10);
+ sprintf(
+ mac, "%02X:%02X:%02X:%02X:%02X:%02X",
+ radio->info.network.mac_address[0], radio->info.network.mac_address[1],
+ radio->info.network.mac_address[2], radio->info.network.mac_address[3],
+ radio->info.network.mac_address[4], radio->info.network.mac_address[5]);
+ sprintf(ip, "%s", inet_ntoa(radio->info.network.address.sin_addr));
+ sprintf(iface, "%s", radio->info.network.interface_name);
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- strcpy(p,"SoapySDR");
- sprintf(version,"v%d.%d.%d)",
- radio->software_version/100,
- (radio->software_version%100)/10,
- radio->software_version%10);
- strcpy(mac,"");
- strcpy(ip,"");
- strcpy(iface,"");
- break;
+ case SOAPYSDR_PROTOCOL:
+ strcpy(p, "SoapySDR");
+ sprintf(version, "v%d.%d.%d)", radio->software_version / 100,
+ (radio->software_version % 100) / 10, radio->software_version % 10);
+ strcpy(mac, "");
+ strcpy(ip, "");
+ strcpy(iface, "");
+ break;
#endif
}
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- case NEW_PROTOCOL:
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ case NEW_PROTOCOL:
#ifdef USBOZY
- if(device==DEVICE_OZY) {
- sprintf(text,"%s (%s) on USB /dev/ozy\n", radio->name, p);
- } else {
+ if (device == DEVICE_OZY) {
+ sprintf(text, "%s (%s) on USB /dev/ozy\n", radio->name, p);
+ } else {
#endif
- sprintf(text,"Starting %s (%s %s)",
- radio->name,
- p,
- version);
+ sprintf(text, "Starting %s (%s %s)", radio->name, p, version);
#ifdef USBOZY
- }
+ }
#endif
- break;
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- sprintf(text,"Starting %s (%s %s)",
- radio->name,
- "SoapySDR",
- version);
- break;
+ case SOAPYSDR_PROTOCOL:
+ sprintf(text, "Starting %s (%s %s)", radio->name, "SoapySDR", version);
+ break;
#endif
- }
+ }
status_text(text);
- sprintf(text,"piHPSDR: %s (%s %s) %s (%s) on %s",
- radio->name,
- p,
- version,
- ip,
- mac,
- iface);
+ sprintf(text, "piHPSDR: %s (%s %s) %s (%s) on %s", radio->name, p, version,
+ ip, mac, iface);
- gtk_window_set_title (GTK_WINDOW (top_window), text);
+ gtk_window_set_title(GTK_WINDOW(top_window), text);
-//
-// determine name of the props file
-//
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- case NEW_PROTOCOL:
- switch(device) {
+ //
+ // determine name of the props file
+ //
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ case NEW_PROTOCOL:
+ switch (device) {
#ifdef USBOZY
- case DEVICE_OZY:
- sprintf(property_path,"ozy.props");
- break;
+ case DEVICE_OZY:
+ sprintf(property_path, "ozy.props");
+ break;
#endif
- default:
- sprintf(property_path,"%02X-%02X-%02X-%02X-%02X-%02X.props",
- radio->info.network.mac_address[0],
- radio->info.network.mac_address[1],
- radio->info.network.mac_address[2],
- radio->info.network.mac_address[3],
- radio->info.network.mac_address[4],
- radio->info.network.mac_address[5]);
- break;
- }
+ default:
+ sprintf(property_path, "%02X-%02X-%02X-%02X-%02X-%02X.props",
+ radio->info.network.mac_address[0],
+ radio->info.network.mac_address[1],
+ radio->info.network.mac_address[2],
+ radio->info.network.mac_address[3],
+ radio->info.network.mac_address[4],
+ radio->info.network.mac_address[5]);
break;
+ }
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- sprintf(property_path,"%s.props",radio->name);
- break;
+ case SOAPYSDR_PROTOCOL:
+ sprintf(property_path, "%s.props", radio->name);
+ break;
#endif
}
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- switch(device) {
- case DEVICE_ORION2:
- //meter_calibration=3.0;
- //display_calibration=3.36;
- break;
- default:
- //meter_calibration=-2.44;
- //display_calibration=-2.1;
- break;
- }
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ switch (device) {
+ case DEVICE_ORION2:
+ // meter_calibration=3.0;
+ // display_calibration=3.36;
break;
- case NEW_PROTOCOL:
- switch(device) {
- case NEW_DEVICE_ORION2:
- //meter_calibration=3.0;
- //display_calibration=3.36;
- break;
- default:
- //meter_calibration=-2.44;
- //display_calibration=-2.1;
- break;
- }
+ default:
+ // meter_calibration=-2.44;
+ // display_calibration=-2.1;
+ break;
+ }
+ break;
+ case NEW_PROTOCOL:
+ switch (device) {
+ case NEW_DEVICE_ORION2:
+ // meter_calibration=3.0;
+ // display_calibration=3.36;
break;
+ default:
+ // meter_calibration=-2.44;
+ // display_calibration=-2.1;
+ break;
+ }
+ break;
}
-
+
//
// Determine number of ADCs in the device
//
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- switch(device) {
- case DEVICE_METIS: // No support for multiple MERCURY cards on a single ATLAS bus.
- case DEVICE_HERMES:
- case DEVICE_HERMES_LITE:
- case DEVICE_HERMES_LITE2:
- n_adc=1;
- break;
- default:
- n_adc=2;
- break;
- }
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ switch (device) {
+ case DEVICE_METIS: // No support for multiple MERCURY cards on a single
+ // ATLAS bus.
+ case DEVICE_HERMES:
+ case DEVICE_HERMES_LITE:
+ case DEVICE_HERMES_LITE2:
+ n_adc = 1;
break;
- case NEW_PROTOCOL:
- switch(device) {
- case NEW_DEVICE_ATLAS:
- n_adc=1; // No support for multiple MERCURY cards on a single ATLAS bus.
- break;
- case NEW_DEVICE_HERMES:
- case NEW_DEVICE_HERMES2:
- case NEW_DEVICE_HERMES_LITE:
- case NEW_DEVICE_HERMES_LITE2:
- n_adc=1;
- break;
- default:
- n_adc=2;
- break;
- }
+ default:
+ n_adc = 2;
break;
-#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- if(strcmp(radio->name,"lime")==0) {
- n_adc=2;
- } else {
- n_adc=1;
- }
+ }
+ break;
+ case NEW_PROTOCOL:
+ switch (device) {
+ case NEW_DEVICE_ATLAS:
+ n_adc = 1; // No support for multiple MERCURY cards on a single ATLAS bus.
+ break;
+ case NEW_DEVICE_HERMES:
+ case NEW_DEVICE_HERMES2:
+ case NEW_DEVICE_HERMES_LITE:
+ case NEW_DEVICE_HERMES_LITE2:
+ n_adc = 1;
break;
-#endif
default:
+ n_adc = 2;
break;
+ }
+ break;
+#ifdef SOAPYSDR
+ case SOAPYSDR_PROTOCOL:
+ if (strcmp(radio->name, "lime") == 0) {
+ n_adc = 2;
+ } else {
+ n_adc = 1;
+ }
+ break;
+#endif
+ default:
+ break;
}
- iqswap=0;
+ iqswap = 0;
#ifdef SOAPYSDR
- if(device==SOAPYSDR_USB_DEVICE) {
- iqswap=1;
- receivers=1;
- filter_board=NONE;
+ if (device == SOAPYSDR_USB_DEVICE) {
+ iqswap = 1;
+ receivers = 1;
+ filter_board = NONE;
}
#endif
adc_attenuation[1]=14;
}
*/
- adc[0].antenna=ANTENNA_1;
- adc[0].filters=AUTOMATIC;
- adc[0].hpf=HPF_13;
- adc[0].lpf=LPF_30_20;
- adc[0].dither=FALSE;
- adc[0].random=FALSE;
- adc[0].preamp=FALSE;
- if(have_rx_gain) {
- adc[0].attenuation=14;
+ adc[0].antenna = ANTENNA_1;
+ adc[0].filters = AUTOMATIC;
+ adc[0].hpf = HPF_13;
+ adc[0].lpf = LPF_30_20;
+ adc[0].dither = FALSE;
+ adc[0].random = FALSE;
+ adc[0].preamp = FALSE;
+ if (have_rx_gain) {
+ adc[0].attenuation = 14;
} else {
- adc[0].attenuation=0;
+ adc[0].attenuation = 0;
}
#ifdef SOAPYSDR
- adc[0].antenna=0;
- if(device==SOAPYSDR_USB_DEVICE) {
- adc[0].gain=0;
- if(radio->info.soapy.rx_gains>0) {
- adc[0].min_gain=radio->info.soapy.rx_range[0].minimum;
- adc[0].max_gain=radio->info.soapy.rx_range[0].maximum;;
+ adc[0].antenna = 0;
+ if (device == SOAPYSDR_USB_DEVICE) {
+ adc[0].gain = 0;
+ if (radio->info.soapy.rx_gains > 0) {
+ adc[0].min_gain = radio->info.soapy.rx_range[0].minimum;
+ adc[0].max_gain = radio->info.soapy.rx_range[0].maximum;
+ ;
} else {
- adc[0].min_gain=0.0;
- adc[0].max_gain=100.0;
+ adc[0].min_gain = 0.0;
+ adc[0].max_gain = 100.0;
}
- adc[0].agc=FALSE;
- dac[0].antenna=1;
- dac[0].gain=0;
+ adc[0].agc = FALSE;
+ dac[0].antenna = 1;
+ dac[0].gain = 0;
}
#endif
- adc[1].antenna=ANTENNA_1;
- adc[1].filters=AUTOMATIC;
- adc[1].hpf=HPF_9_5;
- adc[1].lpf=LPF_60_40;
- adc[1].dither=FALSE;
- adc[1].random=FALSE;
- adc[1].preamp=FALSE;
- if(have_rx_gain) {
- adc[0].attenuation=14;
+ adc[1].antenna = ANTENNA_1;
+ adc[1].filters = AUTOMATIC;
+ adc[1].hpf = HPF_9_5;
+ adc[1].lpf = LPF_60_40;
+ adc[1].dither = FALSE;
+ adc[1].random = FALSE;
+ adc[1].preamp = FALSE;
+ if (have_rx_gain) {
+ adc[0].attenuation = 14;
} else {
- adc[1].attenuation=0;
+ adc[1].attenuation = 0;
}
#ifdef SOAPYSDR
- adc[1].antenna=0;
- if(device==SOAPYSDR_USB_DEVICE) {
- adc[1].gain=0;
- if(radio->info.soapy.rx_gains>0) {
- adc[1].min_gain=radio->info.soapy.rx_range[0].minimum;
- adc[1].max_gain=radio->info.soapy.rx_range[0].maximum;;
+ adc[1].antenna = 0;
+ if (device == SOAPYSDR_USB_DEVICE) {
+ adc[1].gain = 0;
+ if (radio->info.soapy.rx_gains > 0) {
+ adc[1].min_gain = radio->info.soapy.rx_range[0].minimum;
+ adc[1].max_gain = radio->info.soapy.rx_range[0].maximum;
+ ;
} else {
- adc[1].min_gain=0.0;
- adc[1].max_gain=100.0;
+ adc[1].min_gain = 0.0;
+ adc[1].max_gain = 100.0;
}
- adc[1].max_gain=0;
- adc[1].agc=FALSE;
- dac[1].antenna=1;
- dac[1].gain=0;
+ adc[1].max_gain = 0;
+ adc[1].agc = FALSE;
+ dac[1].antenna = 1;
+ dac[1].gain = 0;
}
- radio_sample_rate=radio->info.soapy.sample_rate;
+ radio_sample_rate = radio->info.soapy.sample_rate;
#endif
-//g_print("meter_calibration=%f display_calibration=%f\n", meter_calibration, display_calibration);
+ // g_print("meter_calibration=%f display_calibration=%f\n", meter_calibration,
+ // display_calibration);
#ifdef GPIO
- switch(controller) {
- case NO_CONTROLLER:
- display_zoompan=1;
- display_sliders=1;
- display_toolbar=1;
- break;
- case CONTROLLER2_V1:
- case CONTROLLER2_V2:
- display_zoompan=1;
- display_sliders=0;
- display_toolbar=0;
- break;
+ switch (controller) {
+ case NO_CONTROLLER:
+ display_zoompan = 1;
+ display_sliders = 1;
+ display_toolbar = 1;
+ break;
+ case CONTROLLER2_V1:
+ case CONTROLLER2_V2:
+ display_zoompan = 1;
+ display_sliders = 0;
+ display_toolbar = 0;
+ break;
}
#else
- display_zoompan=1;
- display_sliders=1;
- display_toolbar=1;
+ display_zoompan = 1;
+ display_sliders = 1;
+ display_toolbar = 1;
#endif
- temperature=0;
- average_temperature=0;
- n_temperature=0;
- current=0;
- average_current=0;
- n_current=0;
+ temperature = 0;
+ average_temperature = 0;
+ n_temperature = 0;
+ current = 0;
+ average_current = 0;
+ n_current = 0;
- display_sequence_errors=TRUE;
+ display_sequence_errors = TRUE;
- g_print("%s: setup RECEIVERS protocol=%d\n",__FUNCTION__,protocol);
- switch(protocol) {
+ g_print("%s: setup RECEIVERS protocol=%d\n", __FUNCTION__, protocol);
+ switch (protocol) {
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- g_print("%s: setup RECEIVERS SOAPYSDR\n",__FUNCTION__);
- RECEIVERS=1;
- MAX_RECEIVERS=RECEIVERS;
+ case SOAPYSDR_PROTOCOL:
+ g_print("%s: setup RECEIVERS SOAPYSDR\n", __FUNCTION__);
+ RECEIVERS = 1;
+ MAX_RECEIVERS = RECEIVERS;
#ifdef PURESIGNAL
- PS_TX_FEEDBACK=0;
- PS_RX_FEEDBACK=0;
+ PS_TX_FEEDBACK = 0;
+ PS_RX_FEEDBACK = 0;
#endif
- MAX_DDC=1;
- break;
+ MAX_DDC = 1;
+ break;
#endif
- default:
- g_print("%s: setup RECEIVERS default\n",__FUNCTION__);
- RECEIVERS=2;
+ default:
+ g_print("%s: setup RECEIVERS default\n", __FUNCTION__);
+ RECEIVERS = 2;
#ifdef PURESIGNAL
- MAX_RECEIVERS=(RECEIVERS+2);
- PS_TX_FEEDBACK=(RECEIVERS);
- PS_RX_FEEDBACK=(RECEIVERS+1);
+ MAX_RECEIVERS = (RECEIVERS + 2);
+ PS_TX_FEEDBACK = (RECEIVERS);
+ PS_RX_FEEDBACK = (RECEIVERS + 1);
#else
- MAX_RECEIVERS=RECEIVERS;
+ MAX_RECEIVERS = RECEIVERS;
#endif
- MAX_DDC=(RECEIVERS+2);
- break;
+ MAX_DDC = (RECEIVERS + 2);
+ break;
}
- receivers=RECEIVERS;
+ receivers = RECEIVERS;
radioRestoreState();
-//
-// It is possible that an option has been read in
-// which is not compatible with the hardware.
-// Change setting to reasonable value then.
-// This could possibly be moved to radioRestoreState().
-//
-// Sanity Check #1: restrict buffer size in new protocol
-//
+ //
+ // It is possible that an option has been read in
+ // which is not compatible with the hardware.
+ // Change setting to reasonable value then.
+ // This could possibly be moved to radioRestoreState().
+ //
+ // Sanity Check #1: restrict buffer size in new protocol
+ //
switch (protocol) {
- case ORIGINAL_PROTOCOL:
- if (buffer_size > 2048) buffer_size=2048;
- break;
- case NEW_PROTOCOL:
- if (buffer_size > 512) buffer_size=512;
- break;
+ case ORIGINAL_PROTOCOL:
+ if (buffer_size > 2048)
+ buffer_size = 2048;
+ break;
+ case NEW_PROTOCOL:
+ if (buffer_size > 512)
+ buffer_size = 512;
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- if (buffer_size > 2048) buffer_size=2048;
- break;
+ case SOAPYSDR_PROTOCOL:
+ if (buffer_size > 2048)
+ buffer_size = 2048;
+ break;
#endif
}
-//
-// Sanity Check #2: enable diversity only if there are two RX and two ADCs
-//
- if (RECEIVERS < 2 || n_adc < 2) {
- diversity_enabled=0;
- }
+ //
+ // Sanity Check #2: enable diversity only if there are two RX and two ADCs
+ //
+ if (RECEIVERS < 2 || n_adc < 2) {
+ diversity_enabled = 0;
+ }
radio_change_region(region);
create_visual();
// save every 30 seconds
- //save_timer_id=gdk_threads_add_timeout(30000, save_cb, NULL);
+ // save_timer_id=gdk_threads_add_timeout(30000, save_cb, NULL);
- if(rigctl_enable) {
+ if (rigctl_enable) {
launch_rigctl();
+ launch_serial(); // edit
}
- if(can_transmit) {
+ if (can_transmit) {
calcDriveLevel();
- if(transmitter->puresignal) {
- tx_set_ps(transmitter,transmitter->puresignal);
+ if (transmitter->puresignal) {
+ tx_set_ps(transmitter, transmitter->puresignal);
}
}
- if(protocol==NEW_PROTOCOL) {
+ if (protocol == NEW_PROTOCOL) {
schedule_high_priority();
}
#ifdef SOAPYSDR
- if(protocol==SOAPYSDR_PROTOCOL) {
- RECEIVER *rx=receiver[0];
+ if (protocol == SOAPYSDR_PROTOCOL) {
+ RECEIVER *rx = receiver[0];
soapy_protocol_create_receiver(rx);
- if(can_transmit) {
+ if (can_transmit) {
soapy_protocol_create_transmitter(transmitter);
- soapy_protocol_set_tx_antenna(transmitter,dac[0].antenna);
- soapy_protocol_set_tx_gain(transmitter,transmitter->drive);
+ soapy_protocol_set_tx_antenna(transmitter, dac[0].antenna);
+ soapy_protocol_set_tx_gain(transmitter, transmitter->drive);
soapy_protocol_set_tx_frequency(transmitter);
soapy_protocol_start_transmitter(transmitter);
}
- soapy_protocol_set_rx_antenna(rx,adc[0].antenna);
- soapy_protocol_set_rx_frequency(rx,VFO_A);
- soapy_protocol_set_automatic_gain(rx,adc[0].agc);
+ soapy_protocol_set_rx_antenna(rx, adc[0].antenna);
+ soapy_protocol_set_rx_frequency(rx, VFO_A);
+ soapy_protocol_set_automatic_gain(rx, adc[0].agc);
soapy_protocol_set_gain(rx);
- if(vfo[0].ctun) {
+ if (vfo[0].ctun) {
setFrequency(vfo[0].ctun_frequency);
}
soapy_protocol_start_receiver(rx);
-//g_print("radio: set rf_gain=%f\n",rx->rf_gain);
+ // g_print("radio: set rf_gain=%f\n",rx->rf_gain);
soapy_protocol_set_gain(rx);
-
}
#endif
- g_idle_add(ext_vfo_update,(gpointer)NULL);
+ g_idle_add(ext_vfo_update, (gpointer)NULL);
- gdk_window_set_cursor(gtk_widget_get_window(top_window),gdk_cursor_new(GDK_ARROW));
+ gdk_window_set_cursor(gtk_widget_get_window(top_window),
+ gdk_cursor_new(GDK_ARROW));
//
// MIDIstartup must not be called before the radio is completely set up, since
- // then MIDI can asynchronously trigger actions which require the radio already
- // running. So this is the last thing we do when starting the radio.
+ // then MIDI can asynchronously trigger actions which require the radio
+ // already running. So this is the last thing we do when starting the radio.
//
#ifdef MIDI
- g_print("%s: midi_enabled=%d midi_device_name=%s\n",__FUNCTION__,midi_enabled,midi_device_name);
- if(midi_enabled && (midi_device_name!=NULL)) {
- if(register_midi_device(midi_device_name)<0) {
- midi_enabled=FALSE;
+ g_print("%s: midi_enabled=%d midi_device_name=%s\n", __FUNCTION__,
+ midi_enabled, midi_device_name);
+ if (midi_enabled && (midi_device_name != NULL)) {
+ if (register_midi_device(midi_device_name) < 0) {
+ midi_enabled = FALSE;
}
} else {
- midi_enabled=FALSE;
+ midi_enabled = FALSE;
}
#endif
#ifdef CLIENT_SERVER
- if(hpsdr_server) {
+ if (hpsdr_server) {
create_hpsdr_server();
}
#endif
}
void disable_rigctl() {
- g_print("RIGCTL: disable_rigctl()\n");
- close_rigctl_ports();
+ g_print("RIGCTL: disable_rigctl()\n");
+ close_rigctl_ports();
}
-
void radio_change_receivers(int r) {
-g_print("radio_change_receivers: from %d to %d\n",receivers,r);
+ g_print("radio_change_receivers: from %d to %d\n", receivers, r);
// The button in the radio menu will call this function even if the
// number of receivers has not changed.
- if (receivers == r) return;
- //
- // When changing the number of receivers, restart the
- // old protocol
- //
+ if (receivers == r)
+ return;
+ //
+ // When changing the number of receivers, restart the
+ // old protocol
+ //
#ifdef CLIENT_SERVER
- if(!radio_is_remote) {
+ if (!radio_is_remote) {
#endif
if (protocol == ORIGINAL_PROTOCOL) {
old_protocol_stop();
#ifdef CLIENT_SERVER
}
#endif
- switch(r) {
- case 1:
- set_displaying(receiver[1],0);
- gtk_container_remove(GTK_CONTAINER(fixed),receiver[1]->panel);
- receivers=1;
- break;
- case 2:
- gtk_fixed_put(GTK_FIXED(fixed),receiver[1]->panel,0,0);
- set_displaying(receiver[1],1);
- receivers=2;
- break;
+ switch (r) {
+ case 1:
+ set_displaying(receiver[1], 0);
+ gtk_container_remove(GTK_CONTAINER(fixed), receiver[1]->panel);
+ receivers = 1;
+ break;
+ case 2:
+ gtk_fixed_put(GTK_FIXED(fixed), receiver[1]->panel, 0, 0);
+ set_displaying(receiver[1], 1);
+ receivers = 2;
+ break;
}
reconfigure_radio();
- active_receiver=receiver[0];
+ active_receiver = receiver[0];
#ifdef CLIENT_SERVER
- if(!radio_is_remote) {
+ if (!radio_is_remote) {
#endif
- if(protocol==NEW_PROTOCOL) {
+ if (protocol == NEW_PROTOCOL) {
schedule_high_priority();
}
if (protocol == ORIGINAL_PROTOCOL) {
void radio_change_sample_rate(int rate) {
int i;
-
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- // The radio menu calls this function even if the sample rate
- // has not changed. Do nothing in this case.
- if (receiver[0]->sample_rate != rate) {
- radio_sample_rate=rate;
- old_protocol_stop();
- for(i=0;i<receivers;i++) {
- receiver_change_sample_rate(receiver[i],rate);
- }
+
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ // The radio menu calls this function even if the sample rate
+ // has not changed. Do nothing in this case.
+ if (receiver[0]->sample_rate != rate) {
+ radio_sample_rate = rate;
+ old_protocol_stop();
+ for (i = 0; i < receivers; i++) {
+ receiver_change_sample_rate(receiver[i], rate);
+ }
#ifdef PURESIGNAL
- receiver_change_sample_rate(receiver[PS_RX_FEEDBACK],rate);
+ receiver_change_sample_rate(receiver[PS_RX_FEEDBACK], rate);
#endif
- old_protocol_set_mic_sample_rate(rate);
- old_protocol_run();
- tx_set_ps_sample_rate(transmitter,rate);
- }
- break;
+ old_protocol_set_mic_sample_rate(rate);
+ old_protocol_run();
+ tx_set_ps_sample_rate(transmitter, rate);
+ }
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- soapy_protocol_change_sample_rate(receiver[0]);
- soapy_protocol_set_mic_sample_rate(rate);
- break;
+ case SOAPYSDR_PROTOCOL:
+ soapy_protocol_change_sample_rate(receiver[0]);
+ soapy_protocol_set_mic_sample_rate(rate);
+ break;
#endif
}
}
static void rxtx(int state) {
int i;
- if(state) {
+ if (state) {
// switch to tx
#ifdef PURESIGNAL
- RECEIVER *rx_feedback=receiver[PS_RX_FEEDBACK];
- RECEIVER *tx_feedback=receiver[PS_TX_FEEDBACK];
+ RECEIVER *rx_feedback = receiver[PS_RX_FEEDBACK];
+ RECEIVER *tx_feedback = receiver[PS_TX_FEEDBACK];
- rx_feedback->samples=0;
- tx_feedback->samples=0;
+ rx_feedback->samples = 0;
+ tx_feedback->samples = 0;
#endif
- if(!duplex) {
- for(i=0;i<receivers;i++) {
+ if (!duplex) {
+ for (i = 0; i < receivers; i++) {
// Delivery of RX samples
// to WDSP via fexchange0() may come to an abrupt stop
// (especially with PURESIGNAL or DIVERSITY).
// Therefore, wait for *all* receivers to complete
// their slew-down before going TX.
- SetChannelState(receiver[i]->id,0,1);
- set_displaying(receiver[i],0);
+ SetChannelState(receiver[i]->id, 0, 1);
+ set_displaying(receiver[i], 0);
g_object_ref((gpointer)receiver[i]->panel);
g_object_ref((gpointer)receiver[i]->panadapter);
- if(receiver[i]->waterfall!=NULL) {
+ if (receiver[i]->waterfall != NULL) {
g_object_ref((gpointer)receiver[i]->waterfall);
}
- gtk_container_remove(GTK_CONTAINER(fixed),receiver[i]->panel);
+ gtk_container_remove(GTK_CONTAINER(fixed), receiver[i]->panel);
}
}
- if(duplex) {
+ if (duplex) {
gtk_widget_show_all(transmitter->dialog);
- if(transmitter->dialog_x!=-1 && transmitter->dialog_y!=-1) {
- gtk_window_move(GTK_WINDOW(transmitter->dialog),transmitter->dialog_x,transmitter->dialog_y);
+ if (transmitter->dialog_x != -1 && transmitter->dialog_y != -1) {
+ gtk_window_move(GTK_WINDOW(transmitter->dialog), transmitter->dialog_x,
+ transmitter->dialog_y);
}
} else {
- gtk_fixed_put(GTK_FIXED(fixed),transmitter->panel,transmitter->x,transmitter->y);
+ gtk_fixed_put(GTK_FIXED(fixed), transmitter->panel, transmitter->x,
+ transmitter->y);
}
-
- SetChannelState(transmitter->id,1,0);
- tx_set_displaying(transmitter,1);
- switch(protocol) {
+
+ SetChannelState(transmitter->id, 1, 0);
+ tx_set_displaying(transmitter, 1);
+ switch (protocol) {
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- soapy_protocol_set_tx_frequency(transmitter);
- //soapy_protocol_start_transmitter(transmitter);
- break;
+ case SOAPYSDR_PROTOCOL:
+ soapy_protocol_set_tx_frequency(transmitter);
+ // soapy_protocol_start_transmitter(transmitter);
+ break;
#endif
}
} else {
// switch to rx
- switch(protocol) {
+ switch (protocol) {
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- //soapy_protocol_stop_transmitter(transmitter);
- break;
+ case SOAPYSDR_PROTOCOL:
+ // soapy_protocol_stop_transmitter(transmitter);
+ break;
#endif
}
- SetChannelState(transmitter->id,0,1);
- tx_set_displaying(transmitter,0);
- if(duplex) {
- gtk_window_get_position(GTK_WINDOW(transmitter->dialog),&transmitter->dialog_x,&transmitter->dialog_y);
+ SetChannelState(transmitter->id, 0, 1);
+ tx_set_displaying(transmitter, 0);
+ if (duplex) {
+ gtk_window_get_position(GTK_WINDOW(transmitter->dialog),
+ &transmitter->dialog_x, &transmitter->dialog_y);
gtk_widget_hide(transmitter->dialog);
} else {
gtk_container_remove(GTK_CONTAINER(fixed), transmitter->panel);
}
- if(!duplex) {
- for(i=0;i<receivers;i++) {
- gtk_fixed_put(GTK_FIXED(fixed),receiver[i]->panel,receiver[i]->x,receiver[i]->y);
- SetChannelState(receiver[i]->id,1,0);
- set_displaying(receiver[i],1);
+ if (!duplex) {
+ for (i = 0; i < receivers; i++) {
+ gtk_fixed_put(GTK_FIXED(fixed), receiver[i]->panel, receiver[i]->x,
+ receiver[i]->y);
+ SetChannelState(receiver[i]->id, 1, 0);
+ set_displaying(receiver[i], 1);
}
}
}
#ifdef PURESIGNAL
- if(transmitter->puresignal) {
- SetPSMox(transmitter->id,state);
+ if (transmitter->puresignal) {
+ SetPSMox(transmitter->id, state);
}
#endif
}
void setMox(int state) {
- if(!can_transmit) return;
+ if (!can_transmit)
+ return;
#ifdef SOAPYSDR
- if(protocol==SOAPYSDR_PROTOCOL && !transmitter->local_microphone) return;
+ if (protocol == SOAPYSDR_PROTOCOL && !transmitter->local_microphone)
+ return;
#endif
- vox_cancel(); // remove time-out
- if(mox!=state) {
+ vox_cancel(); // remove time-out
+ if (mox != state) {
if (state && vox) {
// Suppress RX-TX transition if VOX was already active
} else {
rxtx(state);
}
- mox=state;
+ mox = state;
}
- vox=0;
- switch(protocol) {
- case NEW_PROTOCOL:
- schedule_high_priority();
- schedule_receive_specific();
- break;
- default:
- break;
+ vox = 0;
+ switch (protocol) {
+ case NEW_PROTOCOL:
+ schedule_high_priority();
+ schedule_receive_specific();
+ break;
+ default:
+ break;
}
}
-int getMox() {
- return mox;
-}
+int getMox() { return mox; }
void vox_changed(int state) {
- if(vox!=state && !tune && !mox) {
+ if (vox != state && !tune && !mox) {
rxtx(state);
}
- vox=state;
- if(protocol==NEW_PROTOCOL) {
- schedule_high_priority();
- schedule_receive_specific();
+ vox = state;
+ if (protocol == NEW_PROTOCOL) {
+ schedule_high_priority();
+ schedule_receive_specific();
}
}
void frequency_changed(RECEIVER *rx) {
-//g_print("frequency_changed: channel=%d frequency=%ld lo=%ld error=%ld ctun=%d offset=%ld\n",rx->channel,rx->frequency_a,rx->lo_a,rx->error_a,rx->ctun,rx->offset);
- if(vfo[0].ctun) {
+ // g_print("frequency_changed: channel=%d frequency=%ld lo=%ld error=%ld
+ // ctun=%d
+ // offset=%ld\n",rx->channel,rx->frequency_a,rx->lo_a,rx->error_a,rx->ctun,rx->offset);
+ if (vfo[0].ctun) {
SetRXAShiftFreq(rx->id, (double)vfo[0].offset);
RXANBPSetShiftFrequency(rx->id, (double)vfo[0].offset);
#ifdef SOAPYSDR
- if(protocol==SOAPYSDR_PROTOCOL) {
-/*
- if(radio->can_transmit) {
- if(radio->transmitter!=NULL && radio->transmitter->rx==rx) {
- //soapy_protocol_set_tx_frequency(radio->transmitter);
- }
- }
-*/
+ if (protocol == SOAPYSDR_PROTOCOL) {
+ /*
+ if(radio->can_transmit) {
+ if(radio->transmitter!=NULL && radio->transmitter->rx==rx) {
+ //soapy_protocol_set_tx_frequency(radio->transmitter);
+ }
+ }
+ */
}
#endif
} else {
- if(protocol==NEW_PROTOCOL) {
+ if (protocol == NEW_PROTOCOL) {
schedule_high_priority();
#ifdef SOAPYSDR
- } else if(protocol==SOAPYSDR_PROTOCOL) {
- soapy_protocol_set_rx_frequency(rx,VFO_A);
+ } else if (protocol == SOAPYSDR_PROTOCOL) {
+ soapy_protocol_set_rx_frequency(rx, VFO_A);
/*
if(radio->can_transmit) {
if(radio->transmitter!=NULL && radio->transmitter->rx==rx) {
*/
#endif
}
- vfo[0].band=get_band_from_frequency(vfo[0].frequency);
+ vfo[0].band = get_band_from_frequency(vfo[0].frequency);
}
}
-
void setTune(int state) {
int i;
- if(!can_transmit) return;
+ if (!can_transmit)
+ return;
// if state==tune, this function is a no-op
- if(tune!=state) {
+ if (tune != state) {
vox_cancel();
if (vox || mox) {
rxtx(0);
- vox=0;
- mox=0;
+ vox = 0;
+ mox = 0;
}
- if(state) {
+ if (state) {
if (transmitter->puresignal) {
- //
- // DL1YCF:
- // Some users have reported that especially when having
- // very long (10 hours) operating times with PS, hitting
- // the "TUNE" button makes the PS algorithm crazy, such that
- // it produces a very broad line spectrum. Experimentally, it
- // has been observed that this can be avoided by hitting
- // "Off" in the PS menu before hitting "TUNE", and hitting
- // "Restart" in the PS menu when tuning is complete.
- //
- // It is therefore suggested to to so implicitly when PS
- // is enabled.
- //
- // So before start tuning: Reset PS engine
- //
+ //
+ // DL1YCF:
+ // Some users have reported that especially when having
+ // very long (10 hours) operating times with PS, hitting
+ // the "TUNE" button makes the PS algorithm crazy, such that
+ // it produces a very broad line spectrum. Experimentally, it
+ // has been observed that this can be avoided by hitting
+ // "Off" in the PS menu before hitting "TUNE", and hitting
+ // "Restart" in the PS menu when tuning is complete.
+ //
+ // It is therefore suggested to to so implicitly when PS
+ // is enabled.
+ //
+ // So before start tuning: Reset PS engine
+ //
SetPSControl(transmitter->id, 1, 0, 0, 0);
- usleep(50000);
+ usleep(50000);
}
- if(full_tune) {
- if(OCfull_tune_time!=0) {
+ if (full_tune) {
+ if (OCfull_tune_time != 0) {
struct timeval te;
- gettimeofday(&te,NULL);
- tune_timeout=(te.tv_sec*1000LL+te.tv_usec/1000)+(long long)OCfull_tune_time;
+ gettimeofday(&te, NULL);
+ tune_timeout = (te.tv_sec * 1000LL + te.tv_usec / 1000) +
+ (long long)OCfull_tune_time;
}
}
- if(memory_tune) {
- if(OCmemory_tune_time!=0) {
+ if (memory_tune) {
+ if (OCmemory_tune_time != 0) {
struct timeval te;
- gettimeofday(&te,NULL);
- tune_timeout=(te.tv_sec*1000LL+te.tv_usec/1000)+(long long)OCmemory_tune_time;
+ gettimeofday(&te, NULL);
+ tune_timeout = (te.tv_sec * 1000LL + te.tv_usec / 1000) +
+ (long long)OCmemory_tune_time;
}
}
}
- if(protocol==NEW_PROTOCOL) {
+ if (protocol == NEW_PROTOCOL) {
schedule_high_priority();
- //schedule_general();
+ // schedule_general();
}
- if(state) {
- if(!duplex) {
- for(i=0;i<receivers;i++) {
+ if (state) {
+ if (!duplex) {
+ for (i = 0; i < receivers; i++) {
// Delivery of RX samples
// to WDSP via fexchange0() may come to an abrupt stop
// (especially with PURESIGNAL or DIVERSITY)
// Therefore, wait for *all* receivers to complete
// their slew-down before going TX.
- SetChannelState(receiver[i]->id,0,1);
- set_displaying(receiver[i],0);
- if(protocol==NEW_PROTOCOL) {
+ SetChannelState(receiver[i]->id, 0, 1);
+ set_displaying(receiver[i], 0);
+ if (protocol == NEW_PROTOCOL) {
schedule_high_priority();
}
}
}
- int txmode=get_tx_mode();
- pre_tune_mode=txmode;
- pre_tune_cw_internal=cw_keyer_internal;
+ int txmode = get_tx_mode();
+ pre_tune_mode = txmode;
+ pre_tune_cw_internal = cw_keyer_internal;
//
// in USB/DIGU/DSB, tune 1000 Hz above carrier
// in LSB/DIGL, tune 1000 Hz below carrier
// all other (CW, AM, FM): tune on carrier freq.
//
- switch(txmode) {
- case modeLSB:
- case modeDIGL:
- SetTXAPostGenToneFreq(transmitter->id,-(double)1000.0);
- break;
- case modeUSB:
- case modeDSB:
- case modeDIGU:
- SetTXAPostGenToneFreq(transmitter->id,(double)1000.0);
- break;
- default:
- SetTXAPostGenToneFreq(transmitter->id,(double)0.0);
- break;
+ switch (txmode) {
+ case modeLSB:
+ case modeDIGL:
+ SetTXAPostGenToneFreq(transmitter->id, -(double)1000.0);
+ break;
+ case modeUSB:
+ case modeDSB:
+ case modeDIGU:
+ SetTXAPostGenToneFreq(transmitter->id, (double)1000.0);
+ break;
+ default:
+ SetTXAPostGenToneFreq(transmitter->id, (double)0.0);
+ break;
}
- SetTXAPostGenToneMag(transmitter->id,0.99999);
- SetTXAPostGenMode(transmitter->id,0);
- SetTXAPostGenRun(transmitter->id,1);
+ SetTXAPostGenToneMag(transmitter->id, 0.99999);
+ SetTXAPostGenMode(transmitter->id, 0);
+ SetTXAPostGenRun(transmitter->id, 1);
- switch(txmode) {
- case modeCWL:
- cw_keyer_internal=0;
- tx_set_mode(transmitter,modeLSB);
- break;
- case modeCWU:
- cw_keyer_internal=0;
- tx_set_mode(transmitter,modeUSB);
- break;
+ switch (txmode) {
+ case modeCWL:
+ cw_keyer_internal = 0;
+ tx_set_mode(transmitter, modeLSB);
+ break;
+ case modeCWU:
+ cw_keyer_internal = 0;
+ tx_set_mode(transmitter, modeUSB);
+ break;
}
rxtx(state);
} else {
rxtx(state);
- SetTXAPostGenRun(transmitter->id,0);
- switch(pre_tune_mode) {
- case modeCWL:
- case modeCWU:
- tx_set_mode(transmitter,pre_tune_mode);
- cw_keyer_internal=pre_tune_cw_internal;
- break;
+ SetTXAPostGenRun(transmitter->id, 0);
+ switch (pre_tune_mode) {
+ case modeCWL:
+ case modeCWU:
+ tx_set_mode(transmitter, pre_tune_mode);
+ cw_keyer_internal = pre_tune_cw_internal;
+ break;
}
if (transmitter->puresignal) {
- //
- // DL1YCF:
- // Since we have done a "PS reset" when we started tuning,
- // resume PS engine now.
- //
- SetPSControl(transmitter->id, 0, 0, 1, 0);
+ //
+ // DL1YCF:
+ // Since we have done a "PS reset" when we started tuning,
+ // resume PS engine now.
+ //
+ SetPSControl(transmitter->id, 0, 0, 1, 0);
}
}
- tune=state;
+ tune = state;
}
- if(protocol==NEW_PROTOCOL) {
+ if (protocol == NEW_PROTOCOL) {
schedule_high_priority();
schedule_receive_specific();
}
}
-int getTune() {
- return tune;
-}
+int getTune() { return tune; }
-int isTransmitting() {
- return mox | vox | tune;
-}
+int isTransmitting() { return mox | vox | tune; }
void setFrequency(long long f) {
- int v=active_receiver->id;
- vfo[v].band=get_band_from_frequency(f);
+ int v = active_receiver->id;
+ vfo[v].band = get_band_from_frequency(f);
- switch(protocol) {
- case NEW_PROTOCOL:
- case ORIGINAL_PROTOCOL:
+ switch (protocol) {
+ case NEW_PROTOCOL:
+ case ORIGINAL_PROTOCOL:
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
-#endif
- if(vfo[v].ctun) {
- long long minf=vfo[v].frequency-(long long)(active_receiver->sample_rate/2);
- long long maxf=vfo[v].frequency+(long long)(active_receiver->sample_rate/2);
- if(f<minf) f=minf;
- if(f>maxf) f=maxf;
- vfo[v].ctun_frequency=f;
- vfo[v].offset=f-vfo[v].frequency;
- set_offset(active_receiver,vfo[v].offset);
- return;
- } else {
- vfo[v].frequency=f;
- }
- break;
+ case SOAPYSDR_PROTOCOL:
+#endif
+ if (vfo[v].ctun) {
+ long long minf =
+ vfo[v].frequency - (long long)(active_receiver->sample_rate / 2);
+ long long maxf =
+ vfo[v].frequency + (long long)(active_receiver->sample_rate / 2);
+ if (f < minf)
+ f = minf;
+ if (f > maxf)
+ f = maxf;
+ vfo[v].ctun_frequency = f;
+ vfo[v].offset = f - vfo[v].frequency;
+ set_offset(active_receiver, vfo[v].offset);
+ return;
+ } else {
+ vfo[v].frequency = f;
+ }
+ break;
}
- switch(protocol) {
- case NEW_PROTOCOL:
- schedule_high_priority();
- break;
- case ORIGINAL_PROTOCOL:
- break;
+ switch (protocol) {
+ case NEW_PROTOCOL:
+ schedule_high_priority();
+ break;
+ case ORIGINAL_PROTOCOL:
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- if(!vfo[v].ctun) {
- soapy_protocol_set_rx_frequency(active_receiver,v);
- vfo[v].offset=0;
- }
- break;
+ case SOAPYSDR_PROTOCOL:
+ if (!vfo[v].ctun) {
+ soapy_protocol_set_rx_frequency(active_receiver, v);
+ vfo[v].offset = 0;
+ }
+ break;
#endif
}
}
-long long getFrequency() {
- return vfo[active_receiver->id].frequency;
-}
+long long getFrequency() { return vfo[active_receiver->id].frequency; }
-double getDrive() {
- return transmitter->drive;
-}
+double getDrive() { return transmitter->drive; }
static int calcLevel(double d) {
- int level=0;
- int v=get_tx_vfo();
+ int level = 0;
+ int v = get_tx_vfo();
- BAND *band=band_get_band(vfo[v].band);
+ BAND *band = band_get_band(vfo[v].band);
double target_dbm = 10.0 * log10(d * 1000.0);
- double gbb=band->pa_calibration;
- target_dbm-=gbb;
+ double gbb = band->pa_calibration;
+ target_dbm -= gbb;
double target_volts = sqrt(pow(10, target_dbm * 0.1) * 0.05);
- double volts=min((target_volts / 0.8), 1.0);
- double actual_volts=volts*(1.0/0.98);
+ double volts = min((target_volts / 0.8), 1.0);
+ double actual_volts = volts * (1.0 / 0.98);
- if(actual_volts<0.0) {
- actual_volts=0.0;
- } else if(actual_volts>1.0) {
- actual_volts=1.0;
+ if (actual_volts < 0.0) {
+ actual_volts = 0.0;
+ } else if (actual_volts > 1.0) {
+ actual_volts = 1.0;
}
- level=(int)(actual_volts*255.0);
+ level = (int)(actual_volts * 255.0);
return level;
}
void calcDriveLevel() {
- transmitter->drive_level=calcLevel(transmitter->drive);
- if(isTransmitting() && protocol==NEW_PROTOCOL) {
+ transmitter->drive_level = calcLevel(transmitter->drive);
+ if (isTransmitting() && protocol == NEW_PROTOCOL) {
schedule_high_priority();
}
-//g_print("calcDriveLevel: drive=%d drive_level=%d\n",transmitter->drive,transmitter->drive_level);
+ // g_print("calcDriveLevel: drive=%d
+ // drive_level=%d\n",transmitter->drive,transmitter->drive_level);
}
void setDrive(double value) {
- transmitter->drive=value;
- switch(protocol) {
- case ORIGINAL_PROTOCOL:
- case NEW_PROTOCOL:
- calcDriveLevel();
- break;
+ transmitter->drive = value;
+ switch (protocol) {
+ case ORIGINAL_PROTOCOL:
+ case NEW_PROTOCOL:
+ calcDriveLevel();
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- soapy_protocol_set_tx_gain(transmitter,transmitter->drive);
- break;
+ case SOAPYSDR_PROTOCOL:
+ soapy_protocol_set_tx_gain(transmitter, transmitter->drive);
+ break;
#endif
- }
+ }
}
-double getTuneDrive() {
- return transmitter->tune_percent;
-}
+double getTuneDrive() { return transmitter->tune_percent; }
void setSquelch(RECEIVER *rx) {
- double am_sq=((rx->squelch/100.0)*160.0)-160.0;
+ double am_sq = ((rx->squelch / 100.0) * 160.0) - 160.0;
SetRXAAMSQThreshold(rx->id, am_sq);
SetRXAAMSQRun(rx->id, rx->squelch_enable);
- double fm_sq=pow(10.0, -2.0*rx->squelch/100.0);
+ double fm_sq = pow(10.0, -2.0 * rx->squelch / 100.0);
SetRXAFMSQThreshold(rx->id, fm_sq);
SetRXAFMSQRun(rx->id, rx->squelch_enable);
}
void radio_set_rf_gain(RECEIVER *rx) {
#ifdef SOAPYSDR
- soapy_protocol_set_gain_element(rx,radio->info.soapy.rx_gain[rx->adc],(int)adc[rx->adc].gain);
+ soapy_protocol_set_gain_element(rx, radio->info.soapy.rx_gain[rx->adc],
+ (int)adc[rx->adc].gain);
#endif
}
void set_attenuation(int value) {
- switch(protocol) {
- case NEW_PROTOCOL:
- schedule_high_priority();
- break;
+ switch (protocol) {
+ case NEW_PROTOCOL:
+ schedule_high_priority();
+ break;
#ifdef SOAPYSDR
- case SOAPYSDR_PROTOCOL:
- soapy_protocol_set_gain_element(active_receiver,radio->info.soapy.rx_gain[0],(int)adc[0].gain);
- break;
+ case SOAPYSDR_PROTOCOL:
+ soapy_protocol_set_gain_element(
+ active_receiver, radio->info.soapy.rx_gain[0], (int)adc[0].gain);
+ break;
#endif
- }
+ }
}
void set_alex_rx_antenna(int v) {
- if(active_receiver->id==0) {
- active_receiver->alex_antenna=v;
- if(protocol==NEW_PROTOCOL) {
- schedule_high_priority();
- }
+ if (active_receiver->id == 0) {
+ active_receiver->alex_antenna = v;
+ if (protocol == NEW_PROTOCOL) {
+ schedule_high_priority();
}
+ }
#ifdef SOAPYSDR
- if(protocol==SOAPYSDR_PROTOCOL) {
- soapy_protocol_set_rx_antenna(active_receiver,v);
- }
+ if (protocol == SOAPYSDR_PROTOCOL) {
+ soapy_protocol_set_rx_antenna(active_receiver, v);
+ }
#endif
}
void set_alex_tx_antenna(int v) {
- transmitter->alex_antenna=v;
- if(protocol==NEW_PROTOCOL) {
- schedule_high_priority();
- }
+ transmitter->alex_antenna = v;
+ if (protocol == NEW_PROTOCOL) {
+ schedule_high_priority();
+ }
}
//
// receiver, but separately (as is the case with adc_attenuation).
//
void set_alex_attenuation(int v) {
- if(active_receiver->id==0) {
- active_receiver->alex_attenuation=v;
- if(protocol==NEW_PROTOCOL) {
- schedule_high_priority();
- }
+ if (active_receiver->id == 0) {
+ active_receiver->alex_attenuation = v;
+ if (protocol == NEW_PROTOCOL) {
+ schedule_high_priority();
}
+ }
}
void radioRestoreState() {
char *value;
int i;
-g_print("radioRestoreState: %s\n",property_path);
+ g_print("radioRestoreState: %s\n", property_path);
g_mutex_lock(&property_mutex);
loadProperties(property_path);
- value=getProperty("display_filled");
- if(value) display_filled=atoi(value);
- value=getProperty("display_gradient");
- if(value) display_gradient=atoi(value);
- value=getProperty("display_zoompan");
- if(value) display_zoompan=atoi(value);
- value=getProperty("display_sliders");
- if(value) display_sliders=atoi(value);
- value=getProperty("display_toolbar");
- if(value) display_toolbar=atoi(value);
+ value = getProperty("display_filled");
+ if (value)
+ display_filled = atoi(value);
+ value = getProperty("display_gradient");
+ if (value)
+ display_gradient = atoi(value);
+ value = getProperty("display_zoompan");
+ if (value)
+ display_zoompan = atoi(value);
+ value = getProperty("display_sliders");
+ if (value)
+ display_sliders = atoi(value);
+ value = getProperty("display_toolbar");
+ if (value)
+ display_toolbar = atoi(value);
#ifdef CLIENT_SERVER
- if(radio_is_remote) {
+ if (radio_is_remote) {
#ifdef CLIENT_SERVER
#endif
} else {
#endif
- value=getProperty("radio_sample_rate");
- if (value) radio_sample_rate=atoi(value);
- value=getProperty("diversity_enabled");
- if (value) diversity_enabled=atoi(value);
- value=getProperty("diversity_gain");
- if (value) div_gain=atof(value);
- value=getProperty("diversity_phase");
- if (value) div_phase=atof(value);
- value=getProperty("diversity_cos");
- if (value) div_cos=atof(value);
- value=getProperty("diversity_sin");
- if (value) div_sin=atof(value);
- value=getProperty("new_pa_board");
- if (value) new_pa_board=atoi(value);
- value=getProperty("region");
- if(value) region=atoi(value);
- value=getProperty("buffer_size");
- if(value) buffer_size=atoi(value);
- value=getProperty("fft_size");
- if(value) fft_size=atoi(value);
- value=getProperty("atlas_penelope");
- if(value) atlas_penelope=atoi(value);
- value=getProperty("tx_out_of_band");
- if(value) tx_out_of_band=atoi(value);
- value=getProperty("filter_board");
- if(value) filter_board=atoi(value);
- value=getProperty("pa_enabled");
- if(value) pa_enabled=atoi(value);
- value=getProperty("pa_power");
- if(value) pa_power=atoi(value);
- for(i=0;i<11;i++) {
- sprintf(name,"pa_trim[%d]",i);
- value=getProperty(name);
- if(value) pa_trim[i]=atoi(value);
- }
- value=getProperty("updates_per_second");
- if(value) updates_per_second=atoi(value);
- value=getProperty("display_detector_mode");
- if(value) display_detector_mode=atoi(value);
- value=getProperty("display_average_mode");
- if(value) display_average_mode=atoi(value);
- value=getProperty("display_average_time");
- if(value) display_average_time=atof(value);
- value=getProperty("panadapter_high");
- if(value) panadapter_high=atoi(value);
- value=getProperty("panadapter_low");
- if(value) panadapter_low=atoi(value);
- value=getProperty("waterfall_high");
- if(value) waterfall_high=atoi(value);
- value=getProperty("waterfall_low");
- if(value) waterfall_low=atoi(value);
- value=getProperty("mic_gain");
- if(value) mic_gain=atof(value);
- value=getProperty("mic_boost");
- if(value) mic_boost=atof(value);
- value=getProperty("mic_linein");
- if(value) mic_linein=atoi(value);
- value=getProperty("linein_gain");
- if(value) linein_gain=atoi(value);
- value=getProperty("mic_ptt_enabled");
- if(value) mic_ptt_enabled=atof(value);
- value=getProperty("mic_bias_enabled");
- if(value) mic_bias_enabled=atof(value);
- value=getProperty("mic_ptt_tip_bias_ring");
- if(value) mic_ptt_tip_bias_ring=atof(value);
-
- value=getProperty("tx_filter_low");
- if(value) tx_filter_low=atoi(value);
- value=getProperty("tx_filter_high");
- if(value) tx_filter_high=atoi(value);
-
- value=getProperty("step");
- if(value) step=atoll(value);
- value=getProperty("cw_is_on_vfo_freq");
- if(value) cw_is_on_vfo_freq=atoi(value);
- value=getProperty("cw_keys_reversed");
- if(value) cw_keys_reversed=atoi(value);
- value=getProperty("cw_keyer_speed");
- if(value) cw_keyer_speed=atoi(value);
- value=getProperty("cw_keyer_mode");
- if(value) cw_keyer_mode=atoi(value);
- value=getProperty("cw_keyer_weight");
- if(value) cw_keyer_weight=atoi(value);
- value=getProperty("cw_keyer_spacing");
- if(value) cw_keyer_spacing=atoi(value);
+ value = getProperty("radio_sample_rate");
+ if (value)
+ radio_sample_rate = atoi(value);
+ value = getProperty("diversity_enabled");
+ if (value)
+ diversity_enabled = atoi(value);
+ value = getProperty("diversity_gain");
+ if (value)
+ div_gain = atof(value);
+ value = getProperty("diversity_phase");
+ if (value)
+ div_phase = atof(value);
+ value = getProperty("diversity_cos");
+ if (value)
+ div_cos = atof(value);
+ value = getProperty("diversity_sin");
+ if (value)
+ div_sin = atof(value);
+ value = getProperty("new_pa_board");
+ if (value)
+ new_pa_board = atoi(value);
+ value = getProperty("region");
+ if (value)
+ region = atoi(value);
+ value = getProperty("buffer_size");
+ if (value)
+ buffer_size = atoi(value);
+ value = getProperty("fft_size");
+ if (value)
+ fft_size = atoi(value);
+ value = getProperty("atlas_penelope");
+ if (value)
+ atlas_penelope = atoi(value);
+ value = getProperty("tx_out_of_band");
+ if (value)
+ tx_out_of_band = atoi(value);
+ value = getProperty("filter_board");
+ if (value)
+ filter_board = atoi(value);
+ value = getProperty("pa_enabled");
+ if (value)
+ pa_enabled = atoi(value);
+ value = getProperty("pa_power");
+ if (value)
+ pa_power = atoi(value);
+ for (i = 0; i < 11; i++) {
+ sprintf(name, "pa_trim[%d]", i);
+ value = getProperty(name);
+ if (value)
+ pa_trim[i] = atoi(value);
+ }
+ value = getProperty("updates_per_second");
+ if (value)
+ updates_per_second = atoi(value);
+ value = getProperty("display_detector_mode");
+ if (value)
+ display_detector_mode = atoi(value);
+ value = getProperty("display_average_mode");
+ if (value)
+ display_average_mode = atoi(value);
+ value = getProperty("display_average_time");
+ if (value)
+ display_average_time = atof(value);
+ value = getProperty("panadapter_high");
+ if (value)
+ panadapter_high = atoi(value);
+ value = getProperty("panadapter_low");
+ if (value)
+ panadapter_low = atoi(value);
+ value = getProperty("waterfall_high");
+ if (value)
+ waterfall_high = atoi(value);
+ value = getProperty("waterfall_low");
+ if (value)
+ waterfall_low = atoi(value);
+ value = getProperty("mic_gain");
+ if (value)
+ mic_gain = atof(value);
+ value = getProperty("mic_boost");
+ if (value)
+ mic_boost = atof(value);
+ value = getProperty("mic_linein");
+ if (value)
+ mic_linein = atoi(value);
+ value = getProperty("linein_gain");
+ if (value)
+ linein_gain = atoi(value);
+ value = getProperty("mic_ptt_enabled");
+ if (value)
+ mic_ptt_enabled = atof(value);
+ value = getProperty("mic_bias_enabled");
+ if (value)
+ mic_bias_enabled = atof(value);
+ value = getProperty("mic_ptt_tip_bias_ring");
+ if (value)
+ mic_ptt_tip_bias_ring = atof(value);
+
+ value = getProperty("tx_filter_low");
+ if (value)
+ tx_filter_low = atoi(value);
+ value = getProperty("tx_filter_high");
+ if (value)
+ tx_filter_high = atoi(value);
+
+ value = getProperty("step");
+ if (value)
+ step = atoll(value);
+ value = getProperty("cw_is_on_vfo_freq");
+ if (value)
+ cw_is_on_vfo_freq = atoi(value);
+ value = getProperty("cw_keys_reversed");
+ if (value)
+ cw_keys_reversed = atoi(value);
+ value = getProperty("cw_keyer_speed");
+ if (value)
+ cw_keyer_speed = atoi(value);
+ value = getProperty("cw_keyer_mode");
+ if (value)
+ cw_keyer_mode = atoi(value);
+ value = getProperty("cw_keyer_weight");
+ if (value)
+ cw_keyer_weight = atoi(value);
+ value = getProperty("cw_keyer_spacing");
+ if (value)
+ cw_keyer_spacing = atoi(value);
#ifdef LOCALCW
- value=getProperty("cw_keyer_internal");
- if(value) cw_keyer_internal=atoi(value);
-#endif
- value=getProperty("cw_keyer_sidetone_volume");
- if(value) cw_keyer_sidetone_volume=atoi(value);
- value=getProperty("cw_keyer_ptt_delay");
- if(value) cw_keyer_ptt_delay=atoi(value);
- value=getProperty("cw_keyer_hang_time");
- if(value) cw_keyer_hang_time=atoi(value);
- value=getProperty("cw_keyer_sidetone_frequency");
- if(value) cw_keyer_sidetone_frequency=atoi(value);
- value=getProperty("cw_breakin");
- if(value) cw_breakin=atoi(value);
- value=getProperty("vfo_encoder_divisor");
- if(value) vfo_encoder_divisor=atoi(value);
- value=getProperty("OCtune");
- if(value) OCtune=atoi(value);
- value=getProperty("OCfull_tune_time");
- if(value) OCfull_tune_time=atoi(value);
- value=getProperty("OCmemory_tune_time");
- if(value) OCmemory_tune_time=atoi(value);
- value=getProperty("analog_meter");
- if(value) analog_meter=atoi(value);
- value=getProperty("smeter");
- if(value) smeter=atoi(value);
- value=getProperty("alc");
- if(value) alc=atoi(value);
+ value = getProperty("cw_keyer_internal");
+ if (value)
+ cw_keyer_internal = atoi(value);
+#endif
+ value = getProperty("cw_keyer_sidetone_volume");
+ if (value)
+ cw_keyer_sidetone_volume = atoi(value);
+ value = getProperty("cw_keyer_ptt_delay");
+ if (value)
+ cw_keyer_ptt_delay = atoi(value);
+ value = getProperty("cw_keyer_hang_time");
+ if (value)
+ cw_keyer_hang_time = atoi(value);
+ value = getProperty("cw_keyer_sidetone_frequency");
+ if (value)
+ cw_keyer_sidetone_frequency = atoi(value);
+ value = getProperty("cw_breakin");
+ if (value)
+ cw_breakin = atoi(value);
+ value = getProperty("vfo_encoder_divisor");
+ if (value)
+ vfo_encoder_divisor = atoi(value);
+ value = getProperty("OCtune");
+ if (value)
+ OCtune = atoi(value);
+ value = getProperty("OCfull_tune_time");
+ if (value)
+ OCfull_tune_time = atoi(value);
+ value = getProperty("OCmemory_tune_time");
+ if (value)
+ OCmemory_tune_time = atoi(value);
+ value = getProperty("analog_meter");
+ if (value)
+ analog_meter = atoi(value);
+ value = getProperty("smeter");
+ if (value)
+ smeter = atoi(value);
+ value = getProperty("alc");
+ if (value)
+ alc = atoi(value);
#ifdef OLD_AUDIO
- value=getProperty("local_audio");
- if(value) local_audio=atoi(value);
- value=getProperty("n_selected_output_device");
- if(value) n_selected_output_device=atoi(value);
-#endif
- value=getProperty("local_microphone");
- if(value) local_microphone=atoi(value);
-// value=getProperty("n_selected_input_device");
-// if(value) n_selected_input_device=atoi(value);
- value=getProperty("enable_tx_equalizer");
- if(value) enable_tx_equalizer=atoi(value);
- value=getProperty("tx_equalizer.0");
- if(value) tx_equalizer[0]=atoi(value);
- value=getProperty("tx_equalizer.1");
- if(value) tx_equalizer[1]=atoi(value);
- value=getProperty("tx_equalizer.2");
- if(value) tx_equalizer[2]=atoi(value);
- value=getProperty("tx_equalizer.3");
- if(value) tx_equalizer[3]=atoi(value);
- value=getProperty("enable_rx_equalizer");
- if(value) enable_rx_equalizer=atoi(value);
- value=getProperty("rx_equalizer.0");
- if(value) rx_equalizer[0]=atoi(value);
- value=getProperty("rx_equalizer.1");
- if(value) rx_equalizer[1]=atoi(value);
- value=getProperty("rx_equalizer.2");
- if(value) rx_equalizer[2]=atoi(value);
- value=getProperty("rx_equalizer.3");
- if(value) rx_equalizer[3]=atoi(value);
- value=getProperty("rit_increment");
- if(value) rit_increment=atoi(value);
- value=getProperty("pre_emphasize");
- if(value) pre_emphasize=atoi(value);
-
- value=getProperty("vox_enabled");
- if(value) vox_enabled=atoi(value);
- value=getProperty("vox_threshold");
- if(value) vox_threshold=atof(value);
-/*
- value=getProperty("vox_gain");
- if(value) vox_gain=atof(value);
-*/
- value=getProperty("vox_hang");
- if(value) vox_hang=atof(value);
-
- value=getProperty("binaural");
- if(value) binaural=atoi(value);
+ value = getProperty("local_audio");
+ if (value)
+ local_audio = atoi(value);
+ value = getProperty("n_selected_output_device");
+ if (value)
+ n_selected_output_device = atoi(value);
+#endif
+ value = getProperty("local_microphone");
+ if (value)
+ local_microphone = atoi(value);
+ // value=getProperty("n_selected_input_device");
+ // if(value) n_selected_input_device=atoi(value);
+ value = getProperty("enable_tx_equalizer");
+ if (value)
+ enable_tx_equalizer = atoi(value);
+ value = getProperty("tx_equalizer.0");
+ if (value)
+ tx_equalizer[0] = atoi(value);
+ value = getProperty("tx_equalizer.1");
+ if (value)
+ tx_equalizer[1] = atoi(value);
+ value = getProperty("tx_equalizer.2");
+ if (value)
+ tx_equalizer[2] = atoi(value);
+ value = getProperty("tx_equalizer.3");
+ if (value)
+ tx_equalizer[3] = atoi(value);
+ value = getProperty("enable_rx_equalizer");
+ if (value)
+ enable_rx_equalizer = atoi(value);
+ value = getProperty("rx_equalizer.0");
+ if (value)
+ rx_equalizer[0] = atoi(value);
+ value = getProperty("rx_equalizer.1");
+ if (value)
+ rx_equalizer[1] = atoi(value);
+ value = getProperty("rx_equalizer.2");
+ if (value)
+ rx_equalizer[2] = atoi(value);
+ value = getProperty("rx_equalizer.3");
+ if (value)
+ rx_equalizer[3] = atoi(value);
+ value = getProperty("rit_increment");
+ if (value)
+ rit_increment = atoi(value);
+ value = getProperty("pre_emphasize");
+ if (value)
+ pre_emphasize = atoi(value);
+
+ value = getProperty("vox_enabled");
+ if (value)
+ vox_enabled = atoi(value);
+ value = getProperty("vox_threshold");
+ if (value)
+ vox_threshold = atof(value);
+ /*
+ value=getProperty("vox_gain");
+ if(value) vox_gain=atof(value);
+ */
+ value = getProperty("vox_hang");
+ if (value)
+ vox_hang = atof(value);
- value=getProperty("calibration");
- if(value) calibration=atoll(value);
+ value = getProperty("binaural");
+ if (value)
+ binaural = atoi(value);
- value=getProperty("frequencyB");
- if(value) frequencyB=atoll(value);
+ value = getProperty("calibration");
+ if (value)
+ calibration = atoll(value);
- value=getProperty("modeB");
- if(value) modeB=atoi(value);
+ value = getProperty("frequencyB");
+ if (value)
+ frequencyB = atoll(value);
- value=getProperty("filterB");
- if(value) filterB=atoi(value);
+ value = getProperty("modeB");
+ if (value)
+ modeB = atoi(value);
- value=getProperty("tone_level");
- if(value) tone_level=atof(value);
+ value = getProperty("filterB");
+ if (value)
+ filterB = atoi(value);
- value=getProperty("receivers");
- if(value) receivers=atoi(value);
+ value = getProperty("tone_level");
+ if (value)
+ tone_level = atof(value);
- value=getProperty("iqswap");
- if(value) iqswap=atoi(value);
+ value = getProperty("receivers");
+ if (value)
+ receivers = atoi(value);
- value=getProperty("rx_gain_calibration");
- if(value) rx_gain_calibration=atoi(value);
+ value = getProperty("iqswap");
+ if (value)
+ iqswap = atoi(value);
+ value = getProperty("rx_gain_calibration");
+ if (value)
+ rx_gain_calibration = atoi(value);
filterRestoreState();
bandRestoreState();
vfo_restore_state();
modesettings_restore_state();
gpio_restore_actions();
- value=getProperty("rigctl_enable");
- if(value) rigctl_enable=atoi(value);
- value=getProperty("rigctl_port_base");
- if(value) rigctl_port_base=atoi(value);
+ value = getProperty("rigctl_enable");
+ if (value)
+ rigctl_enable = atoi(value);
+ value = getProperty("rigctl_port_base");
+ if (value)
+ rigctl_port_base = atoi(value);
/*
value=getProperty("adc_0_attenuation");
value=getProperty("adc_1_attenuation");
if(value) adc_attenuation[1]=atoi(value);
*/
-
- value=getProperty("split");
- if(value) split=atoi(value);
- value=getProperty("duplex");
- if(value) duplex=atoi(value);
- value=getProperty("sat_mode");
- if(value) sat_mode=atoi(value);
- value=getProperty("mute_rx_while_transmitting");
- if(value) mute_rx_while_transmitting=atoi(value);
-
- value=getProperty("radio.adc[0].filters");
- if(value) adc[0].filters=atoi(value);
- value=getProperty("radio.adc[0].hpf");
- if(value) adc[0].hpf=atoi(value);
- value=getProperty("radio.adc[0].lpf");
- if(value) adc[0].lpf=atoi(value);
- value=getProperty("radio.adc[0].antenna");
- if(value) adc[0].antenna=atoi(value);
- value=getProperty("radio.adc[0].dither");
- if(value) adc[0].dither=atoi(value);
- value=getProperty("radio.adc[0].random");
- if(value) adc[0].random=atoi(value);
- value=getProperty("radio.adc[0].preamp");
- if(value) adc[0].preamp=atoi(value);
- value=getProperty("radio.adc[0].attenuation");
- if(value) adc[0].attenuation=atoi(value);
- value=getProperty("radio.adc[0].enable_step_attenuation");
- if(value) adc[0].enable_step_attenuation=atoi(value);
- value=getProperty("radio.adc[0].gain");
- if(value) adc[0].gain=atof(value);
- value=getProperty("radio.adc[0].min_gain");
- if(value) adc[0].min_gain=atof(value);
- value=getProperty("radio.adc[0].max_gain");
- if(value) adc[0].max_gain=atof(value);
-
-
-#ifdef SOAPYSDR
- if(device==SOAPYSDR_USB_DEVICE) {
- value=getProperty("radio.adc[0].agc");
- }
-#endif
-
- value=getProperty("radio.dac[0].antenna");
- if(value) dac[0].antenna=atoi(value);
- value=getProperty("radio.dac[0].gain");
- if(value) dac[0].gain=atof(value);
-
- if(receivers>1) {
- value=getProperty("radio.adc[1].filters");
- if(value) adc[1].filters=atoi(value);
- value=getProperty("radio.adc[1].hpf");
- if(value) adc[1].hpf=atoi(value);
- value=getProperty("radio.adc[1].lpf");
- if(value) adc[1].lpf=atoi(value);
- value=getProperty("radio.adc[1].antenna");
- if(value) adc[1].antenna=atoi(value);
- value=getProperty("radio.adc[1].dither");
- if(value) adc[1].dither=atoi(value);
- value=getProperty("radio.adc[1].random");
- if(value) adc[1].random=atoi(value);
- value=getProperty("radio.adc[1].preamp");
- if(value) adc[1].preamp=atoi(value);
- value=getProperty("radio.adc[1].attenuation");
- if(value) adc[1].attenuation=atoi(value);
- value=getProperty("radio.adc[1].enable_step_attenuation");
- if(value) adc[1].enable_step_attenuation=atoi(value);
- value=getProperty("radio.adc[1].gain");
- if(value) adc[1].gain=atof(value);
- value=getProperty("radio.adc[1].min_gain");
- if(value) adc[1].min_gain=atof(value);
- value=getProperty("radio.adc[1].max_gain");
- if(value) adc[1].max_gain=atof(value);
-
-
-#ifdef SOAPYSDR
- if(device==SOAPYSDR_USB_DEVICE) {
- value=getProperty("radio.adc[1].agc");
- }
+
+ value = getProperty("split");
+ if (value)
+ split = atoi(value);
+ value = getProperty("duplex");
+ if (value)
+ duplex = atoi(value);
+ value = getProperty("sat_mode");
+ if (value)
+ sat_mode = atoi(value);
+ value = getProperty("mute_rx_while_transmitting");
+ if (value)
+ mute_rx_while_transmitting = atoi(value);
+
+ value = getProperty("radio.adc[0].filters");
+ if (value)
+ adc[0].filters = atoi(value);
+ value = getProperty("radio.adc[0].hpf");
+ if (value)
+ adc[0].hpf = atoi(value);
+ value = getProperty("radio.adc[0].lpf");
+ if (value)
+ adc[0].lpf = atoi(value);
+ value = getProperty("radio.adc[0].antenna");
+ if (value)
+ adc[0].antenna = atoi(value);
+ value = getProperty("radio.adc[0].dither");
+ if (value)
+ adc[0].dither = atoi(value);
+ value = getProperty("radio.adc[0].random");
+ if (value)
+ adc[0].random = atoi(value);
+ value = getProperty("radio.adc[0].preamp");
+ if (value)
+ adc[0].preamp = atoi(value);
+ value = getProperty("radio.adc[0].attenuation");
+ if (value)
+ adc[0].attenuation = atoi(value);
+ value = getProperty("radio.adc[0].enable_step_attenuation");
+ if (value)
+ adc[0].enable_step_attenuation = atoi(value);
+ value = getProperty("radio.adc[0].gain");
+ if (value)
+ adc[0].gain = atof(value);
+ value = getProperty("radio.adc[0].min_gain");
+ if (value)
+ adc[0].min_gain = atof(value);
+ value = getProperty("radio.adc[0].max_gain");
+ if (value)
+ adc[0].max_gain = atof(value);
+
+#ifdef SOAPYSDR
+ if (device == SOAPYSDR_USB_DEVICE) {
+ value = getProperty("radio.adc[0].agc");
+ }
#endif
- value=getProperty("radio.dac[1].antenna");
- if(value) dac[1].antenna=atoi(value);
- value=getProperty("radio.dac[1].gain");
- if(value) dac[1].gain=atof(value);
+ value = getProperty("radio.dac[0].antenna");
+ if (value)
+ dac[0].antenna = atoi(value);
+ value = getProperty("radio.dac[0].gain");
+ if (value)
+ dac[0].gain = atof(value);
+
+ if (receivers > 1) {
+ value = getProperty("radio.adc[1].filters");
+ if (value)
+ adc[1].filters = atoi(value);
+ value = getProperty("radio.adc[1].hpf");
+ if (value)
+ adc[1].hpf = atoi(value);
+ value = getProperty("radio.adc[1].lpf");
+ if (value)
+ adc[1].lpf = atoi(value);
+ value = getProperty("radio.adc[1].antenna");
+ if (value)
+ adc[1].antenna = atoi(value);
+ value = getProperty("radio.adc[1].dither");
+ if (value)
+ adc[1].dither = atoi(value);
+ value = getProperty("radio.adc[1].random");
+ if (value)
+ adc[1].random = atoi(value);
+ value = getProperty("radio.adc[1].preamp");
+ if (value)
+ adc[1].preamp = atoi(value);
+ value = getProperty("radio.adc[1].attenuation");
+ if (value)
+ adc[1].attenuation = atoi(value);
+ value = getProperty("radio.adc[1].enable_step_attenuation");
+ if (value)
+ adc[1].enable_step_attenuation = atoi(value);
+ value = getProperty("radio.adc[1].gain");
+ if (value)
+ adc[1].gain = atof(value);
+ value = getProperty("radio.adc[1].min_gain");
+ if (value)
+ adc[1].min_gain = atof(value);
+ value = getProperty("radio.adc[1].max_gain");
+ if (value)
+ adc[1].max_gain = atof(value);
+#ifdef SOAPYSDR
+ if (device == SOAPYSDR_USB_DEVICE) {
+ value = getProperty("radio.adc[1].agc");
+ }
+#endif
+
+ value = getProperty("radio.dac[1].antenna");
+ if (value)
+ dac[1].antenna = atoi(value);
+ value = getProperty("radio.dac[1].gain");
+ if (value)
+ dac[1].gain = atof(value);
}
#ifdef MIDI
midi_restore_state();
- value=getProperty("radio.midi_enabled");
- if(value) midi_enabled=atoi(value);
+ value = getProperty("radio.midi_enabled");
+ if (value)
+ midi_enabled = atoi(value);
#endif
- value=getProperty("radio.display_sequence_errors");
- if(value!=NULL) display_sequence_errors=atoi(value);
-
+ value = getProperty("radio.display_sequence_errors");
+ if (value != NULL)
+ display_sequence_errors = atoi(value);
-
#ifdef CLIENT_SERVER
}
#endif
#ifdef CLIENT_SERVER
- value=getProperty("radio.hpsdr_server");
- if(value!=NULL) hpsdr_server=atoi(value);
- value=getProperty("radio.hpsdr_server.listen_port");
- if(value!=NULL) listen_port=atoi(value);
+ value = getProperty("radio.hpsdr_server");
+ if (value != NULL)
+ hpsdr_server = atoi(value);
+ value = getProperty("radio.hpsdr_server.listen_port");
+ if (value != NULL)
+ listen_port = atoi(value);
#endif
g_mutex_unlock(&property_mutex);
char value[80];
char name[32];
+ g_print("radioSaveState: %s\n", property_path);
-g_print("radioSaveState: %s\n",property_path);
-
g_mutex_lock(&property_mutex);
clearProperties();
gpio_save_actions();
- sprintf(value,"%d",receivers);
- setProperty("receivers",value);
- for(i=0;i<receivers;i++) {
+ sprintf(value, "%d", receivers);
+ setProperty("receivers", value);
+ for (i = 0; i < receivers; i++) {
receiver_save_state(receiver[i]);
}
- sprintf(value,"%d",display_filled);
- setProperty("display_filled",value);
- sprintf(value,"%d",display_gradient);
- setProperty("display_gradient",value);
- sprintf(value,"%d",display_zoompan);
- setProperty("display_zoompan",value);
- sprintf(value,"%d",display_sliders);
- setProperty("display_sliders",value);
- sprintf(value,"%d",display_toolbar);
- setProperty("display_toolbar",value);
+ sprintf(value, "%d", display_filled);
+ setProperty("display_filled", value);
+ sprintf(value, "%d", display_gradient);
+ setProperty("display_gradient", value);
+ sprintf(value, "%d", display_zoompan);
+ setProperty("display_zoompan", value);
+ sprintf(value, "%d", display_sliders);
+ setProperty("display_sliders", value);
+ sprintf(value, "%d", display_toolbar);
+ setProperty("display_toolbar", value);
- if(can_transmit) {
+ if (can_transmit) {
#ifdef PURESIGNAL
// The only variables of interest in this receiver are
// the alex_antenna an the adc
}
#ifdef CLIENT_SERVER
- if(!radio_is_remote) {
-#endif
- sprintf(value,"%d",radio_sample_rate);
- setProperty("radio_sample_rate",value);
- sprintf(value,"%d",diversity_enabled);
- setProperty("diversity_enabled",value);
- sprintf(value,"%f",div_gain);
- setProperty("diversity_gain",value);
- sprintf(value,"%f",div_phase);
- setProperty("diversity_phase",value);
- sprintf(value,"%f",div_cos);
- setProperty("diversity_cos",value);
- sprintf(value,"%f",div_sin);
- setProperty("diversity_sin",value);
- sprintf(value,"%d",new_pa_board);
- setProperty("new_pa_board",value);
- sprintf(value,"%d",region);
- setProperty("region",value);
- sprintf(value,"%d",buffer_size);
- setProperty("buffer_size",value);
- sprintf(value,"%d",fft_size);
- setProperty("fft_size",value);
- sprintf(value,"%d",atlas_penelope);
- setProperty("atlas_penelope",value);
- sprintf(value,"%d",filter_board);
- setProperty("filter_board",value);
- sprintf(value,"%d",tx_out_of_band);
- setProperty("tx_out_of_band",value);
- sprintf(value,"%d",updates_per_second);
- setProperty("updates_per_second",value);
- sprintf(value,"%d",display_detector_mode);
- setProperty("display_detector_mode",value);
- sprintf(value,"%d",display_average_mode);
- setProperty("display_average_mode",value);
- sprintf(value,"%f",display_average_time);
- setProperty("display_average_time",value);
- sprintf(value,"%d",panadapter_high);
- setProperty("panadapter_high",value);
- sprintf(value,"%d",panadapter_low);
- setProperty("panadapter_low",value);
- sprintf(value,"%d",waterfall_high);
- setProperty("waterfall_high",value);
- sprintf(value,"%d",waterfall_low);
- setProperty("waterfall_low",value);
- sprintf(value,"%f",mic_gain);
- setProperty("mic_gain",value);
- sprintf(value,"%d",mic_boost);
- setProperty("mic_boost",value);
- sprintf(value,"%d",mic_linein);
- setProperty("mic_linein",value);
- sprintf(value,"%d",linein_gain);
- setProperty("linein_gain",value);
- sprintf(value,"%d",mic_ptt_enabled);
- setProperty("mic_ptt_enabled",value);
- sprintf(value,"%d",mic_bias_enabled);
- setProperty("mic_bias_enabled",value);
- sprintf(value,"%d",mic_ptt_tip_bias_ring);
- setProperty("mic_ptt_tip_bias_ring",value);
- sprintf(value,"%d",tx_filter_low);
- setProperty("tx_filter_low",value);
- sprintf(value,"%d",tx_filter_high);
- setProperty("tx_filter_high",value);
- sprintf(value,"%d",pa_enabled);
- setProperty("pa_enabled",value);
- sprintf(value,"%d",pa_power);
- setProperty("pa_power",value);
- for(i=0;i<11;i++) {
- sprintf(name,"pa_trim[%d]",i);
- sprintf(value,"%d",pa_trim[i]);
- setProperty(name,value);
- }
-
- sprintf(value,"%lld",step);
- setProperty("step",value);
- sprintf(value,"%d",cw_is_on_vfo_freq);
- setProperty("cw_is_on_vfo_freq",value);
- sprintf(value,"%d",cw_keys_reversed);
- setProperty("cw_keys_reversed",value);
- sprintf(value,"%d",cw_keyer_speed);
- setProperty("cw_keyer_speed",value);
- sprintf(value,"%d",cw_keyer_mode);
- setProperty("cw_keyer_mode",value);
- sprintf(value,"%d",cw_keyer_weight);
- setProperty("cw_keyer_weight",value);
- sprintf(value,"%d",cw_keyer_spacing);
- setProperty("cw_keyer_spacing",value);
- sprintf(value,"%d",cw_keyer_internal);
- setProperty("cw_keyer_internal",value);
- sprintf(value,"%d",cw_keyer_sidetone_volume);
- setProperty("cw_keyer_sidetone_volume",value);
- sprintf(value,"%d",cw_keyer_ptt_delay);
- setProperty("cw_keyer_ptt_delay",value);
- sprintf(value,"%d",cw_keyer_hang_time);
- setProperty("cw_keyer_hang_time",value);
- sprintf(value,"%d",cw_keyer_sidetone_frequency);
- setProperty("cw_keyer_sidetone_frequency",value);
- sprintf(value,"%d",cw_breakin);
- setProperty("cw_breakin",value);
- sprintf(value,"%d",vfo_encoder_divisor);
- setProperty("vfo_encoder_divisor",value);
- sprintf(value,"%d",OCtune);
- setProperty("OCtune",value);
- sprintf(value,"%d",OCfull_tune_time);
- setProperty("OCfull_tune_time",value);
- sprintf(value,"%d",OCmemory_tune_time);
- setProperty("OCmemory_tune_time",value);
- sprintf(value,"%d",analog_meter);
- setProperty("analog_meter",value);
- sprintf(value,"%d",smeter);
- setProperty("smeter",value);
- sprintf(value,"%d",alc);
- setProperty("alc",value);
+ if (!radio_is_remote) {
+#endif
+ sprintf(value, "%d", radio_sample_rate);
+ setProperty("radio_sample_rate", value);
+ sprintf(value, "%d", diversity_enabled);
+ setProperty("diversity_enabled", value);
+ sprintf(value, "%f", div_gain);
+ setProperty("diversity_gain", value);
+ sprintf(value, "%f", div_phase);
+ setProperty("diversity_phase", value);
+ sprintf(value, "%f", div_cos);
+ setProperty("diversity_cos", value);
+ sprintf(value, "%f", div_sin);
+ setProperty("diversity_sin", value);
+ sprintf(value, "%d", new_pa_board);
+ setProperty("new_pa_board", value);
+ sprintf(value, "%d", region);
+ setProperty("region", value);
+ sprintf(value, "%d", buffer_size);
+ setProperty("buffer_size", value);
+ sprintf(value, "%d", fft_size);
+ setProperty("fft_size", value);
+ sprintf(value, "%d", atlas_penelope);
+ setProperty("atlas_penelope", value);
+ sprintf(value, "%d", filter_board);
+ setProperty("filter_board", value);
+ sprintf(value, "%d", tx_out_of_band);
+ setProperty("tx_out_of_band", value);
+ sprintf(value, "%d", updates_per_second);
+ setProperty("updates_per_second", value);
+ sprintf(value, "%d", display_detector_mode);
+ setProperty("display_detector_mode", value);
+ sprintf(value, "%d", display_average_mode);
+ setProperty("display_average_mode", value);
+ sprintf(value, "%f", display_average_time);
+ setProperty("display_average_time", value);
+ sprintf(value, "%d", panadapter_high);
+ setProperty("panadapter_high", value);
+ sprintf(value, "%d", panadapter_low);
+ setProperty("panadapter_low", value);
+ sprintf(value, "%d", waterfall_high);
+ setProperty("waterfall_high", value);
+ sprintf(value, "%d", waterfall_low);
+ setProperty("waterfall_low", value);
+ sprintf(value, "%f", mic_gain);
+ setProperty("mic_gain", value);
+ sprintf(value, "%d", mic_boost);
+ setProperty("mic_boost", value);
+ sprintf(value, "%d", mic_linein);
+ setProperty("mic_linein", value);
+ sprintf(value, "%d", linein_gain);
+ setProperty("linein_gain", value);
+ sprintf(value, "%d", mic_ptt_enabled);
+ setProperty("mic_ptt_enabled", value);
+ sprintf(value, "%d", mic_bias_enabled);
+ setProperty("mic_bias_enabled", value);
+ sprintf(value, "%d", mic_ptt_tip_bias_ring);
+ setProperty("mic_ptt_tip_bias_ring", value);
+ sprintf(value, "%d", tx_filter_low);
+ setProperty("tx_filter_low", value);
+ sprintf(value, "%d", tx_filter_high);
+ setProperty("tx_filter_high", value);
+ sprintf(value, "%d", pa_enabled);
+ setProperty("pa_enabled", value);
+ sprintf(value, "%d", pa_power);
+ setProperty("pa_power", value);
+ for (i = 0; i < 11; i++) {
+ sprintf(name, "pa_trim[%d]", i);
+ sprintf(value, "%d", pa_trim[i]);
+ setProperty(name, value);
+ }
+
+ sprintf(value, "%lld", step);
+ setProperty("step", value);
+ sprintf(value, "%d", cw_is_on_vfo_freq);
+ setProperty("cw_is_on_vfo_freq", value);
+ sprintf(value, "%d", cw_keys_reversed);
+ setProperty("cw_keys_reversed", value);
+ sprintf(value, "%d", cw_keyer_speed);
+ setProperty("cw_keyer_speed", value);
+ sprintf(value, "%d", cw_keyer_mode);
+ setProperty("cw_keyer_mode", value);
+ sprintf(value, "%d", cw_keyer_weight);
+ setProperty("cw_keyer_weight", value);
+ sprintf(value, "%d", cw_keyer_spacing);
+ setProperty("cw_keyer_spacing", value);
+ sprintf(value, "%d", cw_keyer_internal);
+ setProperty("cw_keyer_internal", value);
+ sprintf(value, "%d", cw_keyer_sidetone_volume);
+ setProperty("cw_keyer_sidetone_volume", value);
+ sprintf(value, "%d", cw_keyer_ptt_delay);
+ setProperty("cw_keyer_ptt_delay", value);
+ sprintf(value, "%d", cw_keyer_hang_time);
+ setProperty("cw_keyer_hang_time", value);
+ sprintf(value, "%d", cw_keyer_sidetone_frequency);
+ setProperty("cw_keyer_sidetone_frequency", value);
+ sprintf(value, "%d", cw_breakin);
+ setProperty("cw_breakin", value);
+ sprintf(value, "%d", vfo_encoder_divisor);
+ setProperty("vfo_encoder_divisor", value);
+ sprintf(value, "%d", OCtune);
+ setProperty("OCtune", value);
+ sprintf(value, "%d", OCfull_tune_time);
+ setProperty("OCfull_tune_time", value);
+ sprintf(value, "%d", OCmemory_tune_time);
+ setProperty("OCmemory_tune_time", value);
+ sprintf(value, "%d", analog_meter);
+ setProperty("analog_meter", value);
+ sprintf(value, "%d", smeter);
+ setProperty("smeter", value);
+ sprintf(value, "%d", alc);
+ setProperty("alc", value);
#ifdef OLD_AUDIO
- sprintf(value,"%d",local_audio);
- setProperty("local_audio",value);
- sprintf(value,"%d",n_selected_output_device);
- setProperty("n_selected_output_device",value);
-#endif
- sprintf(value,"%d",local_microphone);
- setProperty("local_microphone",value);
-
- sprintf(value,"%d",enable_tx_equalizer);
- setProperty("enable_tx_equalizer",value);
- sprintf(value,"%d",tx_equalizer[0]);
- setProperty("tx_equalizer.0",value);
- sprintf(value,"%d",tx_equalizer[1]);
- setProperty("tx_equalizer.1",value);
- sprintf(value,"%d",tx_equalizer[2]);
- setProperty("tx_equalizer.2",value);
- sprintf(value,"%d",tx_equalizer[3]);
- setProperty("tx_equalizer.3",value);
- sprintf(value,"%d",enable_rx_equalizer);
- setProperty("enable_rx_equalizer",value);
- sprintf(value,"%d",rx_equalizer[0]);
- setProperty("rx_equalizer.0",value);
- sprintf(value,"%d",rx_equalizer[1]);
- setProperty("rx_equalizer.1",value);
- sprintf(value,"%d",rx_equalizer[2]);
- setProperty("rx_equalizer.2",value);
- sprintf(value,"%d",rx_equalizer[3]);
- setProperty("rx_equalizer.3",value);
- sprintf(value,"%d",rit_increment);
- setProperty("rit_increment",value);
- sprintf(value,"%d",pre_emphasize);
- setProperty("pre_emphasize",value);
-
- sprintf(value,"%d",vox_enabled);
- setProperty("vox_enabled",value);
- sprintf(value,"%f",vox_threshold);
- setProperty("vox_threshold",value);
- sprintf(value,"%f",vox_hang);
- setProperty("vox_hang",value);
-
- sprintf(value,"%d",binaural);
- setProperty("binaural",value);
-
- sprintf(value,"%lld",calibration);
- setProperty("calibration",value);
-
- sprintf(value,"%lld",frequencyB);
- setProperty("frequencyB",value);
- sprintf(value,"%d",modeB);
- setProperty("modeB",value);
- sprintf(value,"%d",filterB);
- setProperty("filterB",value);
-
- sprintf(value,"%f",tone_level);
- setProperty("tone_level",value);
+ sprintf(value, "%d", local_audio);
+ setProperty("local_audio", value);
+ sprintf(value, "%d", n_selected_output_device);
+ setProperty("n_selected_output_device", value);
+#endif
+ sprintf(value, "%d", local_microphone);
+ setProperty("local_microphone", value);
+
+ sprintf(value, "%d", enable_tx_equalizer);
+ setProperty("enable_tx_equalizer", value);
+ sprintf(value, "%d", tx_equalizer[0]);
+ setProperty("tx_equalizer.0", value);
+ sprintf(value, "%d", tx_equalizer[1]);
+ setProperty("tx_equalizer.1", value);
+ sprintf(value, "%d", tx_equalizer[2]);
+ setProperty("tx_equalizer.2", value);
+ sprintf(value, "%d", tx_equalizer[3]);
+ setProperty("tx_equalizer.3", value);
+ sprintf(value, "%d", enable_rx_equalizer);
+ setProperty("enable_rx_equalizer", value);
+ sprintf(value, "%d", rx_equalizer[0]);
+ setProperty("rx_equalizer.0", value);
+ sprintf(value, "%d", rx_equalizer[1]);
+ setProperty("rx_equalizer.1", value);
+ sprintf(value, "%d", rx_equalizer[2]);
+ setProperty("rx_equalizer.2", value);
+ sprintf(value, "%d", rx_equalizer[3]);
+ setProperty("rx_equalizer.3", value);
+ sprintf(value, "%d", rit_increment);
+ setProperty("rit_increment", value);
+ sprintf(value, "%d", pre_emphasize);
+ setProperty("pre_emphasize", value);
+
+ sprintf(value, "%d", vox_enabled);
+ setProperty("vox_enabled", value);
+ sprintf(value, "%f", vox_threshold);
+ setProperty("vox_threshold", value);
+ sprintf(value, "%f", vox_hang);
+ setProperty("vox_hang", value);
+
+ sprintf(value, "%d", binaural);
+ setProperty("binaural", value);
+
+ sprintf(value, "%lld", calibration);
+ setProperty("calibration", value);
+
+ sprintf(value, "%lld", frequencyB);
+ setProperty("frequencyB", value);
+ sprintf(value, "%d", modeB);
+ setProperty("modeB", value);
+ sprintf(value, "%d", filterB);
+ setProperty("filterB", value);
+
+ sprintf(value, "%f", tone_level);
+ setProperty("tone_level", value);
/*
sprintf(value,"%d",adc_attenuation[0]);
sprintf(value,"%d",adc_attenuation[1]);
setProperty("adc_1_attenuation",value);
*/
-
- sprintf(value,"%d",rx_gain_calibration);
- setProperty("rx_gain_calibration",value);
-
- sprintf(value,"%d", adc[0].filters);
- setProperty("radio.adc[0].filters",value);
- sprintf(value,"%d", adc[0].hpf);
- setProperty("radio.adc[0].hpf",value);
- sprintf(value,"%d", adc[0].lpf);
- setProperty("radio.adc[0].lpf",value);
- sprintf(value,"%d", adc[0].antenna);
- setProperty("radio.adc[0].antenna",value);
- sprintf(value,"%d", adc[0].dither);
- setProperty("radio.adc[0].dither",value);
- sprintf(value,"%d", adc[0].random);
- setProperty("radio.adc[0].random",value);
- sprintf(value,"%d", adc[0].preamp);
- setProperty("radio.adc[0].preamp",value);
- sprintf(value,"%d", adc[0].attenuation);
- setProperty("radio.adc[0].attenuation",value);
- sprintf(value,"%d", adc[0].enable_step_attenuation);
- setProperty("radio.adc[0].enable_step_attenuation",value);
- sprintf(value,"%f", adc[0].gain);
- setProperty("radio.adc[0].gain",value);
- sprintf(value,"%f", adc[0].min_gain);
- setProperty("radio.adc[0].min_gain",value);
- sprintf(value,"%f", adc[0].max_gain);
- setProperty("radio.adc[0].max_gain",value);
-
-
-#ifdef SOAPYSDR
- if(device==SOAPYSDR_USB_DEVICE) {
- sprintf(value,"%d", soapy_protocol_get_automatic_gain(receiver[0]));
- setProperty("radio.adc[0].agc",value);
- }
-#endif
-
- sprintf(value,"%d", dac[0].antenna);
- setProperty("radio.dac[0].antenna",value);
- sprintf(value,"%f", dac[0].gain);
- setProperty("radio.dac[0].gain",value);
-
- if(receivers>1) {
- sprintf(value,"%d", adc[1].filters);
- setProperty("radio.adc[1].filters",value);
- sprintf(value,"%d", adc[1].hpf);
- setProperty("radio.adc[1].hpf",value);
- sprintf(value,"%d", adc[1].lpf);
- setProperty("radio.adc[1].lpf",value);
- sprintf(value,"%d", adc[1].antenna);
- setProperty("radio.adc[1].antenna",value);
- sprintf(value,"%d", adc[1].dither);
- setProperty("radio.adc[1].dither",value);
- sprintf(value,"%d", adc[1].random);
- setProperty("radio.adc[1].random",value);
- sprintf(value,"%d", adc[1].preamp);
- setProperty("radio.adc[1].preamp",value);
- sprintf(value,"%d", adc[1].attenuation);
- setProperty("radio.adc[1].attenuation",value);
- sprintf(value,"%d", adc[1].enable_step_attenuation);
- setProperty("radio.adc[1].enable_step_attenuation",value);
- sprintf(value,"%f", adc[1].gain);
- setProperty("radio.adc[1].gain",value);
- sprintf(value,"%f", adc[1].min_gain);
- setProperty("radio.adc[1].min_gain",value);
- sprintf(value,"%f", adc[1].max_gain);
- setProperty("radio.adc[1].max_gain",value);
-
-#ifdef SOAPYSDR
- if(device==SOAPYSDR_USB_DEVICE) {
- sprintf(value,"%d", soapy_protocol_get_automatic_gain(receiver[1]));
- setProperty("radio.adc[1].agc",value);
+
+ sprintf(value, "%d", rx_gain_calibration);
+ setProperty("rx_gain_calibration", value);
+
+ sprintf(value, "%d", adc[0].filters);
+ setProperty("radio.adc[0].filters", value);
+ sprintf(value, "%d", adc[0].hpf);
+ setProperty("radio.adc[0].hpf", value);
+ sprintf(value, "%d", adc[0].lpf);
+ setProperty("radio.adc[0].lpf", value);
+ sprintf(value, "%d", adc[0].antenna);
+ setProperty("radio.adc[0].antenna", value);
+ sprintf(value, "%d", adc[0].dither);
+ setProperty("radio.adc[0].dither", value);
+ sprintf(value, "%d", adc[0].random);
+ setProperty("radio.adc[0].random", value);
+ sprintf(value, "%d", adc[0].preamp);
+ setProperty("radio.adc[0].preamp", value);
+ sprintf(value, "%d", adc[0].attenuation);
+ setProperty("radio.adc[0].attenuation", value);
+ sprintf(value, "%d", adc[0].enable_step_attenuation);
+ setProperty("radio.adc[0].enable_step_attenuation", value);
+ sprintf(value, "%f", adc[0].gain);
+ setProperty("radio.adc[0].gain", value);
+ sprintf(value, "%f", adc[0].min_gain);
+ setProperty("radio.adc[0].min_gain", value);
+ sprintf(value, "%f", adc[0].max_gain);
+ setProperty("radio.adc[0].max_gain", value);
+
+#ifdef SOAPYSDR
+ if (device == SOAPYSDR_USB_DEVICE) {
+ sprintf(value, "%d", soapy_protocol_get_automatic_gain(receiver[0]));
+ setProperty("radio.adc[0].agc", value);
+ }
+#endif
+
+ sprintf(value, "%d", dac[0].antenna);
+ setProperty("radio.dac[0].antenna", value);
+ sprintf(value, "%f", dac[0].gain);
+ setProperty("radio.dac[0].gain", value);
+
+ if (receivers > 1) {
+ sprintf(value, "%d", adc[1].filters);
+ setProperty("radio.adc[1].filters", value);
+ sprintf(value, "%d", adc[1].hpf);
+ setProperty("radio.adc[1].hpf", value);
+ sprintf(value, "%d", adc[1].lpf);
+ setProperty("radio.adc[1].lpf", value);
+ sprintf(value, "%d", adc[1].antenna);
+ setProperty("radio.adc[1].antenna", value);
+ sprintf(value, "%d", adc[1].dither);
+ setProperty("radio.adc[1].dither", value);
+ sprintf(value, "%d", adc[1].random);
+ setProperty("radio.adc[1].random", value);
+ sprintf(value, "%d", adc[1].preamp);
+ setProperty("radio.adc[1].preamp", value);
+ sprintf(value, "%d", adc[1].attenuation);
+ setProperty("radio.adc[1].attenuation", value);
+ sprintf(value, "%d", adc[1].enable_step_attenuation);
+ setProperty("radio.adc[1].enable_step_attenuation", value);
+ sprintf(value, "%f", adc[1].gain);
+ setProperty("radio.adc[1].gain", value);
+ sprintf(value, "%f", adc[1].min_gain);
+ setProperty("radio.adc[1].min_gain", value);
+ sprintf(value, "%f", adc[1].max_gain);
+ setProperty("radio.adc[1].max_gain", value);
+
+#ifdef SOAPYSDR
+ if (device == SOAPYSDR_USB_DEVICE) {
+ sprintf(value, "%d", soapy_protocol_get_automatic_gain(receiver[1]));
+ setProperty("radio.adc[1].agc", value);
}
#endif
-
- sprintf(value,"%d", dac[1].antenna);
- setProperty("radio.dac[1].antenna",value);
- sprintf(value,"%f", dac[1].gain);
- setProperty("radio.dac[1].gain",value);
+
+ sprintf(value, "%d", dac[1].antenna);
+ setProperty("radio.dac[1].antenna", value);
+ sprintf(value, "%f", dac[1].gain);
+ setProperty("radio.dac[1].gain", value);
}
- sprintf(value,"%d",receivers);
- setProperty("receivers",value);
-
- sprintf(value,"%d",iqswap);
- setProperty("iqswap",value);
-
+ sprintf(value, "%d", receivers);
+ setProperty("receivers", value);
+
+ sprintf(value, "%d", iqswap);
+ setProperty("iqswap", value);
+
#ifdef CLIENT_SERVER
- sprintf(value,"%d",hpsdr_server);
- setProperty("radio.hpsdr_server",value);
- sprintf(value,"%d",listen_port);
- setProperty("radio.hpsdr_server.listen_port",value);
+ sprintf(value, "%d", hpsdr_server);
+ setProperty("radio.hpsdr_server", value);
+ sprintf(value, "%d", listen_port);
+ setProperty("radio.hpsdr_server.listen_port", value);
#endif
vfo_save_state();
modesettings_save_state();
- sprintf(value,"%d",duplex);
- setProperty("duplex",value);
- sprintf(value,"%d",split);
- setProperty("split",value);
- sprintf(value,"%d",sat_mode);
- setProperty("sat_mode",value);
- sprintf(value,"%d",mute_rx_while_transmitting);
- setProperty("mute_rx_while_transmitting",value);
+ sprintf(value, "%d", duplex);
+ setProperty("duplex", value);
+ sprintf(value, "%d", split);
+ setProperty("split", value);
+ sprintf(value, "%d", sat_mode);
+ setProperty("sat_mode", value);
+ sprintf(value, "%d", mute_rx_while_transmitting);
+ setProperty("mute_rx_while_transmitting", value);
filterSaveState();
bandSaveState();
memSaveState();
- sprintf(value,"%d",rigctl_enable);
- setProperty("rigctl_enable",value);
- sprintf(value,"%d",rigctl_port_base);
- setProperty("rigctl_port_base",value);
+ sprintf(value, "%d", rigctl_enable);
+ setProperty("rigctl_enable", value);
+ sprintf(value, "%d", rigctl_port_base);
+ setProperty("rigctl_port_base", value);
- sprintf(value,"%d",display_sequence_errors);
- setProperty("radio.display_sequence_errors",value);
+ sprintf(value, "%d", display_sequence_errors);
+ setProperty("radio.display_sequence_errors", value);
#ifdef CLIENT_SERVER
}
#endif
#ifdef MIDI
- sprintf(value,"%d",midi_enabled);
- setProperty("radio.midi_enabled",value);
+ sprintf(value, "%d", midi_enabled);
+ setProperty("radio.midi_enabled", value);
midi_save_state();
#endif
double display_avb;
int display_average;
- double t=0.001*display_average_time;
+ double t = 0.001 * display_average_time;
display_avb = exp(-1.0 / ((double)rx->fps * t));
display_average = max(2, (int)fmin(60, (double)rx->fps * t));
SetDisplayAvBackmult(rx->id, 0, display_avb);
void set_filter_type(int filter_type) {
int i;
- //g_print("set_filter_type: %d\n",filter_type);
- for(i=0;i<RECEIVERS;i++) {
- receiver[i]->low_latency=filter_type;
+ // g_print("set_filter_type: %d\n",filter_type);
+ for (i = 0; i < RECEIVERS; i++) {
+ receiver[i]->low_latency = filter_type;
RXASetMP(receiver[i]->id, filter_type);
}
- transmitter->low_latency=filter_type;
+ transmitter->low_latency = filter_type;
TXASetMP(transmitter->id, filter_type);
}
void set_filter_size(int filter_size) {
int i;
- //g_print("set_filter_size: %d\n",filter_size);
- for(i=0;i<RECEIVERS;i++) {
- receiver[i]->fft_size=filter_size;
+ // g_print("set_filter_size: %d\n",filter_size);
+ for (i = 0; i < RECEIVERS; i++) {
+ receiver[i]->fft_size = filter_size;
RXASetNC(receiver[i]->id, filter_size);
}
- transmitter->fft_size=filter_size;
+ transmitter->fft_size = filter_size;
TXASetNC(transmitter->id, filter_size);
}
void radio_change_region(int r) {
- region=r;
+ region = r;
switch (region) {
- case REGION_UK:
- channel_entries=UK_CHANNEL_ENTRIES;
- band_channels_60m=&band_channels_60m_UK[0];
- bandstack60.entries=UK_CHANNEL_ENTRIES;
- bandstack60.current_entry=0;
- bandstack60.entry=bandstack_entries60_UK;
- break;
- case REGION_OTHER:
- channel_entries=OTHER_CHANNEL_ENTRIES;
- band_channels_60m=&band_channels_60m_OTHER[0];
- bandstack60.entries=OTHER_CHANNEL_ENTRIES;
- bandstack60.current_entry=0;
- bandstack60.entry=bandstack_entries60_OTHER;
- break;
- case REGION_WRC15:
- channel_entries=WRC15_CHANNEL_ENTRIES;
- band_channels_60m=&band_channels_60m_WRC15[0];
- bandstack60.entries=WRC15_CHANNEL_ENTRIES;
- bandstack60.current_entry=0;
- bandstack60.entry=bandstack_entries60_WRC15;
- break;
+ case REGION_UK:
+ channel_entries = UK_CHANNEL_ENTRIES;
+ band_channels_60m = &band_channels_60m_UK[0];
+ bandstack60.entries = UK_CHANNEL_ENTRIES;
+ bandstack60.current_entry = 0;
+ bandstack60.entry = bandstack_entries60_UK;
+ break;
+ case REGION_OTHER:
+ channel_entries = OTHER_CHANNEL_ENTRIES;
+ band_channels_60m = &band_channels_60m_OTHER[0];
+ bandstack60.entries = OTHER_CHANNEL_ENTRIES;
+ bandstack60.current_entry = 0;
+ bandstack60.entry = bandstack_entries60_OTHER;
+ break;
+ case REGION_WRC15:
+ channel_entries = WRC15_CHANNEL_ENTRIES;
+ band_channels_60m = &band_channels_60m_WRC15[0];
+ bandstack60.entries = WRC15_CHANNEL_ENTRIES;
+ bandstack60.current_entry = 0;
+ bandstack60.entry = bandstack_entries60_WRC15;
+ break;
}
}
#ifdef CLIENT_SERVER
int remote_start(void *data) {
- char *server=(char *)data;
- sprintf(property_path,"%s@%s.props",name,server);
- radio_is_remote=TRUE;
+ char *server = (char *)data;
+ sprintf(property_path, "%s@%s.props", name, server);
+ radio_is_remote = TRUE;
#ifdef GPIO
- switch(controller) {
- case CONTROLLER2_V1:
- case CONTROLLER2_V2:
- display_zoompan=1;
- display_sliders=0;
- display_toolbar=0;
- break;
- default:
- display_zoompan=1;
- display_sliders=1;
- display_toolbar=1;
- break;
+ switch (controller) {
+ case CONTROLLER2_V1:
+ case CONTROLLER2_V2:
+ display_zoompan = 1;
+ display_sliders = 0;
+ display_toolbar = 0;
+ break;
+ default:
+ display_zoompan = 1;
+ display_sliders = 1;
+ display_toolbar = 1;
+ break;
}
#else
- display_zoompan=1;
- display_sliders=1;
- display_toolbar=1;
+ display_zoompan = 1;
+ display_sliders = 1;
+ display_toolbar = 1;
#endif
radioRestoreState();
create_visual();
- for(int i=0;i<receivers;i++) {
+ for (int i = 0; i < receivers; i++) {
receiver_restore_state(receiver[i]);
- if(receiver[i]->local_audio) {
- if(audio_open_output(receiver[i])) {
- receiver[i]->local_audio=0;
+ if (receiver[i]->local_audio) {
+ if (audio_open_output(receiver[i])) {
+ receiver[i]->local_audio = 0;
}
}
}
reconfigure_radio();
- g_idle_add(ext_vfo_update,(gpointer)NULL);
- gdk_window_set_cursor(gtk_widget_get_window(top_window),gdk_cursor_new(GDK_ARROW));
+ g_idle_add(ext_vfo_update, (gpointer)NULL);
+ gdk_window_set_cursor(gtk_widget_get_window(top_window),
+ gdk_cursor_new(GDK_ARROW));
#ifdef MIDI
MIDIstartup();
#endif
- for(int i=0;i<receivers;i++) {
- gint timer_id=gdk_threads_add_timeout_full(G_PRIORITY_DEFAULT_IDLE,100, start_spectrum, receiver[i], NULL);
+ for (int i = 0; i < receivers; i++) {
+ gint timer_id = gdk_threads_add_timeout_full(
+ G_PRIORITY_DEFAULT_IDLE, 100, start_spectrum, receiver[i], NULL);
}
start_vfo_timer();
- remote_started=TRUE;
+ remote_started = TRUE;
return 0;
}
#endif
* With a kindly assist from Jae, K5JAE who has helped
* greatly with hamlib integration!
*/
-#include <gtk/gtk.h>
-#include <gdk/gdk.h>
#include <errno.h>
-#include <fcntl.h>
+#include <fcntl.h>
+#include <gdk/gdk.h>
+#include <gtk/gtk.h>
#include <string.h>
#include <termios.h>
#include <unistd.h>
//#include <semaphore.h>
-#include <stdio.h>
-#include <stdint.h>
-#include <stdlib.h>
-#include "receiver.h"
-#include "toolbar.h"
+#include "agc.h"
+#include "band.h"
#include "band_menu.h"
-#include "sliders.h"
-#include "rigctl.h"
-#include "radio.h"
+#include "bandstack.h"
#include "channel.h"
+#include "ext.h"
#include "filter.h"
-#include "mode.h"
-#include "filter.h"
-#include "band.h"
-#include "bandstack.h"
#include "filter_menu.h"
-#include "vfo.h"
+#include "mode.h"
+#include "new_protocol.h"
+#include "noise_menu.h"
+#include "old_protocol.h"
+#include "radio.h"
+#include "receiver.h"
+#include "rigctl.h"
+#include "rigctl_menu.h"
#include "sliders.h"
+#include "store.h"
+#include "toolbar.h"
#include "transmitter.h"
-#include "agc.h"
+#include "vfo.h"
+#include "zoompan.h"
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
#include <wdsp.h>
-#include "store.h"
-#include "ext.h"
-#include "rigctl_menu.h"
-#include "noise_menu.h"
-#include "new_protocol.h"
#ifdef LOCALCW
-#include "iambic.h" // declare keyer_update()
+#include "iambic.h" // declare keyer_update()
#endif
#include <math.h>
#define NEW_PARSER
// IP stuff below
-#include <sys/socket.h>
#include <arpa/inet.h> //inet_addr
+#include <sys/socket.h>
-int rigctl_port_base=19090;
-int rigctl_enable=0;
+int rigctl_port_base = 19090;
+int rigctl_enable = 0;
// the port client will be connecting to
// 2-26-17 K5JAE - Changed the defines to const ints to allow use via pointers.
static const int TelnetPortB = 19091;
static const int TelnetPortC = 19092;
-#define RIGCTL_THROTTLE_NSEC 15000000L
-#define NSEC_PER_SEC 1000000000L
+#define RIGCTL_THROTTLE_NSEC 15000000L
+#define NSEC_PER_SEC 1000000000L
// max number of bytes we can get at once
#define MAXDATASIZE 2000
-int parse_cmd (void *data);
+int parse_cmd(void *data);
int connect_cnt = 0;
int rigctlGetFilterLow();
int rigctlGetFilterHigh();
int new_level;
int active_transmitter = 0;
-int rigctl_busy = 0; // Used to tell rigctl_menu that launch has already occured
+int rigctl_busy = 0; // Used to tell rigctl_menu that launch has already occured
int cat_control;
extern int enable_tx_equalizer;
-typedef struct {GMutex m; } GT_MUTEX;
-GT_MUTEX * mutex_a;
-GT_MUTEX * mutex_b;
-GT_MUTEX * mutex_c;
-GT_MUTEX * mutex_busy;
+typedef struct {
+ GMutex m;
+} GT_MUTEX;
+GT_MUTEX *mutex_a;
+GT_MUTEX *mutex_b;
+GT_MUTEX *mutex_c;
+GT_MUTEX *mutex_busy;
int mutex_b_exists = 0;
-
-FILE * out;
-int output;
-FILTER * band_filter;
+FILE *out;
+int output;
+FILTER *band_filter;
#define MAX_CLIENTS 3
static GThread *rigctl_server_thread_id = NULL;
static int server_running;
static GThread *serial_server_thread_id = NULL;
-static gboolean serial_running=FALSE;
+static gboolean serial_running = FALSE;
-static int server_socket=-1;
+static int server_socket = -1;
static int server_address_length;
static struct sockaddr_in server_address;
char *command;
} COMMAND;
-int fd; // Serial port file descriptor
+int fd; // Serial port file descriptor
static CLIENT client[MAX_CLIENTS];
-int squelch=-160; //local sim of squelch level
-int fine = 0; // FINE status for TS-2000 decides whether rit_increment is 1Hz/10Hz.
-
+int squelch = -160; // local sim of squelch level
+int fine =
+ 0; // FINE status for TS-2000 decides whether rit_increment is 1Hz/10Hz.
int read_size;
-int freq_flag; // Determines if we are in the middle of receiving frequency info
+int freq_flag; // Determines if we are in the middle of receiving frequency info
int digl_offset = 0;
int digl_pol = 0;
int digu_offset = 0;
int digu_pol = 0;
double new_vol = 0;
-int lcl_cmd=0;
+int lcl_cmd = 0;
long long new_freqA = 0;
long long new_freqB = 0;
long long orig_freqA = 0;
long long orig_freqB = 0;
-int lcl_split = 0;
-int mox_state = 0;
-// Radio functions -
-// Memory channel stuff and things that aren't
+int lcl_split = 0;
+int mox_state = 0;
+// Radio functions -
+// Memory channel stuff and things that aren't
// implemented - but here for a more complete emulation
-int ctcss_tone; // Numbers 01-38 are legal values - set by CN command, read by CT command
-int ctcss_mode; // Numbers 0/1 - on off.
+int ctcss_tone; // Numbers 01-38 are legal values - set by CN command, read by
+ // CT command
+int ctcss_mode; // Numbers 0/1 - on off.
-static gpointer rigctl_client (gpointer data);
+static gpointer rigctl_client(gpointer data);
void close_rigctl_ports() {
int i;
- struct linger linger = { 0 };
+ struct linger linger = {0};
linger.l_onoff = 1;
linger.l_linger = 0;
- g_print("close_rigctl_ports: server_socket=%d\n",server_socket);
- server_running=0;
- for(i=0;i<MAX_CLIENTS;i++) {
- if(client[i].fd!=-1) {
- g_print("setting SO_LINGER to 0 for client_socket: %d\n",client[i].fd);
- if(setsockopt(client[i].fd,SOL_SOCKET,SO_LINGER,(const char *)&linger,sizeof(linger))==-1) {
- perror("setsockopt(...,SO_LINGER,...) failed for client");
- }
- g_print("closing client socket: %d\n",client[i].fd);
- close(client[i].fd);
- client[i].fd=-1;
+ g_print("close_rigctl_ports: server_socket=%d\n", server_socket);
+ server_running = 0;
+ for (i = 0; i < MAX_CLIENTS; i++) {
+ if (client[i].fd != -1) {
+ g_print("setting SO_LINGER to 0 for client_socket: %d\n", client[i].fd);
+ if (setsockopt(client[i].fd, SOL_SOCKET, SO_LINGER, (const char *)&linger,
+ sizeof(linger)) == -1) {
+ perror("setsockopt(...,SO_LINGER,...) failed for client");
}
+ g_print("closing client socket: %d\n", client[i].fd);
+ close(client[i].fd);
+ client[i].fd = -1;
+ }
}
- if(server_socket>=0) {
- g_print("setting SO_LINGER to 0 for server_socket: %d\n",server_socket);
- if(setsockopt(server_socket,SOL_SOCKET,SO_LINGER,(const char *)&linger,sizeof(linger))==-1) {
+ if (server_socket >= 0) {
+ g_print("setting SO_LINGER to 0 for server_socket: %d\n", server_socket);
+ if (setsockopt(server_socket, SOL_SOCKET, SO_LINGER, (const char *)&linger,
+ sizeof(linger)) == -1) {
perror("setsockopt(...,SO_LINGER,...) failed for server");
}
- g_print("closing server_socket: %d\n",server_socket);
+ g_print("closing server_socket: %d\n", server_socket);
close(server_socket);
- server_socket=-1;
+ server_socket = -1;
}
}
-int vfo_sm=0; // VFO State Machine - this keeps track of
+int vfo_sm = 0; // VFO State Machine - this keeps track of
-//
+//
// CW sending stuff
//
static char cw_buf[30];
-static int cw_busy=0;
-static int cat_cw_seen=0;
+static int cw_busy = 0;
+static int cat_cw_seen = 0;
static int dotlen;
static int dashlen;
static int dashsamples;
//
-// send_dash() send a "key-down" of a dashlen, followed by a "key-up" of a dotlen
-// send_dot() send a "key-down" of a dotlen, followed by a "key-up" of a dotlen
-// send_space(int len) send a "key_down" of zero, followed by a "key-up" of len*dotlen
+// send_dash() send a "key-down" of a dashlen, followed by a "key-up" of
+// a dotlen send_dot() send a "key-down" of a dotlen, followed by a
+// "key-up" of a dotlen send_space(int len) send a "key_down" of zero, followed
+// by a "key-up" of len*dotlen
//
-// The "trick" to get proper timing is, that we really specify the number of samples
-// for the next element (dash/dot/nothing) and the following pause. 30 wpm is no
-// problem, and without too much "busy waiting". We just take a nap until 10 msec
-// before we have to act, and then wait several times for 1 msec until we can shoot.
+// The "trick" to get proper timing is, that we really specify the number of
+// samples for the next element (dash/dot/nothing) and the following pause. 30
+// wpm is no problem, and without too much "busy waiting". We just take a nap
+// until 10 msec before we have to act, and then wait several times for 1 msec
+// until we can shoot.
//
void send_dash() {
int TimeToGo;
- for(;;) {
- TimeToGo=cw_key_up+cw_key_down;
+ for (;;) {
+ TimeToGo = cw_key_up + cw_key_down;
// TimeToGo is invalid if local CW keying has set in
- if (cw_key_hit || cw_not_ready) return;
- if (TimeToGo == 0) break;
+ if (cw_key_hit || cw_not_ready)
+ return;
+ if (TimeToGo == 0)
+ break;
// sleep until 10 msec before ignition
- if (TimeToGo > 500) usleep((long)(TimeToGo-500)*20L);
+ if (TimeToGo > 500)
+ usleep((long)(TimeToGo - 500) * 20L);
// sleep 1 msec
usleep(1000L);
}
// If local CW keying has set in, do not interfere
- if (cw_key_hit || cw_not_ready) return;
+ if (cw_key_hit || cw_not_ready)
+ return;
cw_key_down = dashsamples;
- cw_key_up = dotsamples;
+ cw_key_up = dotsamples;
}
void send_dot() {
int TimeToGo;
- for(;;) {
- TimeToGo=cw_key_up+cw_key_down;
+ for (;;) {
+ TimeToGo = cw_key_up + cw_key_down;
// TimeToGo is invalid if local CW keying has set in
- if (cw_key_hit || cw_not_ready) return;
- if (TimeToGo == 0) break;
+ if (cw_key_hit || cw_not_ready)
+ return;
+ if (TimeToGo == 0)
+ break;
// sleep until 10 msec before ignition
- if (TimeToGo > 500) usleep((long)(TimeToGo-500)*20L);
+ if (TimeToGo > 500)
+ usleep((long)(TimeToGo - 500) * 20L);
// sleep 1 msec
usleep(1000L);
}
// If local CW keying has set in, do not interfere
- if (cw_key_hit || cw_not_ready) return;
+ if (cw_key_hit || cw_not_ready)
+ return;
cw_key_down = dotsamples;
- cw_key_up = dotsamples;
+ cw_key_up = dotsamples;
}
void send_space(int len) {
int TimeToGo;
- for(;;) {
- TimeToGo=cw_key_up+cw_key_down;
+ for (;;) {
+ TimeToGo = cw_key_up + cw_key_down;
// TimeToGo is invalid if local CW keying has set in
- if (cw_key_hit || cw_not_ready) return;
- if (TimeToGo == 0) break;
+ if (cw_key_hit || cw_not_ready)
+ return;
+ if (TimeToGo == 0)
+ break;
// sleep until 10 msec before ignition
- if (TimeToGo > 500) usleep((long)(TimeToGo-500)*20L);
+ if (TimeToGo > 500)
+ usleep((long)(TimeToGo - 500) * 20L);
// sleep 1 msec
usleep(1000L);
}
// If local CW keying has set in, do not interfere
- if (cw_key_hit || cw_not_ready) return;
- cw_key_up = len*dotsamples;
+ if (cw_key_hit || cw_not_ready)
+ return;
+ cw_key_up = len * dotsamples;
}
void rigctl_send_cw_char(char cw_char) {
- char pattern[9],*ptr;
- strcpy(pattern,"");
- ptr = &pattern[0];
- switch (cw_char) {
- case 'a':
- case 'A': strcpy(pattern,".-"); break;
- case 'b':
- case 'B': strcpy(pattern,"-..."); break;
- case 'c':
- case 'C': strcpy(pattern,"-.-."); break;
- case 'd':
- case 'D': strcpy(pattern,"-.."); break;
- case 'e':
- case 'E': strcpy(pattern,"."); break;
- case 'f':
- case 'F': strcpy(pattern,"..-."); break;
- case 'g':
- case 'G': strcpy(pattern,"--."); break;
- case 'h':
- case 'H': strcpy(pattern,"...."); break;
- case 'i':
- case 'I': strcpy(pattern,".."); break;
- case 'j':
- case 'J': strcpy(pattern,".---"); break;
- case 'k':
- case 'K': strcpy(pattern,"-.-"); break;
- case 'l':
- case 'L': strcpy(pattern,".-.."); break;
- case 'm':
- case 'M': strcpy(pattern,"--"); break;
- case 'n':
- case 'N': strcpy(pattern,"-."); break;
- case 'o':
- case 'O': strcpy(pattern,"---"); break;
- case 'p':
- case 'P': strcpy(pattern,".--."); break;
- case 'q':
- case 'Q': strcpy(pattern,"--.-"); break;
- case 'r':
- case 'R': strcpy(pattern,".-."); break;
- case 's':
- case 'S': strcpy(pattern,"..."); break;
- case 't':
- case 'T': strcpy(pattern,"-"); break;
- case 'u':
- case 'U': strcpy(pattern,"..-"); break;
- case 'v':
- case 'V': strcpy(pattern,"...-"); break;
- case 'w':
- case 'W': strcpy(pattern,".--"); break;
- case 'x':
- case 'X': strcpy(pattern,"-..-"); break;
- case 'y':
- case 'Y': strcpy(pattern,"-.--"); break;
- case 'z':
- case 'Z': strcpy(pattern,"--.."); break;
- case '0': strcpy(pattern,"-----"); break;
- case '1': strcpy(pattern,".----"); break;
- case '2': strcpy(pattern,"..---"); break;
- case '3': strcpy(pattern,"...--"); break;
- case '4': strcpy(pattern,"....-"); break;
- case '5': strcpy(pattern,".....");break;
- case '6': strcpy(pattern,"-....");break;
- case '7': strcpy(pattern,"--...");break;
- case '8': strcpy(pattern,"---..");break;
- case '9': strcpy(pattern,"----.");break;
-//
-// DL1YCF:
-// There were some signs I considered wrong, other
-// signs missing. Therefore I put the signs here
-// from ITU Recommendation M.1677-1 (2009)
-// in the order given there.
-//
- case '.': strcpy(pattern,".-.-.-"); break;
- case ',': strcpy(pattern,"--..--"); break;
- case ':': strcpy(pattern,"---.."); break;
- case '?': strcpy(pattern,"..--.."); break;
- case '\'': strcpy(pattern,".----."); break;
- case '-': strcpy(pattern,"-....-"); break;
- case '/': strcpy(pattern,"-..-."); break;
- case '(': strcpy(pattern,"-.--."); break;
- case ')': strcpy(pattern,"-.--.-"); break;
- case '"': strcpy(pattern,".-..-."); break;
- case '=': strcpy(pattern,"-...-"); break;
- case '+': strcpy(pattern,".-.-."); break;
- case '@': strcpy(pattern,".--.-."); break;
-//
-// Often used, but not ITU: Ampersand for "wait"
-//
- case '&': strcpy(pattern,".-...");break;
- default: strcpy(pattern,"");
- }
-
- while(*ptr != '\0') {
- if(*ptr == '-') {
- send_dash();
- }
- if(*ptr == '.') {
- send_dot();
- }
- ptr++;
- }
-
- // The last element (dash or dot) sent already has one dotlen space appended.
- // If the current character is another "printable" sign, we need an additional
- // pause of 2 dotlens to form the inter-character spacing of 3 dotlens.
- // However if the current character is a "space" we must produce an inter-word
- // spacing (7 dotlens) and therefore need 6 additional dotlens
- // We need no longer take care of a sequence of spaces since adjacent spaces
- // are now filtered out while filling the CW character (ring-) buffer.
-
- if (cw_char == ' ') {
- send_space(6); // produce inter-word space of 7 dotlens
- } else {
- send_space(2); // produce inter-character space of 3 dotlens
+ char pattern[9], *ptr;
+ strcpy(pattern, "");
+ ptr = &pattern[0];
+ switch (cw_char) {
+ case 'a':
+ case 'A':
+ strcpy(pattern, ".-");
+ break;
+ case 'b':
+ case 'B':
+ strcpy(pattern, "-...");
+ break;
+ case 'c':
+ case 'C':
+ strcpy(pattern, "-.-.");
+ break;
+ case 'd':
+ case 'D':
+ strcpy(pattern, "-..");
+ break;
+ case 'e':
+ case 'E':
+ strcpy(pattern, ".");
+ break;
+ case 'f':
+ case 'F':
+ strcpy(pattern, "..-.");
+ break;
+ case 'g':
+ case 'G':
+ strcpy(pattern, "--.");
+ break;
+ case 'h':
+ case 'H':
+ strcpy(pattern, "....");
+ break;
+ case 'i':
+ case 'I':
+ strcpy(pattern, "..");
+ break;
+ case 'j':
+ case 'J':
+ strcpy(pattern, ".---");
+ break;
+ case 'k':
+ case 'K':
+ strcpy(pattern, "-.-");
+ break;
+ case 'l':
+ case 'L':
+ strcpy(pattern, ".-..");
+ break;
+ case 'm':
+ case 'M':
+ strcpy(pattern, "--");
+ break;
+ case 'n':
+ case 'N':
+ strcpy(pattern, "-.");
+ break;
+ case 'o':
+ case 'O':
+ strcpy(pattern, "---");
+ break;
+ case 'p':
+ case 'P':
+ strcpy(pattern, ".--.");
+ break;
+ case 'q':
+ case 'Q':
+ strcpy(pattern, "--.-");
+ break;
+ case 'r':
+ case 'R':
+ strcpy(pattern, ".-.");
+ break;
+ case 's':
+ case 'S':
+ strcpy(pattern, "...");
+ break;
+ case 't':
+ case 'T':
+ strcpy(pattern, "-");
+ break;
+ case 'u':
+ case 'U':
+ strcpy(pattern, "..-");
+ break;
+ case 'v':
+ case 'V':
+ strcpy(pattern, "...-");
+ break;
+ case 'w':
+ case 'W':
+ strcpy(pattern, ".--");
+ break;
+ case 'x':
+ case 'X':
+ strcpy(pattern, "-..-");
+ break;
+ case 'y':
+ case 'Y':
+ strcpy(pattern, "-.--");
+ break;
+ case 'z':
+ case 'Z':
+ strcpy(pattern, "--..");
+ break;
+ case '0':
+ strcpy(pattern, "-----");
+ break;
+ case '1':
+ strcpy(pattern, ".----");
+ break;
+ case '2':
+ strcpy(pattern, "..---");
+ break;
+ case '3':
+ strcpy(pattern, "...--");
+ break;
+ case '4':
+ strcpy(pattern, "....-");
+ break;
+ case '5':
+ strcpy(pattern, ".....");
+ break;
+ case '6':
+ strcpy(pattern, "-....");
+ break;
+ case '7':
+ strcpy(pattern, "--...");
+ break;
+ case '8':
+ strcpy(pattern, "---..");
+ break;
+ case '9':
+ strcpy(pattern, "----.");
+ break;
+ //
+ // DL1YCF:
+ // There were some signs I considered wrong, other
+ // signs missing. Therefore I put the signs here
+ // from ITU Recommendation M.1677-1 (2009)
+ // in the order given there.
+ //
+ case '.':
+ strcpy(pattern, ".-.-.-");
+ break;
+ case ',':
+ strcpy(pattern, "--..--");
+ break;
+ case ':':
+ strcpy(pattern, "---..");
+ break;
+ case '?':
+ strcpy(pattern, "..--..");
+ break;
+ case '\'':
+ strcpy(pattern, ".----.");
+ break;
+ case '-':
+ strcpy(pattern, "-....-");
+ break;
+ case '/':
+ strcpy(pattern, "-..-.");
+ break;
+ case '(':
+ strcpy(pattern, "-.--.");
+ break;
+ case ')':
+ strcpy(pattern, "-.--.-");
+ break;
+ case '"':
+ strcpy(pattern, ".-..-.");
+ break;
+ case '=':
+ strcpy(pattern, "-...-");
+ break;
+ case '+':
+ strcpy(pattern, ".-.-.");
+ break;
+ case '@':
+ strcpy(pattern, ".--.-.");
+ break;
+ //
+ // Often used, but not ITU: Ampersand for "wait"
+ //
+ case '&':
+ strcpy(pattern, ".-...");
+ break;
+ default:
+ strcpy(pattern, "");
+ }
+
+ while (*ptr != '\0') {
+ if (*ptr == '-') {
+ send_dash();
+ }
+ if (*ptr == '.') {
+ send_dot();
}
+ ptr++;
+ }
+
+ // The last element (dash or dot) sent already has one dotlen space appended.
+ // If the current character is another "printable" sign, we need an additional
+ // pause of 2 dotlens to form the inter-character spacing of 3 dotlens.
+ // However if the current character is a "space" we must produce an inter-word
+ // spacing (7 dotlens) and therefore need 6 additional dotlens
+ // We need no longer take care of a sequence of spaces since adjacent spaces
+ // are now filtered out while filling the CW character (ring-) buffer.
+
+ if (cw_char == ' ') {
+ send_space(6); // produce inter-word space of 7 dotlens
+ } else {
+ send_space(2); // produce inter-character space of 3 dotlens
+ }
}
//
// the ring buffer, cw_busy is NOT reset. Eventually, there
// is enough space in the ring buffer, then cw_busy is reset.
//
-static gpointer rigctl_cw_thread(gpointer data)
-{
+static gpointer rigctl_cw_thread(gpointer data) {
int i;
char c;
- char last_char=0;
+ char last_char = 0;
char ring_buf[130];
- char *write_buf=ring_buf;
- char *read_buf =ring_buf;
+ char *write_buf = ring_buf;
+ char *read_buf = ring_buf;
char *p;
- int num_buf=0;
-
+ int num_buf = 0;
+
while (server_running) {
// wait for CW data (periodically look every 100 msec)
- if (!cw_busy && num_buf ==0) {
- cw_key_hit=0;
+ if (!cw_busy && num_buf == 0) {
+ cw_key_hit = 0;
usleep(100000L);
continue;
}
// to the maximum length (24)
if (cw_busy && num_buf < 100) {
- p=cw_buf;
- while ((c=*p++)) {
- if (last_char == ' ' && c == ' ') continue;
+ p = cw_buf;
+ while ((c = *p++)) {
+ if (last_char == ' ' && c == ' ')
+ continue;
*write_buf++ = c;
- last_char=c;
+ last_char = c;
num_buf++;
- if (write_buf - ring_buf == 128) write_buf=ring_buf; // wrap around
+ if (write_buf - ring_buf == 128)
+ write_buf = ring_buf; // wrap around
}
- cw_busy=0; // mark one-line buffer free again
+ cw_busy = 0; // mark one-line buffer free again
}
// This may happen if cw_buf was empty or contained only blanks
- if (num_buf == 0) continue;
+ if (num_buf == 0)
+ continue;
// these values may have changed, so recompute them here
// This means that we can change the speed (KS command) while
// the buffer is being sent
- dotlen = 1200000L/(long)cw_keyer_speed;
+ dotlen = 1200000L / (long)cw_keyer_speed;
dashlen = (dotlen * 3 * cw_keyer_weight) / 50L;
dotsamples = 57600 / cw_keyer_speed;
dashsamples = (3456 * cw_keyer_weight) / cw_keyer_speed;
- CAT_cw_is_active=1;
+ CAT_cw_is_active = 1;
if (!mox) {
- // activate PTT
- g_idle_add(ext_mox_update ,(gpointer)1);
- // have to wait until it is really there
- // Note that if out-of-band, we would wait
- // forever here, so allow at most 200 msec
- // We also have to wait for cw_not_ready becoming zero
- i=200;
- while ((!mox || cw_not_ready) && i-- > 0) usleep(1000L);
- // still no MOX? --> silently discard CW character and give up
- if (!mox) {
- CAT_cw_is_active=0;
- continue;
- }
+ // activate PTT
+ g_idle_add(ext_mox_update, (gpointer)1);
+ // have to wait until it is really there
+ // Note that if out-of-band, we would wait
+ // forever here, so allow at most 200 msec
+ // We also have to wait for cw_not_ready becoming zero
+ i = 200;
+ while ((!mox || cw_not_ready) && i-- > 0)
+ usleep(1000L);
+ // still no MOX? --> silently discard CW character and give up
+ if (!mox) {
+ CAT_cw_is_active = 0;
+ continue;
+ }
}
// At this point, mox==1 and CAT_cw_active == 1
if (cw_key_hit || cw_not_ready) {
- //
- // CW transmission has been aborted, either due to manually
- // removing MOX, changing the mode to non-CW, or because a CW key has been hit.
- // Do not remove PTT in the latter case
- CAT_cw_is_active=0;
- // If a CW key has been hit, we continue in TX mode.
- // Otherwise, switch PTT off.
- if (!cw_key_hit && mox) {
- g_idle_add(ext_mox_update ,(gpointer)0);
- }
- // Let the CAT system swallow incoming CW commands by setting cw_busy to -1.
- // Do so until no CAT CW message has arrived for 1 second
- cw_busy=-1;
- for (;;) {
- cat_cw_seen=0;
- usleep(1000000L);
- if (cat_cw_seen) continue;
- cw_busy=0;
- break;
- }
- write_buf=read_buf=ring_buf;
- num_buf=0;
+ //
+ // CW transmission has been aborted, either due to manually
+ // removing MOX, changing the mode to non-CW, or because a CW key has been
+ // hit. Do not remove PTT in the latter case
+ CAT_cw_is_active = 0;
+ // If a CW key has been hit, we continue in TX mode.
+ // Otherwise, switch PTT off.
+ if (!cw_key_hit && mox) {
+ g_idle_add(ext_mox_update, (gpointer)0);
+ }
+ // Let the CAT system swallow incoming CW commands by setting cw_busy to
+ // -1. Do so until no CAT CW message has arrived for 1 second
+ cw_busy = -1;
+ for (;;) {
+ cat_cw_seen = 0;
+ usleep(1000000L);
+ if (cat_cw_seen)
+ continue;
+ cw_busy = 0;
+ break;
+ }
+ write_buf = read_buf = ring_buf;
+ num_buf = 0;
} else {
rigctl_send_cw_char(*read_buf++);
- if (read_buf - ring_buf == 128) read_buf=ring_buf; // wrap around
+ if (read_buf - ring_buf == 128)
+ read_buf = ring_buf; // wrap around
num_buf--;
//
// Character has been sent.
// If there are more to send, or the next message is pending, continue.
// Otherwise remove PTT and wait for next CAT CW command.
- if (cw_busy || num_buf > 0) continue;
- CAT_cw_is_active=0;
+ if (cw_busy || num_buf > 0)
+ continue;
+ CAT_cw_is_active = 0;
if (!cw_key_hit) {
- g_idle_add(ext_mox_update ,(gpointer)0);
+ g_idle_add(ext_mox_update, (gpointer)0);
// wait up to 500 msec for MOX having gone
// otherwise there might be a race condition when sending
// the next character really soon
- i=10;
- while (mox && (i--) > 0) usleep(50000L);
+ i = 10;
+ while (mox && (i--) > 0)
+ usleep(50000L);
}
}
// end of while (server_running)
// local CW system gracefully, in case we were in the mid
// of a transmission
rigctl_cw_thread_id = NULL;
- cw_busy=0;
+ cw_busy = 0;
if (CAT_cw_is_active) {
- CAT_cw_is_active=0;
- g_idle_add(ext_mox_update ,(gpointer)0);
+ CAT_cw_is_active = 0;
+ g_idle_add(ext_mox_update, (gpointer)0);
}
return NULL;
}
-// This looks up the frequency of the Active receiver with
+// This looks up the frequency of the Active receiver with
// protection for 1 versus 2 receivers
long long rigctl_getFrequency() {
- if(receivers == 1) {
+ if (receivers == 1) {
return vfo[VFO_A].frequency;
} else {
return vfo[active_receiver->id].frequency;
- }
+ }
}
// Looks up entry INDEX_NUM in the command structure and
// returns the command string
//
-void send_resp (int fd,char * msg) {
- if(rigctl_debug) g_print("RIGCTL: RESP=%s\n",msg);
- int length=strlen(msg);
- int written=0;
-
- while(written<length) {
- written+=write(fd,&msg[written],length-written);
+void send_resp(int fd, char *msg) {
+ if (rigctl_debug)
+ g_print("RIGCTL: RESP=%s\n", msg);
+ int length = strlen(msg);
+ int written = 0;
+
+ while (written < length) {
+ written += write(fd, &msg[written], length - written);
}
-
}
//
//
static gpointer rigctl_server(gpointer data) {
- int port=GPOINTER_TO_INT(data);
- int on=1;
+ int port = GPOINTER_TO_INT(data);
+ int on = 1;
int i;
- g_print("rigctl_server: starting server on port %d\n",port);
+ g_print("rigctl_server: starting server on port %d\n", port);
- server_socket=socket(AF_INET,SOCK_STREAM,0);
- if(server_socket<0) {
+ server_socket = socket(AF_INET, SOCK_STREAM, 0);
+ if (server_socket < 0) {
perror("rigctl_server: listen socket failed");
return NULL;
}
setsockopt(server_socket, SOL_SOCKET, SO_REUSEPORT, &on, sizeof(on));
// bind to listening port
- memset(&server_address,0,sizeof(server_address));
- server_address.sin_family=AF_INET;
- server_address.sin_addr.s_addr=INADDR_ANY;
- server_address.sin_port=htons(port);
- if(bind(server_socket,(struct sockaddr*)&server_address,sizeof(server_address))<0) {
+ memset(&server_address, 0, sizeof(server_address));
+ server_address.sin_family = AF_INET;
+ server_address.sin_addr.s_addr = INADDR_ANY;
+ server_address.sin_port = htons(port);
+ if (bind(server_socket, (struct sockaddr *)&server_address,
+ sizeof(server_address)) < 0) {
perror("rigctl_server: listen socket bind failed");
close(server_socket);
return NULL;
}
- for(i=0;i<MAX_CLIENTS;i++) {
- client[i].fd=-1;
+ for (i = 0; i < MAX_CLIENTS; i++) {
+ client[i].fd = -1;
}
- server_running=1;
+ server_running = 1;
// must start the thread here in order NOT to inherit a lock
- if (!rigctl_cw_thread_id) rigctl_cw_thread_id = g_thread_new("RIGCTL cw", rigctl_cw_thread, NULL);
+ if (!rigctl_cw_thread_id)
+ rigctl_cw_thread_id = g_thread_new("RIGCTL cw", rigctl_cw_thread, NULL);
- while(server_running) {
+ while (server_running) {
// listen with a max queue of 3
- if(listen(server_socket,3)<0) {
+ if (listen(server_socket, 3) < 0) {
perror("rigctl_server: listen failed");
close(server_socket);
return NULL;
}
// find a spare thread
- for(i=0;i<MAX_CLIENTS;i++) {
- if(client[i].fd==-1) {
+ for (i = 0; i < MAX_CLIENTS; i++) {
+ if (client[i].fd == -1) {
- g_print("Using client: %d\n",i);
+ g_print("Using client: %d\n", i);
- client[i].fd=accept(server_socket,(struct sockaddr*)&client[i].address,&client[i].address_length);
- if(client[i].fd<0) {
+ client[i].fd =
+ accept(server_socket, (struct sockaddr *)&client[i].address,
+ &client[i].address_length);
+ if (client[i].fd < 0) {
perror("rigctl_server: client accept failed");
continue;
}
- client[i].thread_id = g_thread_new("rigctl client", rigctl_client, (gpointer)&client[i]);
- if(client[i].thread_id==NULL) {
+ client[i].thread_id =
+ g_thread_new("rigctl client", rigctl_client, (gpointer)&client[i]);
+ if (client[i].thread_id == NULL) {
g_print("g_thread_new failed (n rigctl_client\n");
- g_print("setting SO_LINGER to 0 for client_socket: %d\n",client[i].fd);
- struct linger linger = { 0 };
+ g_print("setting SO_LINGER to 0 for client_socket: %d\n",
+ client[i].fd);
+ struct linger linger = {0};
linger.l_onoff = 1;
linger.l_linger = 0;
- if(setsockopt(client[i].fd,SOL_SOCKET,SO_LINGER,(const char *)&linger,sizeof(linger))==-1) {
+ if (setsockopt(client[i].fd, SOL_SOCKET, SO_LINGER,
+ (const char *)&linger, sizeof(linger)) == -1) {
perror("setsockopt(...,SO_LINGER,...) failed for client");
}
close(client[i].fd);
return NULL;
}
-static gpointer rigctl_client (gpointer data) {
-
- CLIENT *client=(CLIENT *)data;
+static gpointer rigctl_client(gpointer data) {
- g_print("rigctl_client: starting rigctl_client: socket=%d\n",client->fd);
+ CLIENT *client = (CLIENT *)data;
+
+ g_print("rigctl_client: starting rigctl_client: socket=%d\n", client->fd);
g_mutex_lock(&mutex_a->m);
cat_control++;
- if(rigctl_debug) g_print("RIGCTL: CTLA INC cat_contro=%d\n",cat_control);
+ if (rigctl_debug)
+ g_print("RIGCTL: CTLA INC cat_contro=%d\n", cat_control);
g_mutex_unlock(&mutex_a->m);
- g_idle_add(ext_vfo_update,NULL);
+ g_idle_add(ext_vfo_update, NULL);
int save_flag = 0; // Used to concatenate two cmd lines together
int semi_number = 0;
int i;
- char * work_ptr;
+ char *work_ptr;
char work_buf[MAXDATASIZE];
int numbytes;
- char cmd_input[MAXDATASIZE] ;
+ char cmd_input[MAXDATASIZE];
char cmd_save[80];
- char *command=g_new(char,MAXDATASIZE);
- int command_index=0;
-
- while(server_running && (numbytes=recv(client->fd , cmd_input , MAXDATASIZE-2 , 0)) > 0 ) {
- for(i=0;i<numbytes;i++) {
- command[command_index]=cmd_input[i];
- command_index++;
- if(cmd_input[i]==';') {
- command[command_index]='\0';
- if(rigctl_debug) g_print("RIGCTL: command=%s\n",command);
- COMMAND *info=g_new(COMMAND,1);
- info->client=client;
- info->command=command;
- g_idle_add(parse_cmd,info);
- command=g_new(char,MAXDATASIZE);
- command_index=0;
- }
- }
- }
-g_print("RIGCTL: Leaving rigctl_client thread");
- if(client->fd!=-1) {
- g_print("setting SO_LINGER to 0 for client_socket: %d\n",client->fd);
- struct linger linger = { 0 };
+ char *command = g_new(char, MAXDATASIZE);
+ int command_index = 0;
+
+ while (server_running &&
+ (numbytes = recv(client->fd, cmd_input, MAXDATASIZE - 2, 0)) > 0) {
+ for (i = 0; i < numbytes; i++) {
+ command[command_index] = cmd_input[i];
+ command_index++;
+ if (cmd_input[i] == ';') {
+ command[command_index] = '\0';
+ if (rigctl_debug)
+ g_print("RIGCTL: command=%s\n", command);
+ COMMAND *info = g_new(COMMAND, 1);
+ info->client = client;
+ info->command = command;
+ g_idle_add(parse_cmd, info);
+ command = g_new(char, MAXDATASIZE);
+ command_index = 0;
+ }
+ }
+ }
+ g_print("RIGCTL: Leaving rigctl_client thread");
+ if (client->fd != -1) {
+ g_print("setting SO_LINGER to 0 for client_socket: %d\n", client->fd);
+ struct linger linger = {0};
linger.l_onoff = 1;
linger.l_linger = 0;
- if(setsockopt(client->fd,SOL_SOCKET,SO_LINGER,(const char *)&linger,sizeof(linger))==-1) {
+ if (setsockopt(client->fd, SOL_SOCKET, SO_LINGER, (const char *)&linger,
+ sizeof(linger)) == -1) {
perror("setsockopt(...,SO_LINGER,...) failed for client");
}
close(client->fd);
- client->fd=-1;
+ client->fd = -1;
// Decrement CAT_CONTROL
g_mutex_lock(&mutex_a->m);
cat_control--;
- if(rigctl_debug) g_print("RIGCTL: CTLA DEC - cat_control=%d\n",cat_control);
+ if (rigctl_debug)
+ g_print("RIGCTL: CTLA DEC - cat_control=%d\n", cat_control);
g_mutex_unlock(&mutex_a->m);
- g_idle_add(ext_vfo_update,NULL);
+ g_idle_add(ext_vfo_update, NULL);
}
- return NULL;
+ return NULL;
}
-//
+//
// FT command intepret vfo_sm state - used by IF command
//
-int ft_read() {
- return(active_transmitter);
-}
-//
+int ft_read() { return (active_transmitter); }
+//
// Determines RIT state - used by IF command
//
-int rit_on () {
- if(receivers == 1) { // Worry about 1 versus 2 radios
- if(vfo[VFO_A].rit != 0) {
- return 1;
- } else {
- return 0;
- }
+int rit_on() {
+ if (receivers == 1) { // Worry about 1 versus 2 radios
+ if (vfo[VFO_A].rit != 0) {
+ return 1;
+ } else {
+ return 0;
+ }
} else { // Well - we have two so use active_reciever->id
- if(vfo[active_receiver->id].rit != 0) {
- return 1 ;
- } else {
- return 0;
- }
+ if (vfo[active_receiver->id].rit != 0) {
+ return 1;
+ } else {
+ return 0;
+ }
}
}
static int ts2000_mode(int m) {
- int mode=1;
- switch(m) {
- case modeLSB:
- mode=1;
+ int mode = 1;
+ switch (m) {
+ case modeLSB:
+ mode = 1;
+ break;
+ case modeUSB:
+ mode = 2;
+ break;
+ case modeCWL:
+ mode = 7;
+ break;
+ case modeCWU:
+ mode = 3;
+ break;
+ case modeFMN:
+ mode = 4;
+ break;
+ case modeAM:
+ case modeSAM:
+ mode = 5;
+ break;
+ case modeDIGL:
+ mode = 6;
+ break;
+ case modeDIGU:
+ mode = 9;
+ break;
+ default:
+ break;
+ }
+ return mode;
+}
+
+gboolean parse_extended_cmd(char *command, CLIENT *client) {
+ gboolean implemented = TRUE;
+ char reply[256];
+ reply[0] = '\0';
+ switch (command[2]) {
+ case 'A': // ZZAx
+ switch (command[3]) {
+ case 'A': // ZZAA
+ implemented = FALSE;
+ break;
+ case 'B': // ZZAB
+ implemented = FALSE;
break;
- case modeUSB:
- mode=2;
+ case 'C': // ZZAC
+ // sets or reads the Step Size
+ if (command[4] == ';') {
+ // read the step size
+ int i = 0;
+ for (i = 0; i <= 14; i++) {
+ if (steps[i] == step)
+ break;
+ }
+ if (i <= 14) {
+ // send reply back
+ sprintf(reply, "ZZAC%02d;", i);
+ send_resp(client->fd, reply);
+ }
+ } else if (command[6] == ';') {
+ // set the step size
+ int i = atoi(&command[4]);
+ if (i >= 0 && i <= 14) {
+ step = steps[i];
+ vfo_update();
+ }
+ } else {
+ }
+ break;
+ case 'D': // ZZAD
+ // move VFO A down by selected step
+ if (command[6] == ';') {
+ int step_index = atoi(&command[4]);
+ long long hz = 0;
+ if (step_index >= 0 && step_index <= 14) {
+ hz = (long long)steps[step_index];
+ }
+ if (hz != 0LL) {
+ vfo_id_move(VFO_A, -hz, FALSE);
+ }
+ } else {
+ }
+ break;
+ case 'E': // ZZAE
+ // move VFO A down nn tune steps
+ if (command[6] == ';') {
+ int steps = atoi(&command[4]);
+ vfo_id_step(VFO_A, -steps);
+ }
+ break;
+ case 'F': // ZZAF
+ // move VFO A up nn tune steps
+ if (command[6] == ';') {
+ int steps = atoi(&command[4]);
+ vfo_id_step(VFO_A, steps);
+ }
+ break;
+ case 'G': // ZZAG
+ // read/set audio gain
+ if (command[4] == ';') {
+ // send reply back
+ sprintf(reply, "ZZAG%03d;", (int)(active_receiver->volume * 100.0));
+ send_resp(client->fd, reply);
+ } else {
+ int gain = atoi(&command[4]);
+ active_receiver->volume = (double)gain / 100.0;
+ update_af_gain();
+ }
break;
- case modeCWL:
- mode=7;
+ case 'I': // ZZAI
+ implemented = FALSE;
break;
- case modeCWU:
- mode=3;
+ case 'P': // ZZAP
+ implemented = FALSE;
break;
- case modeFMN:
- mode=4;
+ case 'R': // ZZAR
+ // read/set RX0 AGC Threshold
+ if (command[4] == ';') {
+ // send reply back
+ sprintf(reply, "ZZAR%+04d;", (int)(receiver[0]->agc_gain));
+ send_resp(client->fd, reply);
+ } else {
+ int threshold = atoi(&command[4]);
+ set_agc_gain(VFO_A, (double)threshold);
+ }
break;
- case modeAM:
- case modeSAM:
- mode=5;
+ case 'S': // ZZAS
+ // read/set RX1 AGC Threshold
+ if (receivers == 2) {
+ if (command[4] == ';') {
+ // send reply back
+ sprintf(reply, "ZZAS%+04d;", (int)(receiver[1]->agc_gain));
+ send_resp(client->fd, reply);
+ } else {
+ int threshold = atoi(&command[4]);
+ set_agc_gain(VFO_B, (double)threshold);
+ }
+ }
break;
- case modeDIGL:
- mode=6;
+ case 'T': // ZZAT
+ implemented = FALSE;
break;
- case modeDIGU:
- mode=9;
+ case 'U': // ZZAU
+ // move VFO A up by selected step
+ if (command[6] == ';') {
+ int step_index = atoi(&command[4]);
+ long long hz = 0;
+ if (step_index >= 0 && step_index <= 14) {
+ hz = (long long)steps[step_index];
+ }
+ if (hz != 0LL) {
+ vfo_id_move(VFO_A, hz, FALSE);
+ }
+ } else {
+ }
break;
default:
+ implemented = FALSE;
break;
- }
- return mode;
-}
-
-
-gboolean parse_extended_cmd (char *command,CLIENT *client) {
- gboolean implemented=TRUE;
- char reply[256];
- reply[0]='\0';
- switch(command[2]) {
- case 'A': //ZZAx
- switch(command[3]) {
- case 'A': //ZZAA
- implemented=FALSE;
- break;
- case 'B': //ZZAB
- implemented=FALSE;
- break;
- case 'C': //ZZAC
- // sets or reads the Step Size
- if(command[4]==';') {
- // read the step size
- int i=0;
- for(i=0;i<=14;i++) {
- if(steps[i]==step) break;
- }
- if(i<=14) {
- // send reply back
- sprintf(reply,"ZZAC%02d;",i);
- send_resp(client->fd,reply) ;
- }
- } else if(command[6]==';') {
- // set the step size
- int i=atoi(&command[4]) ;
- if(i>=0 && i<=14) {
- step=steps[i];
- vfo_update();
- }
- } else {
- }
- break;
- case 'D': //ZZAD
- // move VFO A down by selected step
- if(command[6]==';') {
- int step_index=atoi(&command[4]);
- long long hz=0;
- if(step_index>=0 && step_index<=14) {
- hz=(long long)steps[step_index];
- }
- if(hz!=0LL) {
- vfo_id_move(VFO_A,-hz,FALSE);
- }
- } else {
- }
- break;
- case 'E': //ZZAE
- // move VFO A down nn tune steps
- if(command[6]==';') {
- int steps=atoi(&command[4]);
- vfo_id_step(VFO_A,-steps);
- }
- break;
- case 'F': //ZZAF
- // move VFO A up nn tune steps
- if(command[6]==';') {
- int steps=atoi(&command[4]);
- vfo_id_step(VFO_A,steps);
- }
- break;
- case 'G': //ZZAG
- // read/set audio gain
- if(command[4]==';') {
- // send reply back
- sprintf(reply,"ZZAG%03d;",(int)(active_receiver->volume*100.0));
- send_resp(client->fd,reply) ;
- } else {
- int gain=atoi(&command[4]);
- active_receiver->volume=(double)gain/100.0;
- update_af_gain();
- }
- break;
- case 'I': //ZZAI
- implemented=FALSE;
- break;
- case 'P': //ZZAP
- implemented=FALSE;
- break;
- case 'R': //ZZAR
- // read/set RX0 AGC Threshold
- if(command[4]==';') {
- // send reply back
- sprintf(reply,"ZZAR%+04d;",(int)(receiver[0]->agc_gain));
- send_resp(client->fd,reply) ;
- } else {
- int threshold=atoi(&command[4]);
- set_agc_gain(VFO_A,(double)threshold);
- }
- break;
- case 'S': //ZZAS
- // read/set RX1 AGC Threshold
- if(receivers==2) {
- if(command[4]==';') {
- // send reply back
- sprintf(reply,"ZZAS%+04d;",(int)(receiver[1]->agc_gain));
- send_resp(client->fd,reply) ;
- } else {
- int threshold=atoi(&command[4]);
- set_agc_gain(VFO_B,(double)threshold);
- }
- }
- break;
- case 'T': //ZZAT
- implemented=FALSE;
- break;
- case 'U': //ZZAU
- // move VFO A up by selected step
- if(command[6]==';') {
- int step_index=atoi(&command[4]);
- long long hz=0;
- if(step_index>=0 && step_index<=14) {
- hz=(long long)steps[step_index];
- }
- if(hz!=0LL) {
- vfo_id_move(VFO_A,hz,FALSE);
- }
- } else {
- }
- break;
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'B': //ZZBx
- switch(command[3]) {
- case 'A': //ZZBA
- // move RX2 down one band
- if(command[4]==';') {
- if(receivers==2) {
- band_minus(receiver[1]->id);
- }
- }
- break;
- case 'B': //ZZBB
- // move RX2 up one band
- if(command[4]==';') {
- if(receivers==2) {
- band_plus(receiver[1]->id);
- }
- }
- break;
- case 'D': //ZZBD
- // move RX1 down one band
- if(command[4]==';') {
- band_minus(receiver[0]->id);
- }
- break;
- case 'E': //ZZBE
- // move VFO B down nn tune steps
- if(command[6]==';') {
- int steps=atoi(&command[4]);
- vfo_id_step(VFO_B,-steps);
- }
-
- break;
- case 'F': //ZZBF
- // move VFO B up nn tune steps
- if(command[6]==';') {
- int steps=atoi(&command[4]);
- vfo_id_step(VFO_B,+steps);
- }
- break;
- case 'G': //ZZBG
- implemented=FALSE;
- break;
- case 'I': //ZZBI
- implemented=FALSE;
- break;
- case 'M': //ZZBM
- // move VFO B down by selected step
- if(command[6]==';') {
- int step_index=atoi(&command[4]);
- long long hz=0;
- if(step_index>=0 && step_index<=14) {
- hz=(long long)steps[step_index];
- }
- if(hz!=0LL) {
- vfo_id_move(VFO_B,-hz,FALSE);
- }
- } else {
- }
+ }
+ break;
+ case 'B': // ZZBx
+ switch (command[3]) {
+ case 'A': // ZZBA
+ // move RX2 down one band
+ if (command[4] == ';') {
+ if (receivers == 2) {
+ band_minus(receiver[1]->id);
+ }
+ }
+ break;
+ case 'B': // ZZBB
+ // move RX2 up one band
+ if (command[4] == ';') {
+ if (receivers == 2) {
+ band_plus(receiver[1]->id);
+ }
+ }
+ break;
+ case 'D': // ZZBD
+ // move RX1 down one band
+ if (command[4] == ';') {
+ band_minus(receiver[0]->id);
+ }
+ break;
+ case 'E': // ZZBE
+ // move VFO B down nn tune steps
+ if (command[6] == ';') {
+ int steps = atoi(&command[4]);
+ vfo_id_step(VFO_B, -steps);
+ }
- break;
- case 'P': //ZZBP
- // move VFO B up by selected step
- if(command[6]==';') {
- int step_index=atoi(&command[4]);
- long long hz=0;
- if(step_index>=0 && step_index<=14) {
- hz=(long long)steps[step_index];
- }
- if(hz!=0LL) {
- vfo_id_move(VFO_B,hz,FALSE);
- }
- } else {
- }
- break;
- case 'R': //ZZBR
- implemented=FALSE;
- break;
- case 'S': //ZZBS
- // set/read RX1 band switch
- if(command[4]==';') {
- int b;
- switch(vfo[VFO_A].band) {
- case band136:
- b=136;
- break;
- case band472:
- b=472;
- break;
- case band160:
- b=160;
- break;
- case band80:
- b=80;
- break;
- case band60:
- b=60;
- break;
- case band40:
- b=40;
- break;
- case band30:
- b=30;
- break;
- case band20:
- b=20;
- break;
- case band17:
- b=17;
- break;
- case band15:
- b=15;
- break;
- case band12:
- b=12;
- break;
- case band10:
- b=10;
- break;
- case band6:
- b=6;
- break;
- case bandGen:
- b=888;
- break;
- case bandWWV:
- b=999;
- break;
- default:
- b=20;
- break;
- }
- sprintf(reply,"ZZBS%03d;",b);
- send_resp(client->fd,reply) ;
- } else if(command[7]==';') {
- int band=band20;
- int b=atoi(&command[4]);
- switch(b) {
- case 136:
- band=band136;
- break;
- case 472:
- band=band472;
- break;
- case 160:
- band=band160;
- break;
- case 80:
- band=band80;
- break;
- case 60:
- band=band60;
- break;
- case 40:
- band=band40;
- break;
- case 30:
- band=band30;
- break;
- case 20:
- band=band20;
- break;
- case 17:
- band=band17;
- break;
- case 15:
- band=band15;
- break;
- case 12:
- band=band12;
- break;
- case 10:
- band=band10;
- break;
- case 6:
- band=band6;
- break;
- case 888:
- band=bandGen;
- break;
- case 999:
- band=bandWWV;
- break;
- }
- vfo_band_changed(VFO_A,band);
- }
- break;
- case 'T': //ZZBT
- // set/read RX2 band switch
- break;
- case 'U': //ZZBU
- // move RX1 up one band
- if(command[4]==';') {
- band_plus(receiver[0]->id);
- }
- break;
- case 'Y': //ZZBY
- // closes console (ignored)
- break;
- default:
- implemented=FALSE;
- break;
+ break;
+ case 'F': // ZZBF
+ // move VFO B up nn tune steps
+ if (command[6] == ';') {
+ int steps = atoi(&command[4]);
+ vfo_id_step(VFO_B, +steps);
}
break;
- case 'C': //ZZCx
- switch(command[3]) {
- case 'B': //ZZCB
- implemented=FALSE;
- break;
- case 'D': //ZZCD
- implemented=FALSE;
- break;
- case 'F': //ZZCF
- implemented=FALSE;
- break;
- case 'I': //ZZCI
- implemented=FALSE;
- break;
- case 'L': //ZZCL
- implemented=FALSE;
- break;
- case 'M': //ZZCM
- implemented=FALSE;
- break;
- case 'N': //ZZCN
- // set/read VFO A CTUN
- if(command[4]==';') {
- // return the CTUN status
- sprintf(reply,"ZZCN%d;",vfo[VFO_A].ctun);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- int state=atoi(&command[4]);
- ctun_update(VFO_A,state);
- vfo_update();
- }
- break;
- case 'O': //ZZCO
- // set/read VFO B CTUN
- if(command[4]==';') {
- // return the CTUN status
- sprintf(reply,"ZZCO%d;",vfo[VFO_B].ctun);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- int state=atoi(&command[4]);
- ctun_update(VFO_B,state);
- vfo_update();
- }
- break;
- case 'P': //ZZCP
- // set/read compander
- if(command[4]==';') {
- sprintf(reply,"ZZCP%d;",0);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- // ignore
- }
- break;
- case 'S': //ZZCS
- implemented=FALSE;
- break;
- case 'T': //ZZCT
- implemented=FALSE;
- break;
- case 'U': //ZZCU
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ case 'G': // ZZBG
+ implemented = FALSE;
+ break;
+ case 'I': // ZZBI
+ implemented = FALSE;
+ break;
+ case 'M': // ZZBM
+ // move VFO B down by selected step
+ if (command[6] == ';') {
+ int step_index = atoi(&command[4]);
+ long long hz = 0;
+ if (step_index >= 0 && step_index <= 14) {
+ hz = (long long)steps[step_index];
+ }
+ if (hz != 0LL) {
+ vfo_id_move(VFO_B, -hz, FALSE);
+ }
+ } else {
+ }
+
+ break;
+ case 'P': // ZZBP
+ // move VFO B up by selected step
+ if (command[6] == ';') {
+ int step_index = atoi(&command[4]);
+ long long hz = 0;
+ if (step_index >= 0 && step_index <= 14) {
+ hz = (long long)steps[step_index];
+ }
+ if (hz != 0LL) {
+ vfo_id_move(VFO_B, hz, FALSE);
+ }
+ } else {
}
break;
- case 'D': //ZZDx
- switch(command[3]) {
- case 'A': //ZZDA
- break;
- case 'B': //ZZDB
- // set/read RX Reference
- if(command[4]==';') {
- sprintf(reply,"ZZDB%d;",0); // currently always 0
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- // ignore
- }
- break;
- case 'C': //ZZDC
- // set/get diversity gain
- if(command[4]==';') {
- sprintf(reply,"ZZDC%04d;",(int)div_gain);
- send_resp(client->fd,reply) ;
- } else if(command[8]==';') {
- // ignore
- }
+ case 'R': // ZZBR
+ implemented = FALSE;
+ break;
+ case 'S': // ZZBS
+ // set/read RX1 band switch
+ if (command[4] == ';') {
+ int b;
+ switch (vfo[VFO_A].band) {
+ case band136:
+ b = 136;
break;
- case 'D': //ZZDD
- // set/get diversity phase
- if(command[4]==';') {
- sprintf(reply,"ZZDD%04d;",(int)div_phase);
- send_resp(client->fd,reply) ;
- } else if(command[8]==';') {
- // ignore
- }
- case 'E': //ZZDE
- implemented=FALSE;
- break;
- case 'F': //ZZDF
- implemented=FALSE;
- break;
- case 'M': //ZZDM
- // set/read Display Mode
- if(command[4]==';') {
- int v=0;
- if(active_receiver->display_waterfall) {
- v=8;
- } else {
- v=2;
- }
- sprintf(reply,"ZZDM%d;",v);
- send_resp(client->fd,reply) ;
- } else {
- }
+ case band472:
+ b = 472;
break;
- case 'N': //ZZDN
- // set/read waterfall low
- if(command[4]==';') {
- sprintf(reply,"ZZDN%+4d;",active_receiver->waterfall_low);
- send_resp(client->fd,reply) ;
- } else {
- }
+ case band160:
+ b = 160;
break;
- case 'O': //ZZDO
- // set/read waterfall high
- if(command[4]==';') {
- sprintf(reply,"ZZDO%+4d;",active_receiver->waterfall_high);
- send_resp(client->fd,reply) ;
- } else {
- }
+ case band80:
+ b = 80;
break;
- case 'P': //ZZDP
- // set/read panadapter high
- if(command[4]==';') {
- sprintf(reply,"ZZDP%+4d;",active_receiver->panadapter_high);
- send_resp(client->fd,reply) ;
- } else {
- }
+ case band60:
+ b = 60;
break;
- case 'Q': //ZZDQ
- // set/read panadapter low
- if(command[4]==';') {
- sprintf(reply,"ZZDQ%+4d;",active_receiver->panadapter_low);
- send_resp(client->fd,reply) ;
- } else {
- }
+ case band40:
+ b = 40;
break;
- case 'R': //ZZDR
- // set/read panadapter step
- if(command[4]==';') {
- sprintf(reply,"ZZDR%2d;",active_receiver->panadapter_step);
- send_resp(client->fd,reply) ;
- } else {
- }
+ case band30:
+ b = 30;
break;
- case 'U': //ZZDU
- implemented=FALSE;
+ case band20:
+ b = 20;
break;
- case 'X': //ZZDX
- implemented=FALSE;
+ case band17:
+ b = 17;
break;
- case 'Y': //ZZDY
- implemented=FALSE;
+ case band15:
+ b = 15;
break;
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'E': //ZZEx
- switch(command[3]) {
- case 'A': //ZZEA
- // set/read rx equalizer values
- if(command[4]==';') {
- sprintf(reply,"ZZEA%03d%03d%03d%03d%03d00000000000000000000;",3,rx_equalizer[0],rx_equalizer[1],rx_equalizer[2],rx_equalizer[3]);
- send_resp(client->fd,reply) ;
- } else if(command[37]==';') {
- char temp[4];
- temp[3]='\0';
- strncpy(temp,&command[4],3);
- int bands=atoi(temp);
- if(bands==3) {
- strncpy(temp,&command[7],3);
- rx_equalizer[0]=atoi(temp);
- strncpy(temp,&command[10],3);
- rx_equalizer[1]=atoi(temp);
- strncpy(temp,&command[13],3);
- rx_equalizer[2]=atoi(temp);
- } else {
- }
- } else {
- }
+ case band12:
+ b = 12;
break;
- case 'B': //ZZEB
- // set/read tx equalizer values
- if(command[4]==';') {
- sprintf(reply,"ZZEB%03d%03d%03d%03d%03d00000000000000000000;",3,tx_equalizer[0],tx_equalizer[1],tx_equalizer[2],tx_equalizer[3]);
- send_resp(client->fd,reply) ;
- } else if(command[37]==';') {
- char temp[4];
- temp[3]='\0';
- strncpy(temp,&command[4],3);
- int bands=atoi(temp);
- if(bands==3) {
- strncpy(temp,&command[7],3);
- tx_equalizer[0]=atoi(temp);
- strncpy(temp,&command[10],3);
- tx_equalizer[1]=atoi(temp);
- strncpy(temp,&command[13],3);
- tx_equalizer[2]=atoi(temp);
- } else {
- }
- } else {
- }
+ case band10:
+ b = 10;
break;
- case 'M': //ZZEM
- implemented=FALSE;
+ case band6:
+ b = 6;
break;
- case 'R': //ZZER
- // set/read rx equalizer
- if(command[4]==';') {
- sprintf(reply,"ZZER%d;",enable_rx_equalizer);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- enable_rx_equalizer=atoi(&command[4]);
- } else {
- }
+ case bandGen:
+ b = 888;
break;
- case 'T': //ZZET
- // set/read tx equalizer
- if(command[4]==';') {
- sprintf(reply,"ZZET%d;",enable_tx_equalizer);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- enable_tx_equalizer=atoi(&command[4]);
- } else {
- }
+ case bandWWV:
+ b = 999;
break;
default:
- implemented=FALSE;
- break;
- }
- break;
- case 'F': //ZZFx
- switch(command[3]) {
- case 'A': //ZZFA
- // set/read VFO-A frequency
- if(command[4]==';') {
- if(vfo[VFO_A].ctun) {
- sprintf(reply,"ZZFA%011lld;",vfo[VFO_A].ctun_frequency);
- } else {
- sprintf(reply,"ZZFA%011lld;",vfo[VFO_A].frequency);
- }
- send_resp(client->fd,reply) ;
- } else if(command[15]==';') {
- long long f=atoll(&command[4]);
- local_set_frequency(VFO_A,f);
- vfo_update();
- }
+ b = 20;
break;
- case 'B': //ZZFB
- // set/read VFO-B frequency
- if(command[4]==';') {
- if(vfo[VFO_B].ctun) {
- sprintf(reply,"ZZFB%011lld;",vfo[VFO_B].ctun_frequency);
- } else {
- sprintf(reply,"ZZFB%011lld;",vfo[VFO_B].frequency);
- }
- send_resp(client->fd,reply) ;
- } else if(command[15]==';') {
- long long f=atoll(&command[4]);
- local_set_frequency(VFO_B,f);
- vfo_update();
- }
+ }
+ sprintf(reply, "ZZBS%03d;", b);
+ send_resp(client->fd, reply);
+ } else if (command[7] == ';') {
+ int band = band20;
+ int b = atoi(&command[4]);
+ switch (b) {
+ case 136:
+ band = band136;
break;
- case 'D': //ZZFD
- // set/read deviation
- if(command[4]==';') {
- sprintf(reply,"ZZFD%d;",active_receiver->deviation==2500?0:1);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- int d=atoi(&command[4]);
- if(d==0) {
- active_receiver->deviation=2500;
- } else if(d==1) {
- active_receiver->deviation=5000;
- } else {
- }
- vfo_update();
- }
+ case 472:
+ band = band472;
break;
- case 'H': //ZZFH
- // set/read RX1 filter high
- if(command[4]==';') {
- sprintf(reply,"ZZFH%05d;",receiver[0]->filter_high);
- send_resp(client->fd,reply) ;
- } else if(command[9]==';') {
- int fh=atoi(&command[4]);
- fh=fmin(9999,fh);
- fh=fmax(-9999,fh);
- // make sure filter is filterVar1
- if(vfo[VFO_A].filter!=filterVar1) {
- vfo_filter_changed(filterVar1);
- }
- FILTER *mode_filters=filters[vfo[VFO_A].mode];
- FILTER *filter=&mode_filters[filterVar1];
- filter->high=fh;
- vfo_filter_changed(filterVar1);
- }
+ case 160:
+ band = band160;
break;
- case 'I': //ZZFI
- // set/read RX1 DSP receive filter
- if(command[4]==';') {
- sprintf(reply,"ZZFI%02d;",vfo[VFO_A].filter);
- send_resp(client->fd,reply) ;
- } else if(command[6]==';') {
- int filter=atoi(&command[4]);
- // update RX1 filter
- }
+ case 80:
+ band = band80;
break;
- case 'J': //ZZFJ
- // set/read RX2 DSP receive filter
- if(command[4]==';') {
- sprintf(reply,"ZZFJ%02d;",vfo[VFO_B].filter);
- send_resp(client->fd,reply) ;
- } else if(command[6]==';') {
- int filter=atoi(&command[4]);
- // update RX2 filter
- }
+ case 60:
+ band = band60;
break;
- case 'L': //ZZFL
- // set/read RX1 filter low
- if(command[4]==';') {
- sprintf(reply,"ZZFL%05d;",receiver[0]->filter_low);
- send_resp(client->fd,reply) ;
- } else if(command[9]==';') {
- int fl=atoi(&command[4]);
- fl=fmin(9999,fl);
- fl=fmax(-9999,fl);
- // make sure filter is filterVar1
- if(vfo[VFO_A].filter!=filterVar1) {
- vfo_filter_changed(filterVar1);
- }
- FILTER *mode_filters=filters[vfo[VFO_A].mode];
- FILTER *filter=&mode_filters[filterVar1];
- filter->low=fl;
- vfo_filter_changed(filterVar1);
- }
+ case 40:
+ band = band40;
break;
- case 'M': //ZZFM
- implemented=FALSE;
+ case 30:
+ band = band30;
break;
- case 'R': //ZZFR
- implemented=FALSE;
+ case 20:
+ band = band20;
break;
- case 'S': //ZZFS
- implemented=FALSE;
+ case 17:
+ band = band17;
break;
- case 'V': //ZZFV
- implemented=FALSE;
+ case 15:
+ band = band15;
break;
- case 'W': //ZZFW
- implemented=FALSE;
+ case 12:
+ band = band12;
break;
- case 'X': //ZZFX
- implemented=FALSE;
+ case 10:
+ band = band10;
break;
- case 'Y': //ZZFY
- implemented=FALSE;
+ case 6:
+ band = band6;
break;
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'G': //ZZGx
- switch(command[3]) {
- case 'E': //ZZGE
- implemented=FALSE;
- break;
- case 'L': //ZZGL
- implemented=FALSE;
- break;
- case 'T': //ZZGT
- // set/read RX1 AGC
- if(command[4]==';') {
- sprintf(reply,"ZZGT%d;",receiver[0]->agc);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- int agc=atoi(&command[4]);
- // update RX1 AGC
- receiver[0]->agc=agc;
- vfo_update();
- }
+ case 888:
+ band = bandGen;
break;
- case 'U': //ZZGU
- // set/read RX2 AGC
- if(command[4]==';') {
- sprintf(reply,"ZZGU%d;",receiver[1]->agc);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- int agc=atoi(&command[4]);
- // update RX2 AGC
- receiver[1]->agc=agc;
- vfo_update();
- }
+ case 999:
+ band = bandWWV;
break;
- default:
- implemented=FALSE;
- break;
+ }
+ vfo_band_changed(VFO_A, band);
}
break;
- case 'H': //ZZHx
- switch(command[3]) {
- case 'A': //ZZHA
- implemented=FALSE;
- break;
- case 'R': //ZZHR
- implemented=FALSE;
- break;
- case 'T': //ZZHT
- implemented=FALSE;
- break;
- case 'U': //ZZHU
- implemented=FALSE;
+ case 'T': // ZZBT
+ // set/read RX2 band switch
+ break;
+ case 'U': // ZZBU
+ // move RX1 up one band
+ if (command[4] == ';') {
+ band_plus(receiver[0]->id);
+ }
+ break;
+ case 'Y': // ZZBY
+ // closes console (ignored)
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'C': // ZZCx
+ switch (command[3]) {
+ case 'B': // ZZCB
+ implemented = FALSE;
+ break;
+ case 'D': // ZZCD
+ implemented = FALSE;
+ break;
+ case 'F': // ZZCF
+ implemented = FALSE;
+ break;
+ case 'I': // ZZCI
+ implemented = FALSE;
+ break;
+ case 'L': // ZZCL
+ implemented = FALSE;
+ break;
+ case 'M': // ZZCM
+ implemented = FALSE;
+ break;
+ case 'N': // ZZCN
+ // set/read VFO A CTUN
+ if (command[4] == ';') {
+ // return the CTUN status
+ sprintf(reply, "ZZCN%d;", vfo[VFO_A].ctun);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ int state = atoi(&command[4]);
+ ctun_update(VFO_A, state);
+ vfo_update();
+ }
+ break;
+ case 'O': // ZZCO
+ // set/read VFO B CTUN
+ if (command[4] == ';') {
+ // return the CTUN status
+ sprintf(reply, "ZZCO%d;", vfo[VFO_B].ctun);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ int state = atoi(&command[4]);
+ ctun_update(VFO_B, state);
+ vfo_update();
+ }
+ break;
+ case 'P': // ZZCP
+ // set/read compander
+ if (command[4] == ';') {
+ sprintf(reply, "ZZCP%d;", 0);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ // ignore
+ }
+ break;
+ case 'S': // ZZCS
+ implemented = FALSE;
+ break;
+ case 'T': // ZZCT
+ implemented = FALSE;
+ break;
+ case 'U': // ZZCU
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'D': // ZZDx
+ switch (command[3]) {
+ case 'A': // ZZDA
+ break;
+ case 'B': // ZZDB
+ // set/read RX Reference
+ if (command[4] == ';') {
+ sprintf(reply, "ZZDB%d;", 0); // currently always 0
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ // ignore
+ }
+ break;
+ case 'C': // ZZDC
+ // set/get diversity gain
+ if (command[4] == ';') {
+ sprintf(reply, "ZZDC%04d;", (int)div_gain);
+ send_resp(client->fd, reply);
+ } else if (command[8] == ';') {
+ // ignore
+ }
+ break;
+ case 'D': // ZZDD
+ // set/get diversity phase
+ if (command[4] == ';') {
+ sprintf(reply, "ZZDD%04d;", (int)div_phase);
+ send_resp(client->fd, reply);
+ } else if (command[8] == ';') {
+ // ignore
+ }
+ case 'E': // ZZDE
+ implemented = FALSE;
+ break;
+ case 'F': // ZZDF
+ implemented = FALSE;
+ break;
+ case 'M': // ZZDM
+ // set/read Display Mode
+ if (command[4] == ';') {
+ int v = 0;
+ if (active_receiver->display_waterfall) {
+ v = 8;
+ } else {
+ v = 2;
+ }
+ sprintf(reply, "ZZDM%d;", v);
+ send_resp(client->fd, reply);
+ } else {
+ }
+ break;
+ case 'N': // ZZDN
+ // set/read waterfall low
+ if (command[4] == ';') {
+ sprintf(reply, "ZZDN%+4d;", active_receiver->waterfall_low);
+ send_resp(client->fd, reply);
+ } else {
+ }
+ break;
+ case 'O': // ZZDO
+ // set/read waterfall high
+ if (command[4] == ';') {
+ sprintf(reply, "ZZDO%+4d;", active_receiver->waterfall_high);
+ send_resp(client->fd, reply);
+ } else {
+ }
+ break;
+ case 'P': // ZZDP
+ // set/read panadapter high
+ if (command[4] == ';') {
+ sprintf(reply, "ZZDP%+4d;", active_receiver->panadapter_high);
+ send_resp(client->fd, reply);
+ } else {
+ }
+ break;
+ case 'Q': // ZZDQ
+ // set/read panadapter low
+ if (command[4] == ';') {
+ sprintf(reply, "ZZDQ%+4d;", active_receiver->panadapter_low);
+ send_resp(client->fd, reply);
+ } else {
+ }
+ break;
+ case 'R': // ZZDR
+ // set/read panadapter step
+ if (command[4] == ';') {
+ sprintf(reply, "ZZDR%2d;", active_receiver->panadapter_step);
+ send_resp(client->fd, reply);
+ } else {
+ }
+ break;
+ case 'U': // ZZDU
+ implemented = FALSE;
+ break;
+ case 'X': // ZZDX
+ implemented = FALSE;
+ break;
+ case 'Y': // ZZDY
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'E': // ZZEx
+ switch (command[3]) {
+ case 'A': // ZZEA
+ // set/read rx equalizer values
+ if (command[4] == ';') {
+ sprintf(reply, "ZZEA%03d%03d%03d%03d%03d00000000000000000000;", 3,
+ rx_equalizer[0], rx_equalizer[1], rx_equalizer[2],
+ rx_equalizer[3]);
+ send_resp(client->fd, reply);
+ } else if (command[37] == ';') {
+ char temp[4];
+ temp[3] = '\0';
+ strncpy(temp, &command[4], 3);
+ int bands = atoi(temp);
+ if (bands == 3) {
+ strncpy(temp, &command[7], 3);
+ rx_equalizer[0] = atoi(temp);
+ strncpy(temp, &command[10], 3);
+ rx_equalizer[1] = atoi(temp);
+ strncpy(temp, &command[13], 3);
+ rx_equalizer[2] = atoi(temp);
+ } else {
+ }
+ } else {
+ }
+ break;
+ case 'B': // ZZEB
+ // set/read tx equalizer values
+ if (command[4] == ';') {
+ sprintf(reply, "ZZEB%03d%03d%03d%03d%03d00000000000000000000;", 3,
+ tx_equalizer[0], tx_equalizer[1], tx_equalizer[2],
+ tx_equalizer[3]);
+ send_resp(client->fd, reply);
+ } else if (command[37] == ';') {
+ char temp[4];
+ temp[3] = '\0';
+ strncpy(temp, &command[4], 3);
+ int bands = atoi(temp);
+ if (bands == 3) {
+ strncpy(temp, &command[7], 3);
+ tx_equalizer[0] = atoi(temp);
+ strncpy(temp, &command[10], 3);
+ tx_equalizer[1] = atoi(temp);
+ strncpy(temp, &command[13], 3);
+ tx_equalizer[2] = atoi(temp);
+ } else {
+ }
+ } else {
+ }
+ break;
+ case 'M': // ZZEM
+ implemented = FALSE;
+ break;
+ case 'R': // ZZER
+ // set/read rx equalizer
+ if (command[4] == ';') {
+ sprintf(reply, "ZZER%d;", enable_rx_equalizer);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ enable_rx_equalizer = atoi(&command[4]);
+ } else {
+ }
+ break;
+ case 'T': // ZZET
+ // set/read tx equalizer
+ if (command[4] == ';') {
+ sprintf(reply, "ZZET%d;", enable_tx_equalizer);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ enable_tx_equalizer = atoi(&command[4]);
+ } else {
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'F': // ZZFx
+ switch (command[3]) {
+ case 'A': // ZZFA
+ // set/read VFO-A frequency
+ if (command[4] == ';') {
+ if (vfo[VFO_A].ctun) {
+ sprintf(reply, "ZZFA%011lld;", vfo[VFO_A].ctun_frequency);
+ } else {
+ sprintf(reply, "ZZFA%011lld;", vfo[VFO_A].frequency);
+ }
+ send_resp(client->fd, reply);
+ } else if (command[15] == ';') {
+ long long f = atoll(&command[4]);
+ local_set_frequency(VFO_A, f);
+ vfo_update();
+ }
+ break;
+ case 'B': // ZZFB
+ // set/read VFO-B frequency
+ if (command[4] == ';') {
+ if (vfo[VFO_B].ctun) {
+ sprintf(reply, "ZZFB%011lld;", vfo[VFO_B].ctun_frequency);
+ } else {
+ sprintf(reply, "ZZFB%011lld;", vfo[VFO_B].frequency);
+ }
+ send_resp(client->fd, reply);
+ } else if (command[15] == ';') {
+ long long f = atoll(&command[4]);
+ local_set_frequency(VFO_B, f);
+ vfo_update();
+ }
+ break;
+ case 'D': // ZZFD
+ // set/read deviation
+ if (command[4] == ';') {
+ sprintf(reply, "ZZFD%d;", active_receiver->deviation == 2500 ? 0 : 1);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ int d = atoi(&command[4]);
+ if (d == 0) {
+ active_receiver->deviation = 2500;
+ } else if (d == 1) {
+ active_receiver->deviation = 5000;
+ } else {
+ }
+ vfo_update();
+ }
+ break;
+ case 'H': // ZZFH
+ // set/read RX1 filter high
+ if (command[4] == ';') {
+ sprintf(reply, "ZZFH%05d;", receiver[0]->filter_high);
+ send_resp(client->fd, reply);
+ } else if (command[9] == ';') {
+ int fh = atoi(&command[4]);
+ fh = fmin(9999, fh);
+ fh = fmax(-9999, fh);
+ // make sure filter is filterVar1
+ if (vfo[VFO_A].filter != filterVar1) {
+ vfo_filter_changed(filterVar1);
+ }
+ FILTER *mode_filters = filters[vfo[VFO_A].mode];
+ FILTER *filter = &mode_filters[filterVar1];
+ filter->high = fh;
+ vfo_filter_changed(filterVar1);
+ }
+ break;
+ case 'I': // ZZFI
+ // set/read RX1 DSP receive filter
+ if (command[4] == ';') {
+ sprintf(reply, "ZZFI%02d;", vfo[VFO_A].filter);
+ send_resp(client->fd, reply);
+ } else if (command[6] == ';') {
+ int filter = atoi(&command[4]);
+ // update RX1 filter
+ vfo_filter_changed(filter);
+ }
+ break;
+ case 'J': // ZZFJ
+ // set/read RX2 DSP receive filter
+ if (command[4] == ';') {
+ sprintf(reply, "ZZFJ%02d;", vfo[VFO_B].filter);
+ send_resp(client->fd, reply);
+ } else if (command[6] == ';') {
+ int filter = atoi(&command[4]);
+ // update RX2 filter
+ vfo_filter_changed(filter);
+ }
+ break;
+ case 'L': // ZZFL
+ // set/read RX1 filter low
+ if (command[4] == ';') {
+ sprintf(reply, "ZZFL%05d;", receiver[0]->filter_low);
+ send_resp(client->fd, reply);
+ } else if (command[9] == ';') {
+ int fl = atoi(&command[4]);
+ fl = fmin(9999, fl);
+ fl = fmax(-9999, fl);
+ // make sure filter is filterVar1
+ if (vfo[VFO_A].filter != filterVar1) {
+ vfo_filter_changed(filterVar1);
+ }
+ FILTER *mode_filters = filters[vfo[VFO_A].mode];
+ FILTER *filter = &mode_filters[filterVar1];
+ filter->low = fl;
+ vfo_filter_changed(filterVar1);
+ }
+ break;
+ case 'M': // ZZFM
+ implemented = FALSE;
+ break;
+ case 'R': // ZZFR
+ implemented = FALSE;
+ break;
+ case 'S': // ZZFS
+ implemented = FALSE;
+ break;
+ case 'V': // ZZFV
+ implemented = FALSE;
+ break;
+ case 'W': // ZZFW
+ implemented = FALSE;
+ break;
+ case 'X': // ZZFX
+ implemented = FALSE;
+ break;
+ case 'Y': // ZZFY
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'G': // ZZGx
+ switch (command[3]) {
+ case 'E': // ZZGE
+ implemented = FALSE;
+ break;
+ case 'L': // ZZGL
+ implemented = FALSE;
+ break;
+ case 'T': // ZZGT
+ // set/read RX1 AGC
+ if (command[4] == ';') {
+ sprintf(reply, "ZZGT%d;", receiver[0]->agc);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ int agc = atoi(&command[4]);
+ // update RX1 AGC
+ receiver[0]->agc = agc;
+ vfo_update();
+ }
+ break;
+ case 'U': // ZZGU
+ // set/read RX2 AGC
+ if (command[4] == ';') {
+ sprintf(reply, "ZZGU%d;", receiver[1]->agc);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ int agc = atoi(&command[4]);
+ // update RX2 AGC
+ receiver[1]->agc = agc;
+ vfo_update();
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'H': // ZZHx
+ switch (command[3]) {
+ case 'A': // ZZHA
+ implemented = FALSE;
+ break;
+ case 'R': // ZZHR
+ implemented = FALSE;
+ break;
+ case 'T': // ZZHT
+ implemented = FALSE;
+ break;
+ case 'U': // ZZHU
+ implemented = FALSE;
+ break;
+ case 'V': // ZZHV
+ implemented = FALSE;
+ break;
+ case 'W': // ZZHW
+ implemented = FALSE;
+ break;
+ case 'X': // ZZHX
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'I': // ZZIx
+ switch (command[3]) {
+ case 'D': // ZZID
+ strcpy(reply, "ZZID240;");
+ send_resp(client->fd, reply);
+ break;
+ case 'F': // ZZIF
+ implemented = FALSE;
+ break;
+ case 'O': // ZZIO
+ implemented = FALSE;
+ break;
+ case 'S': // ZZIS
+ implemented = FALSE;
+ break;
+ case 'T': // ZZIT
+ implemented = FALSE;
+ break;
+ case 'U': // ZZIU
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'K': // ZZKx
+ switch (command[3]) {
+ case 'M': // ZZIM
+ implemented = FALSE;
+ break;
+ case 'O': // ZZIO
+ implemented = FALSE;
+ break;
+ case 'S': // ZZIS
+ implemented = FALSE;
+ break;
+ case 'Y': // ZZIY
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'L': // ZZLx
+ switch (command[3]) {
+ case 'A': // ZZLA
+ // read/set RX0 gain
+ if (command[4] == ';') {
+ // send reply back
+ sprintf(reply, "ZZLA%03d;", (int)(receiver[0]->volume * 100.0));
+ send_resp(client->fd, reply);
+ } else {
+ int gain = atoi(&command[4]);
+ receiver[0]->volume = (double)gain / 100.0;
+ update_af_gain();
+ }
+ break;
+ case 'B': // ZZLB
+ implemented = FALSE;
+ break;
+ case 'C': // ZZLC
+ // read/set RX1 gain
+ if (receivers == 2) {
+ if (command[4] == ';') {
+ // send reply back
+ sprintf(reply, "ZZLC%03d;", (int)(receiver[1]->volume * 100.0));
+ send_resp(client->fd, reply);
+ } else {
+ int gain = atoi(&command[4]);
+ receiver[1]->volume = (double)gain / 100.0;
+ update_af_gain();
+ }
+ }
+ break;
+ case 'D': // ZZLD
+ implemented = FALSE;
+ break;
+ case 'E': // ZZLE
+ implemented = FALSE;
+ break;
+ case 'F': // ZZLF
+ implemented = FALSE;
+ break;
+ case 'G': // ZZLG
+ implemented = FALSE;
+ break;
+ case 'H': // ZZLH
+ implemented = FALSE;
+ break;
+ case 'I': // ZZLI
+ if (transmitter != NULL) {
+ if (command[4] == ';') {
+ // send reply back
+ sprintf(reply, "ZZLI%d;", transmitter->puresignal);
+ send_resp(client->fd, reply);
+ } else {
+ int ps = atoi(&command[4]);
+ transmitter->puresignal = ps;
+ }
+ vfo_update();
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'M': // ZZMx
+ switch (command[3]) {
+ case 'A': // ZZMA
+ {
+ int mute = atoi(&command[4]);
+ active_receiver->mute_radio = mute;
+ implemented = TRUE;
+ } break;
+ case 'B': // ZZMB
+ implemented = FALSE;
+ break;
+ case 'D': // ZZMD
+ // set/read RX1 operating mode
+ if (command[4] == ';') {
+ sprintf(reply, "ZZMD%02d;", vfo[VFO_A].mode);
+ send_resp(client->fd, reply);
+ } else if (command[6] == ';') {
+ vfo_mode_changed(atoi(&command[4]));
+ }
+ break;
+ case 'E': // ZZME
+ // set/read RX2 operating mode
+ if (command[4] == ';') {
+ sprintf(reply, "ZZMD%02d;", vfo[VFO_B].mode);
+ send_resp(client->fd, reply);
+ } else if (command[6] == ';') {
+ vfo_mode_changed(atoi(&command[4]));
+ }
+ break;
+ case 'G': // ZZMG
+ // set/read mic gain
+ if (command[4] == ';') {
+ sprintf(reply, "ZZMG%03d;", (int)mic_gain);
+ send_resp(client->fd, reply);
+ } else if (command[7] == ';') {
+ mic_gain = (double)atoi(&command[4]);
+ }
+ break;
+ case 'L': // ZZML
+ // read DSP modes and indexes
+ if (command[4] == ';') {
+ sprintf(reply, "ZZML LSB00: USB01: DSB02: CWL03: CWU04: FMN05: "
+ "AM06:DIGU07:SPEC08:DIGL09: SAM10: DRM11;");
+ send_resp(client->fd, reply);
+ }
+ break;
+ case 'N': // ZZMN
+ // read Filter Names and indexes
+ if (command[6] == ';') {
+ int mode = atoi(&command[4]) - 1;
+ FILTER *f = filters[mode];
+ sprintf(reply, "ZZMN");
+ char temp[32];
+ for (int i = 0; i < FILTERS; i++) {
+ sprintf(temp, "%5s%5d%5d", f[i].title, f[i].high, f[i].low);
+ strcat(reply, temp);
+ }
+ strcat(reply, ";");
+ send_resp(client->fd, reply);
+ }
+ break;
+ case 'O': // ZZMO
+ // set/read MON status
+ if (command[4] == ';') {
+ sprintf(reply, "ZZMO%d;", 0);
+ send_resp(client->fd, reply);
+ }
+ break;
+ case 'R': // ZZMR
+ // set/read RX Meter mode
+ if (command[4] == ';') {
+ sprintf(reply, "ZZMR%d;", smeter + 1);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ smeter = atoi(&command[4]) - 1;
+ }
+ break;
+ case 'S': // ZZMS
+ implemented = FALSE;
+ break;
+ case 'T': // ZZMT
+ if (command[4] == ';') {
+ sprintf(reply, "ZZMT%02d;", 1); // forward power
+ send_resp(client->fd, reply);
+ } else {
+ }
+ break;
+ case 'U': // ZZMU
+ implemented = FALSE;
+ break;
+ case 'V': // ZZMV
+ implemented = FALSE;
+ break;
+ case 'W': // ZZMW
+ implemented = FALSE;
+ break;
+ case 'X': // ZZMX
+ implemented = FALSE;
+ break;
+ case 'Y': // ZZMY
+ implemented = FALSE;
+ break;
+ case 'Z': // ZZMZ
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'N': // ZZNx
+ switch (command[3]) {
+ case 'A': // ZZNA
+ // set/read RX1 NB1
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNA%d;", receiver[0]->nb);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[0]->nb = atoi(&command[4]);
+ if (receiver[0]->nb) {
+ receiver[0]->nb2 = 0;
+ }
+ update_noise();
+ }
+ break;
+ case 'B': // ZZNB
+ // set/read RX1 NB2
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNB%d;", receiver[0]->nb2);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[0]->nb2 = atoi(&command[4]);
+ if (receiver[0]->nb2) {
+ receiver[0]->nb = 0;
+ }
+ update_noise();
+ }
+ break;
+ case 'C': // ZZNC
+ // set/read RX2 NB1
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNC%d;", receiver[1]->nb);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[1]->nb = atoi(&command[4]);
+ if (receiver[1]->nb) {
+ receiver[1]->nb2 = 0;
+ }
+ update_noise();
+ }
+ break;
+ case 'D': // ZZND
+ // set/read RX2 NB2
+ if (command[4] == ';') {
+ sprintf(reply, "ZZND%d;", receiver[1]->nb2);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[1]->nb2 = atoi(&command[4]);
+ if (receiver[1]->nb2) {
+ receiver[1]->nb = 0;
+ }
+ update_noise();
+ }
+ break;
+ case 'L': // ZZNL
+ // set/read NB1 threshold
+ implemented = FALSE;
+ break;
+ case 'M': // ZZNM
+ // set/read NB2 threshold
+ implemented = FALSE;
+ break;
+ case 'N': // ZZNN
+ // set/read RX1 SNB status
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNN%d;", receiver[0]->snb);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[0]->snb = atoi(&command[4]);
+ update_noise();
+ }
+ break;
+ case 'O': // ZZNO
+ // set/read RX2 SNB status
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNO%d;", receiver[1]->snb);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[1]->snb = atoi(&command[4]);
+ update_noise();
+ }
+ break;
+ case 'R': // ZZNR
+ // set/read RX1 NR
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNR%d;", receiver[0]->nr);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[0]->nr = atoi(&command[4]);
+ if (receiver[0]->nr) {
+ receiver[0]->nr2 = 0;
+ }
+ update_noise();
+ }
+ break;
+ case 'S': // ZZNS
+ // set/read RX1 NR2
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNS%d;", receiver[0]->nr2);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[0]->nr2 = atoi(&command[4]);
+ if (receiver[0]->nr2) {
+ receiver[0]->nr = 0;
+ }
+ update_noise();
+ }
+ break;
+ case 'T': // ZZNT
+ // set/read RX1 ANF
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNT%d;", receiver[0]->anf);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[0]->anf = atoi(&command[4]);
+ update_noise();
+ }
+ break;
+ case 'U': // ZZNU
+ // set/read RX2 ANF
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNU%d;", receiver[1]->anf);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[1]->anf = atoi(&command[4]);
+ update_noise();
+ }
+ break;
+ case 'V': // ZZNV
+ // set/read RX2 NR
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNV%d;", receiver[1]->nr);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[1]->nr = atoi(&command[4]);
+ if (receiver[1]->nr) {
+ receiver[1]->nr2 = 0;
+ }
+ update_noise();
+ }
+ break;
+ case 'W': // ZZNW
+ // set/read RX2 NR2
+ if (command[4] == ';') {
+ sprintf(reply, "ZZNW%d;", receiver[1]->nr2);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ receiver[1]->nr2 = atoi(&command[4]);
+ if (receiver[1]->nr2) {
+ receiver[1]->nr = 0;
+ }
+ update_noise();
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ case 'O': // ZZOx
+ switch (command[3]) {
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'P': // ZZPx
+ switch (command[3]) {
+ case 'A': // ZZPA
+ // set/read preamp setting
+ if (command[4] == ';') {
+ int a = adc[receiver[0]->adc].attenuation;
+ if (a == 0) {
+ a = 1;
+ } else if (a <= -30) {
+ a = 4;
+ } else if (a <= -20) {
+ a = 0;
+ } else if (a <= -10) {
+ a = 2;
+ } else {
+ a = 3;
+ }
+ sprintf(reply, "ZZPA%d;", a);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ int a = atoi(&command[4]);
+ switch (a) {
+ case 0:
+ adc[receiver[0]->adc].attenuation = -20;
break;
- case 'V': //ZZHV
- implemented=FALSE;
+ case 1:
+ adc[receiver[0]->adc].attenuation = 0;
break;
- case 'W': //ZZHW
- implemented=FALSE;
+ case 2:
+ adc[receiver[0]->adc].attenuation = -10;
break;
- case 'X': //ZZHX
- implemented=FALSE;
+ case 3:
+ adc[receiver[0]->adc].attenuation = -20;
+ break;
+ case 4:
+ adc[receiver[0]->adc].attenuation = -30;
break;
default:
- implemented=FALSE;
- break;
+ adc[receiver[0]->adc].attenuation = 0;
+ break;
+ }
+ }
+ break;
+ case 'Y': // ZZPY
+ // set/read Zoom
+ if (command[4] == ';') {
+ sprintf(reply, "ZZPY%d;", receiver[1]->zoom);
+ send_resp(client->fd, reply);
+ } else if (command[7] == ';') {
+ int zoom = atoi(&command[4]);
+ set_zoom(1, zoom);
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'Q': // ZZQx
+ switch (command[3]) {
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'R': // ZZRx
+ switch (command[3]) {
+ case 'C': // ZZRC
+ // clear RIT frequency
+ if (command[4] == ';') {
+ vfo[VFO_A].rit = 0;
+ vfo_update();
+ }
+ break;
+ case 'D': // ZZRD
+ // decrement RIT frequency
+ if (command[4] == ';') {
+ if (vfo[VFO_A].mode == modeCWL || vfo[VFO_A].mode == modeCWU) {
+ vfo[VFO_A].rit -= 10;
+ } else {
+ vfo[VFO_A].rit -= 50;
+ }
+ vfo_update();
+ } else if (command[9] == ';') {
+ vfo[VFO_A].rit = atoi(&command[4]);
+ vfo_update();
+ }
+ break;
+ case 'F': // ZZRF
+ // set/read RIT frequency
+ if (command[4] == ';') {
+ sprintf(reply, "ZZRF%+5lld;", vfo[VFO_A].rit);
+ send_resp(client->fd, reply);
+ } else if (command[9] == ';') {
+ vfo[VFO_A].rit = atoi(&command[4]);
+ vfo_update();
+ }
+ break;
+ case 'M': // ZZRM
+ // read meter value
+ if (command[5] == ';') {
+ int m = atoi(&command[4]);
+ sprintf(reply, "ZZRM%d%20d;", smeter, (int)receiver[0]->meter);
+ send_resp(client->fd, reply);
+ }
+ break;
+ case 'S': // ZZRS
+ // set/read RX2 enable
+ if (command[4] == ';') {
+ sprintf(reply, "ZZRS%d;", receivers == 2);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ int state = atoi(&command[4]);
+ if (state) {
+ radio_change_receivers(2);
+ } else {
+ radio_change_receivers(1);
+ }
+ }
+ break;
+ case 'T': // ZZRT
+ // set/read RIT enable
+ if (command[4] == ';') {
+ sprintf(reply, "ZZRT%d;", vfo[VFO_A].rit_enabled);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ vfo[VFO_A].rit_enabled = atoi(&command[4]);
+ vfo_update();
+ }
+ break;
+ case 'U': // ZZRU
+ // increments RIT Frequency
+ if (command[4] == ';') {
+ if (vfo[VFO_A].mode == modeCWL || vfo[VFO_A].mode == modeCWU) {
+ vfo[VFO_A].rit += 10;
+ } else {
+ vfo[VFO_A].rit += 50;
+ }
+ vfo_update();
+ } else if (command[9] == ';') {
+ vfo[VFO_A].rit = atoi(&command[4]);
+ vfo_update();
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ case 'S': // ZZSx
+ switch (command[3]) {
+ case 'A': // ZZSA
+ // move VFO A down one step
+ if (command[4] == ';') {
+ vfo_step(-1);
+ }
+ break;
+ case 'B': // ZZSB
+ // move VFO A up one step
+ if (command[4] == ';') {
+ vfo_step(1);
+ }
+ break;
+ case 'D': // ZZSD
+ implemented = FALSE;
+ break;
+ case 'F': // ZZSF
+ implemented = FALSE;
+ break;
+ case 'G': // ZZSG
+ // move VFO B down 1 step
+ if (command[4] == ';') {
+ vfo_id_step(VFO_B, -1);
+ }
+ break;
+ case 'H': // ZZSH
+ // move VFO B up 1 step
+ if (command[4] == ';') {
+ vfo_id_step(VFO_B, 1);
+ }
+ break;
+ case 'M': // ZZSM
+ // reads the S Meter (in dB)
+ if (command[5] == ';') {
+ int v = atoi(&command[4]);
+ if (v == VFO_A || v == VFO_B) {
+ double m = receiver[v]->meter;
+ m = fmax(-140.0, m);
+ m = fmin(-10.0, m);
+ sprintf(reply, "ZZSM%d%03d;", v, (int)((m + 140.0) * 2));
+ send_resp(client->fd, reply);
+ }
+ }
+ break;
+ case 'N': // ZZSN
+ implemented = FALSE;
+ break;
+ case 'P': // ZZSP
+ // set/read split
+ if (command[4] == ';') {
+ sprintf(reply, "ZZSP%d;", split);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ split = atoi(&command[4]);
+ tx_set_mode(transmitter, get_tx_mode());
+ vfo_update();
+ }
+ break;
+ case 'R': // ZZSR
+ implemented = FALSE;
+ break;
+ case 'S': // ZZSS
+ implemented = FALSE;
+ break;
+ case 'T': // ZZST
+ implemented = FALSE;
+ break;
+ case 'U': // ZZSU
+ implemented = FALSE;
+ break;
+ case 'V': // ZZSV
+ implemented = FALSE;
+ break;
+ case 'W': // ZZSW
+ // set/read split
+ if (command[4] == ';') {
+ sprintf(reply, "ZZSW%d;", split);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ split = atoi(&command[4]);
+ tx_set_mode(transmitter, get_tx_mode());
+ vfo_update();
+ }
+ break;
+ case 'Y': // ZZSY
+ implemented = FALSE;
+ break;
+ case 'Z': // ZZSZ
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'T': // ZZTx
+ switch (command[3]) {
+ case 'A': // ZZTA
+ implemented = FALSE;
+ break;
+ case 'B': // ZZTB
+ implemented = FALSE;
+ break;
+ case 'F': // ZZTF
+ implemented = FALSE;
+ break;
+ case 'H': // ZZTH
+ implemented = FALSE;
+ break;
+ case 'I': // ZZTI
+ implemented = FALSE;
+ break;
+ case 'L': // ZZTL
+ implemented = FALSE;
+ break;
+ case 'M': // ZZTM
+ implemented = FALSE;
+ break;
+ case 'O': // ZZTO
+ implemented = FALSE;
+ break;
+ case 'P': // ZZTP
+ implemented = FALSE;
+ break;
+ case 'S': // ZZTS
+ implemented = FALSE;
+ break;
+ case 'U': // ZZTU
+ // sets or reads TUN status
+ if (command[4] == ';') {
+ sprintf(reply, "ZZTU%d;", tune);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ tune_update(atoi(&command[4]));
}
break;
- case 'I': //ZZIx
- switch(command[3]) {
- case 'D': //ZZID
- strcpy(reply,"ZZID240;");
- send_resp(client->fd,reply) ;
- break;
- case 'F': //ZZIF
- implemented=FALSE;
- break;
- case 'O': //ZZIO
- implemented=FALSE;
- break;
- case 'S': //ZZIS
- implemented=FALSE;
- break;
- case 'T': //ZZIT
- implemented=FALSE;
- break;
- case 'U': //ZZIU
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ case 'V': // ZZTV
+ implemented = FALSE;
+ break;
+ case 'X': // ZZTX
+ // sets or reads MOX status
+ if (command[4] == ';') {
+ sprintf(reply, "ZZTX%d;", mox);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ mox_update(atoi(&command[4]));
}
break;
- case 'K': //ZZKx
- switch(command[3]) {
- case 'M': //ZZIM
- implemented=FALSE;
- break;
- case 'O': //ZZIO
- implemented=FALSE;
- break;
- case 'S': //ZZIS
- implemented=FALSE;
- break;
- case 'Y': //ZZIY
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'L': //ZZLx
- switch(command[3]) {
- case 'A': //ZZLA
- // read/set RX0 gain
- if(command[4]==';') {
- // send reply back
- sprintf(reply,"ZZLA%03d;",(int)(receiver[0]->volume*100.0));
- send_resp(client->fd,reply) ;
- } else {
- int gain=atoi(&command[4]);
- receiver[0]->volume=(double)gain/100.0;
- update_af_gain();
- }
- break;
- case 'B': //ZZLB
- implemented=FALSE;
- break;
- case 'C': //ZZLC
- // read/set RX1 gain
- if(receivers==2) {
- if(command[4]==';') {
- // send reply back
- sprintf(reply,"ZZLC%03d;",(int)(receiver[1]->volume*100.0));
- send_resp(client->fd,reply) ;
- } else {
- int gain=atoi(&command[4]);
- receiver[1]->volume=(double)gain/100.0;
- update_af_gain();
- }
- }
- break;
- case 'D': //ZZLD
- implemented=FALSE;
- break;
- case 'E': //ZZLE
- implemented=FALSE;
- break;
- case 'F': //ZZLF
- implemented=FALSE;
- break;
- case 'G': //ZZLG
- implemented=FALSE;
- break;
- case 'H': //ZZLH
- implemented=FALSE;
- break;
- case 'I': //ZZLI
- if(transmitter!=NULL) {
- if(command[4]==';') {
- // send reply back
- sprintf(reply,"ZZLI%d;",transmitter->puresignal);
- send_resp(client->fd,reply) ;
- } else {
- int ps=atoi(&command[4]);
- transmitter->puresignal=ps;
- }
- vfo_update();
- }
- break;
- default:
- implemented=FALSE;
- break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'U': // ZZUx
+ switch (command[3]) {
+ case 'A': // ZZUA
+ implemented = FALSE;
+ break;
+ case 'S': // ZZUS
+ implemented = FALSE;
+ break;
+ case 'T': // ZZUT
+ implemented = FALSE;
+ break;
+ case 'X': // ZZUX
+ implemented = FALSE;
+ break;
+ case 'Y': // ZZUY
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'V': // ZZVx
+ switch (command[3]) {
+ case 'A': // ZZVA
+ implemented = FALSE;
+ break;
+ case 'B': // ZZVB
+ implemented = FALSE;
+ break;
+ case 'C': // ZZVC
+ implemented = FALSE;
+ break;
+ case 'D': // ZZVD
+ implemented = FALSE;
+ break;
+ case 'E': // ZZVE
+ implemented = FALSE;
+ break;
+ case 'F': // ZZVF
+ implemented = FALSE;
+ break;
+ case 'H': // ZZVH
+ implemented = FALSE;
+ break;
+ case 'I': // ZZVI
+ implemented = FALSE;
+ break;
+ case 'J': // ZZVJ
+ implemented = FALSE;
+ break;
+ case 'K': // ZZVK
+ implemented = FALSE;
+ break;
+ case 'L': // ZZVL
+ // set/get VFO Lock
+ locked = command[4] == '1';
+ vfo_update();
+ implemented = TRUE;
+ break;
+ case 'M': // ZZVM
+ implemented = FALSE;
+ break;
+ case 'N': // ZZVN
+ implemented = FALSE;
+ break;
+ case 'O': // ZZVO
+ implemented = FALSE;
+ break;
+ case 'P': // ZZVP
+ implemented = FALSE;
+ break;
+ case 'Q': // ZZVQ
+ implemented = FALSE;
+ break;
+ case 'R': // ZZVR
+ implemented = FALSE;
+ break;
+ case 'S': // ZZVS
+ {
+ int i = atoi(&command[4]);
+ if (i == 0) {
+ vfo_a_to_b();
+ } else if (i == 1) {
+ vfo_b_to_a();
+ } else {
+ vfo_a_swap_b();
+ }
+ }
+ implemented = TRUE;
+ break;
+ case 'T': // ZZVT
+ implemented = FALSE;
+ break;
+ case 'U': // ZZVU
+ implemented = FALSE;
+ break;
+ case 'V': // ZZVV
+ implemented = FALSE;
+ break;
+ case 'W': // ZZVW
+ implemented = FALSE;
+ break;
+ case 'X': // ZZVX
+ implemented = FALSE;
+ break;
+ case 'Y': // ZZVY
+ implemented = FALSE;
+ break;
+ case 'Z': // ZZVZ
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'W': // ZZWx
+ switch (command[3]) {
+ case 'A': // ZZWA
+ implemented = FALSE;
+ break;
+ case 'B': // ZZWB
+ implemented = FALSE;
+ break;
+ case 'C': // ZZWC
+ implemented = FALSE;
+ break;
+ case 'D': // ZZWD
+ implemented = FALSE;
+ break;
+ case 'E': // ZZWE
+ implemented = FALSE;
+ break;
+ case 'F': // ZZWF
+ implemented = FALSE;
+ break;
+ case 'G': // ZZWG
+ implemented = FALSE;
+ break;
+ case 'H': // ZZWH
+ implemented = FALSE;
+ break;
+ case 'J': // ZZWJ
+ implemented = FALSE;
+ break;
+ case 'K': // ZZWK
+ implemented = FALSE;
+ break;
+ case 'L': // ZZWL
+ implemented = FALSE;
+ break;
+ case 'M': // ZZWM
+ implemented = FALSE;
+ break;
+ case 'N': // ZZWN
+ implemented = FALSE;
+ break;
+ case 'O': // ZZWO
+ implemented = FALSE;
+ break;
+ case 'P': // ZZWP
+ implemented = FALSE;
+ break;
+ case 'Q': // ZZWQ
+ implemented = FALSE;
+ break;
+ case 'R': // ZZWR
+ implemented = FALSE;
+ break;
+ case 'S': // ZZWS
+ implemented = FALSE;
+ break;
+ case 'T': // ZZWT
+ implemented = FALSE;
+ break;
+ case 'U': // ZZWU
+ implemented = FALSE;
+ break;
+ case 'V': // ZZWV
+ implemented = FALSE;
+ break;
+ case 'W': // ZZWW
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'X': // ZZXx
+ switch (command[3]) {
+ case 'C': // ZZXC
+ // clear transmitter XIT
+ if (command[4] == ';') {
+ transmitter->xit = 0;
+ vfo_update();
}
break;
- case 'M': //ZZMx
- switch(command[3]) {
- case 'A': //ZZMA
- implemented=FALSE;
- break;
- case 'B': //ZZMB
- implemented=FALSE;
- break;
- case 'D': //ZZMD
- // set/read RX1 operating mode
- if(command[4]==';') {
- sprintf(reply,"ZZMD%02d;",vfo[VFO_A].mode);
- send_resp(client->fd,reply);
- } else if(command[6]==';') {
- vfo_mode_changed(atoi(&command[4]));
- }
- break;
- case 'E': //ZZME
- // set/read RX2 operating mode
- if(command[4]==';') {
- sprintf(reply,"ZZMD%02d;",vfo[VFO_B].mode);
- send_resp(client->fd,reply);
- } else if(command[6]==';') {
- vfo_mode_changed(atoi(&command[4]));
- }
- break;
- case 'G': //ZZMG
- // set/read mic gain
- if(command[4]==';') {
- sprintf(reply,"ZZMG%03d;",(int)mic_gain);
- send_resp(client->fd,reply);
- } else if(command[7]==';') {
- mic_gain=(double)atoi(&command[4]);
- }
- break;
- case 'L': //ZZML
- // read DSP modes and indexes
- if(command[4]==';') {
- sprintf(reply,"ZZML LSB00: USB01: DSB02: CWL03: CWU04: FMN05: AM06:DIGU07:SPEC08:DIGL09: SAM10: DRM11;");
- send_resp(client->fd,reply);
- }
- break;
- case 'N': //ZZMN
- // read Filter Names and indexes
- if(command[6]==';') {
- int mode=atoi(&command[4])-1;
- FILTER *f=filters[mode];
- sprintf(reply,"ZZMN");
- char temp[32];
- for(int i=0;i<FILTERS;i++) {
- sprintf(temp,"%5s%5d%5d",f[i].title,f[i].high,f[i].low);
- strcat(reply,temp);
- }
- strcat(reply,";");
- send_resp(client->fd,reply);
- }
- break;
- case 'O': //ZZMO
- // set/read MON status
- if(command[4]==';') {
- sprintf(reply,"ZZMO%d;",0);
- send_resp(client->fd,reply);
- }
- break;
- case 'R': //ZZMR
- // set/read RX Meter mode
- if(command[4]==';') {
- sprintf(reply,"ZZMR%d;",smeter+1);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- smeter=atoi(&command[4])-1;
- }
- break;
- case 'S': //ZZMS
- implemented=FALSE;
- break;
- case 'T': //ZZMT
- if(command[4]==';') {
- sprintf(reply,"ZZMT%02d;",1); // forward power
- send_resp(client->fd,reply);
+ case 'F': // ZZXF
+ // set/read XIT
+ if (command[4] == ';') {
+ sprintf(reply, "ZZXT%+05lld;", transmitter->xit);
+ send_resp(client->fd, reply);
+ } else if (command[9] == ';') {
+ transmitter->xit = (long long)atoi(&command[4]);
+ vfo_update();
+ }
+ break;
+ case 'H': // ZZXH
+ implemented = FALSE;
+ break;
+ case 'N': // ZZXN
+ // read combined RX1 status
+ if (command[4] == ';') {
+ int status = 0;
+ status = status | ((receiver[0]->agc) & 0x03);
+ int a = adc[receiver[0]->adc].attenuation;
+ if (a == 0) {
+ a = 1;
+ } else if (a <= -30) {
+ a = 4;
+ } else if (a <= -20) {
+ a = 0;
+ } else if (a <= -10) {
+ a = 2;
+ } else {
+ a = 3;
+ }
+ status = status | ((a & 0x03) << 3);
+ status = status | ((receiver[0]->squelch_enable & 0x01) << 6);
+ status = status | ((receiver[0]->nb & 0x01) << 7);
+ status = status | ((receiver[0]->nb2 & 0x01) << 8);
+ status = status | ((receiver[0]->nr & 0x01) << 9);
+ status = status | ((receiver[0]->nr2 & 0x01) << 10);
+ status = status | ((receiver[0]->snb & 0x01) << 11);
+ status = status | ((receiver[0]->anf & 0x01) << 12);
+ sprintf(reply, "ZZXN%04d;", status);
+ send_resp(client->fd, reply);
+ }
+ break;
+ case 'O': // ZZXO
+ // read combined RX2 status
+ if (receivers == 2) {
+ if (command[4] == ';') {
+ int status = 0;
+ status = status | ((receiver[1]->agc) & 0x03);
+ int a = adc[receiver[1]->adc].attenuation;
+ if (a == 0) {
+ a = 1;
+ } else if (a <= -30) {
+ a = 4;
+ } else if (a <= -20) {
+ a = 0;
+ } else if (a <= -10) {
+ a = 2;
} else {
- }
- break;
- case 'U': //ZZMU
- implemented=FALSE;
- break;
- case 'V': //ZZMV
- implemented=FALSE;
- break;
- case 'W': //ZZMW
- implemented=FALSE;
- break;
- case 'X': //ZZMX
- implemented=FALSE;
- break;
- case 'Y': //ZZMY
- implemented=FALSE;
- break;
- case 'Z': //ZZMZ
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
-
- }
- break;
- case 'N': //ZZNx
- switch(command[3]) {
- case 'A': //ZZNA
- // set/read RX1 NB1
- if(command[4]==';') {
- sprintf(reply,"ZZNA%d;",receiver[0]->nb);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[0]->nb=atoi(&command[4]);
- if(receiver[0]->nb) {
- receiver[0]->nb2=0;
- }
- update_noise();
- }
- break;
- case 'B': //ZZNB
- // set/read RX1 NB2
- if(command[4]==';') {
- sprintf(reply,"ZZNB%d;",receiver[0]->nb2);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[0]->nb2=atoi(&command[4]);
- if(receiver[0]->nb2) {
- receiver[0]->nb=0;
- }
- update_noise();
- }
- break;
- case 'C': //ZZNC
- // set/read RX2 NB1
- if(command[4]==';') {
- sprintf(reply,"ZZNC%d;",receiver[1]->nb);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[1]->nb=atoi(&command[4]);
- if(receiver[1]->nb) {
- receiver[1]->nb2=0;
- }
- update_noise();
- }
- break;
- case 'D': //ZZND
- // set/read RX2 NB2
- if(command[4]==';') {
- sprintf(reply,"ZZND%d;",receiver[1]->nb2);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[1]->nb2=atoi(&command[4]);
- if(receiver[1]->nb2) {
- receiver[1]->nb=0;
- }
- update_noise();
- }
- break;
- case 'L': //ZZNL
- // set/read NB1 threshold
- implemented=FALSE;
- break;
- case 'M': //ZZNM
- // set/read NB2 threshold
- implemented=FALSE;
- break;
- case 'N': //ZZNN
- // set/read RX1 SNB status
- if(command[4]==';') {
- sprintf(reply,"ZZNN%d;",receiver[0]->snb);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[0]->snb=atoi(&command[4]);
- update_noise();
- }
- break;
- case 'O': //ZZNO
- // set/read RX2 SNB status
- if(command[4]==';') {
- sprintf(reply,"ZZNO%d;",receiver[1]->snb);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[1]->snb=atoi(&command[4]);
- update_noise();
- }
- break;
- case 'R': //ZZNR
- // set/read RX1 NR
- if(command[4]==';') {
- sprintf(reply,"ZZNR%d;",receiver[0]->nr);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[0]->nr=atoi(&command[4]);
- if(receiver[0]->nr) {
- receiver[0]->nr2=0;
- }
- update_noise();
- }
- break;
- case 'S': //ZZNS
- // set/read RX1 NR2
- if(command[4]==';') {
- sprintf(reply,"ZZNS%d;",receiver[0]->nr2);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[0]->nr2=atoi(&command[4]);
- if(receiver[0]->nr2) {
- receiver[0]->nr=0;
- }
- update_noise();
- }
- break;
- case 'T': //ZZNT
- // set/read RX1 ANF
- if(command[4]==';') {
- sprintf(reply,"ZZNT%d;",receiver[0]->anf);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[0]->anf=atoi(&command[4]);
- update_noise();
- }
- break;
- case 'U': //ZZNU
- // set/read RX2 ANF
- if(command[4]==';') {
- sprintf(reply,"ZZNU%d;",receiver[1]->anf);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[1]->anf=atoi(&command[4]);
- update_noise();
- }
- break;
- case 'V': //ZZNV
- // set/read RX2 NR
- if(command[4]==';') {
- sprintf(reply,"ZZNV%d;",receiver[1]->nr);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[1]->nr=atoi(&command[4]);
- if(receiver[1]->nr) {
- receiver[1]->nr2=0;
- }
- update_noise();
- }
- break;
- case 'W': //ZZNW
- // set/read RX2 NR2
- if(command[4]==';') {
- sprintf(reply,"ZZNW%d;",receiver[1]->nr2);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- receiver[1]->nr2=atoi(&command[4]);
- if(receiver[1]->nr2) {
- receiver[1]->nr=0;
- }
- update_noise();
- }
- break;
- default:
- implemented=FALSE;
- break;
+ a = 3;
+ }
+ status = status | ((a & 0x03) << 3);
+ status = status | ((receiver[1]->squelch_enable & 0x01) << 6);
+ status = status | ((receiver[1]->nb & 0x01) << 7);
+ status = status | ((receiver[1]->nb2 & 0x01) << 8);
+ status = status | ((receiver[1]->nr & 0x01) << 9);
+ status = status | ((receiver[1]->nr2 & 0x01) << 10);
+ status = status | ((receiver[1]->snb & 0x01) << 11);
+ status = status | ((receiver[1]->anf & 0x01) << 12);
+ sprintf(reply, "ZZXO%04d;", status);
+ send_resp(client->fd, reply);
+ }
}
- case 'O': //ZZOx
- switch(command[3]) {
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'P': //ZZPx
- switch(command[3]) {
- case 'A': //ZZPA
- // set/read preamp setting
- if(command[4]==';') {
- int a=adc[receiver[0]->adc].attenuation;
- if(a==0) {
- a=1;
- } else if(a<=-30) {
- a=4;
- } else if(a<=-20) {
- a=0;
- } else if(a<=-10) {
- a=2;
- } else {
- a=3;
- }
- sprintf(reply,"ZZPA%d;",a);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- int a=atoi(&command[4]);
- switch(a) {
- case 0:
- adc[receiver[0]->adc].attenuation=-20;
- break;
- case 1:
- adc[receiver[0]->adc].attenuation=0;
- break;
- case 2:
- adc[receiver[0]->adc].attenuation=-10;
- break;
- case 3:
- adc[receiver[0]->adc].attenuation=-20;
- break;
- case 4:
- adc[receiver[0]->adc].attenuation=-30;
- break;
- default:
- adc[receiver[0]->adc].attenuation=0;
- break;
- }
- }
- break;
- default:
- implemented=FALSE;
- break;
+ break;
+ case 'S': // ZZXS
+ /// set/read XIT enable
+ if (command[4] == ';') {
+ sprintf(reply, "ZZXS%d;", transmitter->xit_enabled);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ transmitter->xit_enabled = atoi(&command[4]);
+ vfo_update();
}
break;
- case 'Q': //ZZQx
- switch(command[3]) {
- default:
- implemented=FALSE;
- break;
+ case 'T': // ZZXT
+ implemented = FALSE;
+ break;
+ case 'V': // ZZXV
+ // read combined VFO status
+ if (command[4] == ';') {
+ int status = 0;
+ if (vfo[VFO_A].rit_enabled) {
+ status = status | 0x01;
+ }
+ if (locked) {
+ status = status | 0x02;
+ status = status | 0x04;
+ }
+ if (split) {
+ status = status | 0x08;
+ }
+ if (vfo[VFO_A].ctun) {
+ status = status | 0x10;
+ }
+ if (vfo[VFO_B].ctun) {
+ status = status | 0x20;
+ }
+ if (mox) {
+ status = status | 0x40;
+ }
+ if (tune) {
+ status = status | 0x80;
+ }
+ sprintf(reply, "ZZXV%03d;", status);
+ send_resp(client->fd, reply);
}
break;
- case 'R': //ZZRx
- switch(command[3]) {
- case 'C': //ZZRC
- // clear RIT frequency
- if(command[4]==';') {
- vfo[VFO_A].rit=0;
- vfo_update();
- }
- break;
- case 'D': //ZZRD
- // decrement RIT frequency
- if(command[4]==';') {
- if(vfo[VFO_A].mode==modeCWL || vfo[VFO_A].mode==modeCWU) {
- vfo[VFO_A].rit-=10;
- } else {
- vfo[VFO_A].rit-=50;
- }
- vfo_update();
- } else if(command[9]==';') {
- vfo[VFO_A].rit=atoi(&command[4]);
- vfo_update();
- }
- break;
- case 'F': //ZZRF
- // set/read RIT frequency
- if(command[4]==';') {
- sprintf(reply,"ZZRF%+5lld;",vfo[VFO_A].rit);
- send_resp(client->fd,reply);
- } else if(command[9]==';') {
- vfo[VFO_A].rit=atoi(&command[4]);
- vfo_update();
- }
- break;
- case 'M': //ZZRM
- // read meter value
- if(command[5]==';') {
- int m=atoi(&command[4]);
- sprintf(reply,"ZZRM%d%20d;",smeter,(int)receiver[0]->meter);
- send_resp(client->fd,reply);
- }
- break;
- case 'S': //ZZRS
- // set/read RX2 enable
- if(command[4]==';') {
- sprintf(reply,"ZZRS%d;",receivers==2);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- int state=atoi(&command[4]);
- if(state) {
- radio_change_receivers(2);
- } else {
- radio_change_receivers(1);
- }
- }
- break;
- case 'T': //ZZRT
- // set/read RIT enable
- if(command[4]==';') {
- sprintf(reply,"ZZRT%d;",vfo[VFO_A].rit_enabled);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- vfo[VFO_A].rit_enabled=atoi(&command[4]);
- vfo_update();
- }
- break;
- case 'U': //ZZRU
- // increments RIT Frequency
- if(command[4]==';') {
- if(vfo[VFO_A].mode==modeCWL || vfo[VFO_A].mode==modeCWU) {
- vfo[VFO_A].rit+=10;
- } else {
- vfo[VFO_A].rit+=50;
- }
- vfo_update();
- } else if(command[9]==';') {
- vfo[VFO_A].rit=atoi(&command[4]);
- vfo_update();
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'Y': // ZZYx
+ switch (command[3]) {
+ case 'A': // ZZYA
+ implemented = FALSE;
+ break;
+ case 'B': // ZZYB
+ implemented = FALSE;
+ break;
+ case 'C': // ZZYC
+ implemented = FALSE;
+ break;
+ case 'R': // ZZYR
+ // switch receivers
+ if (command[5] == ';') {
+ int v = atoi(&command[4]);
+ if (v == 0) {
+ active_receiver = receiver[0];
+ } else if (v == 1) {
+ if (receivers == 2) {
+ active_receiver = receiver[1];
}
- break;
- default:
- implemented=FALSE;
- break;
+ }
+ vfo_update();
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'Z': // ZZZx
+ switch (command[3]) {
+ case 'A': // ZZZA
+ implemented = FALSE;
+ break;
+ case 'B': // ZZZB
+ implemented = FALSE;
+ break;
+ case 'Z': // ZZZZ
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ return implemented;
+}
+
+// called with g_idle_add so that the processing is running on the main thread
+int parse_cmd(void *data) {
+ COMMAND *info = (COMMAND *)data;
+ CLIENT *client = info->client;
+ char *command = info->command;
+ char reply[80];
+ reply[0] = '\0';
+ gboolean implemented = TRUE;
+ gboolean errord = FALSE;
+
+ switch (command[0]) {
+ case '#':
+ switch (command[1]) {
+ case 'S':
+ if (command[2] == ';') {
+ radioSaveState();
+ if (protocol == ORIGINAL_PROTOCOL) {
+ old_protocol_stop();
+ } else {
+ new_protocol_stop();
+ }
+ int rc = system("shutdown -h -P now");
+ _exit(0);
+ }
+ break;
+ }
+ break;
+ case 'A':
+ switch (command[1]) {
+ case 'C': // AC
+ // set/read internal atu status
+ implemented = FALSE;
+ break;
+ case 'G': // AG
+ // set/read AF Gain
+ if (command[2] == ';') {
+ // send reply back (covert from 0..1 to 0..255)
+ sprintf(reply, "AG0%03d;", (int)(receiver[0]->volume * 255.0));
+ send_resp(client->fd, reply);
+ } else if (command[6] == ';') {
+ int gain = atoi(&command[3]);
+ receiver[0]->volume = (double)gain / 255.0;
+ update_af_gain();
+ }
+ break;
+ case 'I': // AI
+ // set/read Auto Information
+ implemented = FALSE;
+ break;
+ case 'L': // AL
+ // set/read Auto Notch level
+ implemented = FALSE;
+ break;
+ case 'M': // AM
+ // set/read Auto Mode
+ implemented = FALSE;
+ break;
+ case 'N': // AN
+ // set/read Antenna Connection
+ implemented = FALSE;
+ break;
+ case 'S': // AS
+ // set/read Auto Mode Function Parameters
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'B':
+ switch (command[1]) {
+ case 'C': // BC
+ // set/read Beat Canceller
+ implemented = FALSE;
+ break;
+ case 'D': // BD
+ // band down 1 band
+ band_minus(receiver[0]->id);
+ break;
+ case 'P': // BP
+ // set/read Manual Beat Canceller frequency
+ implemented = FALSE;
+ break;
+ case 'U': // BU
+ // band up 1 band
+ band_plus(receiver[0]->id);
+ break;
+ case 'Y': // BY
+ // read busy signal
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'C':
+ switch (command[1]) {
+ case 'A': // CA
+ // set/read CW Auto Tune
+ implemented = FALSE;
+ break;
+ case 'G': // CG
+ // set/read Carrier Gain
+ implemented = FALSE;
+ break;
+ case 'I': // CI
+ // sets the current frequency to the CALL Channel
+ implemented = FALSE;
+ break;
+ case 'M': // CM
+ // sets/reads the Packet Cluster Tune function
+ implemented = FALSE;
+ break;
+ case 'N': // CN
+ // sets/reads CTCSS function
+ if (command[3] == ';') {
+ sprintf(reply, "CN%02d;", transmitter->ctcss + 1);
+ send_resp(client->fd, reply);
+ } else if (command[4] == ';') {
+ int i = atoi(&command[2]) - 1;
+ transmitter_set_ctcss(transmitter, transmitter->ctcss_enabled, i);
+ }
+ break;
+ case 'T': // CT
+ // sets/reads CTCSS status
+ if (command[3] == ';') {
+ sprintf(reply, "CT%d;", transmitter->ctcss_enabled);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ int state = atoi(&command[2]);
+ transmitter_set_ctcss(transmitter, state, transmitter->ctcss);
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'D':
+ switch (command[1]) {
+ case 'C': // DC
+ // set/read TX band status
+ implemented = FALSE;
+ break;
+ case 'N': // DN
+ // move VFO A down 1 step size
+ vfo_id_step(VFO_A, -1);
+ break;
+ case 'Q': // DQ
+ // set/read DCS function status
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'E':
+ switch (command[1]) {
+ case 'X': // EX
+ // set/read the extension menu
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'F':
+ switch (command[1]) {
+ case 'A': // FA
+ // set/read VFO-A frequency
+ if (command[2] == ';') {
+ if (vfo[VFO_A].ctun) {
+ sprintf(reply, "FA%011lld;", vfo[VFO_A].ctun_frequency);
+ } else {
+ sprintf(reply, "FA%011lld;", vfo[VFO_A].frequency);
+ }
+ send_resp(client->fd, reply);
+ } else if (command[13] == ';') {
+ long long f = atoll(&command[2]);
+ local_set_frequency(VFO_A, f);
+ vfo_update();
}
- case 'S': //ZZSx
- switch(command[3]) {
- case 'A': //ZZSA
- // move VFO A down one step
- if(command[4]==';') {
- vfo_step(-1);
- }
- break;
- case 'B': //ZZSB
- // move VFO A up one step
- if(command[4]==';') {
- vfo_step(1);
- }
- break;
- case 'D': //ZZSD
- implemented=FALSE;
- break;
- case 'F': //ZZSF
- implemented=FALSE;
- break;
- case 'G': //ZZSG
- // move VFO B down 1 step
- if(command[4]==';') {
- vfo_id_step(VFO_B,-1);
- }
- break;
- case 'H': //ZZSH
- // move VFO B up 1 step
- if(command[4]==';') {
- vfo_id_step(VFO_B,1);
- }
- break;
- case 'M': //ZZSM
- // reads the S Meter (in dB)
- if(command[5]==';') {
- int v=atoi(&command[4]);
- if(v==VFO_A || v==VFO_B) {
- double m=receiver[v]->meter;
- m=fmax(-140.0,m);
- m=fmin(-10.0,m);
- sprintf(reply,"ZZSM%d%03d;",v,(int)((m+140.0)*2));
- send_resp(client->fd,reply);
- }
- }
- break;
- case 'N': //ZZSN
- implemented=FALSE;
- break;
- case 'P': //ZZSP
- // set/read split
- if(command[4]==';') {
- sprintf(reply,"ZZSP%d;",split);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- split=atoi(&command[4]);
- tx_set_mode(transmitter,get_tx_mode());
- vfo_update();
- }
- break;
- case 'R': //ZZSR
- implemented=FALSE;
- break;
- case 'S': //ZZSS
- implemented=FALSE;
- break;
- case 'T': //ZZST
- implemented=FALSE;
- break;
- case 'U': //ZZSU
- implemented=FALSE;
- break;
- case 'V': //ZZSV
- implemented=FALSE;
- break;
- case 'W': //ZZSW
- // set/read split
- if(command[4]==';') {
- sprintf(reply,"ZZSW%d;",split);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- split=atoi(&command[4]);
- tx_set_mode(transmitter,get_tx_mode());
- vfo_update();
+ break;
+ case 'B': // FB
+ // set/read VFO-B frequency
+ if (command[2] == ';') {
+ if (vfo[VFO_B].ctun) {
+ sprintf(reply, "FB%011lld;", vfo[VFO_B].ctun_frequency);
+ } else {
+ sprintf(reply, "FB%011lld;", vfo[VFO_B].frequency);
+ }
+ send_resp(client->fd, reply);
+ } else if (command[13] == ';') {
+ long long f = atoll(&command[2]);
+ local_set_frequency(VFO_B, f);
+ vfo_update();
+ }
+ break;
+ case 'C': // FC
+ // set/read the sub receiver VFO frequency menu
+ implemented = FALSE;
+ break;
+ case 'D': // FD
+ // set/read the filter display dot pattern
+ implemented = FALSE;
+ break;
+ case 'R': // FR
+ // set/read transceiver receive VFO
+ if (command[2] == ';') {
+ sprintf(reply, "FR%d;", active_receiver->id);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ int id = atoi(&command[2]);
+ switch (id) {
+ case 0:
+ active_receiver = receiver[id];
+ break;
+ case 1:
+ if (receivers == 2) {
+ active_receiver = receiver[id];
+ } else {
+ implemented = FALSE;
}
break;
- case 'Y': //ZZSY
- implemented=FALSE;
- break;
- case 'Z': //ZZSZ
- implemented=FALSE;
- break;
default:
- implemented=FALSE;
+ implemented = FALSE;
break;
+ }
}
break;
- case 'T': //ZZTx
- switch(command[3]) {
- case 'A': //ZZTA
- implemented=FALSE;
- break;
- case 'B': //ZZTB
- implemented=FALSE;
- break;
- case 'F': //ZZTF
- implemented=FALSE;
- break;
- case 'H': //ZZTH
- implemented=FALSE;
- break;
- case 'I': //ZZTI
- implemented=FALSE;
- break;
- case 'L': //ZZTL
- implemented=FALSE;
- break;
- case 'M': //ZZTM
- implemented=FALSE;
- break;
- case 'O': //ZZTO
- implemented=FALSE;
- break;
- case 'P': //ZZTP
- implemented=FALSE;
+ case 'S': // FS
+ // set/read the fine tune function status
+ implemented = FALSE;
+ break;
+ case 'T': // FT
+ // set/read transceiver transmit VFO
+ if (command[2] == ';') {
+ sprintf(reply, "FT%d;", split);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ split = atoi(&command[2]);
+ tx_set_mode(transmitter, get_tx_mode());
+ vfo_update();
+ }
+ break;
+ case 'W': // FW
+ // set/read filter width
+ // make sure filter is filterVar1
+ if (vfo[active_receiver->id].filter != filterVar1) {
+ vfo_filter_changed(filterVar1);
+ }
+ FILTER *mode_filters = filters[vfo[active_receiver->id].mode];
+ FILTER *filter = &mode_filters[filterVar1];
+ int val = 0;
+ if (command[2] == ';') {
+ switch (vfo[active_receiver->id].mode) {
+ case modeCWL:
+ case modeCWU:
+ val = filter->low * 2;
+ break;
+ case modeAM:
+ case modeSAM:
+ val = filter->low >= -4000;
+ break;
+ case modeFMN:
+ val = active_receiver->deviation == 5000;
break;
- case 'S': //ZZTS
- implemented=FALSE;
+ default:
+ implemented = FALSE;
break;
- case 'U': //ZZTU
- // sets or reads TUN status
- if(command[4]==';') {
- sprintf(reply,"ZZTU%d;",tune);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- tune_update(atoi(&command[4]));
+ }
+ if (implemented) {
+ sprintf(reply, "FW%04d;", val);
+ send_resp(client->fd, reply);
+ }
+ } else if (command[6] == ';') {
+ int fw = atoi(&command[2]);
+ int val = filter->low = fw;
+ switch (vfo[active_receiver->id].mode) {
+ case modeCWL:
+ case modeCWU:
+ filter->low = fw / 2;
+ filter->high = fw / 2;
+ break;
+ case modeFMN:
+ if (fw == 0) {
+ filter->low = -4000;
+ filter->high = 4000;
+ active_receiver->deviation = 2500;
+ } else {
+ filter->low = -8000;
+ filter->high = 8000;
+ active_receiver->deviation = 5000;
}
break;
- case 'V': //ZZTV
- implemented=FALSE;
- break;
- case 'X': //ZZTX
- // sets or reads MOX status
- if(command[4]==';') {
- sprintf(reply,"ZZTX%d;",mox);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- mox_update(atoi(&command[4]));
+ case modeAM:
+ case modeSAM:
+ if (fw == 0) {
+ filter->low = -4000;
+ filter->high = 4000;
+ } else {
+ filter->low = -8000;
+ filter->high = 8000;
}
break;
default:
- implemented=FALSE;
+ implemented = FALSE;
break;
+ }
+ if (implemented) {
+ vfo_filter_changed(filterVar1);
+ }
}
break;
- case 'U': //ZZUx
- switch(command[3]) {
- case 'A': //ZZUA
- implemented=FALSE;
- break;
- case 'S': //ZZUS
- implemented=FALSE;
- break;
- case 'T': //ZZUT
- implemented=FALSE;
- break;
- case 'X': //ZZUX
- implemented=FALSE;
- break;
- case 'Y': //ZZUY
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'G':
+ switch (command[1]) {
+ case 'T': // GT
+ // set/read RX1 AGC
+ if (command[2] == ';') {
+ sprintf(reply, "GT%03d;", receiver[0]->agc * 5);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ // update RX1 AGC
+ receiver[0]->agc = atoi(&command[2]) / 5;
+ vfo_update();
}
break;
- case 'V': //ZZVx
- switch(command[3]) {
- case 'A': //ZZVA
- implemented=FALSE;
- break;
- case 'B': //ZZVB
- implemented=FALSE;
- break;
- case 'C': //ZZVC
- implemented=FALSE;
- break;
- case 'D': //ZZVD
- implemented=FALSE;
- break;
- case 'E': //ZZVE
- implemented=FALSE;
- break;
- case 'F': //ZZVF
- implemented=FALSE;
- break;
- case 'H': //ZZVH
- implemented=FALSE;
- break;
- case 'I': //ZZVI
- implemented=FALSE;
- break;
- case 'J': //ZZVJ
- implemented=FALSE;
- break;
- case 'K': //ZZVK
- implemented=FALSE;
- break;
- case 'L': //ZZVL
- // set/get VFO Lock
- implemented=FALSE;
- break;
- case 'M': //ZZVM
- implemented=FALSE;
- break;
- case 'N': //ZZVN
- implemented=FALSE;
- break;
- case 'O': //ZZVO
- implemented=FALSE;
- break;
- case 'P': //ZZVP
- implemented=FALSE;
- break;
- case 'Q': //ZZVQ
- implemented=FALSE;
- break;
- case 'R': //ZZVR
- implemented=FALSE;
- break;
- case 'S': //ZZVS
- implemented=FALSE;
- break;
- case 'T': //ZZVT
- implemented=FALSE;
- break;
- case 'U': //ZZVU
- implemented=FALSE;
- break;
- case 'V': //ZZVV
- implemented=FALSE;
- break;
- case 'W': //ZZVW
- implemented=FALSE;
- break;
- case 'X': //ZZVX
- implemented=FALSE;
- break;
- case 'Y': //ZZVY
- implemented=FALSE;
- break;
- case 'Z': //ZZVZ
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'H':
+ switch (command[1]) {
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'I':
+ switch (command[1]) {
+ case 'D': // ID
+ // get ID
+ strcpy(reply, "ID019;"); // TS-2000
+ send_resp(client->fd, reply);
+ break;
+ case 'F': // IF
+ {
+ int mode = ts2000_mode(vfo[VFO_A].mode);
+ sprintf(reply, "IF%011lld%04lld%+06lld%d%d%d%02d%d%d%d%d%d%d%02d%d;",
+ vfo[VFO_A].ctun ? vfo[VFO_A].ctun_frequency
+ : vfo[VFO_A].frequency,
+ step, vfo[VFO_A].rit, vfo[VFO_A].rit_enabled,
+ transmitter == NULL ? 0 : transmitter->xit_enabled, 0, 0,
+ isTransmitting(), mode, 0, 0, split,
+ transmitter->ctcss_enabled ? 2 : 0, transmitter->ctcss, 0);
+ send_resp(client->fd, reply);
+ } break;
+ case 'S': // IS
+ // set/read IF shift
+ if (command[2] == ';') {
+ strcpy(reply, "IS 0000;");
+ send_resp(client->fd, reply);
+ } else {
+ implemented = FALSE;
}
break;
- case 'W': //ZZWx
- switch(command[3]) {
- case 'A': //ZZWA
- implemented=FALSE;
- break;
- case 'B': //ZZWB
- implemented=FALSE;
- break;
- case 'C': //ZZWC
- implemented=FALSE;
- break;
- case 'D': //ZZWD
- implemented=FALSE;
- break;
- case 'E': //ZZWE
- implemented=FALSE;
- break;
- case 'F': //ZZWF
- implemented=FALSE;
- break;
- case 'G': //ZZWG
- implemented=FALSE;
- break;
- case 'H': //ZZWH
- implemented=FALSE;
- break;
- case 'J': //ZZWJ
- implemented=FALSE;
- break;
- case 'K': //ZZWK
- implemented=FALSE;
- break;
- case 'L': //ZZWL
- implemented=FALSE;
- break;
- case 'M': //ZZWM
- implemented=FALSE;
- break;
- case 'N': //ZZWN
- implemented=FALSE;
- break;
- case 'O': //ZZWO
- implemented=FALSE;
- break;
- case 'P': //ZZWP
- implemented=FALSE;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'J':
+ switch (command[1]) {
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'K':
+ switch (command[1]) {
+ case 'S': // KS
+ // set/read keying speed
+ if (command[2] == ';') {
+ sprintf(reply, "KS%03d;", cw_keyer_speed);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ int speed = atoi(&command[2]);
+ if (speed >= 1 && speed <= 60) {
+ cw_keyer_speed = speed;
+#ifdef LOCALCW
+ keyer_update();
+#endif
+ vfo_update();
+ }
+ } else {
+ }
+ break;
+ case 'Y': // KY
+ // convert the chaaracters into Morse Code
+ if (command[2] == ';') {
+ sprintf(reply, "KY%d;", cw_busy);
+ send_resp(client->fd, reply);
+ } else if (command[27] == ';') {
+ if (cw_busy == 0) {
+ strncpy(cw_buf, &command[3], 24);
+ cw_busy = 1;
+ }
+ } else {
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'L':
+ switch (command[1]) {
+ case 'K': // LK
+ // set/read key lock
+ if (command[2] == ';') {
+ sprintf(reply, "LK%d%d;", locked, locked);
+ send_resp(client->fd, reply);
+ } else if (command[27] == ';') {
+ locked = command[2] == '1';
+ vfo_update();
+ }
+ break;
+ case 'M': // LM
+ // set/read keyer recording status
+ implemented = FALSE;
+ break;
+ case 'T': // LT
+ // set/read ALT fucntion status
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'M':
+ switch (command[1]) {
+ case 'C': // MC
+ // set/read Memory Channel
+ implemented = FALSE;
+ break;
+ case 'D': // MD
+ // set/read operating mode
+ if (command[2] == ';') {
+ int mode = ts2000_mode(vfo[VFO_A].mode);
+ sprintf(reply, "MD%d;", mode);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ int mode = modeUSB;
+ switch (atoi(&command[2])) {
+ case 1:
+ mode = modeLSB;
break;
- case 'Q': //ZZWQ
- implemented=FALSE;
+ case 2:
+ mode = modeUSB;
break;
- case 'R': //ZZWR
- implemented=FALSE;
+ case 3:
+ mode = modeCWU;
break;
- case 'S': //ZZWS
- implemented=FALSE;
+ case 4:
+ mode = modeFMN;
break;
- case 'T': //ZZWT
- implemented=FALSE;
+ case 5:
+ mode = modeAM;
break;
- case 'U': //ZZWU
- implemented=FALSE;
+ case 6:
+ mode = modeDIGL;
break;
- case 'V': //ZZWV
- implemented=FALSE;
+ case 7:
+ mode = modeCWL;
break;
- case 'W': //ZZWW
- implemented=FALSE;
+ case 9:
+ mode = modeDIGU;
break;
default:
- implemented=FALSE;
break;
+ }
+ vfo_mode_changed(mode);
}
break;
- case 'X': //ZZXx
- switch(command[3]) {
- case 'C': //ZZXC
- // clear transmitter XIT
- if(command[4]==';') {
- transmitter->xit=0;
- vfo_update();
- }
- break;
- case 'F': //ZZXF
- // set/read XIT
- if(command[4]==';') {
- sprintf(reply,"ZZXT%+05lld;",transmitter->xit);
- send_resp(client->fd,reply) ;
- } else if(command[9]==';') {
- transmitter->xit=(long long)atoi(&command[4]);
- vfo_update();
- }
- break;
- case 'H': //ZZXH
- implemented=FALSE;
- break;
- case 'N': //ZZXN
- // read combined RX1 status
- if(command[4]==';') {
- int status=0;
- status=status|((receiver[0]->agc)&0x03);
- int a=adc[receiver[0]->adc].attenuation;
- if(a==0) {
- a=1;
- } else if(a<=-30) {
- a=4;
- } else if(a<=-20) {
- a=0;
- } else if(a<=-10) {
- a=2;
- } else {
- a=3;
- }
- status=status|((a&0x03)<<3);
- status=status|((receiver[0]->squelch_enable&0x01)<<6);
- status=status|((receiver[0]->nb&0x01)<<7);
- status=status|((receiver[0]->nb2&0x01)<<8);
- status=status|((receiver[0]->nr&0x01)<<9);
- status=status|((receiver[0]->nr2&0x01)<<10);
- status=status|((receiver[0]->snb&0x01)<<11);
- status=status|((receiver[0]->anf&0x01)<<12);
- sprintf(reply,"ZZXN%04d;",status);
- send_resp(client->fd,reply);
- }
- break;
- case 'O': //ZZXO
- // read combined RX2 status
- if(receivers==2) {
- if(command[4]==';') {
- int status=0;
- status=status|((receiver[1]->agc)&0x03);
- int a=adc[receiver[1]->adc].attenuation;
- if(a==0) {
- a=1;
- } else if(a<=-30) {
- a=4;
- } else if(a<=-20) {
- a=0;
- } else if(a<=-10) {
- a=2;
- } else {
- a=3;
- }
- status=status|((a&0x03)<<3);
- status=status|((receiver[1]->squelch_enable&0x01)<<6);
- status=status|((receiver[1]->nb&0x01)<<7);
- status=status|((receiver[1]->nb2&0x01)<<8);
- status=status|((receiver[1]->nr&0x01)<<9);
- status=status|((receiver[1]->nr2&0x01)<<10);
- status=status|((receiver[1]->snb&0x01)<<11);
- status=status|((receiver[1]->anf&0x01)<<12);
- sprintf(reply,"ZZXO%04d;",status);
- send_resp(client->fd,reply);
- }
- }
- break;
- case 'S': //ZZXS
- /// set/read XIT enable
- if(command[4]==';') {
- sprintf(reply,"ZZXS%d;",transmitter->xit_enabled);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- transmitter->xit_enabled=atoi(&command[4]);
- vfo_update();
- }
- break;
- case 'T': //ZZXT
- implemented=FALSE;
- break;
- case 'V': //ZZXV
- // read combined VFO status
- if(command[4]==';') {
- int status=0;
- if(vfo[VFO_A].rit_enabled) {
- status=status|0x01;
- }
- if(locked) {
- status=status|0x02;
- status=status|0x04;
- }
- if(split) {
- status=status|0x08;
- }
- if(vfo[VFO_A].ctun) {
- status=status|0x10;
- }
- if(vfo[VFO_B].ctun) {
- status=status|0x20;
- }
- if(mox) {
- status=status|0x40;
- }
- if(tune) {
- status=status|0x80;
- }
- sprintf(reply,"ZZXV%03d;",status);
- send_resp(client->fd,reply);
- }
- break;
- default:
- implemented=FALSE;
- break;
+ case 'F': // MF
+ // set/read Menu
+ implemented = FALSE;
+ break;
+ case 'G': // MG
+ // set/read Menu Gain (-12..60 converts to 0..100)
+ if (command[2] == ';') {
+ sprintf(reply, "MG%03d;", (int)(((mic_gain + 12.0) / 72.0) * 100.0));
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ double gain = (double)atoi(&command[2]);
+ gain = ((gain / 100.0) * 72.0) - 12.0;
+ set_mic_gain(gain);
}
break;
- case 'Y': //ZZYx
- switch(command[3]) {
- case 'A': //ZZYA
- implemented=FALSE;
- break;
- case 'B': //ZZYB
- implemented=FALSE;
- break;
- case 'C': //ZZYC
- implemented=FALSE;
- break;
- case 'R': //ZZYR
- // switch receivers
- if(command[5]==';') {
- int v=atoi(&command[4]);
- if(v==0) {
- active_receiver=receiver[0];
- } else if(v==1) {
- if(receivers==2) {
- active_receiver=receiver[1];
- }
- }
- vfo_update();
- }
- break;
- default:
- implemented=FALSE;
- break;
+ case 'L': // ML
+ // set/read Monitor Function Level
+ implemented = FALSE;
+ break;
+ case 'O': // MO
+ // set/read Monitor Function On/Off
+ implemented = FALSE;
+ break;
+ case 'R': // MR
+ // read Memory Channel
+ implemented = FALSE;
+ break;
+ case 'U': // MU
+ // set/read Memory Group
+ implemented = FALSE;
+ break;
+ case 'W': // MW
+ // Write Memory Channel
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'N':
+ switch (command[1]) {
+ case 'B': // NB
+ // set/read noise blanker
+ if (command[2] == ';') {
+ sprintf(reply, "NB%d;", active_receiver->nb);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ active_receiver->nb = atoi(&command[2]);
+ if (active_receiver->nb) {
+ active_receiver->nb2 = 0;
+ }
+ update_noise();
}
break;
- case 'Z': //ZZZx
- switch(command[3]) {
- case 'A': //ZZZA
- implemented=FALSE;
- break;
- case 'B': //ZZZB
- implemented=FALSE;
- break;
- case 'Z': //ZZZZ
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
+ case 'L': // NL
+ // set/read noise blanker level
+ implemented = FALSE;
+ break;
+ case 'R': // NR
+ // set/read noise reduction
+ if (command[2] == ';') {
+ int n = 0;
+ if (active_receiver->nr) {
+ n = 1;
+ } else if (active_receiver->nr2) {
+ n = 2;
+ }
+ sprintf(reply, "NR%d;", n);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ int n = atoi(&command[2]);
+ switch (n) {
+ case 0: // NR OFF
+ active_receiver->nr = 0;
+ active_receiver->nr2 = 0;
+ break;
+ case 1: // NR ON
+ active_receiver->nr = 1;
+ active_receiver->nr2 = 0;
+ break;
+ case 2: // NR2 ON
+ active_receiver->nr = 0;
+ active_receiver->nr2 = 1;
break;
+ }
+ update_noise();
+ }
+ break;
+ case 'T': // NT
+ // set/read ANF
+ if (command[2] == ';') {
+ sprintf(reply, "NT%d;", active_receiver->anf);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ active_receiver->anf = atoi(&command[2]);
+ SetRXAANFRun(active_receiver->id, active_receiver->anf);
+ vfo_update();
}
break;
default:
- implemented=FALSE;
- break;
- }
- return implemented;
-}
-
-// called with g_idle_add so that the processing is running on the main thread
-int parse_cmd(void *data) {
- COMMAND *info=(COMMAND *)data;
- CLIENT *client=info->client;
- char *command=info->command;
- char reply[80];
- reply[0]='\0';
- gboolean implemented=TRUE;
- gboolean errord=FALSE;
-
- switch(command[0]) {
- case 'A':
- switch(command[1]) {
- case 'C': //AC
- // set/read internal atu status
- implemented=FALSE;
- break;
- case 'G': //AG
- // set/read AF Gain
- if(command[2]==';') {
- // send reply back (covert from 0..1 to 0..255)
- sprintf(reply,"AG0%03d;",(int)(receiver[0]->volume*255.0));
- send_resp(client->fd,reply) ;
- } else if(command[6]==';') {
- int gain=atoi(&command[3]);
- receiver[0]->volume=(double)gain/255.0;
- update_af_gain();
- }
- break;
- case 'I': //AI
- // set/read Auto Information
- implemented=FALSE;
- break;
- case 'L': // AL
- // set/read Auto Notch level
- implemented=FALSE;
- break;
- case 'M': // AM
- // set/read Auto Mode
- implemented=FALSE;
- break;
- case 'N': // AN
- // set/read Antenna Connection
- implemented=FALSE;
- break;
- case 'S': // AS
- // set/read Auto Mode Function Parameters
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'O':
+ switch (command[1]) {
+ case 'F': // OF
+ // set/read offset frequency
+ implemented = FALSE;
+ break;
+ case 'I': // OI
+ // set/read offset frequency
+ implemented = FALSE;
+ break;
+ case 'S': // OS
+ // set/read offset function status
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'P':
+ switch (command[1]) {
+ case 'A': // PA
+ // set/read preamp function status
+ if (command[2] == ';') {
+ sprintf(reply, "PA%d0;", active_receiver->preamp);
+ send_resp(client->fd, reply);
+ } else if (command[4] == ';') {
+ active_receiver->preamp = command[2] == '1';
}
break;
- case 'B':
- switch(command[1]) {
- case 'C': //BC
- // set/read Beat Canceller
- implemented=FALSE;
- break;
- case 'D': //BD
- //band down 1 band
- band_minus(receiver[0]->id);
- break;
- case 'P': //BP
- // set/read Manual Beat Canceller frequency
- implemented=FALSE;
- break;
- case 'U': //BU
- //band up 1 band
- band_plus(receiver[0]->id);
- break;
- case 'Y': //BY
- // read busy signal
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ case 'B': // PB
+ // set/read FRU-3A playback status
+ implemented = FALSE;
+ break;
+ case 'C': // PC
+ // set/read PA Power
+ if (command[2] == ';') {
+ sprintf(reply, "PC%03d;", (int)transmitter->drive);
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ set_drive((double)atoi(&command[2]));
}
break;
- case 'C':
- switch(command[1]) {
- case 'A': //CA
- // set/read CW Auto Tune
- implemented=FALSE;
- break;
- case 'G': //CG
- // set/read Carrier Gain
- implemented=FALSE;
- break;
- case 'I': //CI
- // sets the current frequency to the CALL Channel
- implemented=FALSE;
- break;
- case 'M': //CM
- // sets/reads the Packet Cluster Tune function
- implemented=FALSE;
- break;
- case 'N': //CN
- // sets/reads CTCSS function
- if(command[3]==';') {
- sprintf(reply,"CN%02d;",transmitter->ctcss+1);
- send_resp(client->fd,reply) ;
- } else if(command[4]==';') {
- int i=atoi(&command[2])-1;
- transmitter_set_ctcss(transmitter,transmitter->ctcss_enabled,i);
- }
- break;
- case 'T': //CT
- // sets/reads CTCSS status
- if(command[3]==';') {
- sprintf(reply,"CT%d;",transmitter->ctcss_enabled);
- send_resp(client->fd,reply) ;
- } else if(command[3]==';') {
- int state=atoi(&command[2]);
- transmitter_set_ctcss(transmitter,state,transmitter->ctcss);
- }
- break;
- default:
- implemented=FALSE;
- break;
+ case 'I': // PI
+ // store in program memory channel
+ implemented = FALSE;
+ break;
+ case 'K': // PK
+ // read packet cluster data
+ implemented = FALSE;
+ break;
+ case 'L': // PL
+ // set/read speach processor input/output level
+ if (command[2] == ';') {
+ sprintf(reply, "PL%03d000;",
+ (int)((transmitter->compressor_level / 20.0) * 100.0));
+ send_resp(client->fd, reply);
+ } else if (command[8] == ';') {
+ command[5] = '\0';
+ double level = (double)atoi(&command[2]);
+ level = (level / 100.0) * 20.0;
+ transmitter_set_compressor_level(transmitter, level);
+ vfo_update();
}
break;
- case 'D':
- switch(command[1]) {
- case 'C': //DC
- // set/read TX band status
- implemented=FALSE;
- break;
- case 'N': //DN
- // move VFO A down 1 step size
- vfo_id_step(VFO_A,-1);
- break;
- case 'Q': //DQ
- // set/read DCS function status
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ case 'M': // PM
+ // recall program memory
+ implemented = FALSE;
+ break;
+ case 'R': // PR
+ // set/read speech processor function
+ implemented = FALSE;
+ break;
+ case 'S': // PS
+ // set/read Power (always ON)
+ if (command[2] == ';') {
+ sprintf(reply, "PS1;");
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ // ignore set
}
break;
- case 'E':
- switch(command[1]) {
- case 'X': //EX
- // set/read the extension menu
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'F':
- switch(command[1]) {
- case 'A': //FA
- // set/read VFO-A frequency
- if(command[2]==';') {
- if(vfo[VFO_A].ctun) {
- sprintf(reply,"FA%011lld;",vfo[VFO_A].ctun_frequency);
- } else {
- sprintf(reply,"FA%011lld;",vfo[VFO_A].frequency);
- }
- send_resp(client->fd,reply) ;
- } else if(command[13]==';') {
- long long f=atoll(&command[2]);
- local_set_frequency(VFO_A,f);
- vfo_update();
- }
- break;
- case 'B': //FB
- // set/read VFO-B frequency
- if(command[2]==';') {
- if(vfo[VFO_B].ctun) {
- sprintf(reply,"FB%011lld;",vfo[VFO_B].ctun_frequency);
- } else {
- sprintf(reply,"FB%011lld;",vfo[VFO_B].frequency);
- }
- send_resp(client->fd,reply) ;
- } else if(command[13]==';') {
- long long f=atoll(&command[2]);
- local_set_frequency(VFO_B,f);
- vfo_update();
- }
- break;
- case 'C': //FC
- // set/read the sub receiver VFO frequency menu
- implemented=FALSE;
- break;
- case 'D': //FD
- // set/read the filter display dot pattern
- implemented=FALSE;
- break;
- case 'R': //FR
- // set/read transceiver receive VFO
- if(command[2]==';') {
- sprintf(reply,"FR%d;",active_receiver->id);
- send_resp(client->fd,reply) ;
- } else if(command[3]==';') {
- int id=atoi(&command[2]);
- switch(id) {
- case 0:
- active_receiver=receiver[id];
- break;
- case 1:
- if(receivers==2) {
- active_receiver=receiver[id];
- } else {
- implemented=FALSE;
- }
- break;
- default:
- implemented=FALSE;
- break;
- }
- }
- break;
- case 'S': //FS
- // set/read the fine tune function status
- implemented=FALSE;
- break;
- case 'T': //FT
- // set/read transceiver transmit VFO
- if(command[2]==';') {
- sprintf(reply,"FT%d;",split);
- send_resp(client->fd,reply) ;
- } else if(command[3]==';') {
- split=atoi(&command[2]);
- tx_set_mode(transmitter,get_tx_mode());
- vfo_update();
- }
- break;
- case 'W': //FW
- // set/read filter width
- // make sure filter is filterVar1
- if(vfo[active_receiver->id].filter!=filterVar1) {
- vfo_filter_changed(filterVar1);
- }
- FILTER *mode_filters=filters[vfo[active_receiver->id].mode];
- FILTER *filter=&mode_filters[filterVar1];
- int val=0;
- if(command[2]==';') {
- switch(vfo[active_receiver->id].mode) {
- case modeCWL:
- case modeCWU:
- val=filter->low*2;
- break;
- case modeAM:
- case modeSAM:
- val=filter->low>=-4000;
- break;
- case modeFMN:
- val=active_receiver->deviation==5000;
- break;
- default:
- implemented=FALSE;
- break;
- }
- if(implemented) {
- sprintf(reply,"FW%04d;",val);
- send_resp(client->fd,reply) ;
- }
- } else if(command[6]==';') {
- int fw=atoi(&command[2]);
- int val=
- filter->low=fw;
- switch(vfo[active_receiver->id].mode) {
- case modeCWL:
- case modeCWU:
- filter->low=fw/2;
- filter->high=fw/2;
- break;
- case modeFMN:
- if(fw==0) {
- filter->low=-4000;
- filter->high=4000;
- active_receiver->deviation=2500;
- } else {
- filter->low=-8000;
- filter->high=8000;
- active_receiver->deviation=5000;
- }
- break;
- case modeAM:
- case modeSAM:
- if(fw==0) {
- filter->low=-4000;
- filter->high=4000;
- } else {
- filter->low=-8000;
- filter->high=8000;
- }
- break;
- default:
- implemented=FALSE;
- break;
- }
- if(implemented) {
- vfo_filter_changed(filterVar1);
- }
- }
- break;
- default:
- implemented=FALSE;
- break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'Q':
+ switch (command[1]) {
+ case 'C': // QC
+ // set/read DCS code
+ implemented = FALSE;
+ break;
+ case 'I': // QI
+ // store in quick memory
+ implemented = FALSE;
+ break;
+ case 'R': // QR
+ // set/read quick memory channel data
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'R':
+ switch (command[1]) {
+ case 'A': // RA
+ // set/read Attenuator function
+ if (command[2] == ';') {
+ int att = 0;
+ if (have_rx_gain) {
+ att = (int)(adc[active_receiver->adc].attenuation + 12);
+ att = (int)(((double)att / 60.0) * 99.0);
+ } else {
+ att = (int)(adc[active_receiver->adc].attenuation);
+ att = (int)(((double)att / 31.0) * 99.0);
+ }
+ sprintf(reply, "RA%02d00;", att);
+ send_resp(client->fd, reply);
+ } else if (command[4] == ';') {
+ int att = atoi(&command[2]);
+ if (have_rx_gain) {
+ att = (int)((((double)att / 99.0) * 60.0) - 12.0);
+ } else {
+ att = (int)(((double)att / 99.0) * 31.0);
+ }
+ set_attenuation_value((double)att);
}
break;
- case 'G':
- switch(command[1]) {
- case 'T': //GT
- // set/read RX1 AGC
- if(command[2]==';') {
- sprintf(reply,"GT%03d;",receiver[0]->agc*5);
- send_resp(client->fd,reply) ;
- } else if(command[5]==';') {
- // update RX1 AGC
- receiver[0]->agc=atoi(&command[2])/5;
- vfo_update();
- }
- break;
- default:
- implemented=FALSE;
- break;
+ case 'C': // RC
+ // clears RIT
+ if (command[2] == ';') {
+ vfo[VFO_A].rit = 0;
+ vfo_update();
}
break;
- case 'H':
- switch(command[1]) {
- default:
- implemented=FALSE;
- break;
+ case 'D': // RD
+ // decrements RIT Frequency
+ if (command[2] == ';') {
+ if (vfo[VFO_A].mode == modeCWL || vfo[VFO_A].mode == modeCWU) {
+ vfo[VFO_A].rit -= 10;
+ } else {
+ vfo[VFO_A].rit -= 50;
+ }
+ vfo_update();
+ } else if (command[7] == ';') {
+ vfo[VFO_A].rit = atoi(&command[2]);
+ vfo_update();
}
break;
- case 'I':
- switch(command[1]) {
- case 'D': //ID
- // get ID
- strcpy(reply,"ID019;"); // TS-2000
- send_resp(client->fd,reply);
- break;
- case 'F': //IF
- {
- int mode=ts2000_mode(vfo[VFO_A].mode);
- sprintf(reply,"IF%011lld%04lld%+06lld%d%d%d%02d%d%d%d%d%d%d%02d%d;",
- vfo[VFO_A].ctun?vfo[VFO_A].ctun_frequency:vfo[VFO_A].frequency,
- step,vfo[VFO_A].rit,vfo[VFO_A].rit_enabled,transmitter==NULL?0:transmitter->xit_enabled,
- 0,0,isTransmitting(),mode,0,0,split,transmitter->ctcss_enabled?2:0,transmitter->ctcss,0);
- send_resp(client->fd,reply);
- }
- break;
- case 'S': //IS
- // set/read IF shift
- if(command[2]==';') {
- strcpy(reply,"IS 0000;");
- send_resp(client->fd,reply);
- } else {
- implemented=FALSE;
- }
- break;
- default:
- implemented=FALSE;
- break;
+ case 'G': // RG
+ // set/read RF gain status
+ implemented = FALSE;
+ break;
+ case 'L': // RL
+ // set/read noise reduction level
+ implemented = FALSE;
+ break;
+ case 'M': // RM
+ // set/read meter function
+ implemented = FALSE;
+ break;
+ case 'T': // RT
+ // set/read RIT enable
+ if (command[2] == ';') {
+ sprintf(reply, "RT%d;", vfo[VFO_A].rit_enabled);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ vfo[VFO_A].rit_enabled = atoi(&command[2]);
+ vfo_update();
}
break;
- case 'J':
- switch(command[1]) {
- default:
- implemented=FALSE;
- break;
+ case 'U': // RU
+ // increments RIT Frequency
+ if (command[2] == ';') {
+ if (vfo[VFO_A].mode == modeCWL || vfo[VFO_A].mode == modeCWU) {
+ vfo[VFO_A].rit += 10;
+ } else {
+ vfo[VFO_A].rit += 50;
+ }
+ vfo_update();
+ } else if (command[7] == ';') {
+ vfo[VFO_A].rit = atoi(&command[2]);
+ vfo_update();
}
break;
- case 'K':
- switch(command[1]) {
- case 'S': //KS
- // set/read keying speed
- if(command[2]==';') {
- sprintf(reply,"KS%03d;",cw_keyer_speed);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- int speed=atoi(&command[2]);
- if(speed>=1 && speed<=60) {
- cw_keyer_speed=speed;
-#ifdef LOCALCW
- keyer_update();
-#endif
- vfo_update();
- }
- } else {
- }
- break;
- case 'Y': //KY
- // convert the chaaracters into Morse Code
- if(command[2]==';') {
- sprintf(reply,"KY%d;",cw_busy);
- send_resp(client->fd,reply);
- } else if(command[27]==';') {
- if(cw_busy==0) {
- strncpy(cw_buf,&command[3],24);
- cw_busy=1;
- }
- } else {
- }
- break;
- default:
- implemented=FALSE;
- break;
+ case 'X': // RX
+ // set transceiver to RX mode
+ if (command[2] == ';') {
+ mox_update(0);
}
break;
- case 'L':
- switch(command[1]) {
- case 'K': //LK
- // set/read key lock
- if(command[2]==';') {
- sprintf(reply,"LK%d%d;",locked,locked);
- send_resp(client->fd,reply);
- } else if(command[27]==';') {
- locked=command[2]=='1';
- vfo_update();
- }
- break;
- case 'M': //LM
- // set/read keyer recording status
- implemented=FALSE;
- break;
- case 'T': //LT
- // set/read ALT fucntion status
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'M':
- switch(command[1]) {
- case 'C': //MC
- // set/read Memory Channel
- implemented=FALSE;
- break;
- case 'D': //MD
- // set/read operating mode
- if(command[2]==';') {
- int mode=ts2000_mode(vfo[VFO_A].mode);
- sprintf(reply,"MD%d;",mode);
- send_resp(client->fd,reply);
- } else if(command[3]==';') {
- int mode=modeUSB;
- switch(atoi(&command[2])) {
- case 1:
- mode=modeLSB;
- break;
- case 2:
- mode=modeUSB;
- break;
- case 3:
- mode=modeCWU;
- break;
- case 4:
- mode=modeFMN;
- break;
- case 5:
- mode=modeAM;
- break;
- case 6:
- mode=modeDIGL;
- break;
- case 7:
- mode=modeCWL;
- break;
- case 9:
- mode=modeDIGU;
- break;
- default:
- break;
- }
- vfo_mode_changed(mode);
- }
- break;
- case 'F': //MF
- // set/read Menu
- implemented=FALSE;
- break;
- case 'G': //MG
- // set/read Menu Gain (-12..60 converts to 0..100)
- if(command[2]==';') {
- sprintf(reply,"MG%03d;",(int)(((mic_gain+12.0)/72.0)*100.0));
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- double gain=(double)atoi(&command[2]);
- gain=((gain/100.0)*72.0)-12.0;
- set_mic_gain(gain);
- }
- break;
- case 'L': //ML
- // set/read Monitor Function Level
- implemented=FALSE;
- break;
- case 'O': //MO
- // set/read Monitor Function On/Off
- implemented=FALSE;
- break;
- case 'R': //MR
- // read Memory Channel
- implemented=FALSE;
- break;
- case 'U': //MU
- // set/read Memory Group
- implemented=FALSE;
- break;
- case 'W': //MW
- // Write Memory Channel
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'N':
- switch(command[1]) {
- case 'B': //NB
- // set/read noise blanker
- if(command[2]==';') {
- sprintf(reply,"NB%d;",active_receiver->nb);
- send_resp(client->fd,reply);
- } else if(command[3]==';') {
- active_receiver->nb=atoi(&command[2]);
- if(active_receiver->nb) {
- active_receiver->nb2=0;
- }
- update_noise();
- }
- break;
- case 'L': //NL
- // set/read noise blanker level
- implemented=FALSE;
- break;
- case 'R': //NR
- // set/read noise reduction
- if(command[2]==';') {
- int n=0;
- if(active_receiver->nr) {
- n=1;
- } else if(active_receiver->nr2) {
- n=2;
- }
- sprintf(reply,"NR%d;",n);
- send_resp(client->fd,reply);
- } else if(command[3]==';') {
- int n=atoi(&command[2]);
- switch(n) {
- case 0: // NR OFF
- active_receiver->nr=0;
- active_receiver->nr2=0;
- break;
- case 1: // NR ON
- active_receiver->nr=1;
- active_receiver->nr2=0;
- break;
- case 2: // NR2 ON
- active_receiver->nr=0;
- active_receiver->nr2=1;
- break;
- }
- update_noise();
- }
- break;
- case 'T': //NT
- // set/read ANF
- if(command[2]==';') {
- sprintf(reply,"NT%d;",active_receiver->anf);
- send_resp(client->fd,reply);
- } else if(command[3]==';') {
- active_receiver->anf=atoi(&command[2]);
- SetRXAANFRun(active_receiver->id, active_receiver->anf);
- vfo_update();
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'S':
+ switch (command[1]) {
+ case 'A': // SA
+ // set/read stallite mode status
+ if (command[2] == ';') {
+ sprintf(reply, "SA%d%d%d%d%d%d%dSAT? ;",
+ sat_mode == SAT_MODE | sat_mode == RSAT_MODE, 0, 0, 0,
+ sat_mode == SAT_MODE, sat_mode == RSAT_MODE, 0);
+ send_resp(client->fd, reply);
+ } else if (command[9] == ';') {
+ if (command[2] == '0') {
+ sat_mode = SAT_NONE;
+ } else if (command[2] == '1') {
+ if (command[6] == '0' && command[7] == '0') {
+ sat_mode = SAT_NONE;
+ } else if (command[6] == '1' && command[7] == '0') {
+ sat_mode = SAT_MODE;
+ } else if (command[6] == '0' && command[7] == '1') {
+ sat_mode = RSAT_MODE;
+ } else {
+ implemented = FALSE;
}
- break;
- default:
- implemented=FALSE;
- break;
+ }
+ } else {
+ implemented = FALSE;
}
break;
- case 'O':
- switch(command[1]) {
- case 'F': //OF
- // set/read offset frequency
- implemented=FALSE;
- break;
- case 'I': //OI
- // set/read offset frequency
- implemented=FALSE;
- break;
- case 'S': //OS
- // set/read offset function status
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ case 'B': // SB
+ // set/read SUB,TF-W status
+ implemented = FALSE;
+ break;
+ case 'C': // SC
+ // set/read SCAN function status
+ implemented = FALSE;
+ break;
+ case 'D': // SD
+ // set/read CW break-in time delay
+ if (command[2] == ';') {
+ sprintf(reply, "SD%04d;", (int)fmin(cw_keyer_hang_time, 1000));
+ send_resp(client->fd, reply);
+ } else if (command[6] == ';') {
+ int b = fmin(atoi(&command[2]), 1000);
+ cw_breakin = b == 0;
+ cw_keyer_hang_time = b;
+ } else {
+ implemented = FALSE;
}
break;
- case 'P':
- switch(command[1]) {
- case 'A': //PA
- // set/read preamp function status
- if(command[2]==';') {
- sprintf(reply,"PA%d0;",active_receiver->preamp);
- send_resp(client->fd,reply);
- } else if(command[4]==';') {
- active_receiver->preamp=command[2]=='1';
- }
- break;
- case 'B': //PB
- // set/read FRU-3A playback status
- implemented=FALSE;
- break;
- case 'C': //PC
- // set/read PA Power
- if(command[2]==';') {
- sprintf(reply,"PC%03d;",(int)transmitter->drive);
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- set_drive((double)atoi(&command[2]));
- }
- break;
- case 'I': //PI
- // store in program memory channel
- implemented=FALSE;
- break;
- case 'K': //PK
- // read packet cluster data
- implemented=FALSE;
- break;
- case 'L': //PL
- // set/read speach processor input/output level
- if(command[2]==';') {
- sprintf(reply,"PL%03d000;",(int)((transmitter->compressor_level/20.0)*100.0));
- send_resp(client->fd,reply);
- } else if(command[8]==';') {
- command[5]='\0';
- double level=(double)atoi(&command[2]);
- level=(level/100.0)*20.0;
- transmitter_set_compressor_level(transmitter,level);
- vfo_update();
- }
- break;
- case 'M': //PM
- // recall program memory
- implemented=FALSE;
- break;
- case 'R': //PR
- // set/read speech processor function
- implemented=FALSE;
- break;
- case 'S': //PS
- // set/read Power (always ON)
- if(command[2]==';') {
- sprintf(reply,"PS1;");
- send_resp(client->fd,reply);
- } else if(command[3]==';') {
- // ignore set
+ case 'H': // SH
+ {
+ // set/read filter high
+ // make sure filter is filterVar1
+ if (vfo[active_receiver->id].filter != filterVar1) {
+ vfo_filter_changed(filterVar1);
+ }
+ FILTER *mode_filters = filters[vfo[active_receiver->id].mode];
+ FILTER *filter = &mode_filters[filterVar1];
+ if (command[2] == ';') {
+ int fh = 5;
+ int high = filter->high;
+ if (vfo[active_receiver->id].mode == modeLSB) {
+ high = abs(filter->low);
+ }
+ if (high <= 1400) {
+ fh = 0;
+ } else if (high <= 1600) {
+ fh = 1;
+ } else if (high <= 1800) {
+ fh = 2;
+ } else if (high <= 2000) {
+ fh = 3;
+ } else if (high <= 2200) {
+ fh = 4;
+ } else if (high <= 2400) {
+ fh = 5;
+ } else if (high <= 2600) {
+ fh = 6;
+ } else if (high <= 2800) {
+ fh = 7;
+ } else if (high <= 3000) {
+ fh = 8;
+ } else if (high <= 3400) {
+ fh = 9;
+ } else if (high <= 4000) {
+ fh = 10;
+ } else {
+ fh = 11;
+ }
+ sprintf(reply, "SH%02d;", fh);
+ send_resp(client->fd, reply);
+ } else if (command[4] == ';') {
+ int i = atoi(&command[2]);
+ int fh = 100;
+ switch (vfo[active_receiver->id].mode) {
+ case modeLSB:
+ case modeUSB:
+ case modeFMN:
+ switch (i) {
+ case 0:
+ fh = 1400;
+ break;
+ case 1:
+ fh = 1600;
+ break;
+ case 2:
+ fh = 1800;
+ break;
+ case 3:
+ fh = 2000;
+ break;
+ case 4:
+ fh = 2200;
+ break;
+ case 5:
+ fh = 2400;
+ break;
+ case 6:
+ fh = 2600;
+ break;
+ case 7:
+ fh = 2800;
+ break;
+ case 8:
+ fh = 3000;
+ break;
+ case 9:
+ fh = 3400;
+ break;
+ case 10:
+ fh = 4000;
+ break;
+ case 11:
+ fh = 5000;
+ break;
+ default:
+ fh = 100;
+ break;
+ }
+ break;
+ case modeAM:
+ case modeSAM:
+ switch (i) {
+ case 0:
+ fh = 10;
+ break;
+ case 1:
+ fh = 100;
+ break;
+ case 2:
+ fh = 200;
+ break;
+ case 3:
+ fh = 500;
+ break;
+ default:
+ fh = 100;
+ break;
}
break;
- default:
- implemented=FALSE;
- break;
+ }
+ if (vfo[active_receiver->id].mode == modeLSB) {
+ filter->low = -fh;
+ } else {
+ filter->high = fh;
+ }
+ vfo_filter_changed(filterVar1);
}
+ } break;
+ case 'I': // SI
+ // enter satellite memory name
+ implemented = FALSE;
break;
- case 'Q':
- switch(command[1]) {
- case 'C': //QC
- // set/read DCS code
- implemented=FALSE;
- break;
- case 'I': //QI
- // store in quick memory
- implemented=FALSE;
- break;
- case 'R': //QR
- // set/read quick memory channel data
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'R':
- switch(command[1]) {
- case 'A': //RA
- // set/read Attenuator function
- if(command[2]==';') {
- int att=0;
- if(have_rx_gain) {
- att=(int)(adc[active_receiver->adc].attenuation+12);
- att=(int)(((double)att/60.0)*99.0);
- } else {
- att=(int)(adc[active_receiver->adc].attenuation);
- att=(int)(((double)att/31.0)*99.0);
- }
- sprintf(reply,"RA%02d00;",att);
- send_resp(client->fd,reply);
- } else if(command[4]==';') {
- int att=atoi(&command[2]);
- if(have_rx_gain) {
- att=(int)((((double)att/99.0)*60.0)-12.0);
- } else {
- att=(int)(((double)att/99.0)*31.0);
- }
- set_attenuation_value((double)att);
- }
- break;
- case 'C': //RC
- // clears RIT
- if(command[2]==';') {
- vfo[VFO_A].rit=0;
- vfo_update();
- }
- break;
- case 'D': //RD
- // decrements RIT Frequency
- if(command[2]==';') {
- if(vfo[VFO_A].mode==modeCWL || vfo[VFO_A].mode==modeCWU) {
- vfo[VFO_A].rit-=10;
- } else {
- vfo[VFO_A].rit-=50;
- }
- vfo_update();
- } else if(command[7]==';') {
- vfo[VFO_A].rit=atoi(&command[2]);
- vfo_update();
- }
- break;
- case 'G': //RG
- // set/read RF gain status
- implemented=FALSE;
- break;
- case 'L': //RL
- // set/read noise reduction level
- implemented=FALSE;
- break;
- case 'M': //RM
- // set/read meter function
- implemented=FALSE;
- break;
- case 'T': //RT
- // set/read RIT enable
- if(command[2]==';') {
- sprintf(reply,"RT%d;",vfo[VFO_A].rit_enabled);
- send_resp(client->fd,reply);
- } else if(command[3]==';') {
- vfo[VFO_A].rit_enabled=atoi(&command[2]);
- vfo_update();
- }
- break;
- case 'U': //RU
- // increments RIT Frequency
- if(command[2]==';') {
- if(vfo[VFO_A].mode==modeCWL || vfo[VFO_A].mode==modeCWU) {
- vfo[VFO_A].rit+=10;
- } else {
- vfo[VFO_A].rit+=50;
- }
- vfo_update();
- } else if(command[7]==';') {
- vfo[VFO_A].rit=atoi(&command[2]);
- vfo_update();
- }
- break;
- case 'X': //RX
- // set transceiver to RX mode
- if(command[2]==';') {
- mox_update(0);
+ case 'L': // SL
+ {
+ // set/read filter low
+ // make sure filter is filterVar1
+ if (vfo[active_receiver->id].filter != filterVar1) {
+ vfo_filter_changed(filterVar1);
+ }
+ FILTER *mode_filters = filters[vfo[active_receiver->id].mode];
+ FILTER *filter = &mode_filters[filterVar1];
+ if (command[2] == ';') {
+ int fl = 2;
+ int low = filter->low;
+ if (vfo[active_receiver->id].mode == modeLSB) {
+ low = abs(filter->high);
+ }
+
+ if (low <= 10) {
+ fl = 0;
+ } else if (low <= 50) {
+ fl = 1;
+ } else if (low <= 100) {
+ fl = 2;
+ } else if (low <= 200) {
+ fl = 3;
+ } else if (low <= 300) {
+ fl = 4;
+ } else if (low <= 400) {
+ fl = 5;
+ } else if (low <= 500) {
+ fl = 6;
+ } else if (low <= 600) {
+ fl = 7;
+ } else if (low <= 700) {
+ fl = 8;
+ } else if (low <= 800) {
+ fl = 9;
+ } else if (low <= 900) {
+ fl = 10;
+ } else {
+ fl = 11;
+ }
+ sprintf(reply, "SL%02d;", fl);
+ send_resp(client->fd, reply);
+ } else if (command[4] == ';') {
+ int i = atoi(&command[2]);
+ int fl = 100;
+ switch (vfo[active_receiver->id].mode) {
+ case modeLSB:
+ case modeUSB:
+ case modeFMN:
+ switch (i) {
+ case 0:
+ fl = 10;
+ break;
+ case 1:
+ fl = 50;
+ break;
+ case 2:
+ fl = 100;
+ break;
+ case 3:
+ fl = 200;
+ break;
+ case 4:
+ fl = 300;
+ break;
+ case 5:
+ fl = 400;
+ break;
+ case 6:
+ fl = 500;
+ break;
+ case 7:
+ fl = 600;
+ break;
+ case 8:
+ fl = 700;
+ break;
+ case 9:
+ fl = 800;
+ break;
+ case 10:
+ fl = 900;
+ break;
+ case 11:
+ fl = 1000;
+ break;
+ default:
+ fl = 100;
+ break;
+ }
+ break;
+ case modeAM:
+ case modeSAM:
+ switch (i) {
+ case 0:
+ fl = 10;
+ break;
+ case 1:
+ fl = 100;
+ break;
+ case 2:
+ fl = 200;
+ break;
+ case 3:
+ fl = 500;
+ break;
+ default:
+ fl = 100;
+ break;
}
break;
- default:
- implemented=FALSE;
- break;
+ }
+ if (vfo[active_receiver->id].mode == modeLSB) {
+ filter->high = -fl;
+ } else {
+ filter->low = fl;
+ }
+ vfo_filter_changed(filterVar1);
+ }
+ } break;
+ case 'M': // SM
+ // read the S meter
+ if (command[3] == ';') {
+ int id = atoi(&command[2]);
+ if (id == 0 || id == 1) {
+ sprintf(reply, "SM%04d;", (int)receiver[id]->meter);
+ send_resp(client->fd, reply);
+ }
}
break;
- case 'S':
- switch(command[1]) {
- case 'A': //SA
- // set/read stallite mode status
- if(command[2]==';') {
- sprintf(reply,"SA%d%d%d%d%d%d%dSAT? ;",sat_mode==SAT_MODE|sat_mode==RSAT_MODE,0,0,0,sat_mode==SAT_MODE,sat_mode==RSAT_MODE,0);
- send_resp(client->fd,reply);
- } else if(command[9]==';') {
- if(command[2]=='0') {
- sat_mode=SAT_NONE;
- } else if(command[2]=='1') {
- if(command[6]=='0' && command[7]=='0') {
- sat_mode=SAT_NONE;
- } else if(command[6]=='1' && command[7]=='0') {
- sat_mode=SAT_MODE;
- } else if(command[6]=='0' && command[7]=='1') {
- sat_mode=RSAT_MODE;
- } else {
- implemented=FALSE;
- }
- }
- } else {
- implemented=FALSE;
- }
- break;
- case 'B': //SB
- // set/read SUB,TF-W status
- implemented=FALSE;
- break;
- case 'C': //SC
- // set/read SCAN function status
- implemented=FALSE;
- break;
- case 'D': //SD
- // set/read CW break-in time delay
- if(command[2]==';') {
- sprintf(reply,"SD%04d;",(int)fmin(cw_keyer_hang_time,1000));
- send_resp(client->fd,reply);
- } else if(command[6]==';') {
- int b=fmin(atoi(&command[2]),1000);
- cw_breakin=b==0;
- cw_keyer_hang_time=b;
- } else {
- implemented=FALSE;
- }
- break;
- case 'H': //SH
- {
- // set/read filter high
- // make sure filter is filterVar1
- if(vfo[active_receiver->id].filter!=filterVar1) {
- vfo_filter_changed(filterVar1);
- }
- FILTER *mode_filters=filters[vfo[active_receiver->id].mode];
- FILTER *filter=&mode_filters[filterVar1];
- if(command[2]==';') {
- int fh=5;
- int high=filter->high;
- if(vfo[active_receiver->id].mode==modeLSB) {
- high=abs(filter->low);
- }
- if(high<=1400) {
- fh=0;
- } else if(high<=1600) {
- fh=1;
- } else if(high<=1800) {
- fh=2;
- } else if(high<=2000) {
- fh=3;
- } else if(high<=2200) {
- fh=4;
- } else if(high<=2400) {
- fh=5;
- } else if(high<=2600) {
- fh=6;
- } else if(high<=2800) {
- fh=7;
- } else if(high<=3000) {
- fh=8;
- } else if(high<=3400) {
- fh=9;
- } else if(high<=4000) {
- fh=10;
- } else {
- fh=11;
- }
- sprintf(reply,"SH%02d;",fh);
- send_resp(client->fd,reply) ;
- } else if(command[4]==';') {
- int i=atoi(&command[2]);
- int fh=100;
- switch(vfo[active_receiver->id].mode) {
- case modeLSB:
- case modeUSB:
- case modeFMN:
- switch(i) {
- case 0:
- fh=1400;
- break;
- case 1:
- fh=1600;
- break;
- case 2:
- fh=1800;
- break;
- case 3:
- fh=2000;
- break;
- case 4:
- fh=2200;
- break;
- case 5:
- fh=2400;
- break;
- case 6:
- fh=2600;
- break;
- case 7:
- fh=2800;
- break;
- case 8:
- fh=3000;
- break;
- case 9:
- fh=3400;
- break;
- case 10:
- fh=4000;
- break;
- case 11:
- fh=5000;
- break;
- default:
- fh=100;
- break;
- }
- break;
- case modeAM:
- case modeSAM:
- switch(i) {
- case 0:
- fh=10;
- break;
- case 1:
- fh=100;
- break;
- case 2:
- fh=200;
- break;
- case 3:
- fh=500;
- break;
- default:
- fh=100;
- break;
- }
- break;
- }
- if(vfo[active_receiver->id].mode==modeLSB) {
- filter->low=-fh;
- } else {
- filter->high=fh;
- }
- vfo_filter_changed(filterVar1);
- }
- }
- break;
- case 'I': //SI
- // enter satellite memory name
- implemented=FALSE;
- break;
- case 'L': //SL
- {
- // set/read filter low
- // make sure filter is filterVar1
- if(vfo[active_receiver->id].filter!=filterVar1) {
- vfo_filter_changed(filterVar1);
- }
- FILTER *mode_filters=filters[vfo[active_receiver->id].mode];
- FILTER *filter=&mode_filters[filterVar1];
- if(command[2]==';') {
- int fl=2;
- int low=filter->low;
- if(vfo[active_receiver->id].mode==modeLSB) {
- low=abs(filter->high);
- }
-
- if(low<=10) {
- fl=0;
- } else if(low<=50) {
- fl=1;
- } else if(low<=100) {
- fl=2;
- } else if(low<=200) {
- fl=3;
- } else if(low<=300) {
- fl=4;
- } else if(low<=400) {
- fl=5;
- } else if(low<=500) {
- fl=6;
- } else if(low<=600) {
- fl=7;
- } else if(low<=700) {
- fl=8;
- } else if(low<=800) {
- fl=9;
- } else if(low<=900) {
- fl=10;
- } else {
- fl=11;
- }
- sprintf(reply,"SL%02d;",fl);
- send_resp(client->fd,reply) ;
- } else if(command[4]==';') {
- int i=atoi(&command[2]);
- int fl=100;
- switch(vfo[active_receiver->id].mode) {
- case modeLSB:
- case modeUSB:
- case modeFMN:
- switch(i) {
- case 0:
- fl=10;
- break;
- case 1:
- fl=50;
- break;
- case 2:
- fl=100;
- break;
- case 3:
- fl=200;
- break;
- case 4:
- fl=300;
- break;
- case 5:
- fl=400;
- break;
- case 6:
- fl=500;
- break;
- case 7:
- fl=600;
- break;
- case 8:
- fl=700;
- break;
- case 9:
- fl=800;
- break;
- case 10:
- fl=900;
- break;
- case 11:
- fl=1000;
- break;
- default:
- fl=100;
- break;
- }
- break;
- case modeAM:
- case modeSAM:
- switch(i) {
- case 0:
- fl=10;
- break;
- case 1:
- fl=100;
- break;
- case 2:
- fl=200;
- break;
- case 3:
- fl=500;
- break;
- default:
- fl=100;
- break;
- }
- break;
- }
- if(vfo[active_receiver->id].mode==modeLSB) {
- filter->high=-fl;
- } else {
- filter->low=fl;
- }
- vfo_filter_changed(filterVar1);
- }
- }
- break;
- case 'M': //SM
- // read the S meter
- if(command[3]==';') {
- int id=atoi(&command[2]);
- if(id==0 || id==1) {
- sprintf(reply,"SM%04d;",(int)receiver[id]->meter);
- send_resp(client->fd,reply);
- }
- }
- break;
- case 'Q': //SQ
- // set/read Squelch level
- if(command[3]==';') {
- int p1=atoi(&command[2]);
- if(p1==0) { // Main receiver
- sprintf(reply,"SQ%d%03d;",p1,(int)((double)active_receiver->squelch/100.0*255.0));
- send_resp(client->fd,reply);
- }
- } else if(command[6]==';') {
- if(command[2]=='0') {
- int p2=atoi(&command[3]);
- active_receiver->squelch=(int)((double)p2/255.0*100.0);
- set_squelch();
- }
- } else {
- }
- break;
- case 'R': //SR
- // reset transceiver
- implemented=FALSE;
- break;
- case 'S': //SS
- // set/read program scan pause frequency
- implemented=FALSE;
- break;
- case 'T': //ST
- // set/read MULTI/CH channel frequency steps
- implemented=FALSE;
- break;
- case 'U': //SU
- // set/read program scan pause frequency
- implemented=FALSE;
- break;
- case 'V': //SV
- // execute memory transfer function
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ case 'Q': // SQ
+ // set/read Squelch level
+ if (command[3] == ';') {
+ int p1 = atoi(&command[2]);
+ if (p1 == 0) { // Main receiver
+ sprintf(reply, "SQ%d%03d;", p1,
+ (int)((double)active_receiver->squelch / 100.0 * 255.0));
+ send_resp(client->fd, reply);
+ }
+ } else if (command[6] == ';') {
+ if (command[2] == '0') {
+ int p2 = atoi(&command[3]);
+ active_receiver->squelch = (int)((double)p2 / 255.0 * 100.0);
+ set_squelch();
+ }
+ } else {
}
break;
- case 'T':
- switch(command[1]) {
- case 'C': //TC
- // set/read internal TNC mode
- implemented=FALSE;
- break;
- case 'D': //TD
- // send DTMF memory channel data
- implemented=FALSE;
- break;
- case 'I': //TI
- // read TNC LED status
- implemented=FALSE;
- break;
- case 'N': //TN
- // set/read sub-tone frequency
- implemented=FALSE;
- break;
- case 'O': //TO
- // set/read TONE function
- implemented=FALSE;
- break;
- case 'S': //TS
- // set/read TF-SET function
- implemented=FALSE;
- break;
- case 'X': //TX
- // set transceiver to TX mode
- if(command[2]==';') {
- mox_update(1);
- }
- break;
- case 'Y': //TY
- // set/read microprocessor firmware type
- implemented=FALSE;
- break;
- default:
- implemented=FALSE;
- break;
+ case 'R': // SR
+ // reset transceiver
+ implemented = FALSE;
+ break;
+ case 'S': // SS
+ // set/read program scan pause frequency
+ implemented = FALSE;
+ break;
+ case 'T': // ST
+ // set/read MULTI/CH channel frequency steps
+ implemented = FALSE;
+ break;
+ case 'U': // SU
+ // set/read program scan pause frequency
+ implemented = FALSE;
+ break;
+ case 'V': // SV
+ // execute memory transfer function
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'T':
+ switch (command[1]) {
+ case 'C': // TC
+ // set/read internal TNC mode
+ implemented = FALSE;
+ break;
+ case 'D': // TD
+ // send DTMF memory channel data
+ implemented = FALSE;
+ break;
+ case 'I': // TI
+ // read TNC LED status
+ implemented = FALSE;
+ break;
+ case 'N': // TN
+ // set/read sub-tone frequency
+ implemented = FALSE;
+ break;
+ case 'O': // TO
+ // set/read TONE function
+ implemented = FALSE;
+ break;
+ case 'S': // TS
+ // set/read TF-SET function
+ implemented = FALSE;
+ break;
+ case 'X': // TX
+ // set transceiver to TX mode
+ if (command[2] == ';') {
+ mox_update(1);
}
break;
- case 'U':
- switch(command[1]) {
- case 'L': //UL
- // detects the PLL unlock status
- implemented=FALSE;
- break;
- case 'P': //UP
- // move VFO A up by step
- if(command[2]==';') {
- vfo_step(1);
- }
- break;
- default:
- implemented=FALSE;
- break;
- }
- break;
- case 'V':
- switch(command[1]) {
- case 'D': //VD
- // set/read VOX delay time
- implemented=FALSE;
- break;
- case 'G': //VG
- // set/read VOX gain (0..9)
- if(command[2]==';') {
- // convert 0.0..1.0 to 0..9
- sprintf(reply,"VG%03d;",(int)((vox_threshold*100.0)*0.9));
- send_resp(client->fd,reply);
- } else if(command[5]==';') {
- // convert 0..9 to 0.0..1.0
- vox_threshold=atof(&command[2])/9.0;
- vfo_update();
- }
- break;
- case 'R': //VR
- // emulate VOICE1 or VOICE2 key
- implemented=FALSE;
- break;
- case 'X': //VX
- // set/read VOX status
- if(command[2]==';') {
- sprintf(reply,"VX%d;",vox_enabled);
- send_resp(client->fd,reply);
- } else if(command[3]==';') {
- vox_enabled=atoi(&command[2]);
- vfo_update();
- }
- break;
- default:
- implemented=FALSE;
- break;
+ case 'Y': // TY
+ // set/read microprocessor firmware type
+ implemented = FALSE;
+ break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'U':
+ switch (command[1]) {
+ case 'L': // UL
+ // detects the PLL unlock status
+ implemented = FALSE;
+ break;
+ case 'P': // UP
+ // move VFO A up by step
+ if (command[2] == ';') {
+ vfo_step(1);
}
break;
- case 'W':
- switch(command[1]) {
- default:
- implemented=FALSE;
- break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'V':
+ switch (command[1]) {
+ case 'D': // VD
+ // set/read VOX delay time
+ implemented = FALSE;
+ break;
+ case 'G': // VG
+ // set/read VOX gain (0..9)
+ if (command[2] == ';') {
+ // convert 0.0..1.0 to 0..9
+ sprintf(reply, "VG%03d;", (int)((vox_threshold * 100.0) * 0.9));
+ send_resp(client->fd, reply);
+ } else if (command[5] == ';') {
+ // convert 0..9 to 0.0..1.0
+ vox_threshold = atof(&command[2]) / 9.0;
+ vfo_update();
}
break;
- case 'X':
- switch(command[1]) {
- case 'T': //XT
- // set/read XIT enable
- if(command[2]==';') {
- sprintf(reply,"XT%d;",transmitter->xit_enabled);
- send_resp(client->fd,reply);
- } else if(command[3]==';') {
- transmitter->xit_enabled=atoi(&command[2]);
- vfo_update();
- }
- break;
- default:
- implemented=FALSE;
- break;
+ case 'R': // VR
+ // emulate VOICE1 or VOICE2 key
+ implemented = FALSE;
+ break;
+ case 'X': // VX
+ // set/read VOX status
+ if (command[2] == ';') {
+ sprintf(reply, "VX%d;", vox_enabled);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ vox_enabled = atoi(&command[2]);
+ vfo_update();
}
break;
- case 'Y':
- switch(command[1]) {
- default:
- implemented=FALSE;
- break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'W':
+ switch (command[1]) {
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'X':
+ switch (command[1]) {
+ case 'T': // XT
+ // set/read XIT enable
+ if (command[2] == ';') {
+ sprintf(reply, "XT%d;", transmitter->xit_enabled);
+ send_resp(client->fd, reply);
+ } else if (command[3] == ';') {
+ transmitter->xit_enabled = atoi(&command[2]);
+ vfo_update();
}
break;
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'Y':
+ switch (command[1]) {
+ default:
+ implemented = FALSE;
+ break;
+ }
+ break;
+ case 'Z':
+ switch (command[1]) {
case 'Z':
- switch(command[1]) {
- case 'Z':
- implemented=parse_extended_cmd (command,client);
- break;
- default:
- implemented=FALSE;
- break;
- }
+ implemented = parse_extended_cmd(command, client);
break;
default:
- implemented=FALSE;
+ implemented = FALSE;
break;
+ }
+ break;
+ default:
+ implemented = FALSE;
+ break;
}
- if(!implemented) {
- if(rigctl_debug) g_print("RIGCTL: UNIMPLEMENTED COMMAND: %s\n",info->command);
- send_resp(client->fd,"?;");
+ if (!implemented) {
+ if (rigctl_debug)
+ g_print("RIGCTL: UNIMPLEMENTED COMMAND: %s\n", info->command);
+ send_resp(client->fd, "?;");
}
g_free(info->command);
}
// Serial Port Launch
-int set_interface_attribs (int fd, int speed, int parity)
-{
- struct termios tty;
- memset (&tty, 0, sizeof tty);
- if (tcgetattr (fd, &tty) != 0)
- {
- g_print ("RIGCTL: Error %d from tcgetattr", errno);
- return -1;
- }
-
- cfsetospeed (&tty, speed);
- cfsetispeed (&tty, speed);
-
- tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; // 8-bit chars
- // disable IGNBRK for mismatched speed tests; otherwise receive break
- // as \000 chars
- tty.c_iflag &= ~IGNBRK; // disable break processing
- tty.c_lflag = 0; // no signaling chars, no echo,
- // no canonical processing
- tty.c_oflag = 0; // no remapping, no delays
- tty.c_cc[VMIN] = 0; // read doesn't block
- tty.c_cc[VTIME] = 5; // 0.5 seconds read timeout
-
- //tty.c_iflag &= ~(IXON | IXOFF | IXANY); // shut off xon/xoff ctrl
- tty.c_iflag |= (IXON | IXOFF | IXANY); // shut off xon/xoff ctrl
-
- tty.c_cflag |= (CLOCAL | CREAD);// ignore modem controls,
- // enable reading
- tty.c_cflag &= ~(PARENB | PARODD); // shut off parity
- tty.c_cflag |= parity;
- tty.c_cflag &= ~CSTOPB;
- tty.c_cflag &= ~CRTSCTS;
-
- if (tcsetattr (fd, TCSANOW, &tty) != 0)
- {
- g_print( "RIGCTL: Error %d from tcsetattr", errno);
- return -1;
- }
- return 0;
+int set_interface_attribs(int fd, int speed, int parity) {
+ struct termios tty;
+ memset(&tty, 0, sizeof tty);
+ if (tcgetattr(fd, &tty) != 0) {
+ g_print("RIGCTL: Error %d from tcgetattr", errno);
+ return -1;
+ }
+
+ cfsetospeed(&tty, speed);
+ cfsetispeed(&tty, speed);
+
+ tty.c_cflag = (tty.c_cflag & ~CSIZE) | CS8; // 8-bit chars
+ // disable IGNBRK for mismatched speed tests; otherwise receive break
+ // as \000 chars
+ tty.c_iflag &= ~IGNBRK; // disable break processing
+ tty.c_lflag = 0; // no signaling chars, no echo,
+ // no canonical processing
+ tty.c_oflag = 0; // no remapping, no delays
+ tty.c_cc[VMIN] = 0; // read doesn't block
+ tty.c_cc[VTIME] = 5; // 0.5 seconds read timeout
+
+ // tty.c_iflag &= ~(IXON | IXOFF | IXANY); // shut off xon/xoff ctrl
+ tty.c_iflag |= (IXON | IXOFF | IXANY); // shut off xon/xoff ctrl
+
+ tty.c_cflag |= (CLOCAL | CREAD); // ignore modem controls,
+ // enable reading
+ tty.c_cflag &= ~(PARENB | PARODD); // shut off parity
+ tty.c_cflag |= parity;
+ tty.c_cflag &= ~CSTOPB;
+ tty.c_cflag &= ~CRTSCTS;
+
+ if (tcsetattr(fd, TCSANOW, &tty) != 0) {
+ g_print("RIGCTL: Error %d from tcsetattr", errno);
+ return -1;
+ }
+ return 0;
}
-void set_blocking (int fd, int should_block)
-{
- struct termios tty;
- memset (&tty, 0, sizeof tty);
- if (tcgetattr (fd, &tty) != 0)
- {
- g_print ("RIGCTL: Error %d from tggetattr\n", errno);
- return;
- }
- tty.c_cc[VMIN] = should_block ? 1 : 0;
- tty.c_cc[VTIME] = 5; // 0.5 seconds read timeout
+void set_blocking(int fd, int should_block) {
+ struct termios tty;
+ memset(&tty, 0, sizeof tty);
+ if (tcgetattr(fd, &tty) != 0) {
+ g_print("RIGCTL: Error %d from tggetattr\n", errno);
+ return;
+ }
+ tty.c_cc[VMIN] = should_block ? 1 : 0;
+ tty.c_cc[VTIME] = 5; // 0.5 seconds read timeout
- if (tcsetattr (fd, TCSANOW, &tty) != 0)
- g_print("RIGCTL: error %d setting term attributes\n", errno);
+ if (tcsetattr(fd, TCSANOW, &tty) != 0)
+ g_print("RIGCTL: error %d setting term attributes\n", errno);
}
static gpointer serial_server(gpointer data) {
- // We're going to Read the Serial port and
- // when we get data we'll send it to parse_cmd
- CLIENT *client=(CLIENT *)data;
- char cmd_input[MAXDATASIZE];
- char *command=g_new(char,MAXDATASIZE);
- int command_index=0;
- int numbytes;
- int i;
- cat_control++;
- serial_running=TRUE;
- while(serial_running) {
- numbytes = read (fd, cmd_input, sizeof cmd_input);
- if(numbytes>0) {
- for(i=0;i<numbytes;i++) {
- command[command_index]=cmd_input[i];
- command_index++;
- if(cmd_input[i]==';') {
- command[command_index]='\0';
- if(rigctl_debug) g_print("RIGCTL: command=%s\n",command);
- COMMAND *info=g_new(COMMAND,1);
- info->client=client;
- info->command=command;
- g_mutex_lock(&mutex_busy->m);
- g_idle_add(parse_cmd,info);
- g_mutex_unlock(&mutex_busy->m);
-
- command=g_new(char,MAXDATASIZE);
- command_index=0;
- }
- }
- } else if(numbytes<0) {
- break;
- }
- //usleep(100L);
- }
- close(client->fd);
- cat_control--;
- return NULL;
+ // We're going to Read the Serial port and
+ // when we get data we'll send it to parse_cmd
+ CLIENT *client = (CLIENT *)data;
+ char cmd_input[MAXDATASIZE];
+ char *command = g_new(char, MAXDATASIZE);
+ int command_index = 0;
+ int numbytes;
+ int i;
+ cat_control++;
+ serial_running = TRUE;
+ while (serial_running) {
+ numbytes = read(fd, cmd_input, sizeof cmd_input);
+ if (numbytes > 0) {
+ for (i = 0; i < numbytes; i++) {
+ command[command_index] = cmd_input[i];
+ command_index++;
+ if (cmd_input[i] == ';') {
+ command[command_index] = '\0';
+ if (rigctl_debug)
+ g_print("RIGCTL: command=%s\n", command);
+ COMMAND *info = g_new(COMMAND, 1);
+ info->client = client;
+ info->command = command;
+ g_mutex_lock(&mutex_busy->m);
+ g_idle_add(parse_cmd, info);
+ g_mutex_unlock(&mutex_busy->m);
+
+ command = g_new(char, MAXDATASIZE);
+ command_index = 0;
+ }
+ }
+ } else if (numbytes < 0) {
+ break;
+ }
+ // usleep(100L);
+ }
+ close(client->fd);
+ cat_control--;
+ return NULL;
}
-int launch_serial () {
- g_print("RIGCTL: Launch Serial port %s\n",ser_port);
- if(mutex_b_exists == 0) {
- mutex_b = g_new(GT_MUTEX,1);
- g_mutex_init(&mutex_b->m);
- mutex_b_exists = 1;
- }
-
- if(mutex_busy==NULL) {
- mutex_busy = g_new(GT_MUTEX,1);
- g_print("launch_serial: mutex_busy=%p\n",mutex_busy);
- g_mutex_init(&mutex_busy->m);
- }
-
- fd = open (ser_port, O_RDWR | O_NOCTTY | O_SYNC);
- if (fd < 0)
- {
- g_print("RIGCTL: Error %d opening %s: %s\n", errno, ser_port, strerror (errno));
- return 0 ;
- }
-
- g_print("serial port fd=%d\n",fd);
-
- set_interface_attribs (fd, serial_baud_rate, serial_parity);
- set_blocking (fd, 1); // set no blocking
-
- CLIENT *serial_client=g_new(CLIENT,1);
- serial_client->fd=fd;
-
- serial_server_thread_id = g_thread_new( "Serial server", serial_server, serial_client);
- if(!serial_server_thread_id )
- {
- g_free(serial_client);
- g_print("g_thread_new failed on serial_server\n");
- return 0;
- }
- return 1;
+int launch_serial() {
+ g_print("RIGCTL: Launch Serial port %s\n", ser_port);
+ if (mutex_b_exists == 0) {
+ mutex_b = g_new(GT_MUTEX, 1);
+ g_mutex_init(&mutex_b->m);
+ mutex_b_exists = 1;
+ }
+
+ if (mutex_busy == NULL) {
+ mutex_busy = g_new(GT_MUTEX, 1);
+ g_print("launch_serial: mutex_busy=%p\n", mutex_busy);
+ g_mutex_init(&mutex_busy->m);
+ }
+
+ fd = open(ser_port, O_RDWR | O_NOCTTY | O_SYNC);
+ if (fd < 0) {
+ g_print("RIGCTL: Error %d opening %s: %s\n", errno, ser_port,
+ strerror(errno));
+ return 0;
+ }
+
+ g_print("serial port fd=%d\n", fd);
+
+ set_interface_attribs(fd, serial_baud_rate, serial_parity);
+ set_blocking(fd, 1); // set no blocking
+
+ CLIENT *serial_client = g_new(CLIENT, 1);
+ serial_client->fd = fd;
+
+ serial_server_thread_id =
+ g_thread_new("Serial server", serial_server, serial_client);
+ if (!serial_server_thread_id) {
+ g_free(serial_client);
+ g_print("g_thread_new failed on serial_server\n");
+ return 0;
+ }
+ return 1;
}
// Serial Port close
-void disable_serial () {
- g_print("RIGCTL: Disable Serial port %s\n",ser_port);
- serial_running=FALSE;
+void disable_serial() {
+ g_print("RIGCTL: Disable Serial port %s\n", ser_port);
+ serial_running = FALSE;
}
//
-// 2-25-17 - K5JAE - create each thread with the pointer to the port number
-// (Port numbers now const ints instead of defines..)
+// 2-25-17 - K5JAE - create each thread with the pointer to the port number
+// (Port numbers now const ints instead of defines..)
//
-void launch_rigctl () {
-
- g_print( "LAUNCHING RIGCTL!!\n");
-
- rigctl_busy = 1;
- mutex_a = g_new(GT_MUTEX,1);
- g_mutex_init(&mutex_a->m);
-
- if(mutex_b_exists == 0) {
- mutex_b = g_new(GT_MUTEX,1);
- g_mutex_init(&mutex_b->m);
- mutex_b_exists = 1;
- }
-
- mutex_c = g_new(GT_MUTEX,1);
- g_mutex_init(&mutex_c->m);
-
- mutex_busy = g_new(GT_MUTEX,1);
-g_print("launch_rigctl: mutex_busy=%p\n",mutex_busy);
- g_mutex_init(&mutex_busy->m);
-
- // This routine encapsulates the thread call
- rigctl_server_thread_id = g_thread_new( "rigctl server", rigctl_server, (gpointer)(long)rigctl_port_base);
- if( ! rigctl_server_thread_id )
- {
- g_print("g_thread_new failed on rigctl_server\n");
- }
-}
+void launch_rigctl() {
+ g_print("LAUNCHING RIGCTL!!\n");
-int rigctlGetMode() {
- switch(vfo[active_receiver->id].mode) {
- case modeLSB: return(1); // LSB
- case modeUSB: return(2); // USB
- case modeCWL: return(7); // CWL
- case modeCWU: return(3); // CWU
- case modeFMN: return(4); // FMN
- case modeAM: return(5); // AM
- case modeDIGU: return(9); // DIGU
- case modeDIGL: return(6); // DIGL
- default: return(0);
- }
-}
+ rigctl_busy = 1;
+ mutex_a = g_new(GT_MUTEX, 1);
+ g_mutex_init(&mutex_a->m);
+
+ if (mutex_b_exists == 0) {
+ mutex_b = g_new(GT_MUTEX, 1);
+ g_mutex_init(&mutex_b->m);
+ mutex_b_exists = 1;
+ }
-void set_freqB(long long new_freqB) {
+ mutex_c = g_new(GT_MUTEX, 1);
+ g_mutex_init(&mutex_c->m);
+
+ mutex_busy = g_new(GT_MUTEX, 1);
+ g_print("launch_rigctl: mutex_busy=%p\n", mutex_busy);
+ g_mutex_init(&mutex_busy->m);
+
+ // This routine encapsulates the thread call
+ rigctl_server_thread_id = g_thread_new("rigctl server", rigctl_server,
+ (gpointer)(long)rigctl_port_base);
+ if (!rigctl_server_thread_id) {
+ g_print("g_thread_new failed on rigctl_server\n");
+ }
+}
- vfo[VFO_B].frequency = new_freqB;
- g_idle_add(ext_vfo_update,NULL);
+int rigctlGetMode() {
+ switch (vfo[active_receiver->id].mode) {
+ case modeLSB:
+ return (1); // LSB
+ case modeUSB:
+ return (2); // USB
+ case modeCWL:
+ return (7); // CWL
+ case modeCWU:
+ return (3); // CWU
+ case modeFMN:
+ return (4); // FMN
+ case modeAM:
+ return (5); // AM
+ case modeDIGU:
+ return (9); // DIGU
+ case modeDIGL:
+ return (6); // DIGL
+ default:
+ return (0);
+ }
}
+void set_freqB(long long new_freqB) {
+
+ vfo[VFO_B].frequency = new_freqB;
+ g_idle_add(ext_vfo_update, NULL);
+}
int set_alc(gpointer data) {
- int * lcl_ptr = (int *) data;
- alc = *lcl_ptr;
- g_print("RIGCTL: set_alc=%d\n",alc);
- return 0;
+ int *lcl_ptr = (int *)data;
+ alc = *lcl_ptr;
+ g_print("RIGCTL: set_alc=%d\n", alc);
+ return 0;
}
int lookup_band(int val) {
- int work_int;
- switch(val) {
- case 160: work_int = 0; break;
- case 80: work_int = 1; break;
- case 60: work_int = 2; break;
- case 40: work_int = 3; break;
- case 30: work_int = 4; break;
- case 20: work_int = 5; break;
- case 17: work_int = 6; break;
- case 15: work_int = 7; break;
- case 12: work_int = 8; break;
- case 10: work_int = 9; break;
- case 6: work_int = 10; break;
- case 888: work_int = 11; break; // General coverage
- case 999: work_int = 12; break; // WWV
- case 136: work_int = 13; break; // WWV
- case 472: work_int = 14; break; // WWV
- default: work_int = 0;
- }
- return work_int;
+ int work_int;
+ switch (val) {
+ case 160:
+ work_int = 0;
+ break;
+ case 80:
+ work_int = 1;
+ break;
+ case 60:
+ work_int = 2;
+ break;
+ case 40:
+ work_int = 3;
+ break;
+ case 30:
+ work_int = 4;
+ break;
+ case 20:
+ work_int = 5;
+ break;
+ case 17:
+ work_int = 6;
+ break;
+ case 15:
+ work_int = 7;
+ break;
+ case 12:
+ work_int = 8;
+ break;
+ case 10:
+ work_int = 9;
+ break;
+ case 6:
+ work_int = 10;
+ break;
+ case 888:
+ work_int = 11;
+ break; // General coverage
+ case 999:
+ work_int = 12;
+ break; // WWV
+ case 136:
+ work_int = 13;
+ break; // WWV
+ case 472:
+ work_int = 14;
+ break; // WWV
+ default:
+ work_int = 0;
+ }
+ return work_int;
}
-
-
#include "radio.h"
#include "vfo.h"
-int serial_enable;
+int serial_enable = 1; // edit (enable serial at startup)
char ser_port[64]="/dev/ttyACM0";
int serial_baud_rate = B9600;
int serial_parity = 0; // 0=none, 1=even, 2=odd