payloadmanager.pr 11.4 KB
Newer Older
Rafal Babski's avatar
Rafal Babski committed
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
/* CIF PROCESS (250, 150), (150, 75) */
process Payloadmanager;
    /* CIF TEXT (133, 144), (516, 248) */
    -- input parameters
    dcl param_on_off TC_2_1_DistributeOnoffDeviceCommands_Type;
    dcl param_register_load TC_2_2_DistributeRegisterLoadCommands_Type;
    dcl param_payload_enabled T_Boolean;
    
    -- output parameters
    dcl param_hk_data PAYLOAD_HK_DATA;
    dcl param_execution_report EXECUTION_REPORT;
    
    -- state
    dcl payload_data_enabled T_Boolean := false;
    dcl payload_data UINT8T := 0;
    
    -- auxilary
    dcl hal_success T_Boolean := false;
    /* CIF ENDTEXT */
    /* CIF procedure (766, 482), (184, 35) */
    procedure execute_onoff_instruction;
        /* CIF TEXT (52, 53), (394, 140) */
        -- Text area for declarations and comments
        
        fpar
            in instruction DistributeAnOnoffDeviceCommand_Type,
            in/out operation_success T_Boolean;
        /* CIF ENDTEXT */
        /* CIF START (731, 78), (70, 35) */
        START;
            /* CIF decision (700, 133), (131, 50) */
            decision operation_success;
                /* CIF ANSWER (686, 203), (70, 24) */
                (true):
                    /* CIF decision (614, 247), (212, 50) */
                    decision instruction.onOffDeviceAddress;
37
                        /* CIF ANSWER (570, 317), (207, 24) */
Rafal Babski's avatar
Rafal Babski committed
38
                        (on_off_device_address_display):
39
                            /* CIF decision (596, 361), (156, 50) */
Rafal Babski's avatar
Rafal Babski committed
40
41
42
43
44
45
46
47
48
49
                            decision payload_data_enabled;
                                /* CIF ANSWER (531, 431), (70, 24) */
                                (true):
                                    /* CIF task (464, 475), (203, 35) */
                                    task payload_data_enabled := false;
                                /* CIF ANSWER (817, 431), (70, 24) */
                                (false):
                                    /* CIF task (752, 475), (199, 35) */
                                    task payload_data_enabled := true;
                            enddecision;
50
                            /* CIF PROCEDURECALL (469, 526), (409, 35) */
Rafal Babski's avatar
Rafal Babski committed
51
52
53
54
55
56
57
58
59
60
                            call oled_set_data_enable(payload_data_enabled, operation_success);
                        /* CIF ANSWER (963, 317), (70, 24) */
                        ELSE:
                    enddecision;
                /* CIF ANSWER (1044, 203), (70, 24) */
                (false):
            enddecision;
            /* CIF return (748, 592), (35, 35) */
            return ;
    endprocedure;
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
    /* CIF procedure (416, 584), (233, 35) */
    procedure execute_register_load_instruction;
        /* CIF TEXT (161, 110), (388, 140) */
        -- Text area for declarations and comments
        
        fpar
           in instruction DistributeARegisterLoadCommand_Type,
           in/out operation_success T_Boolean;
        /* CIF ENDTEXT */
        /* CIF START (895, 208), (70, 35) */
        START;
            /* CIF decision (864, 263), (131, 50) */
            decision operation_success;
                /* CIF ANSWER (769, 333), (70, 24) */
                (true):
                    /* CIF task (583, 377), (441, 35) */
                    task payload_data := instruction.registerData.register_address_display_data;
                    /* CIF PROCEDURECALL (635, 432), (336, 35) */
                    call oled_load_register(payload_data, operation_success);
                /* CIF ANSWER (1035, 333), (70, 24) */
                (false):
            enddecision;
            /* CIF return (912, 483), (35, 35) */
            return ;
    endprocedure;
