summaryrefslogtreecommitdiffstats
path: root/policy_manager/stm/zipc/StateTransitionor/RestrictionMode/ZREM_RestrictionMode.c
blob: 7fe5700efe99567a2088b60b8d098e3a4131ae8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
/************************************************************/
/*     ZREM_RestrictionMode.c                               */
/*     RestrictionMode State transition model source file   */
/*     ZIPC Designer Version 1.2.0                          */
/************************************************************/
#include "../ZST_include.h"

/* State management variable */
static uint8_t ZREM_RestrictionModeState[ZREM_RESTRICTIONMODESTATENOMAX];

static void ZREM_RestrictionModes0e1( void );
static void ZREM_RestrictionModes0e2( void );
static void ZREM_RestrictionModes1e0( void );
static void ZREM_RestrictionModes0Event( void );
static void ZREM_RestrictionModes1Event( void );
static void ZREM_RestrictionModes2Event( void );

/****************************************/
/* Action function                      */
/*   STM : RestrictionMode              */
/*   State : restriction_mode_off( No 0 ) */
/*   Event : evt_restriction_mode_1_on( No 1 ) */
/****************************************/
static void ZREM_RestrictionModes0e1( void )
{
    ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES1;
    stm_rem_start_activity_restriction_mode_1_on();
}

/****************************************/
/* Action function                      */
/*   STM : RestrictionMode              */
/*   State : restriction_mode_off( No 0 ) */
/*   Event : evt_restriction_mode_2_on( No 2 ) */
/****************************************/
static void ZREM_RestrictionModes0e2( void )
{
    ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES2;
    stm_rem_start_activity_restriction_mode_2_on();
}

/****************************************/
/* Action function                      */
/*   STM : RestrictionMode              */
/*   State : restriction_mode_1_on( No 1 ) */
/*   Event : evt_restriction_mode_off( No 0 ) */
/****************************************/
static void ZREM_RestrictionModes1e0( void )
{
    ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES0;
    stm_rem_start_activity_restriction_mode_off();
}

/****************************************/
/* Event appraisal function             */
/*   STM : RestrictionMode              */
/*   State : restriction_mode_off( No 0 ) */
/****************************************/
static void ZREM_RestrictionModes0Event( void )
{
    /*evt_restriction_mode_1_on*/
    if( g_stm_event == StmEvtNoRestrictionMode1On )
    {
        ZREM_RestrictionModes0e1();
    }
    /*evt_restriction_mode_2_on*/
    else if( g_stm_event == StmEvtNoRestrictionMode2On )
    {
        ZREM_RestrictionModes0e2();
    }
    else
    {
        /*Else and default design have not done.*/
        /*Please confirm the STM and design else and default.*/
    }
}

/****************************************/
/* Event appraisal function             */
/*   STM : RestrictionMode              */
/*   State : restriction_mode_1_on( No 1 ) */
/****************************************/
static void ZREM_RestrictionModes1Event( void )
{
    /*evt_restriction_mode_off*/
    if( g_stm_event == StmEvtNoRestrictionModeOff )
    {
        ZREM_RestrictionModes1e0();
    }
    /*evt_restriction_mode_2_on*/
    else if( g_stm_event == StmEvtNoRestrictionMode2On )
    {
        ZREM_RestrictionModes0e2();
    }
    else
    {
        /*Else and default design have not done.*/
        /*Please confirm the STM and design else and default.*/
    }
}

/****************************************/
/* Event appraisal function             */
/*   STM : RestrictionMode              */
/*   State : restriction_mode_2_on( No 2 ) */
/****************************************/
static void ZREM_RestrictionModes2Event( void )
{
    /*evt_restriction_mode_off*/
    if( g_stm_event == StmEvtNoRestrictionModeOff )
    {
        ZREM_RestrictionModes1e0();
    }
    /*evt_restriction_mode_1_on*/
    else if( g_stm_event == StmEvtNoRestrictionMode1On )
    {
        ZREM_RestrictionModes0e1();
    }
    else
    {
        /*Else and default design have not done.*/
        /*Please confirm the STM and design else and default.*/
    }
}

/****************************************/
/* Event call function                  */
/*   STM : RestrictionMode              */
/****************************************/
void stm_rem_event_call( void )
{
    stm_rem_start_stm();
    switch( ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] )
    {
    case ZREM_RESTRICTIONMODES0:
        ZREM_RestrictionModes0Event();
        break;
    case ZREM_RESTRICTIONMODES1:
        ZREM_RestrictionModes1Event();
        break;
    case ZREM_RESTRICTIONMODES2:
        ZREM_RestrictionModes2Event();
        break;
    default:
        /*Not accessible to this else (default).*/
        break;
    }
}

/****************************************/
/* Initial function                     */
/*   STM : RestrictionMode              */
/****************************************/
void stm_rem_initialize( void )
{
    ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODES0;
    stm_rem_start_activity_restriction_mode_off();
}

/****************************************/
/* Terminate function                   */
/*   STM : RestrictionMode              */
/****************************************/
void ZREM_RestrictionModeTerminate( void )
{
    ZREM_RestrictionModeState[ZREM_RESTRICTIONMODE] = ( uint8_t )ZREM_RESTRICTIONMODETERMINATE;
}