#NEWLINE# def _process_data( self ) : #NEWLINE# #INDENT# while len ( self . _buffer ) : #NEWLINE# #INDENT# if self . _expecting_ack : #NEWLINE# #INDENT# self . _expecting_ack = False #NEWLINE# self . _check_expected_ack ( ) #NEWLINE# #UNINDENT# if ( len ( self . _buffer ) and ( self . _buffer [ 0 ] == CTRL_C ) ) : #NEWLINE# #INDENT# self . interrupt_event . set ( ) #NEWLINE# self . _buffer = self . _buffer [ 1 : ] #NEWLINE# #UNINDENT# try : #NEWLINE# #INDENT# pkt_begin = self . _buffer . index ( '$' ) #NEWLINE# pkt_end = ( self . _buffer . index ( '#' ) + 2 ) #NEWLINE# if ( ( pkt_begin >= 0 ) and ( pkt_end < len ( self . _buffer ) ) ) : #NEWLINE# #INDENT# pkt = self . _buffer [ pkt_begin : ( pkt_end + 1 ) ] #NEWLINE# self . _buffer = self . _buffer [ ( pkt_end + 1 ) : ] #NEWLINE# self . _handling_incoming_packet ( pkt ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# break #NEWLINE# #UNINDENT# #UNINDENT# except ValueError : #NEWLINE# #INDENT# break