oif.c File Reference

#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <ctype.h>
#include <math.h>
#include <errno.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
#include <assert.h>
#include <signal.h>
#include "common.h"
#include "oifdefine.c"
#include "oifalert.c"
#include "omni.c"

Include dependency graph for oif.c:

Go to the source code of this file.

Defines

#define _GNU_SOURCE
#define MAX_FUZZYNESS   (600)
#define MAX_SAGEDATA_AGE   (4*86400)
#define MAX_LONGINFOS_AGE   (86400+100)
#define MAX_LONGINFOS_AGE_TIMEOUT   (10*86400+100)
#define MAX_GPS_TOP_OLDNESS   (86400+100)
#define DISK_REMAINING_THRESHOLD   (3*86400)
#define POWER_REMAINING_THRESHOLD   (3*86400)
#define INTERNAL_BATTERY_MIN_LEVEL   (6.0)
#define INTERNAL_BATTERY_MAX_LEVEL   (9.0)
#define POWER_LEVEL_THRESHOLD   (11.5)
#define REBOOT_DELAY   (86400/2)
#define MAX_STRING_LENGTH   64
#define OSIRIS_ERROR_MESSAGES   20
#define OSIRIS_ERROR_MESSAGE_LENGTH   255
#define IFNAMSIZ   16
#define STATNAMELEN   12
#define COUNT(i)   { if (acquisit_Fs##i.value.d>0) { myShi.activeChannels++; } }
#define DoItForChannel(dd)

Enumerations

enum  {
  TYPE_Y = 1, TYPE_B, TYPE_T, TYPE_F,
  TYPE_S, TYPE_O, TYPE_D, TYPE_C,
  TYPE_H, TYPE_f, TYPE_G
}

Functions

void ReadShortInfos (void)
 read the shi file and overload the curent information
int ReadField (char *line)
 read a name/value pair and store the value for the 'name' structure
void PrintField (FILE *f, char *pre, struct OsirisInformationField *field, char *post)
 print a field, with, prefix and postfix
void DumpOIF (void)
 dump the OIF fields
void PrintStaLta (FILE *f)
 print STA and LTA values
void PrintIdentification (FILE *f)
 print the general identification fields
void PrintHealth (FILE *f)
 print the time fields
void PrintTime (FILE *f)
 print the time fields
void PrintGPS (FILE *f)
 print the time fields
void PrintDisk (FILE *f)
 print the disk fields
void PrintFTP (FILE *f)
 print the ftp fields
void PrintTrigger (FILE *f)
 print the trigger fields
void PrintSLServer (FILE *f)
 print the slserver fields
void PrintLinks (FILE *f, char *name)
 insert a short local link line
void PrintAlerts (FILE *f)
 print the alert list, if any
void DumpHTML (FILE *f)
 dump the OIF structure content in a HTML file f the stream to send the html source to
int ParseOifOptions (char *cmd)
 parse the oif option
void ReadOEF (void)
 read the OEF file if defined and fill osirisErrorMessages
void CheckAlerts (struct OsirisAlert *table, char *output, char *html, char *tip)
 check for alerts and warnings
void ReadOIF (char *file)
 read the OIF and dump the HTML file set
void DumpGpsMap (void)
 dump the GPS map
void DumpTile (void)
 dump the tile
void ProcessOIF (char *file)
 dump the HTML file set

Variables

int omniMode = 0
int verboseMode = 0
int doGpsMap = 0
 print also the verboseOnly fields
int doHtml = 1
 create the GPS map
int embedHtml = 0
 dump html page
char imagePrefix [256]
 dump html without header
int alertFlag = 0
 current path, to be prepended before the image names
char osirisErrorMessage [OSIRIS_ERROR_MESSAGES][OSIRIS_ERROR_MESSAGE_LENGTH+1]
 general alert flag
char osirisAlertFile [OSIRIS_ERROR_MESSAGE_LENGTH]
char tileBaseName [OSIRIS_ERROR_MESSAGE_LENGTH]
char osirisErrorFile [OSIRIS_ERROR_MESSAGE_LENGTH]
char osirisShortInfoFile [OSIRIS_ERROR_MESSAGE_LENGTH]
int doTile = 0
struct ShortInfos myShi
struct MessageType myMessage
 short information for the current station


Define Documentation

#define _GNU_SOURCE

Definition at line 23 of file oif.c.

#define COUNT (  )     { if (acquisit_Fs##i.value.d>0) { myShi.activeChannels++; } }

Referenced by ReadShortInfos().