Rafal Babski's avatar
Rafal Babski committed
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
    /* CIF START (917, 10), (70, 35) */
    START;
        /* CIF NEXTSTATE (890, 60), (125, 35) */
        NEXTSTATE PayloadDisabled;
    /* CIF state (2564, 23), (121, 35) */
    state PayloadEnabled;
        /* CIF input (2473, 78), (304, 35) */
        input command_register_load(param_register_load);
            /* CIF decision (2544, 133), (162, 50) */
            decision payload_data_enabled;
                /* CIF ANSWER (2450, 203), (70, 24) */
                (true):
                    /* CIF task (2418, 247), (134, 35) */
                    task hal_success := true;
                    /* CIF task (2206, 297), (558, 56) */
                    task for instruction in param_register_load.instructionsToDistributeARegisterLoadCommand:
    call execute_register_load_instruction(instruction, hal_success);
endfor;
                    /* CIF decision (2439, 373), (91, 50) */
                    decision hal_success;
                        /* CIF ANSWER (2136, 443), (70, 24) */
                        (true):
                            /* CIF task (1976, 487), (389, 88) */
                            task param_execution_report := execution_report_success : {
    successfulStartOfExecutionNotificationNotification {
111
        requestID request_id_distribute_register_load_command
Rafal Babski's avatar
Rafal Babski committed
112
113
114
115
116
117
118
    }
};
                        /* CIF ANSWER (2576, 443), (70, 24) */
                        (false):
                            /* CIF task (2377, 487), (468, 104) */
                            task param_execution_report := execution_report_failed : {
    failedStartOfExecutionNotificationNotification {
119
        requestID request_id_distribute_register_load_command,
Rafal Babski's avatar
Rafal Babski committed
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
        failureNoticeData failure_notice_code_invalid_address : invalid_address
    }
};
                    enddecision;
                /* CIF ANSWER (3034, 203), (70, 24) */
                (false):
                    /* CIF task (2857, 247), (425, 104) */
                    task param_execution_report := execution_report_failed : {
    failedStartOfExecutionNotificationNotification {
        requestID request_id_distribute_register_load_command,
        failureNoticeData failure_notice_code_invalid_state : disabled
    }
};
            enddecision;
            /* CIF PROCEDURECALL (2481, 641), (289, 35) */
            call report_execution(param_execution_report);
            /* CIF NEXTSTATE (2565, 691), (121, 35) */
            NEXTSTATE PayloadEnabled;
    endstate;
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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
    /* CIF state (98, 722), (121, 35) */
    state PayloadEnabled;
        /* CIF input (64, 777), (190, 35) */
        input trigger_gather_payload_hk;
            /* CIF task (0, 832), (319, 88) */
            task param_hk_data := {
    payload_enabled true,
    payload_data_enabled payload_data_enabled,
    payload_data payload_data
};
            /* CIF PROCEDURECALL (43, 940), (233, 35) */
            call payload_hk_store(param_hk_data);
            /* CIF NEXTSTATE (97, 990), (125, 35) */
            NEXTSTATE PayloadEnabled;
    endstate;
    /* CIF state (426, 717), (125, 35) */
    state PayloadDisabled;
        /* CIF input (394, 772), (190, 35) */
        input trigger_gather_payload_hk;
            /* CIF task (330, 827), (319, 88) */
            task param_hk_data := {
    payload_enabled false,
    payload_data_enabled payload_data_enabled,
    payload_data payload_data
};
            /* CIF PROCEDURECALL (373, 978), (233, 35) */
            call payload_hk_store(param_hk_data);
            /* CIF NEXTSTATE (427, 1033), (125, 35) */
            NEXTSTATE PayloadDisabled;
    endstate;
    /* CIF state (1807, 19), (125, 35) */
    state PayloadDisabled;
        /* CIF input (1760, 74), (219, 35) */
        input command_on_off(param_on_off);
            /* CIF task (1657, 129), (425, 111) */
            task param_execution_report := execution_report_failed : {
    failedStartOfExecutionNotificationNotification {
        requestID request_id_distribute_on_off_device_command,
        failureNoticeData failure_notice_code_invalid_state : disabled
    }
};
            /* CIF PROCEDURECALL (1725, 260), (289, 35) */
            call report_execution(param_execution_report);
            /* CIF NEXTSTATE (1807, 315), (125, 35) */
            NEXTSTATE PayloadDisabled;
    endstate;
