1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-23 00:18:37 -05:00

CRLF problem

This commit is contained in:
f4exb 2017-10-04 01:51:56 +02:00
parent 69be1d59ee
commit 1ace1f58d0
17 changed files with 2922 additions and 2922 deletions

View File

@ -1,325 +1,325 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB // // Copyright (C) 2017 Edouard Griffiths, F4EXB //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <cstdio> #include <cstdio>
#include <cstring> #include <cstring>
#include <cmath> #include <cmath>
#include "devicelimesdr.h" #include "devicelimesdr.h"
bool DeviceLimeSDR::setNCOFrequency(lms_device_t *device, bool dir_tx, std::size_t chan, bool enable, float frequency) bool DeviceLimeSDR::setNCOFrequency(lms_device_t *device, bool dir_tx, std::size_t chan, bool enable, float frequency)
{ {
if (enable) if (enable)
{ {
bool positive; bool positive;
float_type freqs[LMS_NCO_VAL_COUNT]; float_type freqs[LMS_NCO_VAL_COUNT];
float_type phos[LMS_NCO_VAL_COUNT]; float_type phos[LMS_NCO_VAL_COUNT];
if (LMS_GetNCOFrequency(device, dir_tx, chan, freqs, phos) < 0) if (LMS_GetNCOFrequency(device, dir_tx, chan, freqs, phos) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot get NCO frequencies and phases\n"); fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot get NCO frequencies and phases\n");
} }
if (frequency < 0) if (frequency < 0)
{ {
positive = false; positive = false;
frequency = -frequency; frequency = -frequency;
} }
else else
{ {
positive = true; positive = true;
} }
freqs[0] = frequency; freqs[0] = frequency;
if (LMS_SetNCOFrequency(device, dir_tx, chan, freqs, 0.0f) < 0) if (LMS_SetNCOFrequency(device, dir_tx, chan, freqs, 0.0f) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot set frequency to %f\n", frequency); fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot set frequency to %f\n", frequency);
return false; return false;
} }
if (LMS_SetNCOIndex(device, dir_tx, chan, 0, !positive) < 0) if (LMS_SetNCOIndex(device, dir_tx, chan, 0, !positive) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot set conversion direction %sfreq\n", positive ? "+" : "-"); fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot set conversion direction %sfreq\n", positive ? "+" : "-");
return false; return false;
} }
return true; return true;
} }
else else
{ {
if (LMS_SetNCOIndex(device, dir_tx, chan, LMS_NCO_VAL_COUNT, true) < 0) if (LMS_SetNCOIndex(device, dir_tx, chan, LMS_NCO_VAL_COUNT, true) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot disable NCO\n"); fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: cannot disable NCO\n");
return false; return false;
} }
else else
{ {
fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: NCO disabled\n"); fprintf(stderr, "DeviceLimeSDR::setNCOFrequency: NCO disabled\n");
return true; return true;
} }
} }
} }
bool DeviceLimeSDR::SetRFELNA_dB(lms_device_t *device, std::size_t chan, int value) bool DeviceLimeSDR::SetRFELNA_dB(lms_device_t *device, std::size_t chan, int value)
{ {
if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0) if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::SetRFELNA_dB: cannot set channel to #%lu\n", chan); fprintf(stderr, "DeviceLimeSDR::SetRFELNA_dB: cannot set channel to #%lu\n", chan);
return false; return false;
} }
if (value > 30) { if (value > 30) {
value = 30; value = 30;
} }
int val = value - 30; int val = value - 30;
int g_lna_rfe = 0; int g_lna_rfe = 0;
if (val >= 0) g_lna_rfe = 15; if (val >= 0) g_lna_rfe = 15;
else if (val >= -1) g_lna_rfe = 14; else if (val >= -1) g_lna_rfe = 14;
else if (val >= -2) g_lna_rfe = 13; else if (val >= -2) g_lna_rfe = 13;
else if (val >= -3) g_lna_rfe = 12; else if (val >= -3) g_lna_rfe = 12;
else if (val >= -4) g_lna_rfe = 11; else if (val >= -4) g_lna_rfe = 11;
else if (val >= -5) g_lna_rfe = 10; else if (val >= -5) g_lna_rfe = 10;
else if (val >= -6) g_lna_rfe = 9; else if (val >= -6) g_lna_rfe = 9;
else if (val >= -9) g_lna_rfe = 8; else if (val >= -9) g_lna_rfe = 8;
else if (val >= -12) g_lna_rfe = 7; else if (val >= -12) g_lna_rfe = 7;
else if (val >= -15) g_lna_rfe = 6; else if (val >= -15) g_lna_rfe = 6;
else if (val >= -18) g_lna_rfe = 5; else if (val >= -18) g_lna_rfe = 5;
else if (val >= -21) g_lna_rfe = 4; else if (val >= -21) g_lna_rfe = 4;
else if (val >= -24) g_lna_rfe = 3; else if (val >= -24) g_lna_rfe = 3;
else if (val >= -27) g_lna_rfe = 2; else if (val >= -27) g_lna_rfe = 2;
else g_lna_rfe = 1; else g_lna_rfe = 1;
if (LMS_WriteParam(device, LMS7param(G_LNA_RFE), g_lna_rfe) < 0) if (LMS_WriteParam(device, LMS7param(G_LNA_RFE), g_lna_rfe) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::SetRFELNA_dB: cannot set LNA gain to %d (%d)\n", value, g_lna_rfe); fprintf(stderr, "DeviceLimeSDR::SetRFELNA_dB: cannot set LNA gain to %d (%d)\n", value, g_lna_rfe);
return false; return false;
} }
return true; return true;
} }
bool DeviceLimeSDR::SetRFETIA_dB(lms_device_t *device, std::size_t chan, int value) bool DeviceLimeSDR::SetRFETIA_dB(lms_device_t *device, std::size_t chan, int value)
{ {
if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0) if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::SetRFETIA_dB: cannot set channel to #%lu\n", chan); fprintf(stderr, "DeviceLimeSDR::SetRFETIA_dB: cannot set channel to #%lu\n", chan);
return false; return false;
} }
if (value > 3) { if (value > 3) {
value = 3; value = 3;
} else if (value < 1) { } else if (value < 1) {
value = 1; value = 1;
} }
int g_tia_rfe = value; int g_tia_rfe = value;
if (LMS_WriteParam(device, LMS7param(G_TIA_RFE), g_tia_rfe) < 0) if (LMS_WriteParam(device, LMS7param(G_TIA_RFE), g_tia_rfe) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::SetRFELNA_dB: cannot set TIA gain to %d (%d)\n", value, g_tia_rfe); fprintf(stderr, "DeviceLimeSDR::SetRFELNA_dB: cannot set TIA gain to %d (%d)\n", value, g_tia_rfe);
return false; return false;
} }
return true; return true;
} }
bool DeviceLimeSDR::SetRBBPGA_dB(lms_device_t *device, std::size_t chan, float value) bool DeviceLimeSDR::SetRBBPGA_dB(lms_device_t *device, std::size_t chan, float value)
{ {
if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0) if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::SetRBBPGA_dB: cannot set channel to #%lu\n", chan); fprintf(stderr, "DeviceLimeSDR::SetRBBPGA_dB: cannot set channel to #%lu\n", chan);
return false; return false;
} }
int g_pga_rbb = (int)(value + 12.5); int g_pga_rbb = (int)(value + 12.5);
if (g_pga_rbb > 0x1f) g_pga_rbb = 0x1f; if (g_pga_rbb > 0x1f) g_pga_rbb = 0x1f;
if (g_pga_rbb < 0) g_pga_rbb = 0; if (g_pga_rbb < 0) g_pga_rbb = 0;
if (LMS_WriteParam(device, LMS7param(G_PGA_RBB), g_pga_rbb) < 0) if (LMS_WriteParam(device, LMS7param(G_PGA_RBB), g_pga_rbb) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::SetRBBPGA_dB: cannot set G_PGA_RBB to %d\n", g_pga_rbb); fprintf(stderr, "DeviceLimeSDR::SetRBBPGA_dB: cannot set G_PGA_RBB to %d\n", g_pga_rbb);
return false; return false;
} }
int rcc_ctl_pga_rbb = (430.0*pow(0.65, (g_pga_rbb/10.0))-110.35)/20.4516 + 16; int rcc_ctl_pga_rbb = (430.0*pow(0.65, (g_pga_rbb/10.0))-110.35)/20.4516 + 16;
int c_ctl_pga_rbb = 0; int c_ctl_pga_rbb = 0;
if (0 <= g_pga_rbb && g_pga_rbb < 8) c_ctl_pga_rbb = 3; if (0 <= g_pga_rbb && g_pga_rbb < 8) c_ctl_pga_rbb = 3;
if (8 <= g_pga_rbb && g_pga_rbb < 13) c_ctl_pga_rbb = 2; if (8 <= g_pga_rbb && g_pga_rbb < 13) c_ctl_pga_rbb = 2;
if (13 <= g_pga_rbb && g_pga_rbb < 21) c_ctl_pga_rbb = 1; if (13 <= g_pga_rbb && g_pga_rbb < 21) c_ctl_pga_rbb = 1;
if (21 <= g_pga_rbb) c_ctl_pga_rbb = 0; if (21 <= g_pga_rbb) c_ctl_pga_rbb = 0;
if (LMS_WriteParam(device, LMS7param(RCC_CTL_PGA_RBB), rcc_ctl_pga_rbb) < 0) if (LMS_WriteParam(device, LMS7param(RCC_CTL_PGA_RBB), rcc_ctl_pga_rbb) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::SetRBBPGA_dB: cannot set RCC_CTL_PGA_RBB to %d\n", rcc_ctl_pga_rbb); fprintf(stderr, "DeviceLimeSDR::SetRBBPGA_dB: cannot set RCC_CTL_PGA_RBB to %d\n", rcc_ctl_pga_rbb);
return false; return false;
} }
if (LMS_WriteParam(device, LMS7param(C_CTL_PGA_RBB), c_ctl_pga_rbb) < 0) if (LMS_WriteParam(device, LMS7param(C_CTL_PGA_RBB), c_ctl_pga_rbb) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::SetRBBPGA_dB: cannot set C_CTL_PGA_RBB to %d\n", c_ctl_pga_rbb); fprintf(stderr, "DeviceLimeSDR::SetRBBPGA_dB: cannot set C_CTL_PGA_RBB to %d\n", c_ctl_pga_rbb);
return false; return false;
} }
return true; return true;
} }
bool DeviceLimeSDR::setRxAntennaPath(lms_device_t *device, std::size_t chan, int path) bool DeviceLimeSDR::setRxAntennaPath(lms_device_t *device, std::size_t chan, int path)
{ {
// if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0) // if (LMS_WriteParam(device, LMS7param(MAC), chan+1) < 0)
// { // {
// fprintf(stderr, "DeviceLimeSDR::setAntennaPath: cannot set channel to #%lu\n", chan); // fprintf(stderr, "DeviceLimeSDR::setAntennaPath: cannot set channel to #%lu\n", chan);
// return false; // return false;
// } // }
// //
// int sel_path_rfe = 0; // int sel_path_rfe = 0;
// switch ((PathRFE) path) // switch ((PathRFE) path)
// { // {
// case PATH_RFE_NONE: sel_path_rfe = 0; break; // case PATH_RFE_NONE: sel_path_rfe = 0; break;
// case PATH_RFE_LNAH: sel_path_rfe = 1; break; // case PATH_RFE_LNAH: sel_path_rfe = 1; break;
// case PATH_RFE_LNAL: sel_path_rfe = 2; break; // case PATH_RFE_LNAL: sel_path_rfe = 2; break;
// case PATH_RFE_LNAW: sel_path_rfe = 3; break; // case PATH_RFE_LNAW: sel_path_rfe = 3; break;
// case PATH_RFE_LB1: sel_path_rfe = 3; break; // case PATH_RFE_LB1: sel_path_rfe = 3; break;
// case PATH_RFE_LB2: sel_path_rfe = 2; break; // case PATH_RFE_LB2: sel_path_rfe = 2; break;
// } // }
// //
// int pd_lna_rfe = 1; // int pd_lna_rfe = 1;
// switch ((PathRFE) path) // switch ((PathRFE) path)
// { // {
// case PATH_RFE_LNAH: // case PATH_RFE_LNAH:
// case PATH_RFE_LNAL: // case PATH_RFE_LNAL:
// case PATH_RFE_LNAW: pd_lna_rfe = 0; break; // case PATH_RFE_LNAW: pd_lna_rfe = 0; break;
// default: break; // default: break;
// } // }
// //
// int pd_rloopb_1_rfe = (path == (int) PATH_RFE_LB1) ? 0 : 1; // int pd_rloopb_1_rfe = (path == (int) PATH_RFE_LB1) ? 0 : 1;
// int pd_rloopb_2_rfe = (path == (int) PATH_RFE_LB2) ? 0 : 1; // int pd_rloopb_2_rfe = (path == (int) PATH_RFE_LB2) ? 0 : 1;
// int en_inshsw_l_rfe = (path == (int) PATH_RFE_LNAL ) ? 0 : 1; // int en_inshsw_l_rfe = (path == (int) PATH_RFE_LNAL ) ? 0 : 1;
// int en_inshsw_w_rfe = (path == (int) PATH_RFE_LNAW) ? 0 : 1; // int en_inshsw_w_rfe = (path == (int) PATH_RFE_LNAW) ? 0 : 1;
// int en_inshsw_lb1_rfe = (path == (int) PATH_RFE_LB1) ? 0 : 1; // int en_inshsw_lb1_rfe = (path == (int) PATH_RFE_LB1) ? 0 : 1;
// int en_inshsw_lb2_rfe = (path == (int) PATH_RFE_LB2) ? 0 : 1; // int en_inshsw_lb2_rfe = (path == (int) PATH_RFE_LB2) ? 0 : 1;
// //
// int ret = 0; // int ret = 0;
// //
// ret += LMS_WriteParam(device, LMS7param(PD_LNA_RFE), pd_lna_rfe); // ret += LMS_WriteParam(device, LMS7param(PD_LNA_RFE), pd_lna_rfe);
// ret += LMS_WriteParam(device, LMS7param(PD_RLOOPB_1_RFE), pd_rloopb_1_rfe); // ret += LMS_WriteParam(device, LMS7param(PD_RLOOPB_1_RFE), pd_rloopb_1_rfe);
// ret += LMS_WriteParam(device, LMS7param(PD_RLOOPB_2_RFE), pd_rloopb_2_rfe); // ret += LMS_WriteParam(device, LMS7param(PD_RLOOPB_2_RFE), pd_rloopb_2_rfe);
// ret += LMS_WriteParam(device, LMS7param(EN_INSHSW_LB1_RFE), en_inshsw_lb1_rfe); // ret += LMS_WriteParam(device, LMS7param(EN_INSHSW_LB1_RFE), en_inshsw_lb1_rfe);
// ret += LMS_WriteParam(device, LMS7param(EN_INSHSW_LB2_RFE), en_inshsw_lb2_rfe); // ret += LMS_WriteParam(device, LMS7param(EN_INSHSW_LB2_RFE), en_inshsw_lb2_rfe);
// ret += LMS_WriteParam(device, LMS7param(EN_INSHSW_L_RFE), en_inshsw_l_rfe); // ret += LMS_WriteParam(device, LMS7param(EN_INSHSW_L_RFE), en_inshsw_l_rfe);
// ret += LMS_WriteParam(device, LMS7param(EN_INSHSW_W_RFE), en_inshsw_w_rfe); // ret += LMS_WriteParam(device, LMS7param(EN_INSHSW_W_RFE), en_inshsw_w_rfe);
// ret += LMS_WriteParam(device, LMS7param(SEL_PATH_RFE), sel_path_rfe); // ret += LMS_WriteParam(device, LMS7param(SEL_PATH_RFE), sel_path_rfe);
// //
// if (ret < 0) // if (ret < 0)
// { // {
// fprintf(stderr, "DeviceLimeSDR::setAntennaPath: cannot set channel #%lu to %d\n", chan, path); // fprintf(stderr, "DeviceLimeSDR::setAntennaPath: cannot set channel #%lu to %d\n", chan, path);
// return false; // return false;
// } // }
// //
// //enable/disable the loopback path // //enable/disable the loopback path
// const bool loopback = (path == (int) PATH_RFE_LB1) or (path == (int) PATH_RFE_LB2); // const bool loopback = (path == (int) PATH_RFE_LB1) or (path == (int) PATH_RFE_LB2);
// //
// if (LMS_WriteParam(device, LMS7param(EN_LOOPB_TXPAD_TRF), loopback ? 1 : 0) < 0) // if (LMS_WriteParam(device, LMS7param(EN_LOOPB_TXPAD_TRF), loopback ? 1 : 0) < 0)
// { // {
// fprintf(stderr, "DeviceLimeSDR::setAntennaPath: cannot %sset loopback on channel #%lu\n", loopback ? "" : "re", chan); // fprintf(stderr, "DeviceLimeSDR::setAntennaPath: cannot %sset loopback on channel #%lu\n", loopback ? "" : "re", chan);
// return false; // return false;
// } // }
// //
// //update external band-selection to match // //update external band-selection to match
// //this->UpdateExternalBandSelect(); // //this->UpdateExternalBandSelect();
// //
// return true; // return true;
switch ((PathRxRFE) path) switch ((PathRxRFE) path)
{ {
case PATH_RFE_LNAH: case PATH_RFE_LNAH:
if (LMS_SetAntenna(device, LMS_CH_RX, chan, 1) < 0) if (LMS_SetAntenna(device, LMS_CH_RX, chan, 1) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to LNAH\n"); fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to LNAH\n");
return false; return false;
} }
break; break;
case PATH_RFE_LNAL: case PATH_RFE_LNAL:
if (LMS_SetAntenna(device, LMS_CH_RX, chan, 2) < 0) if (LMS_SetAntenna(device, LMS_CH_RX, chan, 2) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to LNAL\n"); fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to LNAL\n");
return false; return false;
} }
break; break;
case PATH_RFE_LNAW: case PATH_RFE_LNAW:
if (LMS_SetAntenna(device, LMS_CH_RX, chan, 3) < 0) if (LMS_SetAntenna(device, LMS_CH_RX, chan, 3) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to LNAW\n"); fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to LNAW\n");
return false; return false;
} }
break; break;
case PATH_RFE_LB1: case PATH_RFE_LB1:
if (LMS_SetAntenna(device, LMS_CH_TX, chan, 1) < 0) if (LMS_SetAntenna(device, LMS_CH_TX, chan, 1) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to Loopback TX1\n"); fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to Loopback TX1\n");
return false; return false;
} }
break; break;
case PATH_RFE_LB2: case PATH_RFE_LB2:
if (LMS_SetAntenna(device, LMS_CH_TX, chan, 2) < 0) if (LMS_SetAntenna(device, LMS_CH_TX, chan, 2) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to Loopback TX2\n"); fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to Loopback TX2\n");
return false; return false;
} }
break; break;
case PATH_RFE_RX_NONE: case PATH_RFE_RX_NONE:
default: default:
if (LMS_SetAntenna(device, LMS_CH_RX, chan, 0) < 0) if (LMS_SetAntenna(device, LMS_CH_RX, chan, 0) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to none\n"); fprintf(stderr, "DeviceLimeSDR::setRxAntennaPath: cannot set to none\n");
return false; return false;
} }
} }
return true; return true;
} }
bool DeviceLimeSDR::setTxAntennaPath(lms_device_t *device, std::size_t chan, int path) bool DeviceLimeSDR::setTxAntennaPath(lms_device_t *device, std::size_t chan, int path)
{ {
switch ((PathTxRFE) path) switch ((PathTxRFE) path)
{ {
case PATH_RFE_TXRF1: case PATH_RFE_TXRF1:
if (LMS_SetAntenna(device, LMS_CH_TX, chan, 1) < 0) if (LMS_SetAntenna(device, LMS_CH_TX, chan, 1) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setTxAntennaPath: cannot set to TXRF1\n"); fprintf(stderr, "DeviceLimeSDR::setTxAntennaPath: cannot set to TXRF1\n");
return false; return false;
} }
break; break;
case PATH_RFE_TXRF2: case PATH_RFE_TXRF2:
if (LMS_SetAntenna(device, LMS_CH_TX, chan, 2) < 0) if (LMS_SetAntenna(device, LMS_CH_TX, chan, 2) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setTxAntennaPath: cannot set to TXRF2\n"); fprintf(stderr, "DeviceLimeSDR::setTxAntennaPath: cannot set to TXRF2\n");
return false; return false;
} }
break; break;
case PATH_RFE_TX_NONE: case PATH_RFE_TX_NONE:
default: default:
if (LMS_SetAntenna(device, LMS_CH_TX, chan, 0) < 0) if (LMS_SetAntenna(device, LMS_CH_TX, chan, 0) < 0)
{ {
fprintf(stderr, "DeviceLimeSDR::setTxAntennaPath: cannot set to none\n"); fprintf(stderr, "DeviceLimeSDR::setTxAntennaPath: cannot set to none\n");
return false; return false;
} }
} }
return true; return true;
} }

