Beispiel #1
0
 def OnButtonPTT(self, event):
   btn = event.GetEventObject()
   if btn.GetValue():
     QS.set_PTT(1)
     QS.set_key_down(1)
   else:
     QS.set_PTT(0)
     QS.set_key_down(0)
Beispiel #2
0
 def OnButtonPTT(self, event):
   btn = event.GetEventObject()
   if btn.GetValue():		# Turn the software key bit on or off
     self.button_PTT = 1
   else:
     self.button_PTT = 0
   QS.set_key_down(self.button_PTT)
   self.NewUdpStatus()
Beispiel #3
0
 def OnPTT(self, ptt):
     if self.key_thread:
         self.key_thread.OnPTT(ptt)
     elif self.usb_dev:
         QS.set_key_down(ptt)
         try:
             self.usb_dev.ctrl_transfer(IN, 0x50, ptt, 0, 3)
         except usb.core.USBError:
             QS.set_key_down(0)
             if DEBUG: traceback.print_exc()
Beispiel #4
0
 def OnPTT(self, ptt):
   if self.key_thread:
     self.key_thread.OnPTT(ptt)
   elif self.usb_dev:
     QS.set_key_down(ptt)
     try:
       self.usb_dev.ctrl_transfer(IN, 0x50, ptt, 0, 3)
     except usb.core.USBError:
       QS.set_key_down(0)
       if DEBUG: traceback.print_exc()
    def OnButtonPTT(self, event=None):
        self.ptt_button=0
        if event:
            if event.GetEventObject().GetValue():
                self.ptt_button = 1
                if DEBUG: print('PTT pressed')
            else:
                if DEBUG: print('PTT released')
                self.ptt_button = 0

        self.receiver.set_ptt(Hamlib.RIG_VFO_CURR,self.ptt_button)
        QS.set_key_down(self.ptt_button)
Beispiel #6
0
 def OnButtonPTT(self, event=None):
   if event:
     if event.GetEventObject().GetValue():
        cmdstr='*x1\r'
        if DEBUG: print('PTT pressed')
     else:
        if DEBUG: print('PTT released')
        cmdstr='*x0\r'
     if serialport.isOpen():
         if DEBUG == 1:
             print("Setting ptt, pttstring:  ", cmdstr)
         serialport.write(cmdstr.encode())
     QS.set_key_down(event.GetEventObject().GetValue())
  def OnButtonPTT(self, event=None):
    if event:
      if event.GetEventObject().GetValue():
        self.ptt_button = 1
	message = "set ptt on"
      else:
        self.ptt_button = 0
	message = "set ptt off"
      #srsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      #srsock.settimeout(1)
      #srsock.sendto(message, (self.usbsr_ip_address, self.usbsr_port))
      #data, addr = srsock.recvfrom(1024) # buffer size is 1024 bytes
      #srsock.close()
      #print (data)
      #if data == "ok":
      QS.set_key_down(self.ptt_button)
Beispiel #8
0
 def run(self):
     while not self.doQuit.isSet():
         try:
             if self.ptt:
                 key_down = 1
             else:  # read key state
                 ret = self.usb_dev.ctrl_transfer(IN, 0x51, 0, 0, 1)
                 # bit 0x20 is the tip, bit 0x02 is the ring
                 if ret[0] & 0x20:  # Tip: key is up
                     key_down = 0
                 else:  # key is down
                     key_down = 1
             if key_down != self.key_down:
                 self.key_down = key_down
                 self.usb_dev.ctrl_transfer(IN, 0x50, key_down, 0, 3)
                 QS.set_key_down(key_down)
         except usb.core.USBError:
             QS.set_key_down(0)
             if DEBUG: traceback.print_exc()
         time.sleep(self.poll_secs)
Beispiel #9
0
  def OnButtonPTT(self, event=None):
    if event:
      if event.GetEventObject().GetValue():
        self.ptt_button = 1
	message = "set ptt on"
      else:
        self.ptt_button = 0
	message = "set ptt off"
      srsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
      srsock.settimeout(1)
      srsock.sendto(message, (self.usbsr_ip_address, self.usbsr_port))
      data, addr = srsock.recvfrom(1024) # buffer size is 1024 bytes
      srsock.close()
      print (data)
      if data == "ok":
        QS.set_key_down(self.ptt_button)
      else:
        print ('error doing', message)
        text = "error setting ptt on or off!"
        self.config_text = text
Beispiel #10
0
 def OnButtonPTT(self, event=None):
     if event:
         if event.GetEventObject().GetValue():
             self.ptt_button = 1
             message = "set ptt on"
         else:
             self.ptt_button = 0
             message = "set ptt off"
         srsock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
         srsock.settimeout(1)
         srsock.sendto(message, (self.usbsr_ip_address, self.usbsr_port))
         data, addr = srsock.recvfrom(1024)  # buffer size is 1024 bytes
         srsock.close()
         print(data)
         if data == "ok":
             QS.set_key_down(self.ptt_button)
         else:
             print('error doing', message)
             text = "error setting ptt on or off!"
             self.config_text = text