#define DISK_REMAINING_THRESHOLD   (3*86400)

Definition at line 48 of file oif.c.

#define DoItForChannel ( dd   ) 

Value:

if (acquisit_Sta##dd.valid) \
                { \
                        if (verboseMode) \
                        fprintf(f,"<tr ALIGN=center><td>%d</td><td>%d</td><td>%d</td><td>%d</td></tr>", \
                                        dd,acquisit_Sta##dd.value.d, \
                                        acquisit_Lta##dd.value.d, \
                                        acquisit_Fs##dd.value.d); \
                        else \
                        fprintf(f,"<tr ALIGN=center><td>%d</td><td>%d</td></tr>", \
                                        dd,\
                                        acquisit_Fs##dd.value.d); \
                }

Referenced by PrintStaLta().

#define IFNAMSIZ   16

Definition at line 118 of file oif.c.

#define INTERNAL_BATTERY_MAX_LEVEL   (9.0)

Definition at line 51 of file oif.c.

Referenced by CheckInternalBatteryLevel().

#define INTERNAL_BATTERY_MIN_LEVEL   (6.0)

Definition at line 50 of file oif.c.

Referenced by CheckInternalBatteryLevel().

#define MAX_FUZZYNESS   (600)

Definition at line 43 of file oif.c.

Referenced by CheckAcquisitDiskmgrTime(), and CheckRecordingAge().

#define MAX_GPS_TOP_OLDNESS   (86400+100)

Definition at line 47 of file oif.c.

Referenced by CheckAgeOfLastPulse().

#define MAX_LONGINFOS_AGE   (86400+100)

Definition at line 45 of file oif.c.

Referenced by CheckLastInformationTime().

#define MAX_LONGINFOS_AGE_TIMEOUT   (10*86400+100)

Definition at line 46 of file oif.c.

Referenced by CheckLastInformationTime(), CheckSageLastData(), and CheckSageLastEventList().

#define MAX_SAGEDATA_AGE   (4*86400)

Definition at line 44 of file oif.c.

Referenced by CheckSageLastData(), and CheckSageLastEventList().

#define MAX_STRING_LENGTH   64

Definition at line 55 of file oif.c.

Referenced by ReadField(), and ReadOIF().

#define OSIRIS_ERROR_MESSAGE_LENGTH   255

Definition at line 57 of file oif.c.

Referenced by CheckAlerts(), and ReadOEF().

#define OSIRIS_ERROR_MESSAGES   20

Definition at line 56 of file oif.c.

Referenced by DumpHTML(), and ReadOEF().

#define POWER_LEVEL_THRESHOLD   (11.5)

Definition at line 52 of file oif.c.

Referenced by CheckBatteryLevel().

#define POWER_REMAINING_THRESHOLD   (3*86400)

Definition at line 49 of file oif.c.

Referenced by CheckBatteryETR().

#define REBOOT_DELAY   (86400/2)

Definition at line 53 of file oif.c.

Referenced by CheckBootTime().

#define STATNAMELEN   12

Definition at line 124 of file oif.c.


Enumeration Type Documentation

anonymous enum

Enumerator:
TYPE_Y 
TYPE_B 
TYPE_T 
TYPE_F 
TYPE_S 
TYPE_O 
TYPE_D 
TYPE_C 
TYPE_H 
TYPE_f 
TYPE_G 

Definition at line 61 of file oif.c.


Function Documentation

void CheckAlerts ( struct OsirisAlert *  table,
char *  output,
char *  html,
char *  tip 
)

check for alerts and warnings

Parameters:
table the alert table to process

Definition at line 1964 of file oif.c.

References alertFlag, OSIRIS_ERROR_MESSAGE_LENGTH, PrintError, and Rename().

Referenced by ProcessOIF().

Here is the call graph for this function:

void DumpGpsMap ( void   ) 

void DumpHTML ( FILE *  f  ) 

dump the OIF structure content in a HTML file f the stream to send the html source to

Definition at line 1716 of file oif.c.

References comd_Hostid, comd_StationName, doTile, embedHtml, imagePrefix, OSIRIS_ERROR_MESSAGES, osirisErrorMessage, PrintDisk(), PrintFTP(), PrintGPS(), PrintHealth(), PrintIdentification(), PrintLinks(), PrintSLServer(), PrintStaLta(), PrintTime(), PrintTrigger(), tileBaseName, and verboseMode.

Referenced by ProcessOIF().

Here is the call graph for this function:

void DumpOIF ( void   ) 

dump the OIF fields

Definition at line 1263 of file oif.c.

References MaskToList(), OIFList, TYPE_B, TYPE_C, TYPE_D, TYPE_F, TYPE_H, TYPE_O, TYPE_S, TYPE_T, and TYPE_Y.

Here is the call graph for this function:

void DumpTile ( void   ) 

dump the tile

Definition at line 2159 of file oif.c.

References doTile, PrintError, Rename(), and tileBaseName.

Referenced by ProcessOIF().

Here is the call graph for this function:

int ParseOifOptions ( char *  cmd  ) 

parse the oif option

Parameters:
cmd the option string
Returns:
0 on success, -1 on error

Definition at line 1789 of file oif.c.

References doGpsMap, doHtml, doTile, embedHtml, imagePrefix, osirisAlertFile, osirisErrorFile, osirisShortInfoFile, PrintDebug, PrintError, tileBaseName, and verboseMode.

Referenced by ParseOptions().

void PrintAlerts ( FILE *  f  ) 

print the alert list, if any

Parameters:
f the output stream

Definition at line 1710 of file oif.c.

void PrintDisk ( FILE *  f  ) 

void PrintField ( FILE *  f,
char *  pre,
struct OsirisInformationField *  field,
char *  post 
)

print a field, with, prefix and postfix

Parameters:
f the strem to send printings to
pre the prefix, may be NULL
field the field
post the postfix, may be NULL

Definition at line 1184 of file oif.c.

References MaskToList(), omniMode, TYPE_B, TYPE_C, TYPE_D, TYPE_f, TYPE_F, TYPE_G, TYPE_H, TYPE_O, TYPE_S, TYPE_T, TYPE_Y, and verboseMode.

Referenced by PrintDisk(), PrintFTP(), PrintGPS(), PrintHealth(), PrintIdentification(), PrintSLServer(), PrintTime(), and PrintTrigger().

Here is the call graph for this function:

void PrintFTP ( FILE *  f  ) 

print the ftp fields

Parameters:
f the output stream

Definition at line 1622 of file oif.c.

References diskmgr_ftpConnection, diskmgr_ftpCurrentFile, ftpdisk_nextFtpCycle, and PrintField().

Referenced by DumpHTML().

Here is the call graph for this function:

void PrintGPS ( FILE *  f  ) 

void PrintHealth ( FILE *  f  ) 

print the time fields

Parameters:
f the output stream

Definition at line 1428 of file oif.c.

References PrintField(), sysd_AdcEnv0, sysd_AdcEnv1, sysd_AdcEnv2, sysd_AdcEnv3, sysd_AdcEnv4, sysd_BattRemaining, sysd_BattState, sysd_CPULoad, sysd_ExtBat, sysd_IntBat, sysd_IntTemp, sysd_RS232Power, sysd_SeismoPower, sysd_StartTime, and sysd_TrueIntBat.

Referenced by DumpHTML().

Here is the call graph for this function:

void PrintIdentification ( FILE *  f  ) 

void PrintLinks ( FILE *  f,
char *  name 
)

insert a short local link line

Parameters:
f 
name a local page target

Definition at line 1686 of file oif.c.

References verboseMode.

Referenced by DumpHTML().

void PrintSLServer ( FILE *  f  ) 

print the slserver fields

Parameters:
f the output stream

Definition at line 1654 of file oif.c.

References PrintField(), slserver_ChannelMask, slserver_ClientIP, slserver_IgnoreMask, slserver_ReadFrame, slserver_ReadNdx, slserver_Sequence, slserver_SLActivity, slserver_SLIOclock, slserver_SLQuality, slserver_WriteFrame, and slserver_WriteNdx.

Referenced by DumpHTML().

Here is the call graph for this function:

void PrintStaLta ( FILE *  f  ) 

print STA and LTA values

Parameters:
f the output stream

Definition at line 1317 of file oif.c.

References DoItForChannel, and verboseMode.

Referenced by DumpHTML().

void PrintTime ( FILE *  f  ) 

print the time fields

Parameters:
f the output stream

Definition at line 1470 of file oif.c.

References acquisit_ClockState, acquisit_CorrectedTime, acquisit_DeltaDspSys, acquisit_Drift, acquisit_LastDSPTimeSet, acquisit_LastGpsTop, acquisit_LastShift, acquisit_TargetShift, gpsd_GpsTime, gpsd_LastTimeSent, gpsd_LocalTimeCorrection, gpsd_SystemTime, and PrintField().

Referenced by DumpHTML().

Here is the call graph for this function:

void PrintTrigger ( FILE *  f  ) 

print the trigger fields

Parameters:
f the output stream

Definition at line 1637 of file oif.c.

References PrintField(), trigger_n1, trigger_n2, trigger_n3, and trigger_n4.

Referenced by DumpHTML().

Here is the call graph for this function:

void ProcessOIF ( char *  file  ) 

dump the HTML file set

Parameters:
file the file to read

Definition at line 2187 of file oif.c.

References AlertTable, CheckAlerts(), comd_Hostid, doHtml, DumpGpsMap(), DumpHTML(), DumpTile(), MykerinosRAlertTable, osirisAlertFile, PrintError, ReadOEF(), ReadOIF(), ReadShortInfos(), sysd_OsirisModel, and WarningTable.

Referenced by ParseOptions().

Here is the call graph for this function:

int ReadField ( char *  line  ) 

read a name/value pair and store the value for the 'name' structure

Parameters:
line the line containing the pair name/value
Returns:
-1 on error, 0 on success

Definition at line 1062 of file oif.c.

References MAX_STRING_LENGTH, OIFList, PrintDebug, PrintError, TYPE_B, TYPE_C, TYPE_D, TYPE_f, TYPE_F, TYPE_G, TYPE_H, TYPE_O, TYPE_S, TYPE_T, and TYPE_Y.

Referenced by ReadOIF().

void ReadOEF ( void   ) 

read the OEF file if defined and fill osirisErrorMessages

Definition at line 1929 of file oif.c.

References OSIRIS_ERROR_MESSAGE_LENGTH, OSIRIS_ERROR_MESSAGES, osirisErrorFile, osirisErrorMessage, and PrintError.

Referenced by ProcessOIF().

void ReadOIF ( char *  file  ) 

read the OIF and dump the HTML file set

Definition at line 2068 of file oif.c.

References gpsd_SystemTime, MAX_STRING_LENGTH, PrintError, ReadField(), sysd_BattRemaining, sysd_BattState, sysd_ExtBat, and sysd_OsirisModel.

Referenced by ParseOptions(), and ProcessOIF().

Here is the call graph for this function:

void ReadShortInfos ( void   ) 


Variable Documentation

int alertFlag = 0

current path, to be prepended before the image names

Definition at line 68 of file oif.c.

Referenced by CheckAlerts().

int doGpsMap = 0

print also the verboseOnly fields

Definition at line 64 of file oif.c.

Referenced by DumpGpsMap(), ParseOifOptions(), and PrintGPS().

int doHtml = 1

create the GPS map

Definition at line 65 of file oif.c.

Referenced by ParseOifOptions(), and ProcessOIF().

int doTile = 0

Definition at line 89 of file oif.c.

Referenced by DumpGpsMap(), DumpHTML(), DumpTile(), and ParseOifOptions().

int embedHtml = 0

dump html page

Definition at line 66 of file oif.c.

Referenced by DumpHTML(), and ParseOifOptions().

char imagePrefix[256]

dump html without header

Definition at line 67 of file oif.c.

Referenced by DumpHTML(), ParseOifOptions(), and PrintGPS().

struct MessageType myMessage

struct ShortInfos myShi

int omniMode = 0

Definition at line 59 of file oif.c.

Referenced by PrintField().

char osirisAlertFile[OSIRIS_ERROR_MESSAGE_LENGTH]

Definition at line 71 of file oif.c.

Referenced by ParseOifOptions(), and ProcessOIF().

char osirisErrorFile[OSIRIS_ERROR_MESSAGE_LENGTH]

Definition at line 73 of file oif.c.

Referenced by ParseOifOptions(), and ReadOEF().

char osirisErrorMessage[OSIRIS_ERROR_MESSAGES][OSIRIS_ERROR_MESSAGE_LENGTH+1]

general alert flag

Definition at line 70 of file oif.c.

Referenced by DumpHTML(), and ReadOEF().

char osirisShortInfoFile[OSIRIS_ERROR_MESSAGE_LENGTH]

Definition at line 74 of file oif.c.

Referenced by ParseOifOptions(), and ReadShortInfos().

char tileBaseName[OSIRIS_ERROR_MESSAGE_LENGTH]

Definition at line 72 of file oif.c.

Referenced by DumpGpsMap(), DumpHTML(), DumpTile(), ParseOifOptions(), and PrintGPS().

int verboseMode = 0


Generated on Tue Jul 22 23:11:57 2008 for Titan2Reader by  doxygen 1.5.6