View File

@ -1,56 +1,56 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB // // Copyright (C) 2017 Edouard Griffiths, F4EXB //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef DEVICES_LIMESDR_DEVICELIMESDR_H_ #ifndef DEVICES_LIMESDR_DEVICELIMESDR_H_
#define DEVICES_LIMESDR_DEVICELIMESDR_H_ #define DEVICES_LIMESDR_DEVICELIMESDR_H_
#include "lime/LimeSuite.h" #include "lime/LimeSuite.h"
class DeviceLimeSDR class DeviceLimeSDR
{ {
public: public:
enum PathRxRFE enum PathRxRFE
{ {
PATH_RFE_RX_NONE = 0, PATH_RFE_RX_NONE = 0,
PATH_RFE_LNAH, PATH_RFE_LNAH,
PATH_RFE_LNAL, PATH_RFE_LNAL,
PATH_RFE_LNAW, PATH_RFE_LNAW,
PATH_RFE_LB1, PATH_RFE_LB1,
PATH_RFE_LB2 PATH_RFE_LB2
}; };
enum PathTxRFE enum PathTxRFE
{ {
PATH_RFE_TX_NONE = 0, PATH_RFE_TX_NONE = 0,
PATH_RFE_TXRF1, PATH_RFE_TXRF1,
PATH_RFE_TXRF2, PATH_RFE_TXRF2,
}; };
/** set NCO frequency with positive or negative frequency (deals with up/down convert). Enables or disables NCO */ /** set NCO frequency with positive or negative frequency (deals with up/down convert). Enables or disables NCO */
static bool setNCOFrequency(lms_device_t *device, bool dir_tx, std::size_t chan, bool enable, float frequency); static bool setNCOFrequency(lms_device_t *device, bool dir_tx, std::size_t chan, bool enable, float frequency);
/** set LNA gain Range: [1-30] (dB) **/ /** set LNA gain Range: [1-30] (dB) **/
static bool SetRFELNA_dB(lms_device_t *device, std::size_t chan, int value); static bool SetRFELNA_dB(lms_device_t *device, std::size_t chan, int value);
/** set TIA gain Range: [1-3] **/ /** set TIA gain Range: [1-3] **/
static bool SetRFETIA_dB(lms_device_t *device, std::size_t chan, int value); static bool SetRFETIA_dB(lms_device_t *device, std::size_t chan, int value);
/** set PGA gain Range: [0-32] (dB) **/ /** set PGA gain Range: [0-32] (dB) **/
static bool SetRBBPGA_dB(lms_device_t *device, std::size_t chan, float value); static bool SetRBBPGA_dB(lms_device_t *device, std::size_t chan, float value);
/** Set Rx antenna path **/ /** Set Rx antenna path **/
static bool setRxAntennaPath(lms_device_t *device, std::size_t chan, int path); static bool setRxAntennaPath(lms_device_t *device, std::size_t chan, int path);
/** Set Tx antenna path **/ /** Set Tx antenna path **/
static bool setTxAntennaPath(lms_device_t *device, std::size_t chan, int path); static bool setTxAntennaPath(lms_device_t *device, std::size_t chan, int path);
}; };
#endif /* DEVICES_LIMESDR_DEVICELIMESDR_H_ */ #endif /* DEVICES_LIMESDR_DEVICELIMESDR_H_ */

