pdevs_sim_interface.py 632 B

123456789101112131415161718192021222324
  1. from modelverse import *
  2. init()
  3. login("pdevs_sim_interface_acct", "my_password")
  4. def pdevs_sim_interface(port):
  5. # Set up Statechart, bind service to input event generation.
  6. # For output: set up listener to output port... But function has to return? Maybe (blocking?) polling function...
  7. def pdevs_sim(input):
  8. return
  9. service_set(port, pdevs_sim(service_get(port)))
  10. service_register("fibonacci", fibonacci_service)
  11. print("Registered")
  12. while raw_input() != "STOP":
  13. # Stay active, as we shouldn't exit while the service is running!
  14. pass
  15. print("Stopping")
  16. service_stop()
  17. print("Service halted")