#NEWLINE# def pretty( self , indent = 0 ) : #NEWLINE# #INDENT# lines = list ( ) #NEWLINE# if self . name : #NEWLINE# #INDENT# lines . append ( ( 'identifier' , repr ( self . name ) ) ) #NEWLINE# #UNINDENT# lines . append ( ( 'device address' , self . device_address ) ) #NEWLINE# if self . local_device_name : #NEWLINE# #INDENT# lines . append ( ( 'device name' , self . local_device_name ) ) #NEWLINE# #UNINDENT# if self . class_of_device : #NEWLINE# #INDENT# cod = self . class_of_device #NEWLINE# if ( ( cod & 3 ) == 0 ) : #NEWLINE# #INDENT# lines . append ( ( 'device class' , decode_class_of_device ( cod ) ) ) #NEWLINE# msc = [ major_service_class [ mask ] for mask in sorted ( major_service_class ) if ( ( self . class_of_device >> 13 ) & mask ) ] #NEWLINE# lines . append ( ( 'major service' , ', ' . join ( msc ) ) ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# lines . append ( ( 'class of device' , '{0:b}' . format ( cod ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# if self . simple_pairing_hash : #NEWLINE# #INDENT# simple_pairing_hash = str ( self . simple_pairing_hash ) #NEWLINE# lines . append ( ( 'pubkey hash' , simple_pairing_hash . encode ( 'hex' ) ) ) #NEWLINE# #UNINDENT# if self . simple_pairing_rand : #NEWLINE# #INDENT# simple_pairing_rand = str ( self . simple_pairing_rand ) #NEWLINE# lines . append ( ( 'randomizer' , simple_pairing_rand . encode ( 'hex' ) ) ) #NEWLINE# #UNINDENT# for service_class_uuid in self . service_class_uuid_list : #NEWLINE# #INDENT# try : #NEWLINE# #INDENT# service_class = service_class_uuid_map [ service_class_uuid ] #NEWLINE# #UNINDENT# except KeyError : #NEWLINE# #INDENT# service_class = service_class_uuid #NEWLINE# #UNINDENT# lines . append ( ( 'service class' , service_class ) ) #NEWLINE# #UNINDENT# for ( key , value ) in self . eir . items ( ) : #NEWLINE# #INDENT# if ( key not in ( 3 , 5 , 7 , 8 , 9 , 13 , 14 , 15 ) ) : #NEWLINE# #INDENT# lines . append ( ( ( 'EIR 0x%02x' % key ) , repr ( value ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# indent = ( indent * ' ' ) #NEWLINE# lwidth = max ( [ len ( line [ 0 ] ) for line in lines ] ) #NEWLINE# lines = [ ( ( line [ 0 ] . ljust ( lwidth ) + ' = ' ) + line [ 1 ] ) for line in lines ] #NEWLINE# return '\n' . join ( [ ( indent + line ) for line in lines ] )