mirror of
https://github.com/f4exb/sdrangel.git
synced 2024-11-13 20:01:46 -05:00
SDRDaemonSource: sample bit size conversion 16 / 24 bits bidirectional
This commit is contained in:
parent
0ae5955b76
commit
7e97f62615
@ -38,8 +38,8 @@ QByteArray SDRdaemonSourceSettings::serialize() const
|
|||||||
SimpleSerializer s(1);
|
SimpleSerializer s(1);
|
||||||
|
|
||||||
s.writeString(5, m_apiAddress);
|
s.writeString(5, m_apiAddress);
|
||||||
s.writeU32(6, m_dataPort);
|
s.writeU32(6, m_apiPort);
|
||||||
s.writeU32(7, m_apiPort);
|
s.writeU32(7, m_dataPort);
|
||||||
s.writeString(8, m_dataAddress);
|
s.writeString(8, m_dataAddress);
|
||||||
s.writeBool(9, m_dcBlock);
|
s.writeBool(9, m_dcBlock);
|
||||||
s.writeBool(10, m_iqCorrection);
|
s.writeBool(10, m_iqCorrection);
|
||||||
@ -62,7 +62,7 @@ bool SDRdaemonSourceSettings::deserialize(const QByteArray& data)
|
|||||||
quint32 uintval;
|
quint32 uintval;
|
||||||
d.readString(5, &m_apiAddress, "127.0.0.1");
|
d.readString(5, &m_apiAddress, "127.0.0.1");
|
||||||
d.readU32(6, &uintval, 9090);
|
d.readU32(6, &uintval, 9090);
|
||||||
m_dataPort = uintval % (1<<16);
|
m_apiPort = uintval % (1<<16);
|
||||||
d.readU32(7, &uintval, 9091);
|
d.readU32(7, &uintval, 9091);
|
||||||
m_dataPort = uintval % (1<<16);
|
m_dataPort = uintval % (1<<16);
|
||||||
d.readString(8, &m_dataAddress, "127.0.0.1");
|
d.readString(8, &m_dataAddress, "127.0.0.1");
|
||||||
|
@ -264,14 +264,15 @@ void SDRdaemonSourceUDPHandler::tick()
|
|||||||
}
|
}
|
||||||
|
|
||||||
m_readLength = m_readLengthSamples * SDRdaemonSourceBuffer::m_iqSampleSize;
|
m_readLength = m_readLengthSamples * SDRdaemonSourceBuffer::m_iqSampleSize;
|
||||||
|
const SDRdaemonSourceBuffer::MetaDataFEC& metaData = m_sdrDaemonBuffer.getCurrentMeta();
|
||||||
|
|
||||||
if (SDR_RX_SAMP_SZ == 16)
|
if (SDR_RX_SAMP_SZ == metaData.m_sampleBits) // same sample size
|
||||||
{
|
{
|
||||||
// read samples directly feeding the SampleFifo (no callback)
|
// read samples directly feeding the SampleFifo (no callback)
|
||||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_sdrDaemonBuffer.readData(m_readLength)), m_readLength);
|
m_sampleFifo->write(reinterpret_cast<quint8*>(m_sdrDaemonBuffer.readData(m_readLength)), m_readLength);
|
||||||
m_samplesCount += m_readLengthSamples;
|
m_samplesCount += m_readLengthSamples;
|
||||||
}
|
}
|
||||||
else if (SDR_RX_SAMP_SZ == 24)
|
else if (metaData.m_sampleBits == 16) // 16 -> 24 bits
|
||||||
{
|
{
|
||||||
if (m_readLengthSamples > m_converterBufferNbSamples)
|
if (m_readLengthSamples > m_converterBufferNbSamples)
|
||||||
{
|
{
|
||||||
@ -283,14 +284,37 @@ void SDRdaemonSourceUDPHandler::tick()
|
|||||||
|
|
||||||
for (unsigned int is = 0; is < m_readLengthSamples; is++)
|
for (unsigned int is = 0; is < m_readLengthSamples; is++)
|
||||||
{
|
{
|
||||||
m_converterBuffer[2*is] = ((int16_t*)buf)[2*is];
|
m_converterBuffer[2*is] = ((int16_t*)buf)[2*is]; // I
|
||||||
m_converterBuffer[2*is]<<=8;
|
m_converterBuffer[2*is]<<=8;
|
||||||
m_converterBuffer[2*is+1] = ((int16_t*)buf)[2*is+1];
|
m_converterBuffer[2*is+1] = ((int16_t*)buf)[2*is+1]; // Q
|
||||||
m_converterBuffer[2*is+1]<<=8;
|
m_converterBuffer[2*is+1]<<=8;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
||||||
}
|
}
|
||||||
|
else if (metaData.m_sampleBits == 24) // 24 -> 16 bits
|
||||||
|
{
|
||||||
|
if (m_readLengthSamples > m_converterBufferNbSamples)
|
||||||
|
{
|
||||||
|
if (m_converterBuffer) { delete[] m_converterBuffer; }
|
||||||
|
m_converterBuffer = new int32_t[m_readLengthSamples];
|
||||||
|
}
|
||||||
|
|
||||||
|
uint8_t *buf = m_sdrDaemonBuffer.readData(m_readLength);
|
||||||
|
|
||||||
|
for (unsigned int is = 0; is < m_readLengthSamples; is++)
|
||||||
|
{
|
||||||
|
m_converterBuffer[is] = ((int32_t *)buf)[2*is]>>8; // I -> MSB
|
||||||
|
m_converterBuffer[is] <<=16;
|
||||||
|
m_converterBuffer[is] += ((int32_t *)buf)[2*is+1]>>8; // Q -> LSB
|
||||||
|
}
|
||||||
|
|
||||||
|
m_sampleFifo->write(reinterpret_cast<quint8*>(m_converterBuffer), m_readLengthSamples*sizeof(Sample));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qWarning("SDRdaemonSourceUDPHandler::tick: unexpected sample size in stream: %d bits", (int) metaData.m_sampleBits);
|
||||||
|
}
|
||||||
|
|
||||||
if (m_tickCount < m_rateDivider)
|
if (m_tickCount < m_rateDivider)
|
||||||
{
|
{
|
||||||
|
@ -13,6 +13,7 @@ requests_methods = {
|
|||||||
"DELETE": requests.delete
|
"DELETE": requests.delete
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
def getInputOptions():
|
def getInputOptions():
|
||||||
|
|
||||||
@ -27,8 +28,9 @@ def getInputOptions():
|
|||||||
parser.add_option("-A", "--antenna-path", dest="antenna_path", help="antenna path index", metavar="INDEX", type="int")
|
parser.add_option("-A", "--antenna-path", dest="antenna_path", help="antenna path index", metavar="INDEX", type="int")
|
||||||
parser.add_option("-s", "--sample-rate", dest="sample_rate", help="device to host sample rate (kS/s)", metavar="RATE", type="int")
|
parser.add_option("-s", "--sample-rate", dest="sample_rate", help="device to host sample rate (kS/s)", metavar="RATE", type="int")
|
||||||
parser.add_option("-l", "--log2-decim", dest="log2_decim", help="log2 of the desired software decimation factor", metavar="LOG2", type="int", default=4)
|
parser.add_option("-l", "--log2-decim", dest="log2_decim", help="log2 of the desired software decimation factor", metavar="LOG2", type="int", default=4)
|
||||||
parser.add_option("-b", "--af-bw", dest="af_bw", help="audio babdwidth (kHz)", metavar="FREQUENCY_KHZ", type="int" ,default=3)
|
parser.add_option("--device-rfbw", dest="device_rfbw", help="Device RF bandwidth in kHz", metavar="FREQUENCY_KHZ", type="int")
|
||||||
parser.add_option("-r", "--rf-bw", dest="rf_bw", help="RF babdwidth (Hz). Sets to nearest available", metavar="FREQUENCY", type="int", default=10000)
|
parser.add_option("-b", "--channel-afbw", dest="af_bw", help="Channel audio babdwidth (kHz)", metavar="FREQUENCY_KHZ", type="int" , default=3)
|
||||||
|
parser.add_option("-r", "--channel-rfbw", dest="rf_bw", help="Channel RF bandwidth (Hz). Sets to nearest available", metavar="FREQUENCY", type="int", default=10000)
|
||||||
parser.add_option("--vol", dest="volume", help="audio volume", metavar="VOLUME", type="float", default=1.0)
|
parser.add_option("--vol", dest="volume", help="audio volume", metavar="VOLUME", type="float", default=1.0)
|
||||||
parser.add_option("-c", "--create", dest="create", help="create a new device set", metavar="CREATE", action="store_true", default=False)
|
parser.add_option("-c", "--create", dest="create", help="create a new device set", metavar="CREATE", action="store_true", default=False)
|
||||||
parser.add_option("--ppm", dest="lo_ppm", help="LO correction in PPM", metavar="PPM", type="float", default=0.0)
|
parser.add_option("--ppm", dest="lo_ppm", help="LO correction in PPM", metavar="PPM", type="float", default=0.0)
|
||||||
@ -76,6 +78,7 @@ def getInputOptions():
|
|||||||
|
|
||||||
return options
|
return options
|
||||||
|
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
def printResponse(response):
|
def printResponse(response):
|
||||||
content_type = response.headers.get("Content-Type", None)
|
content_type = response.headers.get("Content-Type", None)
|
||||||
@ -85,25 +88,27 @@ def printResponse(response):
|
|||||||
elif "text/plain" in content_type:
|
elif "text/plain" in content_type:
|
||||||
print(response.text)
|
print(response.text)
|
||||||
|
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
def callAPI(url, method, params, json, text):
|
def callAPI(url, method, params, json, text):
|
||||||
request_method = requests_methods.get(method, None)
|
request_method = requests_methods.get(method, None)
|
||||||
if request_method is not None:
|
if request_method is not None:
|
||||||
#print(base_url, url, json)
|
# print(base_url, url, json)
|
||||||
r = request_method(url=base_url+url, params=params, json=json)
|
r = request_method(url=base_url + url, params=params, json=json)
|
||||||
if r.status_code / 100 == 2:
|
if r.status_code / 100 == 2:
|
||||||
print(text + " succeeded")
|
print(text + " succeeded")
|
||||||
printResponse(r)
|
printResponse(r)
|
||||||
return r.json() # all 200 yield application/json response
|
return r.json() # all 200 yield application/json response
|
||||||
else:
|
else:
|
||||||
print(text + " failed")
|
print(text + " failed")
|
||||||
printResponse(r)
|
printResponse(r)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
def setup_audio(options):
|
def setup_audio(options):
|
||||||
audio_dict = {}
|
audio_dict = {}
|
||||||
if options.audio_name: # must not be None and reference a valid audio device
|
if options.audio_name: # must not be None and reference a valid audio device
|
||||||
audio_dict["name"] = options.audio_name
|
audio_dict["name"] = options.audio_name
|
||||||
if options.audio_udp:
|
if options.audio_udp:
|
||||||
audio_dict["copyToUDP"] = 0 if options.audio_udp == 0 else 1
|
audio_dict["copyToUDP"] = 0 if options.audio_udp == 0 else 1
|
||||||
@ -114,12 +119,13 @@ def setup_audio(options):
|
|||||||
if options.audio_port:
|
if options.audio_port:
|
||||||
audio_dict["udpPort"] = options.audio_port
|
audio_dict["udpPort"] = options.audio_port
|
||||||
if options.audio_channels:
|
if options.audio_channels:
|
||||||
audio_dict["udpChannelMode"] = 0 if options.audio_channels < 0 else 3 if options.audio_channels > 3 else options.audio_channels
|
audio_dict["udpChannelMode"] = 0 if options.audio_channels < 0 else 3 if options.audio_channels > 3 else options.audio_channels
|
||||||
|
|
||||||
r = callAPI('/audio/output/parameters', "PATCH", None, audio_dict, "setup audio {}".format(options.audio_name))
|
r = callAPI('/audio/output/parameters', "PATCH", None, audio_dict, "setup audio {}".format(options.audio_name))
|
||||||
if r is None:
|
if r is None:
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
def setupDevice(deviceset_url, options):
|
def setupDevice(deviceset_url, options):
|
||||||
r = callAPI(deviceset_url + "/device", "PUT", None, {"hwType": "%s" % options.device_hwid, "tx": 0}, "setup device on Rx device set")
|
r = callAPI(deviceset_url + "/device", "PUT", None, {"hwType": "%s" % options.device_hwid, "tx": 0}, "setup device on Rx device set")
|
||||||
@ -131,22 +137,22 @@ def setupDevice(deviceset_url, options):
|
|||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
# calculate RF analog and FIR optimal bandpass filters bandwidths
|
# calculate RF analog and FIR optimal bandpass filters bandwidths
|
||||||
lpFIRBW = options.sample_rate*1000 / (1<<options.log2_decim)
|
lpFIRBW = options.sample_rate * 1000 / (1 << options.log2_decim)
|
||||||
if options.fc_pos == 2: # center of passband
|
if options.fc_pos == 2: # center of passband
|
||||||
lpfBW = options.sample_rate*1000 / (1<<options.log2_decim)
|
lpfBW = options.sample_rate * 1000 / (1 << options.log2_decim)
|
||||||
else: # side of passband
|
else: # side of passband
|
||||||
if options.log2_decim == 0:
|
if options.log2_decim == 0:
|
||||||
lpfBW = options.sample_rate*1000
|
lpfBW = options.sample_rate * 1000
|
||||||
elif options.log2_decim == 1:
|
elif options.log2_decim == 1:
|
||||||
lpfBW = options.sample_rate*1000
|
lpfBW = options.sample_rate * 1000
|
||||||
elif options.log2_decim == 2:
|
elif options.log2_decim == 2:
|
||||||
lpfBW = options.sample_rate*500
|
lpfBW = options.sample_rate * 500
|
||||||
else:
|
else:
|
||||||
lpfBW = options.sample_rate*750
|
lpfBW = options.sample_rate * 750
|
||||||
|
|
||||||
if options.device_hwid == "Airspy":
|
if options.device_hwid == "Airspy":
|
||||||
settings['airspySettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
settings['airspySettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
||||||
settings["airspySettings"]["centerFrequency"] = options.device_freq*1000
|
settings["airspySettings"]["centerFrequency"] = options.device_freq * 1000
|
||||||
settings["airspySettings"]["devSampleRateIndex"] = 1
|
settings["airspySettings"]["devSampleRateIndex"] = 1
|
||||||
settings['airspySettings']['log2Decim'] = options.log2_decim
|
settings['airspySettings']['log2Decim'] = options.log2_decim
|
||||||
settings['airspySettings']['fcPos'] = options.fc_pos
|
settings['airspySettings']['fcPos'] = options.fc_pos
|
||||||
@ -162,16 +168,16 @@ def setupDevice(deviceset_url, options):
|
|||||||
settings["airspyHFSettings"]["bandIndex"] = 1
|
settings["airspyHFSettings"]["bandIndex"] = 1
|
||||||
else:
|
else:
|
||||||
settings["airspyHFSettings"]["bandIndex"] = 0
|
settings["airspyHFSettings"]["bandIndex"] = 0
|
||||||
settings["airspyHFSettings"]["centerFrequency"] = options.device_freq*1000
|
settings["airspyHFSettings"]["centerFrequency"] = options.device_freq * 1000
|
||||||
settings["airspyHFSettings"]["devSampleRateIndex"] = 0
|
settings["airspyHFSettings"]["devSampleRateIndex"] = 0
|
||||||
settings['airspyHFSettings']['log2Decim'] = options.log2_decim
|
settings['airspyHFSettings']['log2Decim'] = options.log2_decim
|
||||||
settings['airspyHFSettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
settings['airspyHFSettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
||||||
elif options.device_hwid == "LimeSDR":
|
elif options.device_hwid == "LimeSDR":
|
||||||
settings["limeSdrInputSettings"]["antennaPath"] = options.antenna_path
|
settings["limeSdrInputSettings"]["antennaPath"] = options.antenna_path
|
||||||
settings["limeSdrInputSettings"]["devSampleRate"] = options.sample_rate*1000
|
settings["limeSdrInputSettings"]["devSampleRate"] = options.sample_rate * 1000
|
||||||
settings["limeSdrInputSettings"]["log2HardDecim"] = 4
|
settings["limeSdrInputSettings"]["log2HardDecim"] = 4
|
||||||
settings["limeSdrInputSettings"]["log2SoftDecim"] = options.log2_decim
|
settings["limeSdrInputSettings"]["log2SoftDecim"] = options.log2_decim
|
||||||
settings["limeSdrInputSettings"]["centerFrequency"] = options.device_freq*1000 + 500000
|
settings["limeSdrInputSettings"]["centerFrequency"] = options.device_freq * 1000 + 500000
|
||||||
settings["limeSdrInputSettings"]["ncoEnable"] = 1
|
settings["limeSdrInputSettings"]["ncoEnable"] = 1
|
||||||
settings["limeSdrInputSettings"]["ncoFrequency"] = -500000
|
settings["limeSdrInputSettings"]["ncoFrequency"] = -500000
|
||||||
settings["limeSdrInputSettings"]["lpfBW"] = lpfBW
|
settings["limeSdrInputSettings"]["lpfBW"] = lpfBW
|
||||||
@ -180,10 +186,10 @@ def setupDevice(deviceset_url, options):
|
|||||||
settings['limeSdrInputSettings']['dcBlock'] = 1
|
settings['limeSdrInputSettings']['dcBlock'] = 1
|
||||||
elif options.device_hwid == "PlutoSDR":
|
elif options.device_hwid == "PlutoSDR":
|
||||||
settings["plutoSdrInputSettings"]["antennaPath"] = options.antenna_path
|
settings["plutoSdrInputSettings"]["antennaPath"] = options.antenna_path
|
||||||
settings["plutoSdrInputSettings"]["devSampleRate"] = options.sample_rate*1000
|
settings["plutoSdrInputSettings"]["devSampleRate"] = options.sample_rate * 1000
|
||||||
settings["plutoSdrInputSettings"]["lpfFIRlog2Decim"] = 1
|
settings["plutoSdrInputSettings"]["lpfFIRlog2Decim"] = 1
|
||||||
settings["plutoSdrInputSettings"]["log2Decim"] = options.log2_decim
|
settings["plutoSdrInputSettings"]["log2Decim"] = options.log2_decim
|
||||||
settings["plutoSdrInputSettings"]["centerFrequency"] = options.device_freq*1000
|
settings["plutoSdrInputSettings"]["centerFrequency"] = options.device_freq * 1000
|
||||||
settings["plutoSdrInputSettings"]["lpfBW"] = lpfBW
|
settings["plutoSdrInputSettings"]["lpfBW"] = lpfBW
|
||||||
settings["plutoSdrInputSettings"]["lpfFIRBW"] = lpFIRBW
|
settings["plutoSdrInputSettings"]["lpfFIRBW"] = lpFIRBW
|
||||||
settings["plutoSdrInputSettings"]["lpfFIREnable"] = 1
|
settings["plutoSdrInputSettings"]["lpfFIREnable"] = 1
|
||||||
@ -192,8 +198,8 @@ def setupDevice(deviceset_url, options):
|
|||||||
settings['plutoSdrInputSettings']['iqImbalance'] = options.fc_pos == 2
|
settings['plutoSdrInputSettings']['iqImbalance'] = options.fc_pos == 2
|
||||||
settings['plutoSdrInputSettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
settings['plutoSdrInputSettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
||||||
elif options.device_hwid == "RTLSDR":
|
elif options.device_hwid == "RTLSDR":
|
||||||
settings['rtlSdrSettings']['devSampleRate'] = options.sample_rate*1000
|
settings['rtlSdrSettings']['devSampleRate'] = options.sample_rate * 1000
|
||||||
settings['rtlSdrSettings']['centerFrequency'] = options.device_freq*1000
|
settings['rtlSdrSettings']['centerFrequency'] = options.device_freq * 1000
|
||||||
settings['rtlSdrSettings']['gain'] = 496
|
settings['rtlSdrSettings']['gain'] = 496
|
||||||
settings['rtlSdrSettings']['log2Decim'] = options.log2_decim
|
settings['rtlSdrSettings']['log2Decim'] = options.log2_decim
|
||||||
settings['rtlSdrSettings']['fcPos'] = options.fc_pos
|
settings['rtlSdrSettings']['fcPos'] = options.fc_pos
|
||||||
@ -201,20 +207,22 @@ def setupDevice(deviceset_url, options):
|
|||||||
settings['rtlSdrSettings']['iqImbalance'] = options.fc_pos == 2
|
settings['rtlSdrSettings']['iqImbalance'] = options.fc_pos == 2
|
||||||
settings['rtlSdrSettings']['agc'] = 1
|
settings['rtlSdrSettings']['agc'] = 1
|
||||||
settings['rtlSdrSettings']['loPpmCorrection'] = int(options.lo_ppm)
|
settings['rtlSdrSettings']['loPpmCorrection'] = int(options.lo_ppm)
|
||||||
|
if options.device_rfbw:
|
||||||
|
settings['rtlSdrSettings']['rfBandwidth'] = options.device_rfbw * 1000
|
||||||
elif options.device_hwid == "HackRF":
|
elif options.device_hwid == "HackRF":
|
||||||
settings['hackRFInputSettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
settings['hackRFInputSettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
||||||
settings['hackRFInputSettings']['centerFrequency'] = options.device_freq*1000
|
settings['hackRFInputSettings']['centerFrequency'] = options.device_freq * 1000
|
||||||
settings['hackRFInputSettings']['fcPos'] = options.fc_pos
|
settings['hackRFInputSettings']['fcPos'] = options.fc_pos
|
||||||
settings['hackRFInputSettings']['dcBlock'] = options.fc_pos == 2
|
settings['hackRFInputSettings']['dcBlock'] = options.fc_pos == 2
|
||||||
settings['hackRFInputSettings']['iqImbalance'] = options.fc_pos == 2
|
settings['hackRFInputSettings']['iqImbalance'] = options.fc_pos == 2
|
||||||
settings['hackRFInputSettings']['devSampleRate'] = options.sample_rate*1000
|
settings['hackRFInputSettings']['devSampleRate'] = options.sample_rate * 1000
|
||||||
settings['hackRFInputSettings']['lnaExt'] = 1
|
settings['hackRFInputSettings']['lnaExt'] = 1
|
||||||
settings['hackRFInputSettings']['lnaGain'] = 32
|
settings['hackRFInputSettings']['lnaGain'] = 32
|
||||||
settings['hackRFInputSettings']['log2Decim'] = options.log2_decim
|
settings['hackRFInputSettings']['log2Decim'] = options.log2_decim
|
||||||
settings['hackRFInputSettings']['vgaGain'] = 24
|
settings['hackRFInputSettings']['vgaGain'] = 24
|
||||||
elif options.device_hwid == "Perseus":
|
elif options.device_hwid == "Perseus":
|
||||||
settings['perseusSettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
settings['perseusSettings']['LOppmTenths'] = int(options.lo_ppm * 10) # in tenths of PPM
|
||||||
settings['perseusSettings']['centerFrequency'] = options.device_freq*1000
|
settings['perseusSettings']['centerFrequency'] = options.device_freq * 1000
|
||||||
settings["perseusSettings"]["devSampleRateIndex"] = 0
|
settings["perseusSettings"]["devSampleRateIndex"] = 0
|
||||||
settings['perseusSettings']['log2Decim'] = options.log2_decim
|
settings['perseusSettings']['log2Decim'] = options.log2_decim
|
||||||
settings['perseusSettings']['adcDither'] = 0
|
settings['perseusSettings']['adcDither'] = 0
|
||||||
@ -226,6 +234,7 @@ def setupDevice(deviceset_url, options):
|
|||||||
if r is None:
|
if r is None:
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
def setupChannel(deviceset_url, options):
|
def setupChannel(deviceset_url, options):
|
||||||
i = 0
|
i = 0
|
||||||
@ -243,15 +252,15 @@ def setupChannel(deviceset_url, options):
|
|||||||
settings["NFMDemodSettings"]["afBandwidth"] = options.af_bw * 1000
|
settings["NFMDemodSettings"]["afBandwidth"] = options.af_bw * 1000
|
||||||
settings["NFMDemodSettings"]["rfBandwidth"] = options.rf_bw
|
settings["NFMDemodSettings"]["rfBandwidth"] = options.rf_bw
|
||||||
settings["NFMDemodSettings"]["volume"] = options.volume
|
settings["NFMDemodSettings"]["volume"] = options.volume
|
||||||
settings["NFMDemodSettings"]["squelch"] = options.squelch_db * 10 # centi-Bels
|
settings["NFMDemodSettings"]["squelch"] = options.squelch_db * 10 # centi-Bels
|
||||||
settings["NFMDemodSettings"]["squelchGate"] = options.squelch_gate / 10 # 10's of ms
|
settings["NFMDemodSettings"]["squelchGate"] = options.squelch_gate / 10 # 10's of ms
|
||||||
settings["NFMDemodSettings"]["title"] = "Channel %d" % i
|
settings["NFMDemodSettings"]["title"] = "Channel %d" % i
|
||||||
elif options.channel_id == "BFMDemod":
|
elif options.channel_id == "BFMDemod":
|
||||||
settings["BFMDemodSettings"]["inputFrequencyOffset"] = options.channel_freq
|
settings["BFMDemodSettings"]["inputFrequencyOffset"] = options.channel_freq
|
||||||
settings["BFMDemodSettings"]["afBandwidth"] = options.af_bw * 1000
|
settings["BFMDemodSettings"]["afBandwidth"] = options.af_bw * 1000
|
||||||
settings["BFMDemodSettings"]["rfBandwidth"] = options.rf_bw
|
settings["BFMDemodSettings"]["rfBandwidth"] = options.rf_bw
|
||||||
settings["BFMDemodSettings"]["volume"] = options.volume
|
settings["BFMDemodSettings"]["volume"] = options.volume
|
||||||
settings["BFMDemodSettings"]["squelch"] = options.squelch_db # dB
|
settings["BFMDemodSettings"]["squelch"] = options.squelch_db # dB
|
||||||
settings["BFMDemodSettings"]["audioStereo"] = 1 if options.stereo else 0
|
settings["BFMDemodSettings"]["audioStereo"] = 1 if options.stereo else 0
|
||||||
settings["BFMDemodSettings"]["lsbStereo"] = 1 if options.lsb_stereo else 0
|
settings["BFMDemodSettings"]["lsbStereo"] = 1 if options.lsb_stereo else 0
|
||||||
settings["BFMDemodSettings"]["rdsActive"] = 1 if options.rds else 0
|
settings["BFMDemodSettings"]["rdsActive"] = 1 if options.rds else 0
|
||||||
@ -261,7 +270,7 @@ def setupChannel(deviceset_url, options):
|
|||||||
settings["WFMDemodSettings"]["afBandwidth"] = options.af_bw * 1000
|
settings["WFMDemodSettings"]["afBandwidth"] = options.af_bw * 1000
|
||||||
settings["WFMDemodSettings"]["rfBandwidth"] = options.rf_bw
|
settings["WFMDemodSettings"]["rfBandwidth"] = options.rf_bw
|
||||||
settings["WFMDemodSettings"]["volume"] = options.volume
|
settings["WFMDemodSettings"]["volume"] = options.volume
|
||||||
settings["WFMDemodSettings"]["squelch"] = options.squelch_db # dB
|
settings["WFMDemodSettings"]["squelch"] = options.squelch_db # dB
|
||||||
settings["WFMDemodSettings"]["audioMute"] = 0
|
settings["WFMDemodSettings"]["audioMute"] = 0
|
||||||
settings["WFMDemodSettings"]["title"] = "Channel %d" % i
|
settings["WFMDemodSettings"]["title"] = "Channel %d" % i
|
||||||
elif options.channel_id == "AMDemod":
|
elif options.channel_id == "AMDemod":
|
||||||
@ -270,7 +279,7 @@ def setupChannel(deviceset_url, options):
|
|||||||
settings["AMDemodSettings"]["volume"] = options.volume
|
settings["AMDemodSettings"]["volume"] = options.volume
|
||||||
settings["AMDemodSettings"]["squelch"] = options.squelch_db
|
settings["AMDemodSettings"]["squelch"] = options.squelch_db
|
||||||
settings["AMDemodSettings"]["title"] = "Channel %d" % i
|
settings["AMDemodSettings"]["title"] = "Channel %d" % i
|
||||||
settings["AMDemodSettings"]["bandpassEnable"] = 1 # bandpass filter
|
settings["AMDemodSettings"]["bandpassEnable"] = 1 # bandpass filter
|
||||||
elif options.channel_id == "SSBDemod":
|
elif options.channel_id == "SSBDemod":
|
||||||
settings["SSBDemodSettings"]["inputFrequencyOffset"] = options.channel_freq
|
settings["SSBDemodSettings"]["inputFrequencyOffset"] = options.channel_freq
|
||||||
settings["SSBDemodSettings"]["rfBandwidth"] = options.rf_bw
|
settings["SSBDemodSettings"]["rfBandwidth"] = options.rf_bw
|
||||||
@ -318,6 +327,7 @@ def setupChannel(deviceset_url, options):
|
|||||||
if r is None:
|
if r is None:
|
||||||
exit(-1)
|
exit(-1)
|
||||||
|
|
||||||
|
|
||||||
# ======================================================================
|
# ======================================================================
|
||||||
def channelsReport(deviceset_url):
|
def channelsReport(deviceset_url):
|
||||||
report = callAPI(deviceset_url + "/channels/report", "GET", None, None, "Get channels report")
|
report = callAPI(deviceset_url + "/channels/report", "GET", None, None, "Get channels report")
|
||||||
|
Loading…
Reference in New Issue
Block a user