def firmware_version(self): version = '' if self.device: connection = USBDeviceConnection(*self.device) connection.enter_listening_mode() version = connection.determine_firmware_version() return version or ""
def main(): view = ConsoleView() model = ConnectedDeviceModel(view) model.update() if not view.connected: msg("Yo dawg, connect a Particle device to USB") while not view.connected: model.update() msg("Rad. Connected device is {} on port {}".format( view.connected[1].name, view.connected[0])) device_connection = USBDeviceConnection(*view.connected) flash(device_connection)
def flash(self, connected): try: self.updater_state.set_state(FlashState.in_progress) if connected is None: raise ValueError("No device connected") connection = USBDeviceConnection(*connected) progress = ProgressSpan() def progress_update(current): self.callback.progress(progress.min, progress.max, progress.current) progress.on_change += progress_update Updater().start(progress, connection, connection.device) self.updater_state.set_state(FlashState.complete) except: self.updater_state.set_state(FlashState.error) raise