def testMaxConfigPoll(self): # test for >64 configuration keys EXPECTED_ERROR = "Number of configuration keys 67 exceeds maximum of 64" keys = [] for _ in range(67): keys.append("CFG_TEST") with self.assertRaisesRegex(UBXMessageError, EXPECTED_ERROR): UBXMessage.config_poll(0, 0, keys)
def _do_valget(self): """ Send a CFG-VALGET message. """ layers = self._cfglayer.get() if layers == "BBR": layers = 1 elif layers == "FLASH": layers = 2 elif layers == "DEFAULT": layers = 7 else: layers = 0 transaction = 0 keys = [ self._cfgval_keyname, ] msg = UBXMessage.config_poll(layers, transaction, keys) self.__app.serial_handler.serial_write(msg.serialize()) self._ent_val.configure(bg=ENTCOL) self._lbl_send_command.config(image=self._img_pending) self.__container.set_status("CFG-VALGET POLL message sent", "blue") self.__container.set_pending(UBX_CFGVAL, ("CFG-VALGET", "ACK-ACK", "ACK-NAK"))
def testConfigPoll( self): # test creation of CFG-VALGET message with multiple keys keys = ["CFG_UART1_BAUDRATE", 0x40530001] res = UBXMessage.config_poll(ubxcdb.POLL_LAYER_FLASH, 0, keys) self.assertEqual( str(res), "<UBX(CFG-VALGET, version=0, layer=2, position=0, keys_01=1079115777, keys_02=1079181313)>", )
def poll_uart(self, layer=0): """ Poll the current BBR UART1/2 configuration """ position = 0 keys = ["CFG_UART1_BAUDRATE", "CFG_UART2_BAUDRATE"] msg = UBXMessage.config_poll(layer, position, keys) ubp.send(msg.serialize())
ubr = UBXReader(BufferedReader(serial), protfilter=2) print("\nStarting read thread...\n") reading = True serial_lock = Lock() read_thread = start_thread(serial, serial_lock, ubr) # STEP 1: poll the existing configuration in volate memory (for comparison) print( "\nPolling UART configuration in the volatile RAM memory layer via CFG-VALGET..." ) print("(This should result in ACK-ACK and CFG-VALGET responses)") position = 0 layer = POLL_LAYER_RAM # volatile memory keys = [CONFIG_KEY1, CONFIG_KEY2] msg = UBXMessage.config_poll(layer, position, keys) send_message(serial, serial_lock, msg) sleep(1) # STEP 2: poll the existing configuration in non-volatile memory (battery-backed RAM or BBR) print( "\nPolling UART configuration in the BBR memory layer via CFG-VALGET...", "\n(This should result in an ACK-NAK response in the ", "absence of an existing BBR configuration setting)", ) layer = POLL_LAYER_BBR keys = [CONFIG_KEY1, CONFIG_KEY2] msg = UBXMessage.config_poll(layer, position, keys) send_message(serial, serial_lock, msg) sleep(1)