#NEWLINE# def _send_packet( self ) : #NEWLINE# #INDENT# "\n        Send a single packet to the interface\n\n        This function guarentees that the number of packets\n        that are stored in daplink's buffer (the number of\n        packets written but not read) does not exceed the\n        number supported by the given device.\n        " #NEWLINE# cmd = self . _crnt_cmd #NEWLINE# if cmd . get_empty ( ) : #NEWLINE# #INDENT# return #NEWLINE# #UNINDENT# max_packets = self . _interface . getPacketCount ( ) #NEWLINE# if ( len ( self . _commands_to_read ) >= max_packets ) : #NEWLINE# #INDENT# self . _read_packet ( ) #NEWLINE# #UNINDENT# data = cmd . encode_data ( ) #NEWLINE# try : #NEWLINE# #INDENT# self . _interface . write ( list ( data ) ) #NEWLINE# #UNINDENT# except Exception as exception : #NEWLINE# #INDENT# self . _abort_all_transfers ( exception ) #NEWLINE# raise #NEWLINE# #UNINDENT# self . _commands_to_read . append ( cmd ) #NEWLINE# self . _crnt_cmd = _Command ( cmd . _packet_size )