View File

@ -1,70 +1,70 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB // // Copyright (C) 2017 Edouard Griffiths, F4EXB //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_ #ifndef DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_
#define DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_ #define DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_
#include "lime/LimeSuite.h" #include "lime/LimeSuite.h"
/** /**
* This structure refers to one physical device shared among parties (logical devices represented by * This structure refers to one physical device shared among parties (logical devices represented by
* the DeviceSinkAPI or DeviceSourceAPI). * the DeviceSinkAPI or DeviceSourceAPI).
* It allows storing information on the common resources in one place and is shared among participants. * It allows storing information on the common resources in one place and is shared among participants.
* There is only one copy that is constructed by the first participant and destroyed by the last. * There is only one copy that is constructed by the first participant and destroyed by the last.
* A participant knows it is the first or last by checking the lists of buddies (Rx + Tx). * A participant knows it is the first or last by checking the lists of buddies (Rx + Tx).
*/ */
struct DeviceLimeSDRParams struct DeviceLimeSDRParams
{ {
lms_device_t *m_dev; //!< device handle lms_device_t *m_dev; //!< device handle
uint32_t m_nbRxChannels; //!< number of Rx channels (normally 2, we'll see if we really use it...) uint32_t m_nbRxChannels; //!< number of Rx channels (normally 2, we'll see if we really use it...)
uint32_t m_nbTxChannels; //!< number of Tx channels (normally 2, we'll see if we really use it...) uint32_t m_nbTxChannels; //!< number of Tx channels (normally 2, we'll see if we really use it...)
lms_range_t m_lpfRangeRx; //!< Low pass filter range information (Rx side) lms_range_t m_lpfRangeRx; //!< Low pass filter range information (Rx side)
lms_range_t m_lpfRangeTx; //!< Low pass filter range information (Tx side) lms_range_t m_lpfRangeTx; //!< Low pass filter range information (Tx side)
lms_range_t m_loRangeRx; //!< LO range for Rx lms_range_t m_loRangeRx; //!< LO range for Rx
lms_range_t m_loRangeTx; //!< LO range for Tx lms_range_t m_loRangeTx; //!< LO range for Tx
lms_range_t m_srRangeRx; //!< ADC sample rate range lms_range_t m_srRangeRx; //!< ADC sample rate range
lms_range_t m_srRangeTx; //!< DAC sample rate range lms_range_t m_srRangeTx; //!< DAC sample rate range
float m_sampleRate; //!< ADC/DAC sample rate float m_sampleRate; //!< ADC/DAC sample rate
int m_log2OvSRRx; //!< log2 of Rx oversampling (0..5) int m_log2OvSRRx; //!< log2 of Rx oversampling (0..5)
int m_log2OvSRTx; //!< log2 of Tx oversampling (0..5) int m_log2OvSRTx; //!< log2 of Tx oversampling (0..5)
float m_rxFrequency; //!< Rx frequency float m_rxFrequency; //!< Rx frequency
float m_txFrequency; //!< Tx frequency float m_txFrequency; //!< Tx frequency
DeviceLimeSDRParams() : DeviceLimeSDRParams() :
m_dev(0), m_dev(0),
m_nbRxChannels(0), m_nbRxChannels(0),
m_nbTxChannels(0), m_nbTxChannels(0),
m_sampleRate(1e6), m_sampleRate(1e6),
m_log2OvSRRx(0), m_log2OvSRRx(0),
m_log2OvSRTx(0), m_log2OvSRTx(0),
m_rxFrequency(1e6), m_rxFrequency(1e6),
m_txFrequency(1e6) m_txFrequency(1e6)
{ {
} }
/** /**
* Opens and initialize the device and obtain information (# channels, ranges, ...) * Opens and initialize the device and obtain information (# channels, ranges, ...)
*/ */
bool open(lms_info_str_t deviceStr); bool open(lms_info_str_t deviceStr);
void close(); void close();
lms_device_t *getDevice() { return m_dev; } lms_device_t *getDevice() { return m_dev; }
~DeviceLimeSDRParams() ~DeviceLimeSDRParams()
{ {
} }
}; };
#endif /* DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_ */ #endif /* DEVICES_LIMESDR_DEVICELIMESDRPARAM_H_ */

