OB.DAAC Logo
NASA Logo
Ocean Color Science Software

ocssw V2022
process_eng_packet.c
Go to the documentation of this file.
1 #include "L1A_prototype.h"
2 #include "hdf.h"
3 #include "PGS_IO_L0.h"
4 #include "EN_eng_data.h"
5 #include "PGS_SMF.h"
6 #include "PH_pkt_hdr.h"
7 #include "PGS_MODIS_35005.h"
8 
9 
11  int scan_number,
12  PH_PACKET_HEADER_t *pkt_header,
13  PGSt_IO_L0_Packet *pkt)
14 
15 /*
16 !C*****************************************************************************
17 
18 !Description: This function is a router that processes eng packets.
19 
20 !Input Parameters:
21  uint16 scan_number ** The scan number **
22  ** (counting from 1) of **
23  ** the current scan within**
24  ** the current granule **
25 
26  PH_PACKET_HEADER_t *pkt_header ** The header of the eng **
27  ** packet **
28 
29  PGSt_IO_LO_Packet *pkt ** The current eng packet **
30 
31 !Output Parameters:
32  None
33 
34 !Input/Output Parameters:
35  EN_VDATA_TYPE_t eng_data ** The Vdata array **
36  ** structure **
37 
38 Return Values:
39  None
40 
41 Externally Defined:
42  EN_VDATA_TYPE_t (EN_eng_data.h)
43  PGSt_SMF_status (PGS_SMF.h)
44  PGSt_IO_LO_Packet (PGS_IO_L0.h)
45  PH_PACKET_HEADER_t (PH_pkt_hdr.h)
46  MODIS_E_NULL_POINTER (PGS_MODIS_35005.h)
47 
48 Called By:
49  load_eng_data
50  process_a_scan
51 
52 Routines Called:
53  process_cp_hk_tlmy
54  process_sci_eng_data
55  log_fmt_msg
56 
57 !Revision History:
58  Revision 2.1 2001/01/04
59  John Seaton (seaton@ltpmail.gsfc.nasa.gov)
60  Simplified code. Removed 4 subroutine calls.
61 
62  Revision 2.0 1998/10/26 10:22 EST
63  John Seaton/SAIC/GSC (seaton@ltpmail.gsfc.nasa.gov)
64  Added calls to process Current/Prior S/C Ancillary
65  Data Vdatas, and Command Parameters Vdata.
66 
67  revision 1.0 1997/09/11 17:30:00
68  Qi Huang/RDC (qhuang@ltpmail.gsfc.nasa.gov)
69  Original development
70 
71 !Team-unique Header:
72  This software is developed by the MODIS Science
73  Data Support Team (SDST) for the National Aeronautics
74  and Space Administration (NASA), Goddard Space Flight
75  Center (GSFC), under contract NAS5-32373.
76 
77 !References and Credits:
78  None
79 
80 !Design Notes:
81  None
82 
83 !END******************************************************************************
84 */
85 {
86 
87  /*****************************************************************************/
88  /* Set char pointer routine to "process_eng_packet" */
89  /*****************************************************************************/
90 
91  char *routine="process_eng_packet";
92 
93  /*****************************************************************************/
94  /* IF pkt_header equals NULL */
95  /* THEN */
96  /* CALL log_fmt_msg to report the error in LogStatus file */
97  /* INPUTS: MODIS_E_NULL_POINTER, routine, "Packet Header is NULL" */
98  /* OUTPUTS: None */
99  /* RETURN: */
100  /* return */
101  /* ENDIF */
102  /*****************************************************************************/
103 
104  if (pkt_header == NULL) {
105  log_fmt_msg(MODIS_E_NULL_POINTER, routine, "Packet Header is NULL");
106  return;
107  }
108 
109  /*****************************************************************************/
110  /* ELSE */
111  /* IF ( pkt_header->sequence_flag == PH_PRI_SEQUENCE_FIRST_PKT_IN_GROUP) */
112  /* AND (pkt_header->pkt_type == PH_SEC_PKT_TYPE_ENG2_GROUP) */
113  /* THEN */
114  /* CALL process_cp_hk_tlmy to extract the current and prior HK telemetry*/
115  /* information from this packet and place it into the appropriate */
116  /* part of the eng_data structure */
117  /* INPUTS: eng_data, pkt, scan_number */
118  /* OUTPUTS: eng_data */
119  /* RETURN: None */
120  /* */
121  /* CALL process_group1_packet2_vdata to process the Prior/Current */
122  /* S/C Ancillary data along with the Command Procedures SDS. */
123  /* These data will be stored as vdatas. */
124  /* INPUTS: pkt, scan_number, eng_data */
125  /* OUTPUTS: eng_data */
126  /* RETURN: None */
127  /* */
128  /* CALL update_eng_data to write the Command Parameters data to the */
129  /* Vdata array (eng_data). */
130  /* INPUTS: EN_COMM_PROC_VDATA_NUMBER (49), pkt, scan_number, eng_data,*/
131  /* FALSE */
132  /* OUTPUTS: eng_data */
133  /* RETURNS: None */
134  /* */
135  /* ELSE */
136  /* */
137  /* IF (pkt_header->pkt_type == PH_SEC_PKT_TYPE_ENG1_GROUP) AND */
138  /* (pkt_header->sequence_flag == PH_PRI_SEQUENCE_SECOND_PKT_IN_GROUP)*/
139  /* THEN */
140  /* */
141  /* CALL process_sci_eng_data to process this packet */
142  /* INPUTS: eng_data, pkt, scan_number */
143  /* OUTPUTS: eng_data */
144  /* RETURN: None */
145  /* */
146  /* ENDIF */
147  /* ENDIF */
148  /* ENDELSE */
149  /*****************************************************************************/
150 
151  else {
152  if ((pkt_header->sequence_flag == PH_PRI_SEQUENCE_FIRST_PKT_IN_GROUP) &&
153  (pkt_header->pkt_type == PH_SEC_PKT_TYPE_ENG2_GROUP)) {
154  process_cp_hk_tlmy(eng_data,pkt,scan_number);
155  process_group2_packet1_vdata(pkt,eng_data);
156  update_eng_data(EN_COMM_PROC_VDATA_NUMBER,pkt,scan_number,eng_data,FALSE);
157  }
158  else
159  if ((pkt_header->pkt_type == PH_SEC_PKT_TYPE_ENG1_GROUP) &&
161  process_sci_eng_data(eng_data,pkt,scan_number);
162  }
163 
164  return;
165 }
#define FALSE
Definition: rice.h:164
#define NULL
Definition: decode_rs.h:63
#define PH_PRI_SEQUENCE_SECOND_PKT_IN_GROUP
Definition: PH_pkt_hdr.h:128
#define PH_SEC_PKT_TYPE_ENG2_GROUP
Definition: PH_pkt_hdr.h:164
void update_eng_data(uint16 index, PGSt_IO_L0_Packet *eng_packet, uint16 scan_number, EN_VDATA_TYPE_t *eng_data, int use_cp_prior_offset)
void log_fmt_msg(PGSt_SMF_status code, const char *routine, const char *msg_fmt,...)
Definition: log_fmt_msg.c:6
#define PH_PRI_SEQUENCE_FIRST_PKT_IN_GROUP
Definition: PH_pkt_hdr.h:127
void process_eng_packet(EN_VDATA_TYPE_t *eng_data, int scan_number, PH_PACKET_HEADER_t *pkt_header, PGSt_IO_L0_Packet *pkt)
#define PH_SEC_PKT_TYPE_ENG1_GROUP
Definition: PH_pkt_hdr.h:163
void process_group2_packet1_vdata(PGSt_IO_L0_Packet *pkt, EN_VDATA_TYPE_t *eng_data)
void process_sci_eng_data(EN_VDATA_TYPE_t *eng_data, PGSt_IO_L0_Packet *eng_pkt_1_2, uint16 scan_number)
#define MODIS_E_NULL_POINTER
void process_cp_hk_tlmy(EN_VDATA_TYPE_t *eng_data, PGSt_IO_L0_Packet *eng_pkt_2_1, uint16 scan_number)
#define EN_COMM_PROC_VDATA_NUMBER
Definition: EN_eng_data.h:89