main.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /**
  2. * Copyright (c) 2012 committers of YAKINDU and others.
  3. * All rights reserved. This program and the accompanying materials
  4. * are made available under the terms of the Eclipse Public License v1.0
  5. * which accompanies this distribution, and is available at
  6. * http://www.eclipse.org/legal/epl-v10.html
  7. * Contributors:
  8. * m.muehlbrandt - initial API and implementation
  9. *
  10. */
  11. #include "org_yakindu_sct_examples_c_trafficlight.h"
  12. #include <QtGui>
  13. #include <QApplication>
  14. #include "src-gen/sc_types.h"
  15. #include "src-gen/TrafficLightWaiting.h"
  16. #include "statemachine/TrafficLightTimer.h"
  17. #include "statemachine/TrafficLightRunner.h"
  18. TrafficLightTimer *timer;
  19. int main(int argc, char *argv[]) {
  20. TrafficLightWaiting handle;
  21. trafficLightWaiting_init(&handle);
  22. timer = new TrafficLightTimer(&handle);
  23. trafficLightWaiting_enter(&handle);
  24. QApplication a(argc, argv);
  25. TrafficLightRunner *runner = new TrafficLightRunner(&handle, 100);
  26. org_yakindu_sct_examples_c_trafficlight w(0, runner);
  27. w.show();
  28. int ret = a.exec();
  29. return ret;
  30. }
  31. void trafficLightWaiting_setTimer(const sc_eventid evid,
  32. const sc_integer time_ms, const sc_boolean periodic) {
  33. timer->setTimer(evid, time_ms, periodic);
  34. }
  35. void trafficLightWaiting_unsetTimer(const sc_eventid evid) {
  36. timer->unsetTimer(evid);
  37. }