Skip to content

Commit 3c767fe

Browse files
author
Brandon Smith
committed
Updaing for 9-10-20
1 parent 29b32df commit 3c767fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+2707
-588
lines changed

cyberradiodriver/CyberRadioDriver.doxyfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ PROJECT_NAME = CyberRadioDriver
3232
# This could be handy for archiving the generated documentation or
3333
# if some version control system is used.
3434

35-
PROJECT_NUMBER = 20.02.14
35+
PROJECT_NUMBER = 20.09.04a
3636

3737
# Using the PROJECT_BRIEF tag one can provide an optional one line description
3838
# for a project that appears at the top of each page and should give viewer

cyberradiodriver/CyberRadioDriver/__init__.py

+86-21
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
# \author NH
2424
# \author DA
2525
# \author MN
26-
# \copyright Copyright (c) 2017 CyberRadio Solutions, Inc. All
27-
# rights reserved.
26+
# \copyright Copyright (c) 2017-2020 CyberRadio Solutions, Inc.
27+
# All rights reserved.
2828
#
2929
###############################################################
3030

@@ -56,7 +56,7 @@
5656
# <table>
5757
# <tr><th>Radio</th><th>Name String</th></tr>
5858
# <tr><td>\link CyberRadioDriver::radios::ndr301::ndr301 NDR301 \endlink</td><td>"ndr301"</td></tr>
59-
# <tr><td>\link CyberRadioDriver::radios::ndr301ptt::ndr301_ptt NDR301PTT \endlink</td><td>"ndr301ptt"</td></tr>
59+
# <tr><td>\link CyberRadioDriver::radios::ndr301ptt::ndr301_ptt NDR301PTT \endlink</td><td>"ndr301-ptt"</td></tr>
6060
# <tr><td>\link CyberRadioDriver::radios::internal::ndr303::ndr303 NDR303 \endlink</td><td>"ndr303"</td></tr>
6161
# <tr><td>\link CyberRadioDriver::radios::ndr304::ndr304 NDR304 \endlink</td><td>"ndr304"</td></tr>
6262
# <tr><td>\link CyberRadioDriver::radios::ndr308::ndr308_1 NDR308-1 \endlink</td><td>"ndr308_1"</td></tr>
@@ -108,7 +108,7 @@
108108
description = "CyberRadio Solutions NDR Driver"
109109
##
110110
# \brief Driver version number (string).
111-
version = "20.02.14e"
111+
version = "20.09.04a"
112112

