TrafficLightWaiting.h 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. #ifndef TRAFFICLIGHTWAITING_H_
  2. #define TRAFFICLIGHTWAITING_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'TrafficLightWaiting'.
  8. */
  9. //! enumeration of all states
  10. typedef enum {
  11. TrafficLightWaiting_main_region_on ,
  12. TrafficLightWaiting_main_region_on_r1_StreetGreen ,
  13. TrafficLightWaiting_main_region_on_r1_PedWaiting ,
  14. TrafficLightWaiting_main_region_on_r1_PedWaiting_r1_waitOn ,
  15. TrafficLightWaiting_main_region_on_r1_PedWaiting_r1_waitOff ,
  16. TrafficLightWaiting_main_region_on_r1_StreetAttention ,
  17. TrafficLightWaiting_main_region_on_r1_StreetRed ,
  18. TrafficLightWaiting_main_region_on_r1_PedestrianGreen ,
  19. TrafficLightWaiting_main_region_on_r1_PedestrianRed ,
  20. TrafficLightWaiting_main_region_on_r1_StreetPrepared ,
  21. TrafficLightWaiting_main_region_off ,
  22. TrafficLightWaiting_main_region_off_r1_YellowOn ,
  23. TrafficLightWaiting_main_region_off_r1_YellowOff ,
  24. TrafficLightWaiting_last_state
  25. } TrafficLightWaitingStates;
  26. //! Type definition of the data structure for the TrafficLightWaitingIfaceTrafficLight interface scope.
  27. typedef struct {
  28. sc_boolean red;
  29. sc_boolean yellow;
  30. sc_boolean green;
  31. } TrafficLightWaitingIfaceTrafficLight;
  32. //! Type definition of the data structure for the TrafficLightWaitingIfacePedestrian interface scope.
  33. typedef struct {
  34. sc_boolean request;
  35. sc_boolean red;
  36. sc_boolean green;
  37. } TrafficLightWaitingIfacePedestrian;
  38. //! Type definition of the data structure for the TrafficLightWaitingIface interface scope.
  39. typedef struct {
  40. sc_boolean pedestrianRequest_raised;
  41. sc_boolean onOff_raised;
  42. } TrafficLightWaitingIface;
  43. //! Type definition of the data structure for the TrafficLightWaitingTimeEvents interface scope.
  44. typedef struct {
  45. sc_boolean TrafficLightWaiting_main_region_on_r1_PedWaiting_time_event_0_raised;
  46. sc_boolean TrafficLightWaiting_main_region_on_r1_PedWaiting_r1_waitOn_time_event_0_raised;
  47. sc_boolean TrafficLightWaiting_main_region_on_r1_PedWaiting_r1_waitOff_time_event_0_raised;
  48. sc_boolean TrafficLightWaiting_main_region_on_r1_StreetAttention_time_event_0_raised;
  49. sc_boolean TrafficLightWaiting_main_region_on_r1_StreetRed_time_event_0_raised;
  50. sc_boolean TrafficLightWaiting_main_region_on_r1_PedestrianGreen_time_event_0_raised;
  51. sc_boolean TrafficLightWaiting_main_region_on_r1_PedestrianRed_time_event_0_raised;
  52. sc_boolean TrafficLightWaiting_main_region_on_r1_StreetPrepared_time_event_0_raised;
  53. sc_boolean TrafficLightWaiting_main_region_off_r1_YellowOn_time_event_0_raised;
  54. sc_boolean TrafficLightWaiting_main_region_off_r1_YellowOff_time_event_0_raised;
  55. } TrafficLightWaitingTimeEvents;
  56. //! the maximum number of orthogonal states defines the dimension of the state configuration vector.
  57. #define TRAFFICLIGHTWAITING_MAX_ORTHOGONAL_STATES 1
  58. /*! Type definition of the data structure for the TrafficLightWaiting state machine.
  59. This data structure has to be allocated by the client code. */
  60. typedef struct {
  61. TrafficLightWaitingStates stateConfVector[TRAFFICLIGHTWAITING_MAX_ORTHOGONAL_STATES];
  62. sc_ushort stateConfVectorPosition;
  63. TrafficLightWaitingIfaceTrafficLight ifaceTrafficLight;
  64. TrafficLightWaitingIfacePedestrian ifacePedestrian;
  65. TrafficLightWaitingIface iface;
  66. TrafficLightWaitingTimeEvents timeEvents;
  67. } TrafficLightWaiting;
  68. /*! Initializes the TrafficLightWaiting state machine data structures. Must be called before first usage.*/
  69. extern void trafficLightWaiting_init(TrafficLightWaiting* handle);
  70. /*! Activates the state machine */
  71. extern void trafficLightWaiting_enter(TrafficLightWaiting* handle);
  72. /*! Deactivates the state machine */
  73. extern void trafficLightWaiting_exit(TrafficLightWaiting* handle);
  74. /*! Performs a 'run to completion' step. */
  75. extern void trafficLightWaiting_runCycle(TrafficLightWaiting* handle);
  76. /*! Raises a time event. */
  77. extern void trafficLightWaiting_raiseTimeEvent(TrafficLightWaiting* handle, sc_eventid evid);
  78. /*! Gets the value of the variable 'red' that is defined in the interface scope 'TrafficLight'. */
  79. extern sc_boolean trafficLightWaitingIfaceTrafficLight_get_red(TrafficLightWaiting* handle);
  80. /*! Sets the value of the variable 'red' that is defined in the interface scope 'TrafficLight'. */
  81. extern void trafficLightWaitingIfaceTrafficLight_set_red(TrafficLightWaiting* handle, sc_boolean value);
  82. /*! Gets the value of the variable 'yellow' that is defined in the interface scope 'TrafficLight'. */
  83. extern sc_boolean trafficLightWaitingIfaceTrafficLight_get_yellow(TrafficLightWaiting* handle);
  84. /*! Sets the value of the variable 'yellow' that is defined in the interface scope 'TrafficLight'. */
  85. extern void trafficLightWaitingIfaceTrafficLight_set_yellow(TrafficLightWaiting* handle, sc_boolean value);
  86. /*! Gets the value of the variable 'green' that is defined in the interface scope 'TrafficLight'. */
  87. extern sc_boolean trafficLightWaitingIfaceTrafficLight_get_green(TrafficLightWaiting* handle);
  88. /*! Sets the value of the variable 'green' that is defined in the interface scope 'TrafficLight'. */
  89. extern void trafficLightWaitingIfaceTrafficLight_set_green(TrafficLightWaiting* handle, sc_boolean value);
  90. /*! Gets the value of the variable 'request' that is defined in the interface scope 'Pedestrian'. */
  91. extern sc_boolean trafficLightWaitingIfacePedestrian_get_request(TrafficLightWaiting* handle);
  92. /*! Sets the value of the variable 'request' that is defined in the interface scope 'Pedestrian'. */
  93. extern void trafficLightWaitingIfacePedestrian_set_request(TrafficLightWaiting* handle, sc_boolean value);
  94. /*! Gets the value of the variable 'red' that is defined in the interface scope 'Pedestrian'. */
  95. extern sc_boolean trafficLightWaitingIfacePedestrian_get_red(TrafficLightWaiting* handle);
  96. /*! Sets the value of the variable 'red' that is defined in the interface scope 'Pedestrian'. */
  97. extern void trafficLightWaitingIfacePedestrian_set_red(TrafficLightWaiting* handle, sc_boolean value);
  98. /*! Gets the value of the variable 'green' that is defined in the interface scope 'Pedestrian'. */
  99. extern sc_boolean trafficLightWaitingIfacePedestrian_get_green(TrafficLightWaiting* handle);
  100. /*! Sets the value of the variable 'green' that is defined in the interface scope 'Pedestrian'. */
  101. extern void trafficLightWaitingIfacePedestrian_set_green(TrafficLightWaiting* handle, sc_boolean value);
  102. /*! Raises the in event 'pedestrianRequest' that is defined in the default interface scope. */
  103. extern void trafficLightWaitingIface_raise_pedestrianRequest(TrafficLightWaiting* handle);
  104. /*! Raises the in event 'onOff' that is defined in the default interface scope. */
  105. extern void trafficLightWaitingIface_raise_onOff(TrafficLightWaiting* handle);
  106. /*! Checks if the specified state is active. */
  107. extern sc_boolean trafficLightWaiting_isActive(TrafficLightWaiting* handle, TrafficLightWaitingStates state);
  108. #ifdef __cplusplus
  109. }
  110. #endif
  111. #endif /* TRAFFICLIGHTWAITING_H_ */