NamedInterfaceAccess.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. #ifndef NAMEDINTERFACEACCESS_H_
  2. #define NAMEDINTERFACEACCESS_H_
  3. #include "sc_types.h"
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. /*! \file Header of the state machine 'NamedInterfaceAccess'.
  8. */
  9. /*! Enumeration of all states */
  10. typedef enum
  11. {
  12. NamedInterfaceAccess_region_1_Idle,
  13. NamedInterfaceAccess_region_1_Number1Pressed,
  14. NamedInterfaceAccess_region_1_Number2Pressed,
  15. NamedInterfaceAccess_region_1_Number3Pressed,
  16. NamedInterfaceAccess__region1_Closed,
  17. NamedInterfaceAccess__region1_Open,
  18. NamedInterfaceAccess_last_state
  19. } NamedInterfaceAccessStates;
  20. /*! Type definition of the data structure for the NamedInterfaceAccessIfaceSafe interface scope. */
  21. typedef struct
  22. {
  23. sc_boolean open_raised;
  24. sc_boolean close_raised;
  25. } NamedInterfaceAccessIfaceSafe;
  26. /*! Type definition of the data structure for the NamedInterfaceAccessIfaceUser interface scope. */
  27. typedef struct
  28. {
  29. sc_boolean numberPressed_raised;
  30. sc_integer numberPressed_value;
  31. sc_boolean reset_raised;
  32. } NamedInterfaceAccessIfaceUser;
  33. /*! Type definition of the data structure for the NamedInterfaceAccessInternal interface scope. */
  34. typedef struct
  35. {
  36. sc_integer number1;
  37. sc_integer number2;
  38. sc_integer number3;
  39. } NamedInterfaceAccessInternal;
  40. /*! Define dimension of the state configuration vector for orthogonal states. */
  41. #define NAMEDINTERFACEACCESS_MAX_ORTHOGONAL_STATES 2
  42. /*!
  43. * Type definition of the data structure for the NamedInterfaceAccess state machine.
  44. * This data structure has to be allocated by the client code.
  45. */
  46. typedef struct
  47. {
  48. NamedInterfaceAccessStates stateConfVector[NAMEDINTERFACEACCESS_MAX_ORTHOGONAL_STATES];
  49. sc_ushort stateConfVectorPosition;
  50. NamedInterfaceAccessIfaceSafe ifaceSafe;
  51. NamedInterfaceAccessIfaceUser ifaceUser;
  52. NamedInterfaceAccessInternal internal;
  53. } NamedInterfaceAccess;
  54. /*! Initializes the NamedInterfaceAccess state machine data structures. Must be called before first usage.*/
  55. extern void namedInterfaceAccess_init(NamedInterfaceAccess* handle);
  56. /*! Activates the state machine */
  57. extern void namedInterfaceAccess_enter(NamedInterfaceAccess* handle);
  58. /*! Deactivates the state machine */
  59. extern void namedInterfaceAccess_exit(NamedInterfaceAccess* handle);
  60. /*! Performs a 'run to completion' step. */
  61. extern void namedInterfaceAccess_runCycle(NamedInterfaceAccess* handle);
  62. /*! Checks if the out event 'open' that is defined in the interface scope 'Safe' has been raised. */
  63. extern sc_boolean namedInterfaceAccessIfaceSafe_israised_open(const NamedInterfaceAccess* handle);
  64. /*! Checks if the out event 'close' that is defined in the interface scope 'Safe' has been raised. */
  65. extern sc_boolean namedInterfaceAccessIfaceSafe_israised_close(const NamedInterfaceAccess* handle);
  66. /*! Raises the in event 'numberPressed' that is defined in the interface scope 'User'. */
  67. extern void namedInterfaceAccessIfaceUser_raise_numberPressed(NamedInterfaceAccess* handle, sc_integer value);
  68. /*! Raises the in event 'reset' that is defined in the interface scope 'User'. */
  69. extern void namedInterfaceAccessIfaceUser_raise_reset(NamedInterfaceAccess* handle);
  70. /*!
  71. * Checks whether the state machine is active (until 2.4.1 this method was used for states).
  72. * A state machine is active if it was entered. It is inactive if it has not been entered at all or if it has been exited.
  73. */
  74. extern sc_boolean namedInterfaceAccess_isActive(const NamedInterfaceAccess* handle);
  75. /*!
  76. * Checks if all active states are final.
  77. * If there are no active states then the state machine is considered being inactive. In this case this method returns false.
  78. */
  79. extern sc_boolean namedInterfaceAccess_isFinal(const NamedInterfaceAccess* handle);
  80. /*! Checks if the specified state is active (until 2.4.1 the used method for states was called isActive()). */
  81. extern sc_boolean namedInterfaceAccess_isStateActive(const NamedInterfaceAccess* handle, NamedInterfaceAccessStates state);
  82. #ifdef __cplusplus
  83. }
  84. #endif
  85. #endif /* NAMEDINTERFACEACCESS_H_ */