113113
# # This section of code inspects the "radio" module for radio handler
114114
# # objects (objects derived from _radio, thus implementing the IRadio interface)
@@ -252,13 +252,19 @@ def getRadioClass(nameString):
252252
# \brief Factory method for obtaining a radio handler object from the name
253253
# of the radio.
254254
#
255-
# The name string used to identify the radio can be any string returned
256-
# by getSupportedRadios(), but the check is not case-sensitive. The name
257-
# string can also be "auto", in which case the method will attempt to
258-
# auto-detect the type of radio connected to the system. Since radios can
259-
# operate over both TCP and TTY (serial) links, the user needs to supply
260-
# keyword arguments to indicate which devices to scan ("host" to scan over TCP,
261-
# and/or "dev" to scan over TTY -- see below).
255+
# The name string used to identify the radio can be:
256+
# * Any string returned by getSupportedRadios() (but the check is not case-
257+
# sensitive).
258+
# * "auto", in which case the method will attempt to auto-detect the type of
259+
# radio connected to the system. Since radios can operate over both
260+
# Ethernet and TTY (serial) links, the user needs to supply keyword
261+
# arguments to indicate which devices to scan ("host" to scan over
262+
# Ethernet and/or "dev" to scan over TTY -- see below).
263+
# * "server" or "crdd", in which case the method attempts to connect to the
264+
# radio via the CyberRadio Driver Daemon (crdd). Supply the "host" and/or
265+
# "port" arguments if CRDD is not running at the default location (local
266+
# host, port 65432). Also, supply the "clientId" argument if you want
267+
# crdd to log transactions for this client specially.
262268
#
263269
# This method uses keyword arguments to configure the returned radio handler
264270
# object. It consumes the following keyword arguments:
@@ -278,6 +284,8 @@ def getRadioClass(nameString):
278284
# on this device if requested, and automatically connect to it.
279285
# <li> "baudrate": For TTY-connected radios, this is the baud rate for the serial
280286
# connection. If not provided, this defaults to the standard (921600).
287+
# <li> "clientId": For connections through crdd, this provides an identifier
288+
# that crdd can use to identify this client for logging purposes.
281289
# </ul>
282290
# If the "host" and "dev" keyword arguments are both provided, then the auto-
283291
# detection algorithm will try a TCP connection first before falling back to a
@@ -354,10 +362,17 @@ def getRadioObject(nameString, *args, **kwargs):
354362
radioType = radioType.replace("ts", "_ts")
355363
radioType = radioType.replace("-", "_")
356364
radioType = radioType.replace("__", "_")
365+
# NDR804-PTT weirdness: the model name has a space in it -- DA
366+
if radioType == "ndr804 ptt":
367+
radioType = "ndr804-ptt"
368+
# NDR301-PTT weirdness: sometimes the model name does not have the dash
369+
# in it -- DA
370+
if radioType == "ndr301ptt":
371+
radioType = "ndr301-ptt"
357372
# NDR358 weirdness: the NDR358 Recorder mode variant can self-identify
358373
# as "NDR358-5", per NH -- DA
359374
if radioType == "ndr358_5":
360-
radioType = "ndr358_recorder"
375+
radioType = "ndr358_recorder"
361376
# For NDR358 models, read the radio function to identify we should use
362377
# a handler for a specific variant. Note that we don't have handlers
363378
# for all potential variants yet. -- DA
@@ -375,6 +390,7 @@ def getRadioObject(nameString, *args, **kwargs):
375390
if radioType != "":
376391
break
377392
if radioType != "":
393+
kwargs["clientId"] = None
378394
obj = getRadioClass(radioType)(*args, **kwargs)
379395
if connMode in ["tcp", "udp", "https"]:
380396
obj.connect(connMode, kwargs.get("host"), kwargs.get("port", None))
@@ -383,22 +399,23 @@ def getRadioObject(nameString, *args, **kwargs):
383399
return obj
384400
else:
385401
raise RuntimeError("Radio not found")
386-
elif nameString == "server":
402+
elif nameString == "server" or nameString == "crdd":
387403
connMode = "tcp"
388404
host = kwargs.get("host", "localhost")
389-
port = kwargs.get("port", 31415)
405+
port = kwargs.get("port", 65432)
390406
radioType = ""
391407
# Use a temporary radio identifier class to determine what kind of radio the
392408
# server is managing
393409
tmpHandler = None
394-
# -- Try the non-JSON radio identifier first, since the handshake is just a
410+
# -- Try the non-JSON radio identifier first, since the handshake is just a
395411
# line feed. If that doesn't work, then try the JSON identifier.
396412
for radioIdentifierCls in [radio._radio_identifier, radio._radio_identifier_json]:
397-
tmpHandler = radioIdentifierCls(verbose=False,
398-
logFile=None,
413+
tmpHandler = radioIdentifierCls(verbose=False,
414+
logFile=None,
399415
timeout=kwargs.get("timeout", None))
400416
tmpHandler.connect(connMode, host, port)
401-
if tmpHandler.isConnected() or any(["Radio is not connected" in q for q in tmpHandler.connectError]):
417+
#if tmpHandler.isConnected() or any(["Radio is not connected" in q for q in tmpHandler.connectError]):
418+
if tmpHandler.isConnected():
402419
break
403420
# If the radio identifier connected, then identify the radio managed by the server
404421
# and establish a radio-specific handler.
@@ -410,13 +427,39 @@ def getRadioObject(nameString, *args, **kwargs):
410427
radioType = radioType.replace("ts", "_ts")
411428
radioType = radioType.replace("-", "_")
412429
radioType = radioType.replace("__", "_")
430+
# NDR804-PTT weirdness: the model name has a space in it -- DA
431+
if radioType == "ndr804 ptt":
432+
radioType = "ndr804-ptt"
433+
# NDR301-PTT weirdness: sometimes the model name does not have the dash
434+
# in it -- DA
435+
if radioType == "ndr301ptt":
436+
radioType = "ndr301-ptt"
437+
# NDR358 weirdness: the NDR358 Recorder mode variant can self-identify
438+
# as "NDR358-5", per NH -- DA
439+
if radioType == "ndr358_5":
440+
radioType = "ndr358_recorder"
441+
# For NDR358 models, read the radio function to identify we should use
442+
# a handler for a specific variant. Note that we don't have handlers
443+
# for all potential variants yet. -- DA
444+
if radioType == "ndr358":
445+
radioFn = tmpHandler.getConfigurationByKeys(configKeys.RADIO_FUNCTION)
446+
# radioFn == 0 ==> Receiver mode
447+
# radioFn == 1 ==> Fast Scan mode
448+
if radioFn == 2:
449+
radioType = "ndr358_coherent"
450+
# radioFn == 3 ==> Resampler mode
451+
elif radioFn == 4:
452+
radioType = "ndr358_recorder"
453+
# radioFn == 5 ==> ALT_RX1 mode
413454
tmpHandler.disconnect()
414455
if radioType != "":
415456
obj = getRadioClass(radioType)(*args, **kwargs)
416-
# Make sure that the connection mode used for the server is in
457+
# Make sure that the connection mode used for the server is in
417458
# the allowed connection mode list for the radio handler
418459
if not obj.isConnectionModeSupported(connMode):
419460
obj.connectionModes.append(connMode)
461+
# Set crdd flag
462+
obj.isCrddConnection = True
420463
# Connect to the new handler
421464
obj.connect(connMode, host, port)
422465
return obj
@@ -426,6 +469,7 @@ def getRadioObject(nameString, *args, **kwargs):
426469
else:
427470
raise RuntimeError("Radio not found")
428471
else:
472+
kwargs["clientId"] = None
429473
obj = getRadioClass(nameString)(*args, **kwargs)
430474
if kwargs.get("host", None) and any(obj.isConnectionModeSupported(i) for i in ("https","tcp","udp")):
431475
hostname = kwargs["host"]
@@ -1069,9 +1113,13 @@ def getPps(self):
10691113
#
10701114
# \param checkTime Whether to verify that the time was set properly.
10711115
# \param useGpsTime Whether to use the GPS time rather than the system time.
1116+
# \param newPpsTime A specific UTC date/time to set the radio's clock to
1117+
# (string). This method supports several formats for the time string,
1118+
# including YYYY-MM-DD HH:MM:SS and ISO 8601. Set this to None if you
1119+
# want to use the current system/GPS time.
10721120
# \return True if successful, False if the radio does not support
10731121
# PPS edge detection and time setting or if the command was unsuccessful.
1074-
def setTimeNextPps(self,checkTime=False,useGpsTime=False):
1122+
def setTimeNextPps(self,checkTime=False,useGpsTime=False,newPpsTime=None):
10751123
raise NotImplementedError
10761124

10771125
##
@@ -1222,6 +1270,14 @@ def setGpioOutput(self, value):
12221270
def setGpioOutputByIndex(self, index, value, duration, loop, go):
12231271
raise NotImplementedError
12241272

1273+
##
1274+
# \brief Gets the current bandwith of the given tuner.
1275+
# \param tuner Tuner index number
1276+
# \returns The tuner bandwidth, in Hz
1277+
# \throws ValueError if the tuner does not exist on the radio
1278+
def getTunerBandwidth(self, tuner):
1279+
raise NotImplementedError
1280+
12251281
##
12261282
# \brief Gets the name of the radio.
12271283
#
@@ -1308,7 +1364,16 @@ def getTunerAttenuationRes(cls):
13081364
@classmethod
13091365
def getTunerIfFilterList(cls):
13101366
raise NotImplementedError
1311-
1367+
1368+
##
1369+
# \brief Gets whether or not the radio supports setting tuner
1370+
# bandwidth
1371+
#
1372+
# \return True if the bandwidth is settable, False otherwise
1373+
@classmethod
1374+
def isTunerBandwidthSettable(cls):
1375+
raise NotImplementedError
1376+
13121377
##
13131378
# \brief Gets the number of wideband DDCs on the radio.
13141379
#

cyberradiodriver/CyberRadioDriver/command.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@
1313
# \author NH
1414
# \author DA
1515
# \author MN
16-
# \copyright Copyright (c) 2017 CyberRadio Solutions, Inc.
17-
# All rights reserved.
16+
# \copyright Copyright (c) 2017-2020 CyberRadio Solutions, Inc.
17+
# All rights reserved.
1818
#
1919
###############################################################
2020

cyberradiodriver/CyberRadioDriver/components.py

+12-7
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
# \author NH
1616
# \author DA
1717
# \author MN
18-
# \copyright Copyright (c) 2017 CyberRadio Solutions, Inc.
19-
# All rights reserved.
18+
# \copyright Copyright (c) 2017-2020 CyberRadio Solutions, Inc.
19+
# All rights reserved.
2020
#
2121
###############################################################
2222

@@ -119,10 +119,13 @@ def __init__(self, *args, **kwargs):
119119
# CyberRadioDriver.transport.radio_transport).
120120
# \param callback A method that the component uses to send data over the
121121
# connected transport.
122-
def addTransport(self,transport,callback,):
122+
# \param queryConfig Whether or not to query the configuration
123+
# through hardware commands
124+
def addTransport(self,transport,callback,queryConfig=True):
123125
self.transport = transport
124126
self.callback = callback
125-
self.queryConfiguration()
127+
if queryConfig:
128+
self.queryConfiguration()
126129

127130
##
128131
# Deletes the communication transport from this component.
@@ -1066,10 +1069,12 @@ def __init__(self,*args,**kwargs):
10661069
# CyberRadioDriver.transport.radio_transport).
10671070
# \param callback A method that the component uses to send data over the
10681071
# connected transport.
1069-
def addTransport(self,transport,callback,):
1072+
# \param queryConfig Whether or not to query the configuration
1073+
# through hardware commands
1074+
def addTransport(self,transport,callback,queryConfig=True):
10701075
for i in self.toneGenDict:
1071-
self.toneGenDict[i].addTransport(transport, callback)
1072-
_base.addTransport(self, transport, callback)
1076+
self.toneGenDict[i].addTransport(transport, callback, queryConfig)
1077+
_base.addTransport(self, transport, callback, queryConfig)
10731078

10741079
# OVERRIDE
10751080
##

cyberradiodriver/CyberRadioDriver/configKeys.py

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# \author NH
99
# \author DA
1010
# \author MN
11-
# \copyright Copyright (c) 2017 CyberRadio Solutions, Inc.
12-
# All rights reserved.
11+
# \copyright Copyright (c) 2017-2020 CyberRadio Solutions, Inc.
12+
# All rights reserved.
1313
#
1414
###############################################################
1515

@@ -51,6 +51,8 @@
5151
REFERENCE_MODE = "referenceMode"
5252
## Noise State
5353
NOISE_STATE = "noiseState"
54+
## Noise generator selection
55+
NOISE_GENERATOR = "noiseGenerator"
5456
## Reference bypass mode.
5557
BYPASS_MODE = "bypassMode"
5658
## Frequency normalization mode.
@@ -157,6 +159,8 @@
157159
TUNER_IF = "if"
158160
## LO sync indicator
159161
TUNER_LO_SYNC = "loSync"
162+
## Tuner Band for NDR511
163+
TUNER_BAND = "band"
160164

161165
#------ Transmitter Configuration Keys --------------------------------#
162166
TX_INDEX = "txIndex"
@@ -602,6 +606,10 @@
602606
## Low RF LO
603607
STATUS_LOW_RF_LOCK = "lowrflo"
604608

609+
#-- Cntrl Keys ------------------------------------------------------#
610+
## ifOut
611+
CNTRL_IF_OUT = "ifout"
612+
605613

606614
#-- Reset Type Keys --------------------------------------------------#
607615
## Reset type.

cyberradiodriver/CyberRadioDriver/log.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
# \author NH
88
# \author DA
99
# \author MN
10-
# \copyright Copyright (c) 2017 CyberRadio Solutions, Inc.
11-
# All rights reserved.
10+
# \copyright Copyright (c) 2017-2020 CyberRadio Solutions, Inc.
11+
# All rights reserved.
1212
#
1313
###############################################################
1414

0 commit comments

Comments
 (0)