Beispiel #1
0
 def execute(self, string):
     # EXEC
     self.send('EXEC-'+server.encode_compound(string))
     response = server.parse_message(self.receive())
     if not response[0:2] == 'OK':
         raise Exception(response[2:])
     return response[2:]
Beispiel #2
0
 def dir_element(self, item):
     # DIR
     self.send('DIR-'+server.encode_compound(item))
     stuff = server.parse_message(self.receive())
     return server.decode_compound(stuff[2:])
Beispiel #3
0
 def list_components(self):
     # LISTCOMPONENTS
     self.send('LISTCOMP')
     return server.parse_message(self.receive())
Beispiel #4
0
 def get_timer(self):
     # GETTIMER
     self.send('GETTIMER')
     real_time = server.parse_message(self.receive())
     return float(real_time[2:])
Beispiel #5
0
 def quit(self):
     self.send('QUIT')
     msg = server.parse_message(self.receive())
     self.s.close()
     return msg
Beispiel #6
0
 def stop_simulation(self):
     self.send('STOP')
     message = server.parse_message(self.receive())
     if not server.parse_message(self.receive()) == 'OK':
         raise Exception('Error running the STOP command')
Beispiel #7
0
 def get_times(self):
     # GETTIMES
     self.send('GETTIMES')
     sim_time = server.parse_message(self.receive())
     return float(sim_time[2:])
Beispiel #8
0
 def run_simulation(self, time = -1):
     # RUN
     self.send('RUN-S'+str(time))
     if not server.parse_message(self.receive()) == 'OK':
         raise Exception('Error running the RUN command')
Beispiel #9
0
 def load_architecture(self, arch):
     # LOADARCH
     self.send('LOADARCH-S'+arch)
     message = server.parse_message(self.receive())
     print message
     if message != 'OK': raise Exception('Failed to load architecture: '+message)
Beispiel #10
0
 def load_application(self, app):
     # LoadApp
     self.send("LOADAPP-"+server.encode_compound([app]))
     message = server.parse_message(self.receive())
     if message != 'OK': raise Exceotuib('Failed to load application: '+message)
Beispiel #11
0
 def connect_sig(self, item1, port1, item2, port2):
     # CONNECTTLM
     self.send('CONNECTSIG-'+server.encode_compound([item1, port1 , item2, port2]))
     message = server.parse_message(self.receive())
     if message != 'OK': raise Exception('Failed to connect objects: '+message)
Beispiel #12
0
 def create_component(self, typename, name, params ):
     # CREATE
     self.send("CREATE-"+server.encode_compound([typename, name]+params))
     message = server.parse_message(self.receive())
     if message != 'OK': raise Exception('Failed to create object: '+message)