View File

@ -1,25 +1,25 @@
#-------------------------------------------------------- #--------------------------------------------------------
# #
# Pro file for Android and Windows builds with Qt Creator # Pro file for Android and Windows builds with Qt Creator
# #
#-------------------------------------------------------- #--------------------------------------------------------
QT += core QT += core
TEMPLATE = lib TEMPLATE = lib
TARGET = libsqlite3 TARGET = libsqlite3
CONFIG(MINGW32):LIBSQLITE3SRC = "." CONFIG(MINGW32):LIBSQLITE3SRC = "."
CONFIG(MINGW64):LIBSQLITE3SRC = "." CONFIG(MINGW64):LIBSQLITE3SRC = "."
CONFIG(MINGW32):INCLUDEPATH += "src" CONFIG(MINGW32):INCLUDEPATH += "src"
CONFIG(MINGW64):INCLUDEPATH += "src" CONFIG(MINGW64):INCLUDEPATH += "src"
SOURCES = $$LIBSQLITE3SRC/src/sqlite3.c SOURCES = $$LIBSQLITE3SRC/src/sqlite3.c
HEADERS = $$LIBSQLITE3SRC/src/sqlite3.h\ HEADERS = $$LIBSQLITE3SRC/src/sqlite3.h\
$$LIBSQLITE3SRC/src/sqlite3ext.h $$LIBSQLITE3SRC/src/sqlite3ext.h
CONFIG(ANDROID):CONFIG += mobility CONFIG(ANDROID):CONFIG += mobility
CONFIG(ANDROID):MOBILITY = CONFIG(ANDROID):MOBILITY =

View File

@ -1,183 +1,183 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB // // Copyright (C) 2017 Edouard Griffiths, F4EXB //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef INCLUDE_CHANALYZERNG_H #ifndef INCLUDE_CHANALYZERNG_H
#define INCLUDE_CHANALYZERNG_H #define INCLUDE_CHANALYZERNG_H
#include <dsp/basebandsamplesink.h> #include <dsp/basebandsamplesink.h>
#include <QMutex> #include <QMutex>
#include <vector> #include <vector>
#include "dsp/interpolator.h" #include "dsp/interpolator.h"
#include "dsp/ncof.h" #include "dsp/ncof.h"
#include "dsp/fftfilt.h" #include "dsp/fftfilt.h"
#include "audio/audiofifo.h" #include "audio/audiofifo.h"
#include "util/message.h" #include "util/message.h"
#define ssbFftLen 1024 #define ssbFftLen 1024
class ChannelAnalyzerNG : public BasebandSampleSink { class ChannelAnalyzerNG : public BasebandSampleSink {
public: public:
ChannelAnalyzerNG(BasebandSampleSink* m_sampleSink); ChannelAnalyzerNG(BasebandSampleSink* m_sampleSink);
virtual ~ChannelAnalyzerNG(); virtual ~ChannelAnalyzerNG();
void configure(MessageQueue* messageQueue, void configure(MessageQueue* messageQueue,
int channelSampleRate, int channelSampleRate,
Real Bandwidth, Real Bandwidth,
Real LowCutoff, Real LowCutoff,
int spanLog2, int spanLog2,
bool ssb); bool ssb);
int getInputSampleRate() const { return m_running.m_inputSampleRate; } int getInputSampleRate() const { return m_running.m_inputSampleRate; }
int getChannelSampleRate() const { return m_running.m_channelSampleRate; } int getChannelSampleRate() const { return m_running.m_channelSampleRate; }
double getMagSq() const { return m_magsq; } double getMagSq() const { return m_magsq; }
virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly); virtual void feed(const SampleVector::const_iterator& begin, const SampleVector::const_iterator& end, bool positiveOnly);
virtual void start(); virtual void start();
virtual void stop(); virtual void stop();
virtual bool handleMessage(const Message& cmd); virtual bool handleMessage(const Message& cmd);
private: private:
class MsgConfigureChannelAnalyzer : public Message { class MsgConfigureChannelAnalyzer : public Message {
MESSAGE_CLASS_DECLARATION MESSAGE_CLASS_DECLARATION
public: public:
int getChannelSampleRate() const { return m_channelSampleRate; } int getChannelSampleRate() const { return m_channelSampleRate; }
Real getBandwidth() const { return m_Bandwidth; } Real getBandwidth() const { return m_Bandwidth; }
Real getLoCutoff() const { return m_LowCutoff; } Real getLoCutoff() const { return m_LowCutoff; }
int getSpanLog2() const { return m_spanLog2; } int getSpanLog2() const { return m_spanLog2; }
bool getSSB() const { return m_ssb; } bool getSSB() const { return m_ssb; }
static MsgConfigureChannelAnalyzer* create( static MsgConfigureChannelAnalyzer* create(
int channelSampleRate, int channelSampleRate,
Real Bandwidth, Real Bandwidth,
Real LowCutoff, Real LowCutoff,
int spanLog2, int spanLog2,
bool ssb) bool ssb)
{ {
return new MsgConfigureChannelAnalyzer(channelSampleRate, Bandwidth, LowCutoff, spanLog2, ssb); return new MsgConfigureChannelAnalyzer(channelSampleRate, Bandwidth, LowCutoff, spanLog2, ssb);
} }
private: private:
int m_channelSampleRate; int m_channelSampleRate;
Real m_Bandwidth; Real m_Bandwidth;
Real m_LowCutoff; Real m_LowCutoff;
int m_spanLog2; int m_spanLog2;
bool m_ssb; bool m_ssb;
MsgConfigureChannelAnalyzer( MsgConfigureChannelAnalyzer(
int channelSampleRate, int channelSampleRate,
Real Bandwidth, Real Bandwidth,
Real LowCutoff, Real LowCutoff,
int spanLog2, int spanLog2,
bool ssb) : bool ssb) :
Message(), Message(),
m_channelSampleRate(channelSampleRate), m_channelSampleRate(channelSampleRate),
m_Bandwidth(Bandwidth), m_Bandwidth(Bandwidth),
m_LowCutoff(LowCutoff), m_LowCutoff(LowCutoff),
m_spanLog2(spanLog2), m_spanLog2(spanLog2),
m_ssb(ssb) m_ssb(ssb)
{ } { }
}; };
struct Config struct Config
{ {
int m_frequency; int m_frequency;
int m_inputSampleRate; int m_inputSampleRate;
int m_channelSampleRate; int m_channelSampleRate;
Real m_Bandwidth; Real m_Bandwidth;
Real m_LowCutoff; Real m_LowCutoff;
int m_spanLog2; int m_spanLog2;
bool m_ssb; bool m_ssb;
Config() : Config() :
m_frequency(0), m_frequency(0),
m_inputSampleRate(96000), m_inputSampleRate(96000),
m_channelSampleRate(96000), m_channelSampleRate(96000),
m_Bandwidth(5000), m_Bandwidth(5000),
m_LowCutoff(300), m_LowCutoff(300),
m_spanLog2(3), m_spanLog2(3),
m_ssb(false) m_ssb(false)
{} {}
}; };
Config m_config; Config m_config;
Config m_running; Config m_running;
int m_undersampleCount; int m_undersampleCount;
fftfilt::cmplx m_sum; fftfilt::cmplx m_sum;
bool m_usb; bool m_usb;
double m_magsq; double m_magsq;
bool m_useInterpolator; bool m_useInterpolator;
NCOF m_nco; NCOF m_nco;
Interpolator m_interpolator; Interpolator m_interpolator;
Real m_interpolatorDistance; Real m_interpolatorDistance;
Real m_interpolatorDistanceRemain; Real m_interpolatorDistanceRemain;
fftfilt* SSBFilter; fftfilt* SSBFilter;
fftfilt* DSBFilter; fftfilt* DSBFilter;
BasebandSampleSink* m_sampleSink; BasebandSampleSink* m_sampleSink;
SampleVector m_sampleBuffer; SampleVector m_sampleBuffer;
QMutex m_settingsMutex; QMutex m_settingsMutex;
void apply(bool force = false); void apply(bool force = false);
void processOneSample(Complex& c, fftfilt::cmplx *sideband) void processOneSample(Complex& c, fftfilt::cmplx *sideband)
{ {
int n_out; int n_out;
int decim = 1<<m_running.m_spanLog2; int decim = 1<<m_running.m_spanLog2;
if (m_running.m_ssb) if (m_running.m_ssb)
{ {
n_out = SSBFilter->runSSB(c, &sideband, m_usb); n_out = SSBFilter->runSSB(c, &sideband, m_usb);
} }
else else
{ {
n_out = DSBFilter->runDSB(c, &sideband); n_out = DSBFilter->runDSB(c, &sideband);
} }
for (int i = 0; i < n_out; i++) for (int i = 0; i < n_out; i++)
{ {
// Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display // Downsample by 2^(m_scaleLog2 - 1) for SSB band spectrum display
// smart decimation with bit gain using float arithmetic (23 bits significand) // smart decimation with bit gain using float arithmetic (23 bits significand)
m_sum += sideband[i]; m_sum += sideband[i];
if (!(m_undersampleCount++ & (decim - 1))) // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1) if (!(m_undersampleCount++ & (decim - 1))) // counter LSB bit mask for decimation by 2^(m_scaleLog2 - 1)
{ {
m_sum /= decim; m_sum /= decim;
m_magsq = (m_sum.real() * m_sum.real() + m_sum.imag() * m_sum.imag())/ (1<<30); m_magsq = (m_sum.real() * m_sum.real() + m_sum.imag() * m_sum.imag())/ (1<<30);
if (m_running.m_ssb & !m_usb) if (m_running.m_ssb & !m_usb)
{ // invert spectrum for LSB { // invert spectrum for LSB
//m_sampleBuffer.push_back(Sample(m_sum.imag() * 32768.0, m_sum.real() * 32768.0)); //m_sampleBuffer.push_back(Sample(m_sum.imag() * 32768.0, m_sum.real() * 32768.0));
m_sampleBuffer.push_back(Sample(m_sum.imag(), m_sum.real())); m_sampleBuffer.push_back(Sample(m_sum.imag(), m_sum.real()));
} }
else else
{ {
//m_sampleBuffer.push_back(Sample(m_sum.real() * 32768.0, m_sum.imag() * 32768.0)); //m_sampleBuffer.push_back(Sample(m_sum.real() * 32768.0, m_sum.imag() * 32768.0));
m_sampleBuffer.push_back(Sample(m_sum.real(), m_sum.imag())); m_sampleBuffer.push_back(Sample(m_sum.real(), m_sum.imag()));
} }
m_sum = 0; m_sum = 0;
} }
} }
} }
}; };
#endif // INCLUDE_CHANALYZERNG_H #endif // INCLUDE_CHANALYZERNG_H

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,62 +1,62 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB // // Copyright (C) 2017 Edouard Griffiths, F4EXB //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef PLUGINS_SAMPLESOURCE_LIMESDROUTPUT_LIMESDROUTPUTSETTINGS_H_ #ifndef PLUGINS_SAMPLESOURCE_LIMESDROUTPUT_LIMESDROUTPUTSETTINGS_H_
#define PLUGINS_SAMPLESOURCE_LIMESDROUTPUT_LIMESDROUTPUTSETTINGS_H_ #define PLUGINS_SAMPLESOURCE_LIMESDROUTPUT_LIMESDROUTPUTSETTINGS_H_
#include <QByteArray> #include <QByteArray>
#include <stdint.h> #include <stdint.h>
/** /**
* These are the settings individual to each hardware channel or software Tx chain * These are the settings individual to each hardware channel or software Tx chain
* Plus the settings to be saved in the presets * Plus the settings to be saved in the presets
*/ */
struct LimeSDROutputSettings struct LimeSDROutputSettings
{ {
typedef enum { typedef enum {
FC_POS_INFRA = 0, FC_POS_INFRA = 0,
FC_POS_SUPRA, FC_POS_SUPRA,
FC_POS_CENTER FC_POS_CENTER
} fcPos_t; } fcPos_t;
enum PathRFE enum PathRFE
{ {
PATH_RFE_NONE = 0, PATH_RFE_NONE = 0,
PATH_RFE_TXRF1, PATH_RFE_TXRF1,
PATH_RFE_TXEF2 PATH_RFE_TXEF2
}; };
// global settings to be saved // global settings to be saved
uint64_t m_centerFrequency; uint64_t m_centerFrequency;
int m_devSampleRate; int m_devSampleRate;
uint32_t m_log2HardInterp; uint32_t m_log2HardInterp;
// channel settings // channel settings
uint32_t m_log2SoftInterp; uint32_t m_log2SoftInterp;
float m_lpfBW; //!< LMS amalog lowpass filter bandwidth (Hz) float m_lpfBW; //!< LMS amalog lowpass filter bandwidth (Hz)
bool m_lpfFIREnable; //!< Enable LMS digital lowpass FIR filters bool m_lpfFIREnable; //!< Enable LMS digital lowpass FIR filters
float m_lpfFIRBW; //!< LMS digital lowpass FIR filters bandwidth (Hz) float m_lpfFIRBW; //!< LMS digital lowpass FIR filters bandwidth (Hz)
uint32_t m_gain; //!< Optimally distributed gain (dB) uint32_t m_gain; //!< Optimally distributed gain (dB)
bool m_ncoEnable; //!< Enable TSP NCO and mixing bool m_ncoEnable; //!< Enable TSP NCO and mixing
int m_ncoFrequency; //!< Actual NCO frequency (the resulting frequency with mixing is displayed) int m_ncoFrequency; //!< Actual NCO frequency (the resulting frequency with mixing is displayed)
PathRFE m_antennaPath; PathRFE m_antennaPath;
LimeSDROutputSettings(); LimeSDROutputSettings();
void resetToDefaults(); void resetToDefaults();
QByteArray serialize() const; QByteArray serialize() const;
bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data);
}; };
#endif /* PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTSETTINGS_H_ */ #endif /* PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTSETTINGS_H_ */

