<s> from libs . can import * <EOL> from libs . module import * <EOL> class hw_fakeIO ( CANModule ) : <EOL> name = "<STR_LIT>" <EOL> help = """<STR_LIT>""" <EOL> version = <NUM_LIT:1.0> <EOL> CANList = None <EOL> _bus = <NUM_LIT:30> <EOL> def do_start ( self , params ) : <EOL> self . CANList = None <EOL> def do_stop ( self , params ) : <EOL> self . CANList = None <EOL> def do_init ( self , params ) : <EOL> self . _cmdList [ '<STR_LIT:t>' ] = [ "<STR_LIT>" , <NUM_LIT:1> , "<STR_LIT>" , <EOL> self . dev_write , True ] <EOL> return <NUM_LIT:1> <EOL> def dev_write ( self , line ) : <EOL> self . dprint ( <NUM_LIT:0> , "<STR_LIT>" + line ) <EOL> fid = line . split ( "<STR_LIT::>" ) [ <NUM_LIT:0> ] <EOL> length = line . split ( "<STR_LIT::>" ) [ <NUM_LIT:1> ] <EOL> data = line . split ( "<STR_LIT::>" ) [ <NUM_LIT:2> ] <EOL> self . CANList = CANMessage . init_data ( int ( fid ) , int ( length ) , bytes . fromhex ( data ) [ : <NUM_LIT:8> ] ) <EOL> return "<STR_LIT>" <EOL> def do_effect ( self , can_msg , args ) : <EOL> if args . get ( '<STR_LIT:action>' ) == '<STR_LIT>' : <EOL> can_msg = self . do_read ( can_msg ) <EOL> elif args . get ( '<STR_LIT:action>' ) == '<STR_LIT>' : <EOL> self . do_write ( can_msg ) <EOL> else : <EOL> self . dprint ( <NUM_LIT:1> , '<STR_LIT>' + args [ '<STR_LIT:action>' ] + '<STR_LIT>' ) <EOL> return can_msg <EOL> def do_read ( self , can_msg ) : <EOL> if self . CANList : <EOL> can_msg . CANData = True <EOL> can_msg . CANFrame = self . CANList <EOL> can_msg . bus = self . _bus <EOL> self . CANList = None <EOL> self . dprint ( <NUM_LIT:2> , "<STR_LIT>" ) <EOL> return can_msg <EOL> def do_write ( self , can_msg ) : <EOL> if can_msg . CANData : <EOL> self . CANList = can_msg . CANFrame <EOL> self . dprint ( <NUM_LIT:2> , "<STR_LIT>" ) <EOL> return can_msg </s>