Beispiel #11
0
 def run(self):
   while not self.doQuit.isSet():
     try:
       if self.ptt:
         key_down = 1
       else:		# read key state
         ret = self.usb_dev.ctrl_transfer(IN, 0x51, 0, 0, 1)
         # bit 0x20 is the tip, bit 0x02 is the ring
         if ret[0] & 0x20:		# Tip: key is up
           key_down = 0
         else:			# key is down
           key_down = 1
       if key_down != self.key_down:
         self.key_down = key_down
         self.usb_dev.ctrl_transfer(IN, 0x50, key_down, 0, 3)
         QS.set_key_down(key_down)
     except usb.core.USBError:
       QS.set_key_down(0)
       if DEBUG: traceback.print_exc()
     time.sleep(self.poll_secs)
Beispiel #12
0
 def OnButtonPTT(self, event=None):
     if event:
         if event.GetEventObject().GetValue():
             self.ptt_button = 1
         else:
             self.ptt_button = 0
     if self.key_thread:
         self.key_thread.OnPTT(self.ptt_button)
     elif self.usb_dev:
         if self.is_cw:
             QS.set_key_down(0)
             QS.set_transmit_mode(self.ptt_button)
         else:
             QS.set_key_down(self.ptt_button)
         try:
             self.usb_dev.ctrl_transfer(IN, 0x50, self.ptt_button, 0, 3)
         except usb.core.USBError:
             if DEBUG: traceback.print_exc()
             try:
                 self.usb_dev.ctrl_transfer(IN, 0x50, self.ptt_button, 0, 3)
             except usb.core.USBError:
                 if DEBUG: traceback.print_exc()
 def OnButtonPTT(self, event=None):
   if event:
     if event.GetEventObject().GetValue():
       self.ptt_button = 1
     else:
       self.ptt_button = 0
   if self.key_thread:
     self.key_thread.OnPTT(self.ptt_button)
   elif self.usb_dev:
     if self.is_cw:
       QS.set_key_down(0)
       QS.set_transmit_mode(self.ptt_button)
     else:
       QS.set_key_down(self.ptt_button)
     try:
       self.usb_dev.ctrl_transfer(IN, 0x50, self.ptt_button, 0, 3)
     except usb.core.USBError:
       if DEBUG: traceback.print_exc()
       try:
         self.usb_dev.ctrl_transfer(IN, 0x50, self.ptt_button, 0, 3)
       except usb.core.USBError:
         if DEBUG: traceback.print_exc()
Beispiel #14
0
 def run(self):
     while not self.doQuit.isSet():
         try:  # Test key up/down state
             ret = self.usb_dev.ctrl_transfer(IN, 0x51, 0, 0, 1)
         except usb.core.USBError:
             key_down = None
             if DEBUG: traceback.print_exc()
         else:
             # bit 0x20 is the tip, bit 0x02 is the ring (ring not used)
             if ret[0] & 0x20 == 0:  # Tip: key is down
                 key_down = True
             else:  # key is up
                 key_down = False
         if self.is_cw:
             if self.spot_level >= 0 or key_down:  # key is down
                 QS.set_key_down(1)
                 self.key_transmit = 1
                 self.key_timer = time.time()
             else:  # key is up
                 QS.set_key_down(0)
                 if self.key_transmit and time.time(
                 ) - self.key_timer > self.key_hang_time:
                     self.key_transmit = 0
             if self.key_transmit != self.currently_in_tx:
                 try:
                     self.usb_dev.ctrl_transfer(IN, 0x50, self.key_transmit,
                                                0, 3)
                 except usb.core.USBError:
                     if DEBUG: traceback.print_exc()
                 else:
                     self.currently_in_tx = self.key_transmit  # success
                     QS.set_transmit_mode(self.key_transmit)
                     if DEBUG:
                         print("Change CW currently_in_tx",
                               self.currently_in_tx)
         else:
             if key_down or self.ptt_button:
                 self.key_transmit = 1
             else:
                 self.key_transmit = 0
             if self.key_transmit != self.currently_in_tx:
                 QS.set_key_down(self.key_transmit)
                 try:
                     self.usb_dev.ctrl_transfer(IN, 0x50, self.key_transmit,
                                                0, 3)
                 except usb.core.USBError:
                     if DEBUG: traceback.print_exc()
                 else:
                     self.currently_in_tx = self.key_transmit  # success
                     if DEBUG:
                         print("Change currently_in_tx",
                               self.currently_in_tx)
         time.sleep(self.poll_secs)