View File

@ -1,43 +1,43 @@
#-------------------------------------------------------- #--------------------------------------------------------
# #
# Pro file for Android and Windows builds with Qt Creator # Pro file for Android and Windows builds with Qt Creator
# #
#-------------------------------------------------------- #--------------------------------------------------------
TEMPLATE = lib TEMPLATE = lib
CONFIG += plugin CONFIG += plugin
QT += core gui widgets multimedia network QT += core gui widgets multimedia network
TARGET = inputfcdproplus TARGET = inputfcdproplus
DEFINES += USE_SSE2=1 DEFINES += USE_SSE2=1
QMAKE_CXXFLAGS += -msse2 QMAKE_CXXFLAGS += -msse2
DEFINES += USE_SSE4_1=1 DEFINES += USE_SSE4_1=1
QMAKE_CXXFLAGS += -msse4.1 QMAKE_CXXFLAGS += -msse4.1
INCLUDEPATH += $$PWD INCLUDEPATH += $$PWD
INCLUDEPATH += ../../../sdrbase INCLUDEPATH += ../../../sdrbase
INCLUDEPATH += ../../../fcdhid INCLUDEPATH += ../../../fcdhid
INCLUDEPATH += ../../../fcdlib INCLUDEPATH += ../../../fcdlib
CONFIG(Release):build_subdir = release CONFIG(Release):build_subdir = release
CONFIG(Debug):build_subdir = debug CONFIG(Debug):build_subdir = debug
SOURCES = fcdproplusgui.cpp\ SOURCES = fcdproplusgui.cpp\
fcdproplusinputqt.cpp\ fcdproplusinputqt.cpp\
fcdproplusplugin.cpp\ fcdproplusplugin.cpp\
fcdproplussettings.cpp\ fcdproplussettings.cpp\
fcdproplusreader.cpp fcdproplusreader.cpp
HEADERS = fcdproplusgui.h\ HEADERS = fcdproplusgui.h\
fcdproplusinputqt.h\ fcdproplusinputqt.h\
fcdproplusplugin.h\ fcdproplusplugin.h\
fcdproplussettings.h\ fcdproplussettings.h\
fcdproplusreader.h fcdproplusreader.h
FORMS += fcdproplusgui.ui FORMS += fcdproplusgui.ui
LIBS += -L../../../fcdlib/$${build_subdir} -lfcdlib LIBS += -L../../../fcdlib/$${build_subdir} -lfcdlib
LIBS += -L../../../fcdhid/$${build_subdir} -lfcdhid LIBS += -L../../../fcdhid/$${build_subdir} -lfcdhid
LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase LIBS += -L../../../sdrbase/$${build_subdir} -lsdrbase

View File

