def initiateDownload(self, update_id, send_reply, send_error): global target global command global size global description global vendor global path logger.debug('SotaClient.SotaClientService.initiateDownload(%s): Called.', update_id) # Send back an immediate reply since DBUS # doesn't like python dbus-invoked methods to do # their own calls (nested calls). # send_reply(True) # Simulate download sys.stdout.write("Downloading\n") for i in xrange(1,10): sys.stdout.write('.') sys.stdout.flush() time.sleep(0.1) sys.stdout.write("\nDone.\n") swm.dbus_method('org.genivi.SoftwareLoadingManager', 'downloadComplete', self.image_file, self.signature) return None
def initiate_download(self, update_id, send_reply, send_error): global target global command global size global description global vendor global path print "Got initiate_download" print " ID: {}".format(update_id) print "---" # Send back an immediate reply since DBUS # doesn't like python dbus-invoked methods to do # their own calls (nested calls). # send_reply(True) # Simulate download print "Downloading" for i in xrange(1, 10): sys.stdout.write('.') sys.stdout.flush() time.sleep(0.1) print print "Done." swm.dbus_method('org.genivi.software_loading_manager', 'download_complete', self.image_file, self.signature) return None
def update_available(self, update_id, description, signature, request_confirmation, send_reply, send_error): print "Got download available" print " ID: {}".format(update_id) print " descr: {}".format(description) print " confirm: {}".format(request_confirmation) # Send back an immediate reply since DBUS # doesn't like python dbus-invoked methods to do # their own calls (nested calls). # send_reply(True) # # Send a notification to the HMI to get user approval / decline # Once user has responded, HMI will invoke self.package_confirmation() # to drive the use case forward. # if request_confirmation: swm.dbus_method("org.genivi.hmi", "update_notification", update_id, description) print " Called hmi.update_notification()" print "---" return None print " No user confirmation requested. Will initiate download" print "---" self.initiate_download(update_id) return None
def initiateDownload(self, update_id, send_reply, send_error): global target global command global size global description global vendor global path logger.debug( 'SotaClient.SotaClientService.initiateDownload(%s): Called.', update_id) # Send back an immediate reply since DBUS # doesn't like python dbus-invoked methods to do # their own calls (nested calls). # send_reply(True) # Simulate download sys.stdout.write("Downloading\n") for i in xrange(1, 10): sys.stdout.write('.') sys.stdout.flush() time.sleep(0.1) sys.stdout.write("\nDone.\n") swm.dbus_method('org.genivi.SoftwareLoadingManager', 'downloadComplete', self.image_file, self.signature) return None
def initiateDownload(self, update_id, send_reply, send_error): global target global command global size global description global vendor global path print "Got initiateDownload" print " ID: {}".format(update_id) print "---" # Send back an immediate reply since DBUS # doesn't like python dbus-invoked methods to do # their own calls (nested calls). # send_reply(True) # Simulate download print "Downloading" for i in xrange(1,10): sys.stdout.write('.') sys.stdout.flush() time.sleep(0.1) print print "Done." swm.dbus_method('org.genivi.SoftwareLoadingManager', 'downloadComplete', self.image_file, self.signature) return None
def updateAvailable(self, update_id, description, signature, request_confirmation, send_reply, send_error): logger.debug('SoftwareLoadingManager.SLMService.updateAvailable(%s, %s, %s, %s): Called.', update_id, description, signature, request_confirmation) # Send back an immediate reply since DBUS # doesn't like python dbus-invoked methods to do # their own calls (nested calls). # send_reply(True) # # Send a notification to the HMI to get user approval / decline # Once user has responded, HMI will invoke self.package_confirmation() # to drive the use case forward. # if request_confirmation: logger.debug('SoftwareLoadingManager.SLMService.updateAvailable(): Called Hmi.updateNotification().') swm.dbus_method("org.genivi.Hmi", "updateNotification", update_id, description) return None logger.debug('SoftwareLoadingManager.SLMService.updateAvailable(): No user cnfirmation requested: initiating download.') self.initiate_download(update_id) return None
def updateAvailable(self, update_id, description, signature, request_confirmation, send_reply, send_error): logger.debug( 'SoftwareLoadingManager.SLMService.updateAvailable(%s, %s, %s, %s): Called.', update_id, description, signature, request_confirmation) # Send back an immediate reply since DBUS # doesn't like python dbus-invoked methods to do # their own calls (nested calls). # send_reply(True) # # Send a notification to the HMI to get user approval / decline # Once user has responded, HMI will invoke self.package_confirmation() # to drive the use case forward. # if request_confirmation: logger.debug( 'SoftwareLoadingManager.SLMService.updateAvailable(): Called Hmi.updateNotification().' ) swm.dbus_method("org.genivi.Hmi", "updateNotification", update_id, description) return None logger.debug( 'SoftwareLoadingManager.SLMService.updateAvailable(): No user cnfirmation requested: initiating download.' ) self.initiate_download(update_id) return None
def updateAvailable(self, update_id, description, signature, request_confirmation, send_reply, send_error): print "Got download available" print " ID: {}".format(update_id) print " descr: {}".format(description) print " confirm: {}".format(request_confirmation) # Send back an immediate reply since DBUS # doesn't like python dbus-invoked methods to do # their own calls (nested calls). # send_reply(True) # # Send a notification to the HMI to get user approval / decline # Once user has responded, HMI will invoke self.package_confirmation() # to drive the use case forward. # if request_confirmation: swm.dbus_method("org.genivi.Hmi", "updateNotification", update_id, description) print " Called Hmi.updateNotification()" print "---" return None print " No user confirmation requested. Will initiate download" print "---" self.initiate_download(update_id) return None
def send_transaction(self, transaction_id): try: swm.dbus_method(self.path, self.method, transaction_id, *self.arguments) except Exception as e: print "SoftwareOperation.send_transaction({}): Exception: {}".format(self.operation_id, e) return False return True
def inform_hmi_of_new_manifest(self,manifest): total_time = 0 for op in manifest.operations: total_time = total_time + op.time_estimate swm.dbus_method("org.genivi.hmi", "manifest_started", manifest.update_id, total_time, manifest.description) return None
def inform_hmi_of_new_manifest(self,manifest): total_time = 0 for op in manifest.operations: total_time = total_time + op.time_estimate swm.dbus_method("org.genivi.Hmi", "manifestStarted", manifest.update_id, total_time, manifest.description) return None
def send_transaction(self, transaction_id): try: swm.dbus_method(self.path, self.method, transaction_id, *self.arguments) except Exception as e: logger.error('SoftwareLoadingManager.SoftwareOperation.send_transaction(%s): Exception %s', transaction_id, e) return False return True
def distribute_update_result(self, update_id, results): # Send installation report to HMI print "Sending report to hmi.update_report()" swm.dbus_method("org.genivi.hmi", "update_report", dbus.String(update_id), results) # Send installation report to SOTA print "Sending report to sota.update_report()" swm.dbus_method("org.genivi.sota_client", "update_report", dbus.String(update_id), results)
def distribute_update_result(self, update_id, results): # Send installation report to HMI logger.debug('SoftwareLoadingManager.SLMService.distribute_update_result(%s): Sending report to Hmi.updateReport().', update_id) swm.dbus_method("org.genivi.Hmi", "updateReport", dbus.String(update_id), results) # Send installation report to SOTA logger.debug('SoftwareLoadingManager.SLMService.distribute_update_result(%s): Sending report to SotaClient.updateReport().', update_id) swm.dbus_method("org.genivi.SotaClient", "updateReport", dbus.String(update_id), results)
def distribute_update_result(self, update_id, results): # Send installation report to HMI print "Sending report to Hmi.updateReport()" swm.dbus_method("org.genivi.Hmi", "updateReport", dbus.String(update_id), results) # Send installation report to SOTA print "Sending report to SotaClient.updateReport()" swm.dbus_method("org.genivi.SotaClient", "updateReport", dbus.String(update_id), results)
def send_transaction(self, transaction_id): try: swm.dbus_method(self.path, self.method, transaction_id, *self.arguments) except Exception as e: logger.error( 'SoftwareLoadingManager.SoftwareOperation.send_transaction(%s): Exception %s', transaction_id, e) return False return True
def update_notification(self, update_id, description, send_reply, send_error): try: print "HMI: update_notification()" print " ID: {}".format(update_id) print " description: {}".format(description) print "---" # # Send back an async reply to the invoking software_loading_manager # so that we can continue with user interaction without # risking a DBUS timeout # send_reply(True) print print print "DIALOG:" print "DIALOG: UPDATE AVAILABLE" print "DIALOG: update_id: {}".format(update_id) print "DIALOG: Description: {}".format(description) print "DIALOG:" print "DIALOG: Process? (yes/no)" # If we use input or raw_input, the whole dbus loop hangs after # this method returns, for some reason. tcflush(sys.stdin, TCIOFLUSH) resp = sys.stdin.read(1) tcflush(sys.stdin, TCIOFLUSH) # resp = raw_input("DIALOG: Process? (yes/no): ") print if len(resp) == 0 or (resp[0] != 'y' and resp[0] != 'Y'): approved = False else: approved = True # # Call software_loading_manager.package_confirmation() # to inform it of user approval / decline. # swm.dbus_method('org.genivi.software_loading_manager','update_confirmation', update_id, approved) except Exception as e: print "Exception: {}".format(e) traceback.print_exc() return None
def updateNotification(self, update_id, description, send_reply, send_error): try: print "HMI: updateNotification()" print " ID: {}".format(update_id) print " description: {}".format(description) print "---" # # Send back an async reply to the invoking SoftwareLoadingManager # so that we can continue with user interaction without # risking a DBUS timeout # send_reply(True) print print print "DIALOG:" print "DIALOG: UPDATE AVAILABLE" print "DIALOG: update_id: {}".format(update_id) print "DIALOG: Description: {}".format(description) print "DIALOG:" print "DIALOG: Process? (yes/no)" # If we use input or raw_input, the whole dbus loop hangs after # this method returns, for some reason. tcflush(sys.stdin, TCIOFLUSH) resp = sys.stdin.read(1) tcflush(sys.stdin, TCIOFLUSH) # resp = raw_input("DIALOG: Process? (yes/no): ") print if len(resp) == 0 or (resp[0] != 'y' and resp[0] != 'Y'): approved = False else: approved = True # # Call SoftwareLoadingManager.package_confirmation() # to inform it of user approval / decline. # swm.dbus_method('org.genivi.SoftwareLoadingManager', 'updateConfirmation', update_id, approved) except Exception as e: print "Exception: {}".format(e) traceback.print_exc() return None
def distribute_update_result(self, update_id, results): if settings.HMI_ENABLED: # Send installation report to HMI logger.info( 'SoftwareLoadingManager.SLMService.distribute_update_result(%s): Sending report to Hmi.updateReport().', update_id) swm.dbus_method("org.genivi.Hmi", "updateReport", dbus.String(update_id), results) # Send installation report to SOTA logger.debug( 'SoftwareLoadingManager.SLMService.distribute_update_result(%s): Sending report to SotaClient.updateReport().', update_id) swm.dbus_method("org.genivi.SotaClient", "updateReport", dbus.String(update_id), results)
def inform_hmi_of_new_operation(self,op): logger.info('inform hmi of new operation') if settings.HMI_ENABLED: swm.dbus_method("org.genivi.Hmi", "operationStarted", op.operation_id, op.time_estimate, op.hmi_message) return None
def initiate_download(self, package_id): swm.dbus_method("org.genivi.SotaClient", "initiateDownload", package_id)
def inform_hmi_of_new_operation(self, op): logger.info('inform hmi of new operation') if settings.HMI_ENABLED: swm.dbus_method("org.genivi.Hmi", "operationStarted", op.operation_id, op.time_estimate, op.hmi_message) return None
# # If confirmed, SWLM will make an initiate_download() callback to # this sota_client. # # The sota_client will, on simulated download completion, make a # download_complete() call to the SLM to indicate that the update is # ready to be processed. # # The SLM will mount the provided image file as a loopback file system # and execute its update_manifest.json file. Each software operation in # the manifest file will be fanned out to its correct target (PackMgr, # ML, PartMgr) # # Once the update has been processed by SLM, an update operation # report will be sent back to SC and HMI. # swm.dbus_method('org.genivi.SoftwareLoadingManager', 'updateAvailable', update_id, description, signature, request_confirmation) active = True # Active will be set to false by installation_report() while active: gtk.main_iteration() except Exception as e: print "Exception: {}".format(e) traceback.print_exc()
def initiate_download(self, package_id): swm.dbus_method("org.genivi.sota_client", "initiate_download", package_id)
def inform_hmi_of_new_operation(self,op): swm.dbus_method("org.genivi.Hmi", "operationStarted", op.operation_id, op.time_estimate, op.hmi_message) return None
def inform_hmi_of_new_operation(self,op): swm.dbus_method("org.genivi.hmi", "operation_started", op.operation_id, op.time_estimate, op.description) return None
# If requested, SWLM will pop an operation confirmation dialog on the HMI. # # If confirmed, SWLM will make an initiate_download() callback to # this sota_client. # # The sota_client will, on simulated download completion, make a # download_complete() call to the SLM to indicate that the update is # ready to be processed. # # The SLM will mount the provided image file as a loopback file system # and execute its update_manifest.json file. Each software operation in # the manifest file will be fanned out to its correct target (PackMgr, # ML, PartMgr) # # Once the update has been processed by SLM, an update operation # report will be sent back to SC and HMI. # swm.dbus_method('org.genivi.SoftwareLoadingManager', 'updateAvailable', update_id, description, signature, request_confirmation) active = True # Active will be set to false by installation_report() while active: mainloop = gobject.MainLoop() mainloop.run() except Exception as e: print "Exception: {}".format(e) traceback.print_exc()