GLAST / LAT > DAQ and FSW > FSW > Doxygen Index> GRBP / dev > grbp_siu / mv2304
#include <GRBP/io/GRB_stream.h>
#include <GRBP/io/ATT_stream.h>
#include <GRBP/io/ATT_dgm.h>
#include <GRBP/GRBP_client.h>
#include <GRBP_math.h>
#include <GRBP_msgdef.h>
#include <GRBP_pktdef.h>
#include <GRBP_DB/GRBP_DB_clientSchema.h>
#include <GRBP_DB/GRBP_DB_messageSchedule.h>
#include <GRBP_DB/GRBP_DB_window.h>
#include <GRBP_DB/GRBP_DB_print.h>
#include <GRBP_DB/GRBP_DB_locationSchedule.h>
#include <GRB/GRB_siu.h>
#include <ATT/ATT.h>
#include <CDM/CDM_pubdefs.h>
#include <CMX/CMX_lookupPub.h>
#include <stdio.h>
#include <stdlib.h>
#include <EDS/TMR.h>
Classes | |
struct | _Gbm |
Controls the contents and delivery of the GBM calculation message. More... | |
struct | _Ctl |
Captures the command line parameters. More... | |
Defines | |
#define | RADIANS(_degrees) ((_degrees) * (M_PI/180)) |
Converts degrees to the equivalent number of radians. | |
Typedefs | |
typedef enum _OutStyle | OutStyle |
Typedef for enum _OutStyle. | |
typedef struct _Gbm | Gbm |
Typedef for struct _Gbm. | |
typedef struct _Ctl | Ctl |
Typedef for struct _Ctl. | |
Enumerations | |
enum | _OutStyle { OUTSTYLE_K_NONE = 0, OUTSTYLE_K_ASCII = 1, OUTSTYLE_K_BINARY = 2 } |
The output styles. More... | |
Functions | |
int | main (int argc, char *const argv[]) |
Entry point to the client side (SIU) GRBP test program. | |
int | doit (Ctl *ctl) |
Workhorse routine to feed the message and attitude files to the client-side GRBP code. | |
static int | fill_gbm (Gbm *gbm, const char *string) |
Parses the gbm options string. | |
static void * | mem_alloc (unsigned int nbytes) |
Wraps the 'real' allocator. | |
static void | mem_free (void *ptr) |
Wraps the 'real' deallocator. | |
static const void * | lookup (const char *symbol) |
Looksup the address of symbol using CMX_lookupSymbol and exits if not found. | |
static GRBP_DB_clientSchemaAll * | getSchema (int verbose) |
Returns the GRBP DB schema. | |
static const GRB_latMsgServices * | getMsgServices (OutStyle style, const char *name) |
Gets the message service vector based on the output style. | |
static void | closeMsgServices (OutStyle style) |
Closes the message services based on the style. | |
static ATT_stream * | read_att (const char *name, int flag) |
Opens and reads the specified ATT file. | |
static __inline ATT_Control * | setup_att (int size) |
Sets up the ATT record history buffer. | |
static GRB_stream * | read_grb (const char *name, int flag) |
Opens and reads the specified GRB message file. | |
static __inline unsigned long long int | get_base_time (const ATT_attitude *attitude) |
Gets the base time of the GRB. | |
static void __inline | print_msg (const GRBP_msg *msg, int flag) |
Prints the specified GRB message. | |
static void __inline | print_attitude (const ATT_attitude *attitude, int flag) |
Prints the attitude record. | |
static void __inline | print_attitude_header (int flag) |
Prints the attitude header line. | |
static void | close_fprintf (void) |
Closes the output file. | |
static void | reportUsage (void) |
Reports on the usage of grbp_siu. | |
static int | fillCtl (Ctl *ctl, int argc, char *const argv[]) |
Examines the command line parameters and fills the control structure. | |
static int | loadLib (const char *library_name, int verbose) |
Dynamically loads the specified configuration library. | |
static void | suspect_null (const GRB_latAlertMsg *alert) |
Dummy GRB LAT suspect alert message handler. | |
static void | confirm_null (int duration, double ra, double dec) |
Dummy a GRB LAT repoint request message handler. | |
static void | update_null (const GRB_latAlertMsg *alert) |
Dummy GRB LAT update alert message handler. | |
static void | closeout_null (const GRB_latAlertMsg *alert) |
Dummy GRB LAT closeout alert message handler. | |
static void | open_fprintf (const char *name) |
Opens an output file to print the alert messages to. | |
static void | suspect_fprintf (const GRB_latAlertMsg *alert) |
Print the contents of a GRB LAT suspect alert message. | |
static void | confirm_fprintf (int duration, double ra, double dec) |
Print the parameters of the repoint request. | |
static void | update_fprintf (const GRB_latAlertMsg *alert) |
Print the contents of a GRB LAT update alert message. | |
static void | closeout_fprintf (const GRB_latAlertMsg *alert) |
Print the contents of a GRB LAT closeout alert message. | |
static void | alert_fprintf (FILE *fp, const char *name, const GRB_latAlertMsg *alert) |
Print the contents of a GRB LAT a alert message. | |
Variables | |
static FILE * | AlertFp |
The file pointer to write to. |
CVS $Id: grbp_siu.c,v 1.8 2011/03/30 22:11:51 russell Exp $
#define RADIANS | ( | _degrees | ) | ((_degrees) * (M_PI/180)) |
Converts degrees to the equivalent number of radians.
_degrees | The value, in degrees, to convert to radians |
Referenced by alert_fprintf(), confirm_fprintf(), and getSchema().
enum _OutStyle |
static void alert_fprintf | ( | FILE * | fp, | |
const char * | type, | |||
const GRB_latAlertMsg * | alert | |||
) | [static] |
Print the contents of a GRB LAT a alert message.
fp | The target file pointer | |
type | An ASCII string giving the type of message, ie. one of SUSPECT, CONFIRM, UPDATE. CLOSEOUT. | |
alert | The alert message |
References RADIANS.
Referenced by closeout_fprintf(), suspect_fprintf(), and update_fprintf().
static void closeMsgServices | ( | OutStyle | style | ) | [static] |
Closes the message services based on the style.
style | The output style |
References close_fprintf(), and OUTSTYLE_K_ASCII.
Referenced by doit().
static void closeout_fprintf | ( | const GRB_latAlertMsg * | alert | ) | [static] |
Print the contents of a GRB LAT closeout alert message.
alert | The closeout alert message |
References alert_fprintf().
Referenced by getMsgServices().
static void closeout_null | ( | const GRB_latAlertMsg * | alert | ) | [static] |
Dummy GRB LAT closeout alert message handler.
alert | The closeout alert message |
Referenced by getMsgServices().
static void confirm_fprintf | ( | int | duration, | |
double | ra, | |||
double | dec | |||
) | [static] |
Print the parameters of the repoint request.
duration | Duration, in seconds, of the alert | |
ra | The right ascension, in arc minutes | |
dec | The declination, in arc minutes |
References RADIANS.
Referenced by getMsgServices().
static void confirm_null | ( | int | duration, | |
double | ra, | |||
double | dec | |||
) | [static] |
Dummy a GRB LAT repoint request message handler.
duration | Duration, in seconds, of the alert | |
ra | The right ascension, in degrees | |
dec | The declination, in degrees |
Referenced by getMsgServices().
int doit | ( | Ctl * | ctl | ) |
Workhorse routine to feed the message and attitude files to the client-side GRBP code.
ctl | The control parameters |
References ATT__timestampConvert(), _Ctl::attname, closeMsgServices(), _Ctl::gbm, _Ctl::gbm_flag, get_base_time(), getMsgServices(), getSchema(), _Ctl::grbname, GRBP__msgTime(), _GRBP_msg::hdr, lookup(), mem_alloc(), mem_free(), _Gbm::msg, _Ctl::oname, _Ctl::ostyle, print_attitude(), print_attitude_header(), _Ctl::print_cfg, print_msg(), _ATT_attitude::q, read_att(), read_grb(), setup_att(), _Gbm::time, _ATT_attitude::timestamp, _Ctl::verbose, and _ATT_attitude::w.
Referenced by main().
static int fill_gbm | ( | Gbm * | gbm, | |
const char * | string | |||
) | [static] |
Parses the gbm options string.
gbm | The Gbm structure to fill | |
string | The Gbm options string |
References _Gbm::msg, and _Gbm::time.
Referenced by fillCtl().
static int fillCtl | ( | Ctl * | ctl, | |
int | argc, | |||
char *const | argv[] | |||
) | [static] |
Examines the command line parameters and fills the control structure.
ctl | The parameter control block. | |
argc | The number of command line parameters. | |
argv | The array of pointers to the command line parameters. |
0,Everything | is okay. | |
-1,Incorrect | command usage. Usually this means that the input file name was absent. |
References _Ctl::attname, fill_gbm(), _Ctl::gbm, _Ctl::gbm_flag, _Ctl::grbname, loadLib(), _Gbm::msg, _Ctl::oname, _Ctl::ostyle, OUTSTYLE_K_ASCII, OUTSTYLE_K_BINARY, OUTSTYLE_K_NONE, _Ctl::print_cfg, reportUsage(), _Gbm::time, and _Ctl::verbose.
Referenced by main().
static __inline unsigned long long int get_base_time | ( | const ATT_attitude * | attitude | ) | [static] |
Gets the base time of the GRB.
attitude | The first attitude record |
References _ATT_timestamp::secs, and _ATT_attitude::timestamp.
Referenced by doit().
static const GRB_latMsgServices * getMsgServices | ( | OutStyle | style, | |
const char * | name | |||
) | [static] |
Gets the message service vector based on the output style.
style | The output style | |
name | The name of the output file |
References closeout_fprintf(), closeout_null(), confirm_fprintf(), confirm_null(), open_fprintf(), OUTSTYLE_K_ASCII, OUTSTYLE_K_NONE, suspect_fprintf(), suspect_null(), update_fprintf(), and update_null().
Referenced by doit().
static GRBP_DB_clientSchemaAll * getSchema | ( | int | verbose | ) | [static] |
static int loadLib | ( | const char * | library_name, | |
int | verbose | |||
) | [static] |
Dynamically loads the specified configuration library.
0,success | ||
-1,failure |
library_name | The name of the library to load | |
verbose | The verbosity level |
Referenced by fillCtl().
static const void * lookup | ( | const char * | symbol | ) | [static] |
Looksup the address of symbol using CMX_lookupSymbol and exits if not found.
symbol | The symbol to lookup |
Referenced by doit().
static void * mem_alloc | ( | unsigned int | nbytes | ) | [static] |
Wraps the 'real' allocator.
nbytes | The number of bytes |
Referenced by doit().
static void mem_free | ( | void * | ptr | ) | [static] |
static void open_fprintf | ( | const char * | name | ) | [static] |
Opens an output file to print the alert messages to.
name | The name of the output file |
Referenced by getMsgServices().
static void __inline print_attitude | ( | const ATT_attitude * | attitude, | |
int | flag | |||
) | [static] |
Prints the attitude record.
attitude | The attitude record to parse | |
flag | Flag indicating whether to print or not |
References _ATT_attitude::q, _ATT_timestamp::secs, _ATT_attitude::timestamp, and _ATT_timestamp::usecs.
Referenced by doit().
static void __inline print_attitude_header | ( | int | flag | ) | [static] |
Prints the attitude header line.
flag | Flag indicating whether to print or not |
Referenced by doit().
static __inline void print_msg | ( | const GRBP_msg * | msg, | |
int | flag | |||
) | [static] |
Prints the specified GRB message.
msg | The message to print | |
flag | The print flags |
References _GRBP_msg::bdy, _GRBP_msgBdy::dx, _GRBP_msgBdy::dy, _GRBP_msgBdy::dz, _GRBP_msgBdy::energy, GRBP__msgKey(), and GRBP__msgTime().
Referenced by doit().
static ATT_stream * read_att | ( | const char * | name, | |
int | flag | |||
) | [static] |
Opens and reads the specified ATT file.
name | The name of the file to open | |
flag | Print flag |
References ATT_STREAM_TYPE_K_FILE.
Referenced by doit().
static GRB_stream * read_grb | ( | const char * | name, | |
int | flag | |||
) | [static] |
Opens and reads the specified GRB message file.
name | The name of the file to open | |
flag | Print flag |
References GRB_STREAM_TYPE_K_FILE.
Referenced by doit().
static __inline ATT_Control * setup_att | ( | int | size | ) | [static] |
Sets up the ATT record history buffer.
size | The size of the history buffer |
Referenced by doit().
static void suspect_fprintf | ( | const GRB_latAlertMsg * | alert | ) | [static] |
Print the contents of a GRB LAT suspect alert message.
alert | The suspect alert message |
References alert_fprintf().
Referenced by getMsgServices().
static void suspect_null | ( | const GRB_latAlertMsg * | alert | ) | [static] |
Dummy GRB LAT suspect alert message handler.
alert | The suspect alert message |
Referenced by getMsgServices().
static void update_fprintf | ( | const GRB_latAlertMsg * | alert | ) | [static] |
Print the contents of a GRB LAT update alert message.
alert | The update alert message |
References alert_fprintf().
Referenced by getMsgServices().
static void update_null | ( | const GRB_latAlertMsg * | alert | ) | [static] |
Dummy GRB LAT update alert message handler.
alert | The update alert message |
Referenced by getMsgServices().