Пример #1
0
    def _on_send_cfg_msg(self):
        '''
        CFG-MSG command send button has been clicked.
        '''

        msg = UBXMessage.key_from_val(UBX_CONFIG_MESSAGES,
                                      self._cfg_msg_command)
        msgClass = int.from_bytes(msg[0:1], 'little', signed=False)
        msgID = int.from_bytes(msg[1:2], 'little', signed=False)
        rateDDC = int(self._ddc_rate.get())
        rateUART1 = int(self._uart1_rate.get())
        rateUSB = int(self._usb_rate.get())
        rateSPI = int(self._spi_rate.get())
        data = UBXMessage('CFG',
                          'CFG-MSG',
                          SET,
                          msgClass=msgClass,
                          msgID=msgID,
                          rateDDC=rateDDC,
                          rateUART1=rateUART1,
                          rateUSB=rateUSB,
                          rateSPI=rateSPI)
        self.__app.serial_handler.serial_write(data.serialize())
        data = UBXMessage('CFG', 'CFG-MSG', POLL,
                          payload=msg)  # poll for a response
        self.__app.serial_handler.serial_write(data.serialize())

        self.set_status("CFG-MSG command sent")
        self._awaiting_cfgmsg = True
        self._lbl_send_cfg_msg.config(image=self._img_pending)
Пример #2
0
    def _on_select_cfg_msg(self, *args, **kwargs):
        '''
        CFG-MSG command has been selected.
        '''

        idx = self._lbx_cfg_msg.curselection()
        self._cfg_msg_command = self._lbx_cfg_msg.get(idx)

        # poll selected message configuration to get current message rates
        msg = UBXMessage.key_from_val(UBX_CONFIG_MESSAGES,
                                      self._cfg_msg_command)
        data = UBXMessage('CFG', 'CFG-MSG', POLL, payload=msg)
        self.__app.serial_handler.serial_write(data.serialize())
        self._awaiting_cfgmsg = True
        self._lbl_send_cfg_msg.config(image=self._img_pending)
Пример #3
0
 def testKeyfromVal(self):
     res = UBXMessage.key_from_val(UBX_CLASSES, 'MON')
     self.assertEqual(res, (b'\x0A'))