g_idle_add(ext_remote_command,agc_gain_command);
}
break;
+ case CMD_RESP_RX_GAIN:
+g_print("server_client_thread: CMD_RESP_RX_GAIN\n");
+ {
+ RFGAIN_COMMAND *command=g_new(RFGAIN_COMMAND,1);
+ command->header.data_type=header.data_type;
+ command->header.version=header.version;
+ command->header.context.client=client;
+ bytes_read=recv_bytes(client->socket,(char *)&command->id,sizeof(RFGAIN_COMMAND)-sizeof(header));
+ if(bytes_read<0) {
+ g_print("server_client_thread: read %d bytes for RFGAIN_COMMAND\n",bytes_read);
+ perror("server_client_thread");
+ // dialog box?
+ return NULL;
+ }
+ g_idle_add(ext_remote_command,command);
+ }
+ break;
case CMD_RESP_RX_ATTENUATION:
g_print("server_client_thread: CMD_RESP_RX_ATTENUATION\n");
{
}
}
+void send_rfgain(int s, int id, double gain) {
+ RFGAIN_COMMAND command;
+g_print("send_rfgain rx=%d gain=%f\n",id,gain);
+ command.header.sync=REMOTE_SYNC;
+ command.header.data_type=htons(CMD_RESP_RX_GAIN);
+ command.header.version=htonl(CLIENT_SERVER_VERSION);
+ command.id=id;
+ command.gain=htond(gain);
+ int bytes_sent=send_bytes(s,(char *)&command,sizeof(command));
+ if(bytes_sent<0) {
+ perror("send_command");
+ } else {
+ g_print("send_command RFGAIN: %d\n",bytes_sent);
+ }
+}
+
void send_attenuation(int s,int rx,int attenuation) {
ATTENUATION_COMMAND command;
short a=(short)attenuation;
receiver[rx]->agc_thresh=(double)thresh;
}
break;
+ case CMD_RESP_RX_GAIN:
+ {
+ RFGAIN_COMMAND command;
+ bytes_read=recv_bytes(client_socket,(char *)&command.id,sizeof(command)-sizeof(header));
+ if(bytes_read<0) {
+ g_print("client_thread: read %d bytes for RFGAIN_CMD\n",bytes_read);
+ perror("client_thread");
+ // dialog box?
+ return NULL;
+ }
+ int rx=command.id;
+ double gain=ntohd(command.gain);
+g_print("CMD_RESP_RX_GAIN: new=%f rx=%d old=%f\n",gain,rx,adc[receiver[rx]->adc].gain);
+ adc[receiver[rx]->adc].gain=gain;
+ }
+ break;
case CMD_RESP_RX_ATTENUATION:
{
ATTENUATION_COMMAND attenuation_cmd;
CMD_RESP_RX_VOLUME,
CMD_RESP_RX_AGC_GAIN,
CMD_RESP_RX_ATTENUATION,
+ CMD_RESP_RX_GAIN,
CMD_RESP_RX_SQUELCH,
CMD_RESP_RX_FPS,
CMD_RESP_RX_SELECT,
uint16_t attenuation;
} ATTENUATION_COMMAND;
+typedef struct __attribute__((__packed__)) _rfgain_command {
+ HEADER header;
+ uint8_t id;
+ uint16_t gain;
+} RFGAIN_COMMAND;
+
typedef struct __attribute__((__packed__)) _squelch_command {
HEADER header;
uint8_t id;
extern void send_agc(int s,int rx,int agc);
extern void send_agc_gain(int s,int rx,int gain,int hang,int thresh);
extern void send_attenuation(int s,int rx,int attenuation);
+extern void send_rfgain(int s,int rx, double gain);
extern void send_squelch(int s,int rx,int enable,int squelch);
extern void send_noise(int s,int rx,int nb,int nb2,int nr,int nr2,int anf,int snb);
extern void send_band(int s,int rx,int band);
send_agc_gain(client->socket,rx->id,(int)rx->agc_gain,(int)rx->agc_hang,(int)rx->agc_thresh);
}
break;
+ case CMD_RESP_RX_GAIN:
+ {
+ RFGAIN_COMMAND *command=(RFGAIN_COMMAND *) data;
+ double td=ntohd(command->gain);
+ set_rf_gain(command->id, td);
+ }
+ break;
case CMD_RESP_RX_ATTENUATION:
{
ATTENUATION_COMMAND *attenuation_command=(ATTENUATION_COMMAND *)data;