/*--------------------------------------------------------------------------*/ /* kwhd2.c */ /*--------------------------------------------------------------------------*/ /* kwhd2.c 2nd half: master header formatter file for DOS programs */ /* 6/10/86 1.00 change #include to proper .H file before call to decodeheader1() do hfp = fopen(hfpname,"wt"); after return from decodheader2() do fclose(hfp); */ /* for KWPARD - edit out all 'ro' items define HEADER == FALSE in kwpard.h */ /* used by kwpard, kw2asc, kwrc, kwphf */ /* HEADER == FALSE, TRUE, TRUE, TRUE */ /* not used by kwtc, kwtrig, kwntp, kwsum, kw2cnts, or kw2suds, kw2v1 */ /* 6/19/96 make all formatted headers the same, master in \kwsup\heads */ /* 7/10/96 add 'autocallout disabled for xx.rwParms.modem.flags, bit 0 and callout conditions if enabled */ /* 7/11/96 remove modem.rw.autoanswerON/OFF -- not used */ /* move cellular callout mdg to modem callout msg remove phone numbers 3: & 4: */ /* make autoanswer/autocall smarter */ /* 7/12/96 add 'off' to cellular_on_times */ /* 9/18/96 FIX: K2 cell variables not changed from copy from mwhead ! REMOVE: Sensor Response - not used */ /* 9/19/96 merged vhf1/2.c into kwhd1/2.c */ /* 3/29/97 ADD: 1.40 K2 & 1/50 MTW */ /* 3/30/97 ADD: Seismological Parms & Serial Data Stream Parms */ /* 9/22/97 H2.50 SCR 296 Fix gpsStatus decode, using '&&', s/b using '&' */ /* SCR 287 Fix limit on voterinfo array. ADD maxvoters */ /* SCR 272 FIX-CHANGE reporting of timing.local Offset */ #include "kw2asc.h" /* kw2asc.h, kwphf.h, kwpard.h, kwrc.h, qlca.h */ void decodeheader2(void) { char hb,by,by1; BYTE uby, trigtype; char string1[80],string2[80]; int i,j,k,m,hi,hi1,hi2,maxvoters; unsigned int hw,us; float hr,si; unsigned long ul; /* ----------------------------------------------- */ /* THE PREVIOUS CODE FOR THE FORMATTED HEADER */ /* IS IN KWHD1.C */ /* ------------------------------------------------ */ /* sensor response 1-6 removed 9/19/96 -- not used */ for (j = 0; j <= row; j++) { fprintf(hfp,"Ch "); // 27 for (k = 0; k < 3; k++) { if (chidx[(j*3)+k] !=0) { fprintf(hfp,"%2d",chidx[(j*3)+k]); if ((k==0) || (k==1)) { // if ((chidx[(j*3)+k+1] >= 1) && (chidx[(j*3)+k+1] <= 9)) fprintf(hfp," "); // 15 spaces // else // fprintf(hfp," "); // 15 spaces } } // for chidx } // for k fprintf(hfp,"\n"); //--- begin add 3/29/97 1.40/1.50 -------------------------------- if (headver >= 140) { fprintf(hfp,"Trigger Filter: "); // 23 for (k =0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { if ( headtype == MTW ) uby = mwhead.rwParms.channel[chidx[(j*3)+k]-1].iirTriggerFilter; else uby = k2head.rwParms.channel[chidx[(j*3)+k]-1].iirTriggerFilter; if (uby == 0) { fprintf(hfp," IIR A "); // 10 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces } if (uby == 1) { fprintf(hfp,"Classic SM"); // 10 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces } if (uby == 2) { fprintf(hfp," IIR B "); // 10 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces } } // if have chan } // for columns fprintf(hfp,"\n"); fprintf(hfp,"Trigger Type: "); // 24 for (k =0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { if ( headtype == MTW ) uby = mwhead.rwParms.channel[chidx[(j*3)+k]-1].triggerType; else uby = k2head.rwParms.channel[chidx[(j*3)+k]-1].triggerType; if (uby == 0) { fprintf(hfp,"Threshold"); // 9 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 8 spaces } if (uby == 1) { fprintf(hfp," STA/LTA "); // 9 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 8 spaces } } // if have chan } // for columns fprintf(hfp,"\n"); fprintf(hfp,"Threshold:\n"); fprintf(hfp," Trigger Threshold: "); // 23 for (k =0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { #if HEADER // not used by kwpard if ( headtype == MTW ) trigtype = mwhead.rwParms.channel[chidx[(j*3)+k]-1].triggerType; else trigtype = k2head.rwParms.channel[chidx[(j*3)+k]-1].triggerType; if (trigtype == 0) { #endif if ( headtype == MTW ) si = swap4r(mwhead.rwParms.channel[chidx[(j*3)+k]-1].triggerThreshold); else si = swap4r(k2head.rwParms.channel[chidx[(j*3)+k]-1].triggerThreshold); fprintf(hfp,"%7.3f%%FS",si*100.0); // 10 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces #if HEADER // not used by kwpard } else { fprintf(hfp," ---- "); // 10 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces } #endif } // if have chan } // for columns fprintf(hfp,"\n"); fprintf(hfp," Detrigger Threshold: "); // 23 for (k=0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { #if HEADER // not used by kwpard if ( headtype == MTW ) trigtype = mwhead.rwParms.channel[chidx[(j*3)+k]-1].triggerType; else trigtype = k2head.rwParms.channel[chidx[(j*3)+k]-1].triggerType; if (trigtype == 0) { #endif if ( headtype == MTW ) si = swap4r(mwhead.rwParms.channel[chidx[(j*3)+k]-1].detriggerThreshold); else si = swap4r(k2head.rwParms.channel[chidx[(j*3)+k]-1].detriggerThreshold); fprintf(hfp,"%7.3f%%FS",si*100.0); // 10 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces #if HEADER // not used by kwpard } else { fprintf(hfp," ---- "); // 10 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces } // if threshold trigtype == 0 #endif } // if have chan } // for columns fprintf(hfp,"\n"); fprintf(hfp,"STA/LTA:\n"); fprintf(hfp," STA Length(sec): "); // 27 for (k =0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { #if HEADER // not used by kwpard if ( headtype == MTW ) trigtype = mwhead.rwParms.channel[chidx[(j*3)+k]-1].triggerType; else trigtype = k2head.rwParms.channel[chidx[(j*3)+k]-1].triggerType; if (trigtype == 1) { #endif if ( headtype == MTW ) uby = mwhead.rwParms.channel[chidx[(j*3)+k]-1].StaSeconds; else uby = k2head.rwParms.channel[chidx[(j*3)+k]-1].StaSeconds; fprintf(hfp,"%4.1f",uby * 0.1); // 4 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 13 spaces #if HEADER // not used by kwpard } else { fprintf(hfp,"----"); // 4 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 13 spaces } #endif } // if have chan } // for columns fprintf(hfp,"\n"); fprintf(hfp," LTA Length(sec): "); // 27 for (k =0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { #if HEADER // not used by kwpard if ( headtype == MTW ) trigtype = mwhead.rwParms.channel[chidx[(j*3)+k]-1].triggerType; else trigtype = k2head.rwParms.channel[chidx[(j*3)+k]-1].triggerType; if (trigtype == 1) { #endif if ( headtype == MTW ) uby = mwhead.rwParms.channel[chidx[(j*3)+k]-1].LtaSeconds; else uby = k2head.rwParms.channel[chidx[(j*3)+k]-1].LtaSeconds; fprintf(hfp,"%3d ",uby); // 4 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 13 spaces #if HEADER // not used by kwpard } else { fprintf(hfp,"----"); // 4 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 13 spaces } // if trigtype == 1 #endif } // if have chan } // for columns fprintf(hfp,"\n"); fprintf(hfp," Trigger Ratio: "); // 26 for (k =0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { #if HEADER // not used by kwpard if ( headtype == MTW ) trigtype = mwhead.rwParms.channel[chidx[(j*3)+k]-1].triggerType; else trigtype = k2head.rwParms.channel[chidx[(j*3)+k]-1].triggerType; if (trigtype == 1) { #endif if ( headtype == MTW ) us = swap2(mwhead.rwParms.channel[chidx[(j*3)+k]-1].StaLtaRatio); else us = swap2(k2head.rwParms.channel[chidx[(j*3)+k]-1].StaLtaRatio); fprintf(hfp,"%5.1f",us*0.1); // 5 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 12 spaces #if HEADER // not used by kwpard } else { fprintf(hfp," ----"); // 5 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 12 spaces } // if trigtype == 1 #endif } // if have chan } // for columns fprintf(hfp,"\n"); fprintf(hfp," Detrigger %% of Trigger "); // 26 for (k =0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { #if HEADER // not used by kwpard if ( headtype == MTW ) trigtype = mwhead.rwParms.channel[chidx[(j*3)+k]-1].triggerType; else trigtype = k2head.rwParms.channel[chidx[(j*3)+k]-1].triggerType; if (trigtype == 1) { #endif if ( headtype == MTW ) uby = mwhead.rwParms.channel[chidx[(j*3)+k]-1].StaLtaPercent; else uby = k2head.rwParms.channel[chidx[(j*3)+k]-1].StaLtaPercent; fprintf(hfp," %3d%%",uby); // 5 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 12 spaces #if HEADER // not used by kwpard } else { fprintf(hfp," ----"); // 5 if ( (k==0) || (k==1) ) fprintf(hfp," "); // 12 spaces } #endif } // if have chan } // for columns fprintf(hfp,"\n"); } // headerver >= 1.40 else { fprintf(hfp,"Trigger Threshold: "); for (k =0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { if ( headtype == MTW ) si = swap4r(mwhead.rwParms.channel[chidx[(j*3)+k]-1].triggerThreshold); else si = swap4r(k2head.rwParms.channel[chidx[(j*3)+k]-1].triggerThreshold); fprintf(hfp,"%6.3f%FS",si*100.0); if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces } // if have chan } fprintf(hfp,"\n"); fprintf(hfp," Detrigger Threshold: "); // for (k=0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { if ( headtype == MTW ) si = swap4r(mwhead.rwParms.channel[chidx[(j*3)+k]-1].detriggerThreshold); else si = swap4r(k2head.rwParms.channel[chidx[(j*3)+k]-1].detriggerThreshold); fprintf(hfp,"%6.3f%FS",si*100.0); if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces } // if have chan } fprintf(hfp,"\n"); } // if else headver >= 140 //--- end add 3/29/97 1.40/1.50 -------------------------------- fprintf(hfp,"Alarm Trig Threshold: "); // 23 for (k=0; k<3; k++) { if (chidx[(j*3)+k] != 0) { if ( headtype == MTW ) si = swap4r(mwhead.rwParms.channel[chidx[(j*3)+k]-1].alarmTriggerThreshold); else si = swap4r(k2head.rwParms.channel[chidx[(j*3)+k]-1].alarmTriggerThreshold); fprintf(hfp,"%7.3f%%FS",si*100.0); if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces } // if have chan } fprintf(hfp,"\n"); // channel vote weights if ( headtype == MTW ) // limit checking with in allowed array size maxvoters = 21; // 18 + 3 else maxvoters = 15; // 12 + 3 fprintf(hfp," Votes: "); for (k=0; k<3; k ++) { if (chidx[(j*3)+k] != 0) { for (m = 0; m < maxvoters; m++) { if ( headtype == MTW ) { by = mwhead.rwParms.stream.voterInfo[m].type; by1 = mwhead.rwParms.stream.voterInfo[m].number; } else { by = k2head.rwParms.stream.voterInfo[m].type; by1 = k2head.rwParms.stream.voterInfo[m].number; } if ( (by == 'C') && (by1 == ((j*3)+k)) ) { if ( headtype == MTW ) hi1 = swap2(mwhead.rwParms.stream.voterInfo[m].weight); else hi1 = swap2(k2head.rwParms.stream.voterInfo[m].weight); fprintf(hfp,"%5d",hi1); break; // found the right voter_info } else if (m == (maxvoters -1)) // checked last possible place, didn't find it fprintf(hfp,"undef"); } // for m = 0 to < maxvoters if ( (k==0) || (k==1) ) fprintf(hfp," "); // 12 spaces } // if have chan } fprintf(hfp,"\n"); fprintf(hfp,"\n"); // blank line between } // for j //--- begin add 3/29/97 1.40/1.50 -------------------------------- if (headver >= K2140) { fprintf(hfp,"Anti-alias Filter:"); if ( headtype == MTW ) uby = mwhead.rwParms.stream.FilterType; else uby = k2head.rwParms.stream.FilterType; if (uby == 0) { fprintf(hfp," Non-causal"); if ( (k==0) || (k==1) ) fprintf(hfp," "); // 3 spaces } if (uby == 1) { fprintf(hfp," Causal"); if ( (k==0) || (k==1) ) fprintf(hfp," "); // 7 spaces } fprintf(hfp,"\n"); } // headver >= K2140 //--- end add 3/29/97 1.40/1.50 -------------------------------- if (headver >= K2110) // do network { if ( headtype == MTW ) hb = mwhead.rwParms.misc.networkFlag; else hb = k2head.rwParms.misc.networkFlag; hb = hb & 0x01; // bit0: 0 = master, 1 = slave if (hb == 0) fprintf(hfp,"Network Master."); else fprintf(hfp,"Network Slave."); for (m = 0; m < (maxvoters); m++) { if ( headtype == MTW ) by = mwhead.rwParms.stream.voterInfo[m].type; else by = k2head.rwParms.stream.voterInfo[m].type; if (by == 'N') // network votes { if ( headtype == MTW ) hi1 = swap2(mwhead.rwParms.stream.voterInfo[m].weight); else hi1 = swap2(k2head.rwParms.stream.voterInfo[m].weight); fprintf(hfp," Votes: %d",hi1); break; // found the right voter_info } else if (m == (maxvoters -1)) // checked last possible place, didn't find it fprintf(hfp," Votes: undefined"); } // for m = 0 to < maxvoters fprintf(hfp,"\n"); } // if headver == K2110 do network fprintf(hfp,"External Trigger:"); if ( headtype == MTW ) hb = mwhead.rwParms.misc.externalTrigger; else hb = k2head.rwParms.misc.externalTrigger; if (hb == 1) fprintf(hfp," ON, "); else fprintf(hfp," OFF, "); for (m = 0; m < (maxvoters); m++) { if ( headtype == MTW ) by = mwhead.rwParms.stream.voterInfo[m].type; else by = k2head.rwParms.stream.voterInfo[m].type; if (by == 'E') // external { if ( headtype == MTW ) hi1 = swap2(mwhead.rwParms.stream.voterInfo[m].weight); else hi1 = swap2(k2head.rwParms.stream.voterInfo[m].weight); fprintf(hfp," Votes: %d",hi1); break; // found the right voter_info } else if (m == (maxvoters -1)) // checked last possible place, didn't find it fprintf(hfp," Votes: undefined"); } // for m = 0 to < maxvoters fprintf(hfp,"\n"); for (m = 0; m < (maxvoters); m++) { if ( headtype == MTW ) by = mwhead.rwParms.stream.voterInfo[m].type; else by = k2head.rwParms.stream.voterInfo[m].type; if (by == 'K') // keyboard if defined { if ( headtype == MTW ) hi1 = swap2(mwhead.rwParms.stream.voterInfo[m].weight); else hi1 = swap2(k2head.rwParms.stream.voterInfo[m].weight); fprintf(hfp,"Keyboard Trigger Votes: %d",hi1); break; // found the right voter_info } else if (m == (maxvoters -1)) // checked last possible place, didn't find it fprintf(hfp,"Keyboard Trigger Votes: undefined"); } // for m = 0 to < maxvoters fprintf(hfp,"\n"); if ( headtype == MTW ) { hi1 = swap2(mwhead.rwParms.stream.VotesToTrigger); hi2 = swap2(mwhead.rwParms.stream.VotesToDetrigger); } else { hi1 = swap2(k2head.rwParms.stream.VotesToTrigger); hi2 = swap2(k2head.rwParms.stream.VotesToDetrigger); } fprintf(hfp,"Stream: Votes to trigger: %d, Votes to detrigger: %d\n",hi1,hi2); //......................................... fprintf(hfp,"\n"); if ( headtype == MTW ) hb = mwhead.rwParms.timing.gpsTurnOnInterval; else hb = k2head.rwParms.timing.gpsTurnOnInterval; fprintf(hfp,"GPS turn On interval: %d minutes(s).\n",hb); if ( headtype == MTW ) hb = mwhead.rwParms.timing.gpsMaxTurnOnTime; else hb = k2head.rwParms.timing.gpsMaxTurnOnTime; fprintf(hfp,"GPS maximum On time: %d minute(s)\n",hb); if ( headtype == MTW ) hi = swap2(mwhead.rwParms.timing.localOffset); // swap2() added 10/5/94 else hi = swap2(k2head.rwParms.timing.localOffset); // swap2() added 10/5/94 fprintf(hfp,"All times as set manually, or %d hour(s) from UTC if from GPS",hi); #if 0 /// out 9/22/98, not correct, localOffset only subtracted from GPS if (hi == 0) fprintf(hfp,"All event times are in local time."); else fprintf(hfp,"All times in UTC, local time is %d hour(s) to UTC.",hi); #endif fprintf(hfp,"\n"); #if HEADER // not used for kwpard if ( headtype == MTW ) hb = mwhead.roParms.timing.clockSource; else hb = k2head.roParms.timing.clockSource; switch (hb) { case 0 : fprintf(hfp,"Clock Source: RTC from cold start."); break; case 1 : fprintf(hfp,"Clock Source: Keyboard."); break; case 2 : fprintf(hfp,"Clock Source: External Reference Pulse."); break; case 3 : fprintf(hfp,"Clock Source: Internal GPS"); break; default: fprintf(hfp,"Clock Source unknown."); } fprintf(hfp,"\n"); fprintf(hfp,"GPS Status byte decoded:\n"); if ( headtype == MTW ) hb = mwhead.roParms.timing.gpsStatus; else hb = k2head.roParms.timing.gpsStatus; if ((0x01 & hb) == 0x01) // bit 0 fprintf(hfp," Currently checking for presence of GPS.\n"); if ((0x02 & hb) == 0x02) // bit 1 fprintf(hfp," GPS present.\n"); if ((0x03 & hb) == 0x00) fprintf(hfp," GPS not present.\n"); if ((0x04 & hb) == 0x04) // bit 2 fprintf(hfp," Error communicating with GPS.\n"); if ((0x08 & hb) == 0x08) // bit 3 fprintf(hfp," GPS failed to lock with gpsMaxTurnOnTime.\n"); if ((0x10 & hb) == 0x10) // bit 4 fprintf(hfp," GPS not locked.\n"); if ((0x20 & hb) == 0x20) // bit 5 fprintf(hfp," GPS power is ON.\n"); // imbedded \n fprintf(hfp,"GPS state of health byte [same as Acutime SOH byte]:\n"); if ( headtype == MTW ) hb = mwhead.roParms.timing.gpsSOH; else hb = k2head.roParms.timing.gpsSOH; if (hb == 0x00) fprintf(hfp," Doing position fixes.\n"); if (hb == 0x01) fprintf(hfp," Don't have GPS time yet.\n"); if (hb == 0x03) fprintf(hfp," PDOP is too high.\n"); if (hb == 0x08) fprintf(hfp," No usable satellites.\n"); if (hb == 0x09) fprintf(hfp," Only 1 usable satellite.\n"); if (hb == 0x0A) fprintf(hfp," Only 2 usable satellites.\n"); if (hb == 0x0B) fprintf(hfp," Only 3 usable satellites.\n"); if (hb == 0x0C) fprintf(hfp," The chosen satellite is unusable.\n"); // imbedded \n if ( headtype == MTW ) hw = swap2(mwhead.roParms.timing.gpsUpdateRTCCount); else hw = swap2(k2head.roParms.timing.gpsUpdateRTCCount); fprintf(hfp,"GPS updated the RTC %d times since last reset.\n",hw); if ( headtype == MTW ) { hi1 = swap2(mwhead.roParms.timing.gpsLastDrift[0]); hi2 = swap2(mwhead.roParms.timing.gpsLastDrift[1]); } else { hi1 = swap2(k2head.roParms.timing.gpsLastDrift[0]); hi2 = swap2(k2head.roParms.timing.gpsLastDrift[1]); } fprintf(hfp,"Drift Rate at last two RTC updates to UTC: %d & %d msec.",hi1,hi2); fprintf(hfp,"\n"); if ( headtype == MTW ) temptime = swap4i(mwhead.roParms.timing.gpsLastUpdateTime[0]); else temptime = swap4i(k2head.roParms.timing.gpsLastUpdateTime[0]); CK2Time(temptime); sprintf(string1,"%d/%d/%d (%d) %02d:%02d:%02d",m_nMonth,m_nDayOfMonth,m_nYear, m_nDayOfYear,m_nHour, m_nMin, m_nSec); if ( headtype == MTW ) temptime = swap4i(mwhead.roParms.timing.gpsLastUpdateTime[1]); else temptime = swap4i(k2head.roParms.timing.gpsLastUpdateTime[1]); CK2Time(temptime); sprintf(string2,"%d/%d/%d (%d) %02d:%02d:%02d",m_nMonth,m_nDayOfMonth,m_nYear, m_nDayOfYear,m_nHour, m_nMin, m_nSec); fprintf(hfp,"Last GPS Update times were:\n"); fprintf(hfp," %s & %s.",string1,string2); fprintf(hfp,"\n"); if ( headtype == MTW ) temptime = swap4i(mwhead.roParms.timing.gpsLastTurnOnTime[0]); else temptime = swap4i(k2head.roParms.timing.gpsLastTurnOnTime[0]); CK2Time(temptime); sprintf(string1,"%d/%d/%d (%d) %02d:%02d:%02d",m_nMonth,m_nDayOfMonth,m_nYear, m_nDayOfYear,m_nHour, m_nMin, m_nSec); if ( headtype == MTW ) temptime = swap4i(mwhead.roParms.timing.gpsLastTurnOnTime[1]); else temptime = swap4i(k2head.roParms.timing.gpsLastTurnOnTime[1]); CK2Time(temptime); sprintf(string2,"%d/%d/%d (%d) %02d:%02d:%02d",m_nMonth,m_nDayOfMonth,m_nYear, m_nDayOfYear,m_nHour, m_nMin, m_nSec); fprintf(hfp,"Last GPS TurnOn times were:\n"); fprintf(hfp," %s & %s.",string1,string2); fprintf(hfp,"\n"); if ( headtype == MTW ) temptime = swap4i(mwhead.roParms.timing.gpsLastLockTime[0]); else temptime = swap4i(k2head.roParms.timing.gpsLastLockTime[0]); CK2Time(temptime); sprintf(string1,"%d/%d/%d (%d) %02d:%02d:%02d",m_nMonth,m_nDayOfMonth,m_nYear, m_nDayOfYear,m_nHour, m_nMin, m_nSec); if ( headtype == MTW ) temptime = swap4i(mwhead.roParms.timing.gpsLastLockTime[1]); else temptime = swap4i(k2head.roParms.timing.gpsLastLockTime[1]); CK2Time(temptime); sprintf(string2,"%d/%d/%d (%d) %02d:%02d:%02d",m_nMonth,m_nDayOfMonth,m_nYear, m_nDayOfYear,m_nHour, m_nMin, m_nSec); fprintf(hfp,"Last GPS Lock times were:\n"); fprintf(hfp," %s & %s.",string1,string2); fprintf(hfp,"\n"); if ( headtype == MTW ) hw = swap2(mwhead.roParms.timing.gpsLockFailCount); else hw = swap2(k2head.roParms.timing.gpsLockFailCount); fprintf(hfp,"Count of times GPS failed to lock\n"); fprintf(hfp," within gpsMaxTurnOnTime: %d\n",hw); #endif //................................................................... fprintf(hfp,"\n"); fprintf(hfp,"\n"); fprintf(hfp,"Modem strings [ NULL TERMINATED ] from event header...\n"); if ( headtype == MTW ) fprintf(hfp," Initialization: %s\n",mwhead.rwParms.modem.initCmd); else fprintf(hfp," Initialization: %s\n",k2head.rwParms.modem.initCmd); if ( headtype == MTW ) fprintf(hfp," Dialing Prefix: %s\n",mwhead.rwParms.modem.dialingPrefix); else fprintf(hfp," Dialing Prefix: %s\n",k2head.rwParms.modem.dialingPrefix); if ( headtype == MTW ) fprintf(hfp," Dialing Suffix: %s\n",mwhead.rwParms.modem.dialingSuffix); else fprintf(hfp," Dialing Suffix: %s\n",k2head.rwParms.modem.dialingSuffix); if ( headtype == MTW ) fprintf(hfp," Hangup command: %s\n",mwhead.rwParms.modem.hangupCmd); else fprintf(hfp," Hangup command: %s\n",k2head.rwParms.modem.hangupCmd); if ( headtype == MTW ) fprintf(hfp," Callout message: %s\n",mwhead.rwParms.modem.calloutMsg); else fprintf(hfp," Callout message: %s\n",k2head.rwParms.modem.calloutMsg); // added 5/21/96 fprintf(hfp,"Cellular Phone Parameters:\n"); if ( headtype == MTW ) by = mwhead.rwParms.modem.cellOnTime; else by = k2head.rwParms.modem.cellOnTime; if (by == -1) fprintf(hfp," Power control always ON.\n"); else { if (by == 0) fprintf(hfp," Power control OFF.\n"); else fprintf(hfp," Power ON time: %d minutes.\n",by); } if ( headtype == MTW ) fprintf(hfp," WarmupTime %d seconds\n",mwhead.rwParms.modem.cellWarmupTime); else fprintf(hfp," WarmupTime %d seconds\n",k2head.rwParms.modem.cellWarmupTime); fprintf(hfp," Call-In Times: "); for (j = 0; j < 5; j++) // changed 2->5 6/10/96 { if ( headtype == MTW ) hi = swap2(mwhead.rwParms.modem.cellStartTime[j]); else hi = swap2(k2head.rwParms.modem.cellStartTime[j]); if (hi < 0) fprintf(hfp," OFF "); else { hi1 = hi /60; // get hours hi2 = hi % 60; // get minutes fprintf(hfp," %02d:%02d",hi1,hi2); } } // for j fprintf(hfp,"\n"); // end cell stuff added 5/21/96 fprintf(hfp," Phone Numbers: \n"); // remove 3 & 4 7/11/96 if ( headtype == MTW ) { fprintf(hfp," 1: %s ",mwhead.rwParms.modem.phoneNumber[0]); fprintf(hfp," 2:% s\n",mwhead.rwParms.modem.phoneNumber[1]); // fprintf(hfp," 3: %s",mwhead.rwParms.modem.phoneNumber[2]); // fprintf(hfp," 4: %s\n",mwhead.rwParms.modem.phoneNumber[3]); } else { fprintf(hfp," 1: %s",k2head.rwParms.modem.phoneNumber[0]); fprintf(hfp," 2: %s\n",k2head.rwParms.modem.phoneNumber[1]); // fprintf(hfp," 3: %s",k2head.rwParms.modem.phoneNumber[2]); // fprintf(hfp," 4: %s\n",k2head.rwParms.modem.phoneNumber[3]); } if (headver >= K2110) // k2 110, mw 120, k2 130, k2 140, mtw 150 { if ( headtype == MTW ) hi = swap2(mwhead.rwParms.modem.flags); else hi = swap2(k2head.rwParms.modem.flags); if ((hi & 0x0001) == 0x0001) { if (((hi & 0x0002) != 0x0000) || ((hi & 0x0004) != 0x0000) || ((hi & 0x0008) != 0x0000) || ((hi & 0x0010) != 0x0000) || ((hi & 0x0020) != 0x0000)) { fprintf(hfp,"Automatic callout ON.\n"); if ((hi & 0x0002) != 0x0000) fprintf(hfp," Call out on low battery voltage\n"); else fprintf(hfp," Ignore battery voltage\n"); if ((hi & 0x0004) != 0x0000) fprintf(hfp," Call out on battery charge failed\n"); else fprintf(hfp," Ignore battery charge\n"); if ((hi & 0x0008) != 0x0000) fprintf(hfp," Call out on extreme temperature\n"); else fprintf(hfp," Ignore temperature\n"); if ((hi & 0x0010) != 0x0000) fprintf(hfp," Call out on event\n"); else fprintf(hfp," Ignore event\n"); if ((hi & 0x0020) != 0x0000) fprintf(hfp," Call out on GPS lock failure\n"); else fprintf(hfp," Ignore GPS lock failure\n"); } else fprintf(hfp,"Automatic answer ON.\n"); } else fprintf(hfp,"Automatic answer/callout OFF.\n"); } if ( headtype == MTW ) hb = mwhead.rwParms.modem.waitForConnection; else hb = k2head.rwParms.modem.waitForConnection; fprintf(hfp," Wait for connection %d seconds.\n",hb); if ( headtype == MTW ) hb = mwhead.rwParms.modem.pauseBetweenCalls; else hb = k2head.rwParms.modem.pauseBetweenCalls; if (hb == 0) // added 5/21/96 fprintf(hfp," Pause random delay, 5-30 seconds, between calls.\n",hb); else fprintf(hfp," Pause %d seconds between calls.\n",hb); if ( headtype == MTW ) hb = mwhead.rwParms.modem.maxDialAttempts; else hb = k2head.rwParms.modem.maxDialAttempts; fprintf(hfp," Max dial attempts: %d.\n",hb); fprintf(hfp,"\n"); // -------- begin 1.40/1.50 ------------------- if (headver >= 140) // Seismo & SDS parameters added { fprintf(hfp,"Serial Data Stream Parameters:\n"); if ( headtype == MTW ) hi = swap2(mwhead.rwParms.stream.Timeout); else hi = swap2(k2head.rwParms.stream.Timeout); fprintf(hfp," Mode: "); if (hi == 0) { fprintf(hfp," One \n",hi); } if ((hi >= 6) && (hi <= 32766)) { fprintf(hfp," Two, Send 'Continue' every %d blocks\n",hi); } if (hi == -1) { fprintf(hfp," Three \n",hi); } if ( headtype == MTW ) uby = mwhead.rwParms.stream.DataFmt; else uby = k2head.rwParms.stream.DataFmt; fprintf(hfp," Data Format: "); if (uby == 0) { fprintf(hfp," Uncompressed\n"); } if (uby == 1) { fprintf(hfp," Compressed\n"); } if ( headtype == MTW ) hw = swap2(mwhead.rwParms.stream.BufferSize); else hw = swap2(k2head.rwParms.stream.BufferSize); fprintf(hfp," Disk Buffer Size (16K blocks): %u \n",hw); if ( headtype == MTW ) hw = swap2(mwhead.rwParms.stream.SampleRate); else hw = swap2(k2head.rwParms.stream.SampleRate); if (hw == 0) { fprintf(hfp," Transmission Sample Rate: OFF \n",hw); } else { fprintf(hfp," Transmission Sample Rate: %u \n",hw,hw); } // if samrate = 0 if ( headtype == MTW ) hw = swap2(mwhead.rwParms.stream.TxBlkSize); else hw = swap2(k2head.rwParms.stream.TxBlkSize); fprintf(hfp," Samples per Block: %u \n",hw); if ( headtype == MTW ) ul = swap4i(mwhead.rwParms.stream.TxChanMap); else ul = swap4i(k2head.rwParms.stream.TxChanMap); fprintf(hfp," Channel(s) transmitted: ",ul); for (i = 0; i < MAX_CHANNELS; i++) { if ((ul & 0x00000001) == 1) fprintf(hfp," %d",i+1); ul = ul >> 1; } fprintf(hfp,"\n"); fprintf(hfp,"\n"); } // if headver >= 140 // --------- end 1.40/1.50 ----------------------- if ( headtype == MTW ) us = swap2(mwhead.rwParms.misc.serialNumber); else us = swap2(k2head.rwParms.misc.serialNumber); fprintf(hfp,"End Altus "); if (headtype == K2) fprintf(hfp,"K2 "); else fprintf(hfp,"Mt. Whitney "); fprintf(hfp,"Header S/N %d, %s\n\n\n",us,infname); // // file, hfp, will be closed after return // } // end kwhd2.c /*--- end kwhd2.c ---------------------------------------------------*/