Пример #1
0
 def close(self):
     BaseHardware.close(self)
     if self.serial:
         self.serial.write('EX\r')
         time.sleep(1)  # wait for output to drain, but don't block
         self.serial.close()
         self.serial = None
Пример #2
0
 def close(self):
   print "***close called"    
   BaseHardware.close(self)
   if self.serial:
     self.serial.write('AL~SDROF\r')
     time.sleep(1)            # wait for output to drain, but don't block
     self.serial.close()
     self.serial = None
Пример #3
0
 def close(self):
     self.hamlib_socket.close()
     self.hamlib_connected = False
     return BaseHardware.close(self)
Пример #4
0
class Hardware(BaseHardware):
  def __init__(self, app, conf):
    BaseHardware.__init__(self, app, conf)
    global UseSdriq, UseRxudp, Application, Config
    Application = app
    Config = conf
    UseSdriq = conf.use_sdriq
    UseRxudp = conf.use_rx_udp
    self.use_sidetone = 1
    self.vfo_frequency = 0		# current vfo frequency
    # Select receiver
    if conf.use_rx_udp:
      from n2adr import hardware_transceiver
      self.receiver = hardware_transceiver.Hardware(app, conf)
      self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10')
    elif UseSdriq:
      from sdriqpkg import quisk_hardware as quisk_hardware_sdriq
      self.receiver = quisk_hardware_sdriq.Hardware(app, conf)
      self.rf_gain_labels = self.receiver.rf_gain_labels
    else:
      self.receiver = HwRxEthVfo()
      self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10')
    # Select transmitter
    if conf.use_rx_udp:
      self.transmitter = self.receiver		# this is a transceiver
    elif Config.tx_ip:
      self.transmitter =  HwTx2007()
    else:
      self.transmitter =  BaseHardware(app, conf)
    # Other hardware
    self.anttuner = AntennaTuner()	# Control the antenna tuner
    self.lpfilter = LowPassFilter()		# Control LP filter box
    self.hpfilter = HighPassFilter()	# Control HP filter box
    #self.antenna = AntennaControl(self.AntCtrlAddress)		# Control antenna
  def open(self):
    if self.transmitter is not self.receiver:
      self.transmitter.open()
    self.anttuner.open()
    return self.receiver.open()
  def close(self):
    if self.transmitter is not self.receiver:
      self.transmitter.close()
    self.anttuner.close()
    self.receiver.close()
  def ReturnFrequency(self):	# Return the current tuning and VFO frequency
    return None, None		# frequencies have not changed
  def ChangeFilterFrequency(self, tx_freq):
    # Change the filters but not the receiver; used for panadapter
    if tx_freq and tx_freq > 0:
      self.anttuner.SetTxFreq(tx_freq)
      self.lpfilter.SetTxFreq(tx_freq)
      self.hpfilter.SetTxFreq(tx_freq)
      #self.antenna.SetTxFreq(tx_freq)
  def ChangeFrequency(self, tx_freq, vfo_freq, source='', band='', event=None):
    self.receiver.ChangeFrequency(tx_freq, vfo_freq, source, band, event)
    if self.transmitter is not self.receiver:
      self.transmitter.ChangeFrequency(tx_freq, vfo_freq, source, band, event)
    if tx_freq and tx_freq > 0:
      self.anttuner.SetTxFreq(tx_freq)
      self.lpfilter.SetTxFreq(tx_freq)
      self.hpfilter.SetTxFreq(tx_freq)
      #self.antenna.SetTxFreq(tx_freq)
    return tx_freq, vfo_freq
  def ChangeMode(self, mode):
    # mode is a string: "USB", "AM", etc.
    #if mode[0:3] == 'IMD':
    #  QS.set_fdx(1)
    #else:
    #  QS.set_fdx(0)
    self.receiver.ChangeMode(mode)
    self.transmitter.ChangeMode(mode)
  def ChangeBand(self, band):
    # band is a string: "60", "40", "WWV", etc.
    self.receiver.ChangeBand(band)
    self.transmitter.ChangeBand(band)
    self.anttuner.ChangeBand(band)
    self.lpfilter.ChangeBand(band)
    self.hpfilter.ChangeBand(band)
    #self.antenna.ChangeBand(band)
  def HeartBeat(self):	# Called at about 10 Hz by the main
    self.receiver.HeartBeat()
    if self.transmitter != self.receiver:
      self.transmitter.HeartBeat()
    self.anttuner.HeartBeat()
    self.lpfilter.HeartBeat()
    self.hpfilter.HeartBeat()
    #self.antenna.HeartBeat()
  def OnSpot(self, mode):
    self.anttuner.OnSpot(mode)
    self.transmitter.OnSpot(mode)
  def OnButtonRfGain(self, event):
    if UseSdriq:
      self.receiver.OnButtonRfGain(event)
    else:
      if self.hpfilter:
        self.hpfilter.OnButtonRfGain(event)
  def GetFirmwareVersion(self):
    if UseRxudp:
      return self.receiver.firmware_version
    return 0
  def VarDecimGetChoices(self):
    return self.receiver.VarDecimGetChoices()
  def VarDecimGetLabel(self):
    return self.receiver.VarDecimGetLabel()
  def VarDecimGetIndex(self):
    return self.receiver.VarDecimGetIndex()
  def VarDecimSet(self, index=None):
    return self.receiver.VarDecimSet(index)
 def close(self):
   self.hamlib_socket.close()
   self.hamlib_connected = False
   return BaseHardware.close(self)
