00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #include <stdio.h>
00019 #include <stdlib.h>
00020 #include <string.h>
00021 #include <endian.h>
00022 #include <byteswap.h>
00023 #include <time.h>
00024
00025
00026 #include "midas.h"
00027
00028
00029 #include "mucap_compress.h"
00030 #include "common.h"
00031
00032
00033
00034 extern HNDLE hDB;
00035
00036
00037
00038
00039
00040 INT MUnCompressRawData_init(void);
00041 INT MUnCompressRawData(EVENT_HEADER*, void*);
00042
00043 ANA_MODULE MUnCompressRawData_module = {
00044 "MUnCompressRawData",
00045 "Tom Banks",
00046 MUnCompressRawData,
00047 NULL,
00048 NULL,
00049 MUnCompressRawData_init,
00050 NULL,
00051 NULL,
00052 0,
00053 NULL,
00054 };
00055
00056
00057
00058 INT MUnCompressRawData_init(void)
00059 {
00060 compress_load_all();
00061
00062 return SUCCESS;
00063 }
00064
00065
00066
00067 INT MUnCompressRawData(EVENT_HEADER *pheader, void *pevent)
00068 {
00069 int event_id = pheader->event_id;
00070
00071 int event_serial = pheader->serial_number;
00072
00073
00074
00075 int skip_threshold = 1;
00076 if (event_serial % skip_threshold !=0){
00077 printf("Event is not divisible by %d, no analysis will be done\n",skip_threshold);
00078 return ANA_SKIP;
00079 }
00080 time_t block_time = pheader->time_stamp;
00081 char fdate[] = "%Y-%m-%d", ftime[] = "%H:%M:%S";
00082 struct tm block_tm;
00083 localtime_r(&block_time, &block_tm);
00084 char sdate[100], stime[100];
00085 strftime(sdate, 100, fdate, &block_tm);
00086 strftime(stime, 100, ftime, &block_tm);
00087
00088
00089
00090 if (event_id == EVENTID_BOR ||
00091 event_id == EVENTID_EOR ||
00092 event_id == EVENTID_MESSAGE) {
00093
00094
00095
00096 } else {
00097
00098 expand_event(pevent, pevent);
00099
00100 }
00101
00102 return SUCCESS;
00103 }
00104
00105