#NEWLINE# def _install_legacy2( self ) : #NEWLINE# #INDENT# metadata = self . _bundle . get_app_metadata ( ) #NEWLINE# app_uuid = metadata [ 'uuid' ] #NEWLINE# self . _pebble . send_and_read ( LegacyAppInstallRequest ( data = LegacyUpgradeAppUUID ( uuid = app_uuid ) ) , LegacyAppInstallResponse ) #NEWLINE# result = self . _pebble . send_and_read ( LegacyAppInstallRequest ( data = LegacyBankInfoRequest ( ) ) , LegacyAppInstallResponse ) . data #NEWLINE# assert isinstance ( result , LegacyBankInfoResponse ) #NEWLINE# first_free = 0 #NEWLINE# for app in result . apps : #NEWLINE# #INDENT# assert isinstance ( worker , LegacyBankEntry ) #NEWLINE# if ( app . bank_number == first_free ) : #NEWLINE# #INDENT# first_free += 1 #NEWLINE# #UNINDENT# #UNINDENT# if ( first_free == result . bank_count ) : #NEWLINE# #INDENT# raise AppInstallError ( 'No app banks free.' ) #NEWLINE# #UNINDENT# binary = self . _bundle . zip . read ( self . _bundle . get_app_path ( ) ) #NEWLINE# self . _send_part_legacy2 ( PutBytesType . Binary , binary , first_free ) #NEWLINE# if self . _bundle . has_resources : #NEWLINE# #INDENT# resources = self . _bundle . zip . read ( self . _bundle . get_resource_path ( ) ) #NEWLINE# self . _send_part_legacy2 ( PutBytesType . Resources , resources , first_free ) #NEWLINE# #UNINDENT# if self . _bundle . has_worker : #NEWLINE# #INDENT# worker = self . _bundle . zip . read ( self . _bundle . get_worker_path ( ) ) #NEWLINE# self . _send_part_legacy2 ( PutBytesType . Worker , worker , first_free ) #NEWLINE# #UNINDENT# self . _pebble . send_and_read ( LegacyAppInstallRequest ( data = LegacyAppAvailable ( bank = first_free , vibrate = True ) ) , LegacyAppInstallResponse ) #NEWLINE# appmessage = AppMessageService ( self . _pebble , message_type = LegacyAppLaunchMessage ) #NEWLINE# appmessage . send_message ( app_uuid , { #NEWLINE# #INDENT# LegacyAppLaunchMessage . Keys . RunState : AMUint8 ( LegacyAppLaunchMessage . States . Running ) , #NEWLINE# #UNINDENT# } ) #NEWLINE# appmessage . shutdown ( )