Beispiel #15
0
 def run(self):
   while not self.doQuit.isSet():
     try:		# Test key up/down state
       ret = self.usb_dev.ctrl_transfer(IN, 0x51, 0, 0, 1)
     except usb.core.USBError:
       key_down = None
       if DEBUG: traceback.print_exc()
     else:
       # bit 0x20 is the tip, bit 0x02 is the ring (ring not used)
       if ret[0] & 0x20 == 0:		# Tip: key is down
         key_down = True
       else:			# key is up
         key_down = False
     if self.is_cw:
       if self.spot_level >= 0 or key_down:		# key is down
         QS.set_key_down(1)
         self.key_transmit = 1
         self.key_timer = time.time()
       else:			# key is up
         QS.set_key_down(0)
         if self.key_transmit and time.time() - self.key_timer > self.key_hang_time:
           self.key_transmit = 0
       if self.key_transmit != self.currently_in_tx:
         try:
           self.usb_dev.ctrl_transfer(IN, 0x50, self.key_transmit, 0, 3)
         except usb.core.USBError:
           if DEBUG: traceback.print_exc()
         else:
           self.currently_in_tx = self.key_transmit	# success
           QS.set_transmit_mode(self.key_transmit)
           if DEBUG: print ("Change CW currently_in_tx", self.currently_in_tx)
     else:
       if key_down or self.ptt_button:
         self.key_transmit = 1
       else:
         self.key_transmit = 0
       if self.key_transmit != self.currently_in_tx:
         QS.set_key_down(self.key_transmit)
         try:
           self.usb_dev.ctrl_transfer(IN, 0x50, self.key_transmit, 0, 3)
         except usb.core.USBError:
           if DEBUG: traceback.print_exc()
         else:
           self.currently_in_tx = self.key_transmit	# success
           if DEBUG: print ("Change currently_in_tx", self.currently_in_tx)
     time.sleep(self.poll_secs)
Beispiel #16
0
    def run(self):
        while not self.doQuit.isSet():
            if DEBUG:
                if not self.text == "":
                    print("DeBug: self.text: %s" % self.text)
                    self.text = ""

            try:  # Test key up/down state
                #ret = self.usb_dev.ctrl_transfer(IN, 0x51, 0, 0, 1)
                if self.serial:  ##JMH 20190909 ADDED to support keying SSMicro via external key
                    chars = self.serial.read(1024)
                    if chars:
                        if (self.HrdwrTalk): print("SSMicro: %s" % chars)
                        if (chars[0:6] == "KEYDWN"):
                            self.key_down = True
                            self.stateChng = True
                            self.stateChng1 = True
                        if (chars[0:5] == "KEYUP"):
                            self.key_down = False
                            self.stateChng = True
                            self.stateChng1 = True

            except usb.core.USBError:
                if DEBUG: traceback.print_exc()
            if self.is_cw:
                if self.stateChng:
                    if self.spot_level >= 0 or self.key_down:  # key is down
                        QS.set_key_down(1)
                        self.key_transmit = 1
                        #self.key_timer = time.time()
                    else:  # key is up
                        QS.set_key_down(0)
##            if self.key_transmit and time.time() - self.key_timer > self.key_hang_time:
##              self.key_transmit = 0
                    self.stateChng = False
                if self.spot_level >= 0 or self.key_down:  # key is down
                    self.key_timer = time.time()
                else:
                    if self.key_transmit and time.time(
                    ) - self.key_timer > self.key_hang_time:
                        self.key_transmit = 0

                if self.key_transmit != self.currently_in_tx:
                    QS.set_transmit_mode(self.key_transmit)
                    #wx.CallAfter(self.application.OnButtonPTT(None))
                    #self.application.pttButton.SetValue(0, self.key_transmit)
                    #self.ptt_button = self.key_transmit
                    self.currently_in_tx = self.key_transmit  # success


##          try:
##            #self.usb_dev.ctrl_transfer(IN, 0x50, self.key_transmit, 0, 3)
##            print("key_transmit state %d" %self.key_transmit)
##          except usb.core.USBError:
##            if DEBUG: traceback.print_exc()
##          else:
##            self.currently_in_tx = self.key_transmit	# success
##            QS.set_transmit_mode(self.key_transmit)
##            if DEBUG: print ("Change CW currently_in_tx", self.currently_in_tx)
##      else:  #weare not in the CW mode
##        if self.key_down or self.ptt_button:
##          self.key_transmit = 1
##        else:
##          self.key_transmit = 0
##        if self.key_transmit != self.currently_in_tx:
##          QS.set_key_down(self.key_transmit)
##          try:
##            #self.usb_dev.ctrl_transfer(IN, 0x50, self.key_transmit, 0, 3)
##            print("key_transmit state %d" %self.key_transmit)
##          except usb.core.USBError:
##            if DEBUG: traceback.print_exc()
##          else:
##            self.currently_in_tx = self.key_transmit	# success
##            if DEBUG: print ("Change currently_in_tx", self.currently_in_tx)
            time.sleep(self.poll_secs)
Beispiel #17
0
 def OnButtonPTT(self, event):
   if event.GetEventObject().GetValue():
     QS.set_key_down(1)
   else:
     QS.set_key_down(0)
Beispiel #18
0
 def OnButtonPTT(self, event):
   if event.GetEventObject().GetValue():
     QS.set_key_down(1)
   else:
     QS.set_key_down(0)