@ -1,76 +1,76 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 Edouard Griffiths, F4EXB // // Copyright (C) 2017 Edouard Griffiths, F4EXB //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTSETTINGS_H_ #ifndef PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTSETTINGS_H_
#define PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTSETTINGS_H_ #define PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTSETTINGS_H_
#include <QByteArray> #include <QByteArray>
#include <stdint.h> #include <stdint.h>
/** /**
* These are the settings individual to each hardware channel or software Rx chain * These are the settings individual to each hardware channel or software Rx chain
* Plus the settings to be saved in the presets * Plus the settings to be saved in the presets
*/ */
struct LimeSDRInputSettings struct LimeSDRInputSettings
{ {
typedef enum { typedef enum {
FC_POS_INFRA = 0, FC_POS_INFRA = 0,
FC_POS_SUPRA, FC_POS_SUPRA,
FC_POS_CENTER FC_POS_CENTER
} fcPos_t; } fcPos_t;
enum PathRFE enum PathRFE
{ {
PATH_RFE_NONE = 0, PATH_RFE_NONE = 0,
PATH_RFE_LNAH, PATH_RFE_LNAH,
PATH_RFE_LNAL, PATH_RFE_LNAL,
PATH_RFE_LNAW, PATH_RFE_LNAW,
PATH_RFE_LB1, PATH_RFE_LB1,
PATH_RFE_LB2 PATH_RFE_LB2
}; };
typedef enum { typedef enum {
GAIN_AUTO, GAIN_AUTO,
GAIN_MANUAL GAIN_MANUAL
} GainMode; } GainMode;
// global settings to be saved // global settings to be saved
uint64_t m_centerFrequency; uint64_t m_centerFrequency;
int m_devSampleRate; int m_devSampleRate;
uint32_t m_log2HardDecim; uint32_t m_log2HardDecim;
// channel settings // channel settings
bool m_dcBlock; bool m_dcBlock;
bool m_iqCorrection; bool m_iqCorrection;
uint32_t m_log2SoftDecim; uint32_t m_log2SoftDecim;
float m_lpfBW; //!< LMS amalog lowpass filter bandwidth (Hz) float m_lpfBW; //!< LMS amalog lowpass filter bandwidth (Hz)
bool m_lpfFIREnable; //!< Enable LMS digital lowpass FIR filters bool m_lpfFIREnable; //!< Enable LMS digital lowpass FIR filters
float m_lpfFIRBW; //!< LMS digital lowpass FIR filters bandwidth (Hz) float m_lpfFIRBW; //!< LMS digital lowpass FIR filters bandwidth (Hz)
uint32_t m_gain; //!< Optimally distributed gain (dB) uint32_t m_gain; //!< Optimally distributed gain (dB)
bool m_ncoEnable; //!< Enable TSP NCO and mixing bool m_ncoEnable; //!< Enable TSP NCO and mixing
int m_ncoFrequency; //!< Actual NCO frequency (the resulting frequency with mixing is displayed) int m_ncoFrequency; //!< Actual NCO frequency (the resulting frequency with mixing is displayed)
PathRFE m_antennaPath; PathRFE m_antennaPath;
GainMode m_gainMode; //!< Gain mode: auto or manual GainMode m_gainMode; //!< Gain mode: auto or manual
uint32_t m_lnaGain; //!< Manual LAN gain uint32_t m_lnaGain; //!< Manual LAN gain
uint32_t m_tiaGain; //!< Manual TIA gain uint32_t m_tiaGain; //!< Manual TIA gain
uint32_t m_pgaGain; //!< Manual PGA gain uint32_t m_pgaGain; //!< Manual PGA gain
LimeSDRInputSettings(); LimeSDRInputSettings();
void resetToDefaults(); void resetToDefaults();
QByteArray serialize() const; QByteArray serialize() const;
bool deserialize(const QByteArray& data); bool deserialize(const QByteArray& data);
}; };
#endif /* PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTSETTINGS_H_ */ #endif /* PLUGINS_SAMPLESOURCE_LIMESDRINPUT_LIMESDRINPUTSETTINGS_H_ */

View File

@ -1,69 +1,69 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 Edouard Griffiths, F4EXB // // Copyright (C) 2016 Edouard Griffiths, F4EXB //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRBASE_AUDIO_AUDIOINPUT_H_ #ifndef SDRBASE_AUDIO_AUDIOINPUT_H_
#define SDRBASE_AUDIO_AUDIOINPUT_H_ #define SDRBASE_AUDIO_AUDIOINPUT_H_
#include <QMutex> #include <QMutex>
#include <QIODevice> #include <QIODevice>
#include <QAudioFormat> #include <QAudioFormat>
#include <list> #include <list>
#include <vector> #include <vector>
#include "util/export.h" #include "util/export.h"
class QAudioInput; class QAudioInput;
class AudioFifo; class AudioFifo;
class AudioOutputPipe; class AudioOutputPipe;
class SDRANGEL_API AudioInput : public QIODevice { class SDRANGEL_API AudioInput : public QIODevice {
public: public:
AudioInput(); AudioInput();
virtual ~AudioInput(); virtual ~AudioInput();
bool start(int device, int rate); bool start(int device, int rate);
void stop(); void stop();
void addFifo(AudioFifo* audioFifo); void addFifo(AudioFifo* audioFifo);
void removeFifo(AudioFifo* audioFifo); void removeFifo(AudioFifo* audioFifo);
uint getRate() const { return m_audioFormat.sampleRate(); } uint getRate() const { return m_audioFormat.sampleRate(); }
void setOnExit(bool onExit) { m_onExit = onExit; } void setOnExit(bool onExit) { m_onExit = onExit; }
void setVolume(float volume) { m_volume = volume; } void setVolume(float volume) { m_volume = volume; }
private: private:
QMutex m_mutex; QMutex m_mutex;
QAudioInput* m_audioInput; QAudioInput* m_audioInput;
uint m_audioUsageCount; uint m_audioUsageCount;
bool m_onExit; bool m_onExit;
float m_volume; float m_volume;
typedef std::list<AudioFifo*> AudioFifos; typedef std::list<AudioFifo*> AudioFifos;
AudioFifos m_audioFifos; AudioFifos m_audioFifos;
std::vector<qint32> m_mixBuffer; std::vector<qint32> m_mixBuffer;
QAudioFormat m_audioFormat; QAudioFormat m_audioFormat;
//virtual bool open(OpenMode mode); //virtual bool open(OpenMode mode);
virtual qint64 readData(char* data, qint64 maxLen); virtual qint64 readData(char* data, qint64 maxLen);
virtual qint64 writeData(const char* data, qint64 len); virtual qint64 writeData(const char* data, qint64 len);
friend class AudioOutputPipe; friend class AudioOutputPipe;
}; };
#endif /* SDRBASE_AUDIO_AUDIOINPUT_H_ */ #endif /* SDRBASE_AUDIO_AUDIOINPUT_H_ */

View File

@ -1,58 +1,58 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 F4EXB // // Copyright (C) 2016 F4EXB //
// written by Edouard Griffiths // // written by Edouard Griffiths //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include "dsp/basebandsamplesource.h" #include "dsp/basebandsamplesource.h"
#include "util/message.h" #include "util/message.h"
BasebandSampleSource::BasebandSampleSource() : BasebandSampleSource::BasebandSampleSource() :
m_sampleFifo(48000) // arbitrary, will be adjusted to match device sink FIFO size m_sampleFifo(48000) // arbitrary, will be adjusted to match device sink FIFO size
{ {
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
connect(&m_sampleFifo, SIGNAL(dataWrite(int)), this, SLOT(handleWriteToFifo(int))); connect(&m_sampleFifo, SIGNAL(dataWrite(int)), this, SLOT(handleWriteToFifo(int)));
} }
BasebandSampleSource::~BasebandSampleSource() BasebandSampleSource::~BasebandSampleSource()
{ {
} }
void BasebandSampleSource::handleInputMessages() void BasebandSampleSource::handleInputMessages()
{ {
Message* message; Message* message;
while ((message = m_inputMessageQueue.pop()) != 0) while ((message = m_inputMessageQueue.pop()) != 0)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
delete message; delete message;
} }
} }
} }
void BasebandSampleSource::handleWriteToFifo(int nbSamples) void BasebandSampleSource::handleWriteToFifo(int nbSamples)
{ {
SampleVector::iterator writeAt; SampleVector::iterator writeAt;
m_sampleFifo.getWriteIterator(writeAt); m_sampleFifo.getWriteIterator(writeAt);
pullAudio(nbSamples); // Pre-fetch input audio samples this is mandatory to keep things running smoothly pullAudio(nbSamples); // Pre-fetch input audio samples this is mandatory to keep things running smoothly
for (int i = 0; i < nbSamples; i++) for (int i = 0; i < nbSamples; i++)
{ {
pull((*writeAt)); pull((*writeAt));
m_sampleFifo.bumpIndex(writeAt); m_sampleFifo.bumpIndex(writeAt);
} }
} }

View File

