File: /home/oboss/Users/gec/sources/Basic_Services/Internal_PUS/pus_state.ads
1 --% Compilation Unit: PUS_State
2 --
3 --% Category: Package Declaration
4 --
5 --% Release: $Name: $
6 --
7 --% Version: $Revision: 2.2 $
8 --
9 --% Author: $Author: gec $
10 --
11 --% Revision Log:
12 -- $Log: pus_state.ads,v $
13 -- Revision 2.2 2004/02/13 16:16:27 gec
14 -- Merged results of Demonstrator development on to main OBOSS trunk.
15 --
16 -- Revision 2.1.2.1 2004/02/05 09:24:59 gec
17 -- Added share copy operation on PUS packets.
18 --
19 -- Revision 2.1 2003/11/13 14:57:33 gec
20 -- Merged ECSS Migration branch to main trunk.
21 --
22 -- Revision 2.0.8.2 2003/10/29 15:38:08 gec
23 -- Added support for management of telemetry packet subcounters.
24 --
25 -- Revision 2.0.8.1 2003/10/29 07:17:39 gec
26 -- Packet headers and data field headers updated to be compliant to ECSS
27 --+ Telemetry & Telecommand Packet Utilization standard.
28 --
29 -- Revision 2.0 2003/04/04 08:50:03 gec
30 -- Initial release of source files serving as baseline for OBOSS-III
31 --+ project.
32 --
33 -- Revision 1.1.1.1 2003/04/04 08:13:02 gec
34 -- Imported using TkCVS
35 --
36 --
37 --
38 --% Project: OBOSS
39 --
40 --% Copyright (C) 2003 by Terma A/S
41 -- Proprietary and intellectual rights of Terma A/S, Denmark,
42 -- are involved in the subject-matter of this material and
43 -- all manufacturing, reproduction, use, disclosure, and
44 -- sales rights pertaining to such subject-matter are
45 -- expressly reserved. This material is submitted for a
46 -- specific purpose as agreed, and the recipient by
47 -- accepting this material agrees that this material will
48 -- not be used, copied, or reproduced in whole or in part
49 -- nor its contents revealed in any manner or to any person,
50 -- except to meet the purpose for which it was submitted and
51 -- subject to the terms of the agreement.
52 --
53 --% Target Dependencies:
54 -- None
55 --% Compiler Dependencies:
56 -- None
57
58 --~-----------------------------------------------------------------------------
59
60 with Basic_Types;
61 with Mission_Parameters;
62 with Source_Data_Stream;
63 with Parameter_Representation;
64 with PUS;
65 with PUS_Data_Types;
66 with PUS_Packet_Manager;
67 package PUS_State is
68
69 --% Library Package:
70 -- Administration of a collection of PUS packets including operations on
71 --+ their contents
72 --% Active Tasks:
73 --> None
74 --% Passive Tasks:
75 --> None
76
77 -- Indicates that operation failed as heap of source data streams is empty
78 No_Streams_Available : exception renames Source_Data_Stream.
79 No_Streams_Available;
80 -- Indicates that operation failed as heap of internal PUS packets is empty
81 No_Packets_Available : exception renames PUS_Packet_Manager.
82 No_Resources_Available;
83
84 -- Allocation functions
85
86 --% Subprogram:
87 -- Create a new PUS packet with a given source data size
88 --% Parameter Constraints:
89 --> None
90 --% Exceptions Raised:
91 --> Satellite_Clock.Time_Not_CUC_Representable - Raised if the time-stamp
92 --+ to be used for a generated telemetry packet has no CUC
93 --+ representation.
94 --> No_Streams_Available - Heap of source data streams has been
95 --+ exhausted.
96 --> No_Packets_Available - Heap of internal PUS packets has been
97 --+ exhausted.
98
99 function Generate_PUS
100 (Pck_Type : in PUS_Data_Types.Packet_Type;
101 Sender_APID : in Mission_Parameters.APID;
102 Receiver_APID : in Mission_Parameters.APID;
103 Service : in PUS_Data_Types.Service_Name;
104 Size : in PUS_Data_Types.Source_Data_Allocation_Size)
105 return PUS.PUS_Packet;
106
107
108 --% Subprogram:
109 -- Create a new PUS packet with a given write stream as source data
110 --% Parameter Constraints:
111 --> None
112 --% Exceptions Raised:
113 --> Satellite_Clock.Time_Not_CUC_Representable - Raised if the time-stamp
114 --+ to be used for a generated telemetry packet has no CUC
115 --+ representation.
116 --> No_Packets_Available - Heap of internal PUS packets has been
117 --+ exhausted.
118
119 function Generate_PUS
120 (Pck_Type : in PUS_Data_Types.Packet_Type;
121 Sender_APID : in Mission_Parameters.APID;
122 Receiver_APID : in Mission_Parameters.APID;
123 Service : in PUS_Data_Types.Service_Name;
124 Stream : in Source_Data_Stream.Write_Stream)
125 return PUS.PUS_Packet;
126
127
128 --% Subprogram:
129 -- Create a new PUS packet with a given internal PUS packet
130 --+ implementation as its contents
131 --% Parameter Constraints:
132 --> None
133 --% Exceptions Raised:
134 --> No_Packets_Available - Heap of internal PUS packets has been
135 --+ exhausted.
136
137 function Allocate_PUS_Packet_Impl
138 (Packet_Impl : in PUS_Data_Types.PUS_Packet_Impl)
139 return PUS.PUS_Packet;
140
141 -- PUS_Packet_Not_Allocated is raised if Dispose_PUS is attempted on a PUS
142 --+ packet which itself or whose included stream is not allocated.
143 PUS_Packet_Not_Allocated : exception;
144
145
146
147 --% Subprogram:
148 -- Notes (through reference counting) a shared copy of Packet
149 --% Parameter Constraints:
150 --> None
151 --% Exceptions Raised:
152 --> PUS_Packet_Not_Allocated - Raised if the PUS packet or its included
153 --+ stream is not allocated.
154
155 procedure Share_PUS
156 (Packet : in PUS.PUS_Packet);
157
158 --% Subprogram:
159 -- Deallocates a PUS packet
160 --% Parameter Constraints:
161 --> None
162 --% Exceptions Raised:
163 --> PUS_Packet_Not_Allocated - Raised if the PUS packet or its included
164 --+ stream is not allocated.
165
166 procedure Dispose_PUS
167 (Packet : in PUS.PUS_Packet);
168
169
170 -- Extraction functions
171
172 --% Subprogram:
173 -- Checks whether a PUS packet is a telecommand packet
174 --% Parameter Constraints:
175 --> None
176 --% Exceptions Raised:
177 --> None
178
179 function Is_TC_PUS_Packet
180 (Packet : in PUS.PUS_Packet)
181 return Boolean;
182
183
184 --% Subprogram:
185 -- Checks whether a PUS packet is a telemetry packet
186 --% Parameter Constraints:
187 --> None
188 --% Exceptions Raised:
189 --> None
190
191 function Is_TM_PUS_Packet
192 (Packet : in PUS.PUS_Packet)
193 return Boolean;
194
195
196 --% Subprogram:
197 -- Extracts the type of a PUS packet, i.e. telecommand or telemetry
198 --% Parameter Constraints:
199 --> None
200 --% Exceptions Raised:
201 --> None
202
203 function Get_Packet_Type
204 (Packet : in PUS.PUS_Packet)
205 return PUS_Data_Types.Packet_Type;
206
207
208 --% Subprogram:
209 -- Extracts the receiver application process of a PUS packet
210 --% Parameter Constraints:
211 --> None
212 --% Exceptions Raised:
213 --> None
214
215 function Get_Receiver_APID
216 (Packet : in PUS.PUS_Packet)
217 return Mission_Parameters.APID;
218
219
220 --% Subprogram:
221 -- Extracts the sender application process of a PUS packet
222 --% Parameter Constraints:
223 --> None
224 --% Exceptions Raised:
225 --> None
226
227 function Get_Sender_APID
228 (Packet : in PUS.PUS_Packet)
229 return Mission_Parameters.APID;
230
231
232 --% Subprogram:
233 -- Extracts the optional packet store to which the PUS packet is
234 --+ destined
235 --% Parameter Constraints:
236 --> None
237 --% Exceptions Raised:
238 --> PUS_Data_Types.Wrong_Packet_Kind - Raised if the function is applied
239 --+ to a telecommand
240
241 function Get_Optional_Packet_Store_ID
242 (Packet : in PUS.PUS_Packet)
243 return PUS_Data_Types.Optional_Packet_Store_ID;
244
245
246 --% Subprogram:
247 -- Extracts the sequence count from a PUS packet
248 --% Parameter Constraints:
249 --> None
250 --% Exceptions Raised:
251 --> None
252 function Get_Sequence_Count
253 (Packet : in PUS.PUS_Packet)
254 return PUS_Data_Types.Sequence_Count;
255
256
257 --% Subprogram:
258 -- Extracts the service name, i.e. type and subtype, of a PUS packet
259 --% Parameter Constraints:
260 --> None
261 --% Exceptions Raised:
262 --> None
263
264 function Get_Service_Name
265 (Packet : in PUS.PUS_Packet)
266 return PUS_Data_Types.Service_Name;
267
268
269 --% Subprogram:
270 -- Extracts the service type of a PUS packet
271 --% Parameter Constraints:
272 --> None
273 --% Exceptions Raised:
274 --> None
275
276 function Get_Service_Type
277 (Packet : in PUS.PUS_Packet)
278 return PUS_Data_Types.Service_Type;
279
280
281 --% Subprogram:
282 -- Extracts the service subtype of a PUS packet
283 --% Parameter Constraints:
284 --> None
285 --% Exceptions Raised:
286 --> None
287
288 function Get_Service_Subtype
289 (Packet : in PUS.PUS_Packet)
290 return PUS_Data_Types.Service_Subtype;
291
292
293 --% Subprogram:
294 -- Extracts the acknowledgement specification of a PUS packet
295 --% Parameter Constraints:
296 --> None
297 --% Exceptions Raised:
298 --> PUS_Data_Types.Wrong_Packet_Kind - Raised if the function is applied
299 --+ to a telemetry packet
300
301 function Get_Ack_Type
302 (Packet : in PUS.PUS_Packet)
303 return PUS_Data_Types.Ack_Type;
304
305
306 --% Subprogram:
307 -- Extracts the time of a PUS packet
308 --% Parameter Constraints:
309 --> None
310 --% Exceptions Raised:
311 --> PUS_Data_Types.Wrong_Packet_Kind - Raised if the function is applied
312 --+ to a telecommand
313
314 function Get_Time
315 (Packet : in PUS.PUS_Packet)
316 return PUS_Data_Types.On_Board_Time;
317
318
319 --% Subprogram:
320 -- Extracts the internal representation of a PUS packet
321 --% Parameter Constraints:
322 --> None
323 --% Exceptions Raised:
324 --> None
325
326 function Get_PUS_Packet_Impl
327 (Packet : in PUS.PUS_Packet)
328 return PUS_Data_Types.PUS_Packet_Impl;
329
330
331
332 --% Subprogram:
333 -- Extracts the source data of a PUS packet as a write stream
334 --% Parameter Constraints:
335 --> None
336 --% Exceptions Raised:
337 --> None
338
339 function Get_Write_Stream
340 (Packet : in PUS.PUS_Packet)
341 return Source_Data_Stream.Write_Stream;
342
343
344 --% Subprogram:
345 -- Extracts the the source data of a PUS packet as a read stream
346 --% Parameter Constraints:
347 --> None
348 --% Exceptions Raised:
349 --> None
350
351 function Get_Read_Stream
352 (Packet : in PUS.PUS_Packet)
353 return Source_Data_Stream.Read_Stream;
354
355
356 -- Update procedures
357
358 --% Subprogram:
359 -- Updates the receiver application process of a PUS packet
360 --% Parameter Constraints:
361 --> None
362 --% Exceptions Raised:
363 --> None
364
365 procedure Update_Receiver_APID
366 (Packet : in PUS.PUS_Packet;
367 Application_ID : in Mission_Parameters.APID);
368
369
370 --% Subprogram:
371 -- Updates the sender application process of a PUS packet
372 --% Parameter Constraints:
373 --> None
374 --% Exceptions Raised:
375 --> None
376
377 procedure Update_Sender_APID
378 (Packet : in PUS.PUS_Packet;
379 Application_ID : in Mission_Parameters.APID);
380
381
382 --% Subprogram:
383 -- Updates the optional packet store to which the PUS packet is destined
384 --% Parameter Constraints:
385 --> None
386 --% Exceptions Raised:
387 --> PUS_Data_Types.Wrong_Packet_Kind - Raised if the function is applied
388 --+ to a telecommand
389
390 procedure Update_Packet_Store_ID
391 (Packet : in PUS.PUS_Packet;
392 Store_ID : in Mission_Parameters.Packet_Store_ID);
393
394
395 --% Subprogram:
396 -- Updates the type of a PUS packet, i.e. telecommand or telemetry
397 --% Parameter Constraints:
398 --> None
399 --% Exceptions Raised:
400 --> None
401
402 procedure Update_Packet_Type
403 (Packet : in PUS.PUS_Packet;
404 Pck_Type : in PUS_Data_Types.Packet_Type);
405
406
407 --% Subprogram:
408 -- Updates the sequence count of a PUS packet
409 --% Parameter Constraints:
410 --> None
411 --% Exceptions Raised:
412 --> None
413 procedure Update_Sequence_Count
414 (Packet : in PUS.PUS_Packet;
415 Sequence_Counter : in PUS_Data_Types.Sequence_Count);
416
417 --% Subprogram:
418 -- Updates the packet sub-counter of a PUS packet
419 --% Parameter Constraints:
420 --> Packet - Must be a telemetry source packet
421 --% Exceptions Raised:
422 --> PUS_Data_Types.Wrong_Packet_Kind - Raised iff Is_TM(Packet)
423 procedure Update_Packet_Subcounter
424 (Packet : in PUS.PUS_Packet;
425 Packet_Subcounter : in PUS_Data_Types.Packet_Subcount);
426
427
428 --% Subprogram:
429 -- Updates the service name, i.e. type and subtype, of a PUS packet
430 --% Parameter Constraints:
431 --> None
432 --% Exceptions Raised:
433 --> None
434
435 procedure Update_Service_Name
436 (Packet : in PUS.PUS_Packet;
437 Service : in PUS_Data_Types.Service_Name);
438
439
440 --% Subprogram:
441 -- Updates the service type of a PUS packet
442 --% Parameter Constraints:
443 --> None
444 --% Exceptions Raised:
445 --> None
446
447 procedure Update_Service_Type
448 (Packet : in PUS.PUS_Packet;
449 Service_Type_Val : in PUS_Data_Types.Service_Type);
450
451
452 --% Subprogram:
453 -- Updates the service subtype of a PUS packet
454 --% Parameter Constraints:
455 --> None
456 --% Exceptions Raised:
457 --> None
458
459 procedure Update_Service_Subtype
460 (Packet : in PUS.PUS_Packet;
461 Service_Subtype_Val : in PUS_Data_Types.Service_Subtype);
462
463
464 --% Subprogram:
465 -- Updates the acknowledgement specification of a PUS packet
466 --% Parameter Constraints:
467 --> Packet - Must be a telecommand
468 --% Exceptions Raised:
469 --> PUS_Data_Types.Wrong_Packet_Kind - Raised if the function is applied
470 --+ to a telemetry packet
471
472 procedure Update_Ack_Type
473 (Packet : in PUS.PUS_Packet;
474 Ack : in PUS_Data_Types.Ack_Type);
475
476
477 --% Subprogram:
478 -- Updates the complete internal representation of a PUS packet
479 --% Parameter Constraints:
480 --> None
481 --% Exceptions Raised:
482 --> None
483
484 procedure Store_PUS_Packet_Impl
485 (Packet : in PUS.PUS_Packet;
486 Packet_Impl : in PUS_Data_Types.PUS_Packet_Impl);
487
488
489 --% Subprogram:
490 -- Writes a byte array at the end of the source data of a PUS packet
491 --% Parameter Constraints:
492 --> None
493 --% Exceptions Raised:
494 --> None
495
496 procedure Image_Put
497 (Packet : in PUS.PUS_Packet;
498 Img : in Basic_Types.Byte_Array);
499
500
501 --% Subprogram:
502 -- Reads a byte array from the source data of a PUS packet
503 --% Parameter Constraints:
504 --> None
505 --% Exceptions Raised:
506 --> None
507
508 procedure Image_Get
509 (Reader : in out Source_Data_Stream.Read_Stream;
510 Img : out Basic_Types.Byte_Array)
511 renames Source_Data_Stream.Get;
512
513
514 --% Subprogram:
515 -- Writes a stream at the end of the source data of a PUS packet
516 --% Parameter Constraints:
517 --> None
518 --% Exceptions Raised:
519 --> None
520
521 procedure Stream_Append
522 (Packet : in PUS.PUS_Packet;
523 Stream : in Source_Data_Stream.Read_Stream);
524
525
526 --% Subprogram:
527 -- Updates the write stream that constitutes the source data of a PUS
528 --+ packet
529 --% Parameter Constraints:
530 --> None
531 --% Exceptions Raised:
532 --> None
533
534 procedure Update_Write_Stream
535 (Packet : in PUS.PUS_Packet;
536 Stream : in Source_Data_Stream.Write_Stream);
537
538 end PUS_State;
539
540 --~-----------------------------------------------------------------------------
541