Пример #6
0
class Hardware(BaseHardware):
    def __init__(self, app, conf):
        BaseHardware.__init__(self, app, conf)
        global UseSdriq, UseRxudp, Application, Config
        Application = app
        Config = conf
        UseSdriq = conf.use_sdriq
        UseRxudp = conf.use_rx_udp
        self.use_sidetone = 1
        self.vfo_frequency = 0  # current vfo frequency
        # Select receiver
        if conf.use_rx_udp:
            from hiqsdr import quisk_hardware as hw
            self.receiver = hw.Hardware(app, conf)
            self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10')
        elif UseSdriq:
            from sdriqpkg import quisk_hardware as quisk_hardware_sdriq
            self.receiver = quisk_hardware_sdriq.Hardware(app, conf)
            self.rf_gain_labels = self.receiver.rf_gain_labels
        else:
            self.receiver = HwRxEthVfo()
            self.rf_gain_labels = ('RF 0 dB', 'RF +16', 'RF -20', 'RF -10')
        # Select transmitter
        if conf.use_rx_udp:
            self.transmitter = self.receiver  # this is a transceiver
        elif Config.tx_ip:
            self.transmitter = HwTx2007()
        else:
            self.transmitter = BaseHardware(app, conf)
        # Other hardware
        self.anttuner = AntennaTuner()  # Control the antenna tuner
        self.lpfilter = LowPassFilter()  # Control LP filter box
        self.hpfilter = HighPassFilter()  # Control HP filter box
        #self.antenna = AntennaControl(self.AntCtrlAddress)		# Control antenna
    def open(self):
        if self.transmitter is not self.receiver:
            self.transmitter.open()
        self.anttuner.open()
        return self.receiver.open()

    def close(self):
        if self.transmitter is not self.receiver:
            self.transmitter.close()
        self.anttuner.close()
        self.receiver.close()

    def ReturnFrequency(self):  # Return the current tuning and VFO frequency
        return None, None  # frequencies have not changed

    def ChangeFilterFrequency(self, tx_freq):
        # Change the filters but not the receiver; used for panadapter
        if tx_freq and tx_freq > 0:
            self.anttuner.SetTxFreq(tx_freq)
            self.lpfilter.SetTxFreq(tx_freq)
            self.hpfilter.SetTxFreq(tx_freq)
            #self.antenna.SetTxFreq(tx_freq)
    def ChangeFrequency(self,
                        tx_freq,
                        vfo_freq,
                        source='',
                        band='',
                        event=None):
        self.receiver.ChangeFrequency(tx_freq, vfo_freq, source, band, event)
        if self.transmitter is not self.receiver:
            self.transmitter.ChangeFrequency(tx_freq, vfo_freq, source, band,
                                             event)
        if tx_freq and tx_freq > 0:
            self.anttuner.SetTxFreq(tx_freq)
            self.lpfilter.SetTxFreq(tx_freq)
            self.hpfilter.SetTxFreq(tx_freq)
            #self.antenna.SetTxFreq(tx_freq)
        return tx_freq, vfo_freq

    def ChangeMode(self, mode):
        # mode is a string: "USB", "AM", etc.
        #if mode[0:3] == 'IMD':
        #  QS.set_fdx(1)
        #else:
        #  QS.set_fdx(0)
        self.receiver.ChangeMode(mode)
        self.transmitter.ChangeMode(mode)

    def ChangeBand(self, band):
        # band is a string: "60", "40", "WWV", etc.
        self.receiver.ChangeBand(band)
        self.transmitter.ChangeBand(band)
        self.anttuner.ChangeBand(band)
        self.lpfilter.ChangeBand(band)
        self.hpfilter.ChangeBand(band)
        #self.antenna.ChangeBand(band)
        if band == '40':
            self.correct_smeter = 20.5
        else:
            self.correct_smeter = 20.5

    def HeartBeat(self):  # Called at about 10 Hz by the main
        self.receiver.HeartBeat()
        if self.transmitter != self.receiver:
            self.transmitter.HeartBeat()
        self.anttuner.HeartBeat()
        self.lpfilter.HeartBeat()
        self.hpfilter.HeartBeat()
        #self.antenna.HeartBeat()
    def OnSpot(self, level):
        self.anttuner.OnSpot(level)
        if hasattr(self.transmitter, 'OnSpot'):
            self.transmitter.OnSpot(level)

    def OnButtonRfGain(self, event):
        if UseSdriq:
            self.receiver.OnButtonRfGain(event)
        else:
            if self.hpfilter:
                self.hpfilter.OnButtonRfGain(event)

    def GetFirmwareVersion(self):
        if UseRxudp:
            return self.receiver.firmware_version
        return 0

    def VarDecimGetChoices(self):
        return self.receiver.VarDecimGetChoices()

    def VarDecimGetLabel(self):
        return self.receiver.VarDecimGetLabel()

    def VarDecimGetIndex(self):
        return self.receiver.VarDecimGetIndex()

    def VarDecimSet(self, index=None):
        return self.receiver.VarDecimSet(index)

    def SetVNA(self, key_down=None, freq=None):
        if hasattr(self.transmitter, 'SetVNA'):
            self.transmitter.SetVNA(key_down, freq)
Пример #7
0
 def close(self):
     BaseHardware.close(self)
     self.fcd.close()