@ -1,71 +1,71 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 F4EXB // // Copyright (C) 2016 F4EXB //
// written by Edouard Griffiths // // written by Edouard Griffiths //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#ifndef SDRBASE_DSP_BASEBANDSAMPLESOURCE_H_ #ifndef SDRBASE_DSP_BASEBANDSAMPLESOURCE_H_
#define SDRBASE_DSP_BASEBANDSAMPLESOURCE_H_ #define SDRBASE_DSP_BASEBANDSAMPLESOURCE_H_
#include <QObject> #include <QObject>
#include "dsp/dsptypes.h" #include "dsp/dsptypes.h"
#include "dsp/samplesourcefifo.h" #include "dsp/samplesourcefifo.h"
#include "util/export.h" #include "util/export.h"
#include "util/messagequeue.h" #include "util/messagequeue.h"
class Message; class Message;
class SDRANGEL_API BasebandSampleSource : public QObject { class SDRANGEL_API BasebandSampleSource : public QObject {
Q_OBJECT Q_OBJECT
public: public:
BasebandSampleSource(); BasebandSampleSource();
virtual ~BasebandSampleSource(); virtual ~BasebandSampleSource();
virtual void start() = 0; virtual void start() = 0;
virtual void stop() = 0; virtual void stop() = 0;
virtual void pull(Sample& sample) = 0; virtual void pull(Sample& sample) = 0;
virtual void pullAudio(int nbSamples __attribute__((unused))) {} virtual void pullAudio(int nbSamples __attribute__((unused))) {}
/** direct feeding of sample source FIFO */ /** direct feeding of sample source FIFO */
void feed(SampleSourceFifo* sampleFifo, int nbSamples) void feed(SampleSourceFifo* sampleFifo, int nbSamples)
{ {
SampleVector::iterator writeAt; SampleVector::iterator writeAt;
sampleFifo->getWriteIterator(writeAt); sampleFifo->getWriteIterator(writeAt);
pullAudio(nbSamples); // Pre-fetch input audio samples this is mandatory to keep things running smoothly pullAudio(nbSamples); // Pre-fetch input audio samples this is mandatory to keep things running smoothly
for (int i = 0; i < nbSamples; i++) for (int i = 0; i < nbSamples; i++)
{ {
pull((*writeAt)); pull((*writeAt));
sampleFifo->bumpIndex(writeAt); sampleFifo->bumpIndex(writeAt);
} }
} }
SampleSourceFifo& getSampleSourceFifo() { return m_sampleFifo; } SampleSourceFifo& getSampleSourceFifo() { return m_sampleFifo; }
virtual bool handleMessage(const Message& cmd) = 0; //!< Processing of a message. Returns true if message has actually been processed virtual bool handleMessage(const Message& cmd) = 0; //!< Processing of a message. Returns true if message has actually been processed
MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication MessageQueue *getInputMessageQueue() { return &m_inputMessageQueue; } //!< Get the queue for asynchronous inbound communication
MessageQueue *getOutputMessageQueue() { return &m_outputMessageQueue; } //!< Get the queue for asynchronous outbound communication MessageQueue *getOutputMessageQueue() { return &m_outputMessageQueue; } //!< Get the queue for asynchronous outbound communication
protected: protected:
MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication MessageQueue m_inputMessageQueue; //!< Queue for asynchronous inbound communication
MessageQueue m_outputMessageQueue; //!< Queue for asynchronous outbound communication MessageQueue m_outputMessageQueue; //!< Queue for asynchronous outbound communication
SampleSourceFifo m_sampleFifo; //!< Internal FIFO for multi-channel processing SampleSourceFifo m_sampleFifo; //!< Internal FIFO for multi-channel processing
protected slots: protected slots:
void handleInputMessages(); void handleInputMessages();
void handleWriteToFifo(int nbSamples); void handleWriteToFifo(int nbSamples);
}; };
#endif /* SDRBASE_DSP_BASEBANDSAMPLESOURCE_H_ */ #endif /* SDRBASE_DSP_BASEBANDSAMPLESOURCE_H_ */

View File

@ -1,45 +1,45 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2016 F4EXB // // Copyright (C) 2016 F4EXB //
// written by Edouard Griffiths // // written by Edouard Griffiths //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include "dsp/devicesamplesink.h" #include "dsp/devicesamplesink.h"
DeviceSampleSink::DeviceSampleSink() : DeviceSampleSink::DeviceSampleSink() :
m_sampleSourceFifo(1<<19) m_sampleSourceFifo(1<<19)
{ {
connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages())); connect(&m_inputMessageQueue, SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
} }
DeviceSampleSink::~DeviceSampleSink() DeviceSampleSink::~DeviceSampleSink()
{ {
} }
void DeviceSampleSink::handleInputMessages() void DeviceSampleSink::handleInputMessages()
{ {
Message* message; Message* message;
while ((message = m_inputMessageQueue.pop()) != 0) while ((message = m_inputMessageQueue.pop()) != 0)
{ {
if (handleMessage(*message)) if (handleMessage(*message))
{ {
delete message; delete message;
} }
} }
} }

View File

@ -1,441 +1,441 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>CWKeyerGUI</class> <class>CWKeyerGUI</class>
<widget class="QWidget" name="CWKeyerGUI"> <widget class="QWidget" name="CWKeyerGUI">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>375</width> <width>375</width>
<height>60</height> <height>60</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family> <family>Sans Serif</family>
<pointsize>8</pointsize> <pointsize>8</pointsize>
</font> </font>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>CW Keyer</string> <string>CW Keyer</string>
</property> </property>
<layout class="QGridLayout" name="gridLayout" columnstretch="1,0,0"> <layout class="QGridLayout" name="gridLayout" columnstretch="1,0,0">
<property name="margin"> <property name="margin">
<number>2</number> <number>2</number>
</property> </property>
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
<item row="3" column="0" colspan="3"> <item row="3" column="0" colspan="3">
<layout class="QHBoxLayout" name="controlBtns"> <layout class="QHBoxLayout" name="controlBtns">
<property name="spacing"> <property name="spacing">
<number>3</number> <number>3</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="cwSpeedLabel"> <widget class="QLabel" name="cwSpeedLabel">
<property name="text"> <property name="text">
<string>WPM</string> <string>WPM</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDial" name="cwSpeed"> <widget class="QDial" name="cwSpeed">
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>CW speed (WPM)</string> <string>CW speed (WPM)</string>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>1</number> <number>1</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>26</number> <number>26</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>1</number> <number>1</number>
</property> </property>
<property name="value"> <property name="value">
<number>13</number> <number>13</number>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QLabel" name="cwSpeedText"> <widget class="QLabel" name="cwSpeedText">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>16</width> <width>16</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>9</pointsize> <pointsize>9</pointsize>
</font> </font>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>CW speed display (WPM)</string> <string>CW speed display (WPM)</string>
</property> </property>
<property name="text"> <property name="text">
<string>13</string> <string>13</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="ButtonSwitch" name="playDots"> <widget class="ButtonSwitch" name="playDots">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="palette"> <property name="palette">
<palette> <palette>
<active> <active>
<colorrole role="ButtonText"> <colorrole role="ButtonText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="ButtonText"> <colorrole role="ButtonText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="ButtonText"> <colorrole role="ButtonText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Send dots</string> <string>Send dots</string>
</property> </property>
<property name="text"> <property name="text">
<string>.</string> <string>.</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="ButtonSwitch" name="playDashes"> <widget class="ButtonSwitch" name="playDashes">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="palette"> <property name="palette">
<palette> <palette>
<active> <active>
<colorrole role="ButtonText"> <colorrole role="ButtonText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="ButtonText"> <colorrole role="ButtonText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="ButtonText"> <colorrole role="ButtonText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<pointsize>12</pointsize> <pointsize>12</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Send dashes</string> <string>Send dashes</string>
</property> </property>
<property name="text"> <property name="text">
<string>-</string> <string>-</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="Line" name="line_2"> <widget class="Line" name="line_2">
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="ButtonSwitch" name="playText"> <widget class="ButtonSwitch" name="playText">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="palette"> <property name="palette">
<palette> <palette>
<active> <active>
<colorrole role="ButtonText"> <colorrole role="ButtonText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
</active> </active>
<inactive> <inactive>
<colorrole role="ButtonText"> <colorrole role="ButtonText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>255</red> <red>255</red>
<green>255</green> <green>255</green>
<blue>255</blue> <blue>255</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
</inactive> </inactive>
<disabled> <disabled>
<colorrole role="ButtonText"> <colorrole role="ButtonText">
<brush brushstyle="SolidPattern"> <brush brushstyle="SolidPattern">
<color alpha="255"> <color alpha="255">
<red>106</red> <red>106</red>
<green>104</green> <green>104</green>
<blue>100</blue> <blue>100</blue>
</color> </color>
</brush> </brush>
</colorrole> </colorrole>
</disabled> </disabled>
</palette> </palette>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<family>DejaVu Serif</family> <family>DejaVu Serif</family>
<pointsize>9</pointsize> <pointsize>9</pointsize>
<weight>75</weight> <weight>75</weight>
<bold>true</bold> <bold>true</bold>
</font> </font>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Send text written above</string> <string>Send text written above</string>
</property> </property>
<property name="text"> <property name="text">
<string>T</string> <string>T</string>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="ButtonSwitch" name="playLoopCW"> <widget class="ButtonSwitch" name="playLoopCW">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Play text in a loop</string> <string>Play text in a loop</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources/res.qrc"> <iconset resource="../resources/res.qrc">
<normaloff>:/playloop.png</normaloff>:/playloop.png</iconset> <normaloff>:/playloop.png</normaloff>:/playloop.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>16</width> <width>16</width>
<height>16</height> <height>16</height>
</size> </size>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="ButtonSwitch" name="playStop"> <widget class="ButtonSwitch" name="playStop">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Minimum"> <sizepolicy hsizetype="Minimum" vsizetype="Minimum">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
</property> </property>
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Play / stop text coding</string> <string>Play / stop text coding</string>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources/res.qrc"> <iconset resource="../resources/res.qrc">
<normaloff>:/play.png</normaloff> <normaloff>:/play.png</normaloff>
<normalon>:/stop.png</normalon>:/play.png</iconset> <normalon>:/stop.png</normalon>:/play.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>16</width> <width>16</width>
<height>16</height> <height>16</height>
</size> </size>
</property> </property>
<property name="checkable"> <property name="checkable">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="autoRaise"> <property name="autoRaise">
<bool>false</bool> <bool>false</bool>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<spacer name="horizontalSpacer"> <spacer name="horizontalSpacer">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="sizeHint" stdset="0"> <property name="sizeHint" stdset="0">
<size> <size>
<width>40</width> <width>40</width>
<height>20</height> <height>20</height>
</size> </size>
</property> </property>
</spacer> </spacer>
</item> </item>
</layout> </layout>
</item> </item>
<item row="2" column="0" colspan="3"> <item row="2" column="0" colspan="3">
<layout class="QHBoxLayout" name="cwTextLayout"> <layout class="QHBoxLayout" name="cwTextLayout">
<item> <item>
<widget class="QLineEdit" name="cwTextEdit"> <widget class="QLineEdit" name="cwTextEdit">
<property name="toolTip"> <property name="toolTip">
<string>CW text</string> <string>CW text</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QPushButton" name="cwTextClear"> <widget class="QPushButton" name="cwTextClear">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>24</width> <width>24</width>
<height>24</height> <height>24</height>
</size> </size>
</property> </property>
<property name="toolTip"> <property name="toolTip">
<string>Clear CW text</string> <string>Clear CW text</string>
</property> </property>
<property name="text"> <property name="text">
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset resource="../resources/res.qrc"> <iconset resource="../resources/res.qrc">
<normaloff>:/clear.png</normaloff>:/clear.png</iconset> <normaloff>:/clear.png</normaloff>:/clear.png</iconset>
</property> </property>
<property name="iconSize"> <property name="iconSize">
<size> <size>
<width>16</width> <width>16</width>
<height>16</height> <height>16</height>
</size> </size>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets> <customwidgets>
<customwidget> <customwidget>
<class>ButtonSwitch</class> <class>ButtonSwitch</class>
<extends>QToolButton</extends> <extends>QToolButton</extends>
<header>gui/buttonswitch.h</header> <header>gui/buttonswitch.h</header>
</customwidget> </customwidget>
</customwidgets> </customwidgets>
<tabstops> <tabstops>
<tabstop>playLoopCW</tabstop> <tabstop>playLoopCW</tabstop>
</tabstops> </tabstops>
<resources> <resources>
<include location="../resources/res.qrc"/> <include location="../resources/res.qrc"/>
</resources> </resources>
<connections/> <connections/>
</ui> </ui>