Rafal Babski's avatar
Rafal Babski committed
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
    /* CIF state (2038, 720), (226, 35) */
    state PayloadEnabled,PayloadDisabled;
        /* CIF input (2012, 775), (277, 35) */
        input enable_payload(param_payload_enabled);
            /* CIF decision (2065, 830), (172, 50) */
            decision param_payload_enabled;
                /* CIF ANSWER (1983, 900), (70, 24) */
                (true):
                    /* CIF task (1914, 944), (209, 35) */
                    task payload_data_enabled := false;
                    /* CIF task (1954, 999), (129, 35) */
                    task payload_data := 0;
                    /* CIF PROCEDURECALL (1901, 1049), (234, 35) */
                    call oled_turn_on_off(true, hal_success);
                    /* CIF NEXTSTATE (1956, 1104), (125, 35) */
                    NEXTSTATE PayloadEnabled;
                /* CIF ANSWER (2234, 900), (70, 24) */
                (false):
203
                    /* CIF task (2165, 944), (209, 35) */
Rafal Babski's avatar
Rafal Babski committed
204
                    task payload_data_enabled := false;
205
                    /* CIF task (2205, 999), (129, 35) */
Rafal Babski's avatar
Rafal Babski committed
206
                    task payload_data := 0;
207
                    /* CIF PROCEDURECALL (2147, 1049), (244, 35) */
Rafal Babski's avatar
Rafal Babski committed
208
                    call oled_turn_on_off(false, hal_success);
209
                    /* CIF NEXTSTATE (2207, 1104), (125, 35) */
Rafal Babski's avatar
Rafal Babski committed
210
211
212
                    NEXTSTATE PayloadDisabled;
            enddecision;
    endstate;
213
    /* CIF state (1689, 412), (125, 35) */
Rafal Babski's avatar
Rafal Babski committed
214
    state PayloadDisabled;
215
216
217
        /* CIF input (1600, 467), (304, 35) */
        input command_register_load(param_register_load);
            /* CIF task (1540, 522), (425, 104) */
Rafal Babski's avatar
Rafal Babski committed
218
219
            task param_execution_report := execution_report_failed : {
    failedStartOfExecutionNotificationNotification {
220
        requestID request_id_distribute_register_load_command,
Rafal Babski's avatar
Rafal Babski committed
221
222
223
        failureNoticeData failure_notice_code_invalid_state : disabled
    }
};
224
            /* CIF PROCEDURECALL (1608, 647), (289, 35) */
Rafal Babski's avatar
Rafal Babski committed
225
            call report_execution(param_execution_report);
226
            /* CIF NEXTSTATE (1690, 702), (125, 35) */
Rafal Babski's avatar
Rafal Babski committed
227
228
            NEXTSTATE PayloadDisabled;
    endstate;
229
    /* CIF state (1108, 373), (121, 35) */
Rafal Babski's avatar
Rafal Babski committed
230
    state PayloadEnabled;
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
        /* CIF input (1059, 428), (219, 35) */
        input command_on_off(param_on_off);
            /* CIF task (1100, 483), (137, 35) */
            task hal_success := true;
            /* CIF task (911, 533), (516, 56) */
            task for instruction in param_on_off.instructionsToDistributeAnOnoffDeviceCommand:
    call execute_onoff_instruction(instruction, hal_success);
endfor;
            /* CIF decision (1123, 609), (91, 50) */
            decision hal_success;
                /* CIF ANSWER (819, 679), (70, 24) */
                (true):
                    /* CIF task (659, 723), (389, 88) */
                    task param_execution_report := execution_report_success : {
    successfulStartOfExecutionNotificationNotification {
        requestID request_id_distribute_on_off_device_command
    }
Rafal Babski's avatar
Rafal Babski committed
248
};
249
250
251
252
253
254
255
256
257
258
259
260
261
                /* CIF ANSWER (1260, 679), (70, 24) */
                (false):
                    /* CIF task (1061, 723), (468, 104) */
                    task param_execution_report := execution_report_failed : {
    failedStartOfExecutionNotificationNotification {
        requestID request_id_distribute_on_off_device_command,
        failureNoticeData failure_notice_code_invalid_address : invalid_address
    }
};
            enddecision;
            /* CIF PROCEDURECALL (1024, 843), (289, 35) */
            call report_execution(param_execution_report);
            /* CIF NEXTSTATE (1108, 893), (121, 35) */
Rafal Babski's avatar
Rafal Babski committed
262
263
264
            NEXTSTATE PayloadEnabled;
    endstate;
endprocess Payloadmanager;