File: /home/oboss/Users/gec/sources/PUS_Services/Device_Command_Distribution/device_command_parser.ads
1 --% Compilation Unit: Device_Command_Parser
2 --
3 --% Category: Package Declaration
4 --
5 --% Release: $Name: $
6 --
7 --% Version: $Revision: 2.1 $
8 --
9 --% Author: $Author: gec $
10 --
11 --% Revision Log:
12 -- $Log: device_command_parser.ads,v $
13 -- Revision 2.1 2004/02/13 16:17:16 gec
14 -- Merged results of Demonstrator development on to main OBOSS trunk.
15 --
16 -- Revision 2.0.12.2 2003/12/18 14:15:17 gec
17 -- Updated global device command distribution in accordance with 'OBOSS-III Demonstrator Specification'.
18 --
19 -- Revision 2.0.12.1 2003/12/04 13:15:07 gec
20 -- Introduced lacking redefinition of device adresses. Should have been part
21 --+ of the ECSS migration.
22 --
23 -- Revision 2.0 2003/04/04 08:50:58 gec
24 -- Initial release of source files serving as baseline for OBOSS-III
25 --+ project.
26 --
27 -- Revision 1.1.1.1 2003/04/04 08:13:11 gec
28 -- Imported using TkCVS
29 --
30 --
31 --
32 --% Project: OBOSS
33 --
34 --% Copyright (C) 2003 by Terma A/S
35 -- Proprietary and intellectual rights of Terma A/S, Denmark,
36 -- are involved in the subject-matter of this material and
37 -- all manufacturing, reproduction, use, disclosure, and
38 -- sales rights pertaining to such subject-matter are
39 -- expressly reserved. This material is submitted for a
40 -- specific purpose as agreed, and the recipient by
41 -- accepting this material agrees that this material will
42 -- not be used, copied, or reproduced in whole or in part
43 -- nor its contents revealed in any manner or to any person,
44 -- except to meet the purpose for which it was submitted and
45 -- subject to the terms of the agreement.
46 --
47 --% Target Dependencies:
48 -- None
49 --% Compiler Dependencies:
50 -- None
51
52 --~-----------------------------------------------------------------------------
53
54 with Device_Command_Distribution_Types;
55 with External_Device_Command_Distribution_Types;
56 with Verification_Types;
57 with PUS;
58 with Parser;
59 with Source_Data_Stream;
60 with PUS_Data_Types;
61 package Device_Command_Parser is
62
63 --% Library Package:
64 -- Parses telecommand related to service type 2: Device Command
65 --+ Distribution into internal representation.
66 --% Active Tasks:
67 --> None
68 --% Passive Tasks:
69 --> None
70
71 -- Definition of indices for list of device commands
72 subtype List_Length is Device_Command_Distribution_Types.List_Length;
73 subtype Command_Index is
74 List_Length range
75 1 ..
76 List_Length
77 (External_Device_Command_Distribution_Types.Max_No_Of_Commands);
78
79 -- Definition of sequence of on/off device commands
80 subtype On_Off_Command is
81 Device_Command_Distribution_Types.On_Off_Device_Addr;
82 type On_Off_Command_List is array (Command_Index range <>) of
83 On_Off_Command;
84
85 -- Internal representation of list of register load device commands
86
87 type Register_Load_Command is
88 record
89 Register_Address :
90 Device_Command_Distribution_Types.Register_Device_Addr;
91 Register_Data :
92 Device_Command_Distribution_Types.Register_Data;
93 end record;
94
95 type Register_Load_Command_List is array (Command_Index range <>) of
96 Register_Load_Command;
97
98 -- Internal representation of supported device command distribution commands
99 --+
100 type TC_Subservice is
101 (Distribute_On_Off_Commands,
102 Distribute_Register_Load_Commands);
103
104 --% Subprogram:
105 -- Update state keeping track of current progress of execution.
106 --% Parameter Constraints:
107 --> None
108 --% Exceptions Raised:
109 --> None
110
111 --% Subprogram Body:
112 -- Updates global parameter Current_Step_No.
113
114 procedure Start_New_TC_Interpretation;
115
116
117 --% Subprogram:
118 -- Route telecommand verification packet acknowledging execution stage
119 --+ Stage of command TC with status Status
120 --% Parameter Constraints:
121 --> None
122 --% Exceptions Raised:
123 --> None
124
125 procedure Verify_Stage
126 (TC : in PUS.PUS_Packet;
127 Stage : in PUS_Data_Types.Ack_Stages;
128 Status : in Verification_Types.Verification_Status);
129
130 -- Tagged type representing the various classes of device commands
131 type Device_Commands is abstract tagged null record;
132
133 --% Subprogram:
134 -- Submit telecommand TC for execution.
135 --% Parameter Constraints:
136 -- None
137 --% Exceptions Raised:
138 --> None
139 function Interpret_TC
140 (TC : PUS.PUS_Packet;
141 Cmd : Device_Commands)
142 return Boolean is abstract;
143
144
145 -- Internal representaiton of On/Off commands
146 type On_Off_Commands(Number_Of_Commands : List_Length) is new
147 Device_Commands
148 with record
149 -- Service type (2,1)
150 The_On_Off_Commands : On_Off_Command_List (1 .. Number_Of_Commands);
151 end record;
152
153 --% Subprogram:
154 -- Submit telecommand TC for execution.
155 --% Parameter Constraints:
156 --> TC - Shall be a telecommand packet
157 --> Cmd - Shall be an internal representation of the source data contained
158 --+ in TC
159 --% Exceptions Raised:
160 --> PUS_State.No_Streams_Available - Heap of source data streams has been
161 --+ exhausted
162 --> PUS_State.No_Packets_Available - Heap of PUS packets has been
163 --+ exhausted
164
165 function Interpret_TC
166 (TC : PUS.PUS_Packet;
167 Cmd : On_Off_Commands)
168 return Boolean;
169
170
171 type Register_Load_Commands(Number_Of_Commands : List_Length) is new
172 Device_Commands
173 with record
174 -- Service type (2,2)
175 The_Register_Load_Commands :
176 Register_Load_Command_List(1 .. Number_Of_Commands);
177 end record;
178
179 --% Subprogram:
180 -- Submit telecommand TC for execution.
181 --% Parameter Constraints:
182 --> TC - Shall be a telecommand packet
183 --> Cmd - Shall be an internal representation of the source data contained
184 --+ in TC
185 --% Exceptions Raised:
186 --> PUS_State.No_Streams_Available - Heap of source data streams has been
187 --+ exhausted
188 --> PUS_State.No_Packets_Available - Heap of PUS packets has been
189 --+ exhausted
190
191 function Interpret_TC
192 (TC : PUS.PUS_Packet;
193 Cmd : Register_Load_Commands)
194 return Boolean;
195
196 type Interpretation_Result is
197 (Failed,
198 Passed);
199
200 --% Subprogram:
201 -- Parse Src_Data read stream as a telecommand with service type
202 --+ (2,Service_Subtype).
203 --% Parameter Constraints:
204 --> None
205 --% Exceptions Raised:
206 --> Source_Data_Is_Inconsistent - Indicates that read stream could no be
207 --+ interpreted as a legal device command distribution telecommand.
208 function Parse_Source_Data
209 (Service_Subtype : in PUS_Data_Types.Service_Subtype;
210 Src_Data : in Source_Data_Stream.Read_Stream)
211 return Device_Commands'Class;
212
213 Device_Command_Service_Type :
214 constant PUS_Data_Types.Service_Type :=
215 PUS_Data_Types.Device_Level_Commanding;
216
217 package The_Parser is new Parser
218 (Service_Type => Device_Command_Service_Type,
219 Internal_TC_Source_Data => Device_Commands,
220 Parse_Source_Data => Parse_Source_Data);
221
222 subtype Internal_TC_Representation is
223 The_Parser.Internal_TC_Representation;
224
225 subtype Internal_TC_Representation_Failed is
226 The_Parser.Internal_TC_Representation_Failed;
227
228 subtype Internal_TC_Representation_Passed is
229 The_Parser.Internal_TC_Representation_Passed;
230
231 --% Subprogram:
232 -- Parse given telecommand packet transforming into an internal
233 --+ representation.
234 --% Parameter Constraints:
235 --> TC - Shall be a telecommand packet
236 --% Exceptions Raised:
237 --> None
238 function Parse_TC
239 (TC : PUS.PUS_Packet)
240 return Internal_TC_Representation'Class;
241
242 end Device_Command_Parser;
243
244 --~-----------------------------------------------------------------------------
245