View File

@ -1,122 +1,122 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>MyPositionDialog</class> <class>MyPositionDialog</class>
<widget class="QDialog" name="MyPositionDialog"> <widget class="QDialog" name="MyPositionDialog">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>324</width> <width>324</width>
<height>127</height> <height>127</height>
</rect> </rect>
</property> </property>
<property name="font"> <property name="font">
<font> <font>
<family>Sans Serif</family> <family>Sans Serif</family>
<pointsize>9</pointsize> <pointsize>9</pointsize>
</font> </font>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>Dialog</string> <string>Dialog</string>
</property> </property>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QGroupBox" name="groupBox"> <widget class="QGroupBox" name="groupBox">
<property name="title"> <property name="title">
<string>My Station Position</string> <string>My Station Position</string>
</property> </property>
<layout class="QFormLayout" name="formLayout"> <layout class="QFormLayout" name="formLayout">
<item row="0" column="0"> <item row="0" column="0">
<widget class="QLabel" name="latitudeLabel"> <widget class="QLabel" name="latitudeLabel">
<property name="text"> <property name="text">
<string>Latitude</string> <string>Latitude</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="0"> <item row="1" column="0">
<widget class="QLabel" name="longitudeLabel"> <widget class="QLabel" name="longitudeLabel">
<property name="text"> <property name="text">
<string>Longitude</string> <string>Longitude</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="1"> <item row="1" column="1">
<widget class="QDoubleSpinBox" name="longitudeSpinBox"> <widget class="QDoubleSpinBox" name="longitudeSpinBox">
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="minimum"> <property name="minimum">
<double>-180.000000000000000</double> <double>-180.000000000000000</double>
</property> </property>
<property name="maximum"> <property name="maximum">
<double>180.000000000000000</double> <double>180.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">
<widget class="QDoubleSpinBox" name="latitudeSpinBox"> <widget class="QDoubleSpinBox" name="latitudeSpinBox">
<property name="decimals"> <property name="decimals">
<number>6</number> <number>6</number>
</property> </property>
<property name="minimum"> <property name="minimum">
<double>-90.000000000000000</double> <double>-90.000000000000000</double>
</property> </property>
<property name="maximum"> <property name="maximum">
<double>90.000000000000000</double> <double>90.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QDialogButtonBox" name="buttonBox"> <widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="standardButtons"> <property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<tabstops> <tabstops>
<tabstop>buttonBox</tabstop> <tabstop>buttonBox</tabstop>
</tabstops> </tabstops>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>accepted()</signal> <signal>accepted()</signal>
<receiver>MyPositionDialog</receiver> <receiver>MyPositionDialog</receiver>
<slot>accept()</slot> <slot>accept()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>257</x> <x>257</x>
<y>194</y> <y>194</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>157</x> <x>157</x>
<y>203</y> <y>203</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>buttonBox</sender> <sender>buttonBox</sender>
<signal>rejected()</signal> <signal>rejected()</signal>
<receiver>MyPositionDialog</receiver> <receiver>MyPositionDialog</receiver>
<slot>reject()</slot> <slot>reject()</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>314</x> <x>314</x>
<y>194</y> <y>194</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>286</x> <x>286</x>
<y>203</y> <y>203</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
</connections> </connections>
</ui> </ui>

View File

@ -1,83 +1,83 @@
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
// Copyright (C) 2017 F4EXB // // Copyright (C) 2017 F4EXB //
// written by Edouard Griffiths // // written by Edouard Griffiths //
// // // //
// Same as ValueDial but handles optionally positive and negative numbers with // // Same as ValueDial but handles optionally positive and negative numbers with //
// sign display. // // sign display. //
// // // //
// This program is free software; you can redistribute it and/or modify // // 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 // // it under the terms of the GNU General Public License as published by //
// the Free Software Foundation as version 3 of the License, or // // the Free Software Foundation as version 3 of the License, or //
// // // //
// This program is distributed in the hope that it will be useful, // // This program is distributed in the hope that it will be useful, //
// but WITHOUT ANY WARRANTY; without even the implied warranty of // // but WITHOUT ANY WARRANTY; without even the implied warranty of //
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
// GNU General Public License V3 for more details. // // GNU General Public License V3 for more details. //
// // // //
// You should have received a copy of the GNU General Public License // // You should have received a copy of the GNU General Public License //
// along with this program. If not, see <http://www.gnu.org/licenses/>. // // along with this program. If not, see <http://www.gnu.org/licenses/>. //
/////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////
#include <QWidget> #include <QWidget>
#include <QTimer> #include <QTimer>
#include "gui/colormapper.h" #include "gui/colormapper.h"
#include "util/export.h" #include "util/export.h"
class SDRANGEL_API ValueDialZ : public QWidget { class SDRANGEL_API ValueDialZ : public QWidget {
Q_OBJECT Q_OBJECT
public: public:
ValueDialZ(bool positiveOnly = true, QWidget* parent = NULL, ColorMapper colorMapper = ColorMapper(ColorMapper::Normal)); ValueDialZ(bool positiveOnly = true, QWidget* parent = NULL, ColorMapper colorMapper = ColorMapper(ColorMapper::Normal));
void setValue(qint64 value); void setValue(qint64 value);
void setValueRange(bool positiveOnly, uint numDigits, qint64 min, qint64 max); void setValueRange(bool positiveOnly, uint numDigits, qint64 min, qint64 max);
void setFont(const QFont& font); void setFont(const QFont& font);
void setBold(bool bold); void setBold(bool bold);
void setColorMapper(ColorMapper colorMapper); void setColorMapper(ColorMapper colorMapper);
qint64 getValue() const { return m_value; } qint64 getValue() const { return m_value; }
qint64 getValueNew() const { return m_valueNew; } qint64 getValueNew() const { return m_valueNew; }
signals: signals:
void changed(qint64 value); void changed(qint64 value);
private: private:
QLinearGradient m_background; QLinearGradient m_background;
int m_numDigits; int m_numDigits;
int m_numDecimalPoints; int m_numDecimalPoints;
int m_digitWidth; int m_digitWidth;
int m_digitHeight; int m_digitHeight;
int m_hightlightedDigit; int m_hightlightedDigit;
int m_cursor; int m_cursor;
bool m_cursorState; bool m_cursorState;
qint64 m_value; qint64 m_value;
qint64 m_valueMax; qint64 m_valueMax;
qint64 m_valueMin; qint64 m_valueMin;
bool m_positiveOnly; bool m_positiveOnly;
QString m_text; QString m_text;
qint64 m_valueNew; qint64 m_valueNew;
QString m_textNew; QString m_textNew;
int m_animationState; int m_animationState;
QTimer m_animationTimer; QTimer m_animationTimer;
QTimer m_blinkTimer; QTimer m_blinkTimer;
ColorMapper m_colorMapper; ColorMapper m_colorMapper;
quint64 findExponent(int digit); quint64 findExponent(int digit);
QChar digitNeigh(QChar c, bool dir); QChar digitNeigh(QChar c, bool dir);
QString formatText(qint64 value); QString formatText(qint64 value);
void paintEvent(QPaintEvent*); void paintEvent(QPaintEvent*);
void mousePressEvent(QMouseEvent*); void mousePressEvent(QMouseEvent*);
void mouseMoveEvent(QMouseEvent*); void mouseMoveEvent(QMouseEvent*);
void wheelEvent(QWheelEvent*); void wheelEvent(QWheelEvent*);
void leaveEvent(QEvent*); void leaveEvent(QEvent*);
void keyPressEvent(QKeyEvent*); void keyPressEvent(QKeyEvent*);
void focusInEvent(QFocusEvent*); void focusInEvent(QFocusEvent*);
void focusOutEvent(QFocusEvent*); void focusOutEvent(QFocusEvent*);
private slots: private slots:
void animate(); void animate();
void blink(); void blink();
}; };