fdhwlib
2.0.25
|
00001 /*************************************************************************** 00002 gpsclock.h - description 00003 00004 begin : Mon Aug 18 2003 00005 copyright : (C) 2003 by A Kopmann 00006 email : kopmann@ipe.fzk.de 00007 status : 00008 test : 00009 history : 00010 ***************************************************************************/ 00011 00012 00013 #ifndef GPSCLOCK_H 00014 #define GPSCLOCK_H 00015 00016 00017 #include <cstdio> 00018 #include <string> 00019 00020 #include <akutil/simpleserver.h> 00021 00022 struct captureTimeStamp { 00023 unsigned long sec; //< Value of the second counter 00024 int count; //< 80MHz count 00025 int edge; //< Falling / rising edge (0, 1) 00026 unsigned long cSec; //< Corrected time 00027 unsigned long cNanoSec; //< Corrected nano second 00028 }; 00029 00030 00031 class shell; 00032 class cmds; 00033 //class GpsClockMessage; 00034 00035 00046 class GpsClock { //: public SimpleServer { 00047 public: 00048 00049 GpsClock(); 00050 ~GpsClock(); 00051 00053 int sign(double value); 00054 00055 00057 int abs(int value); 00058 00059 00060 void displayHeader(FILE *fout, const char *title); 00061 00062 void displayStatus(FILE *fout, char *msgEa); 00063 00065 void displayInifileEntry(FILE *fout, char *name, 00066 long latitude, long longitude, long height, 00067 const char *item = "position", int comment = 0); 00068 00071 void displayCaptureBuffer(FILE *fout, int leapSecs, int nCaptured, 00072 captureTimeStamp *tCapture, int n); 00073 00075 void setLeapSeconds(int sec); 00076 00077 00079 void selftest(); 00080 00082 void receiverId(); 00083 00085 //void console(const char *device="/dev/oncore.serial.0"); 00086 00087 00089 //int read_from_client(int fdActive); 00090 00092 //int read_from_keyboard(); 00093 00095 int openDevice(const char *device="/dev/oncore.serial.0"); 00096 00098 int closeDevice(); 00099 00107 int sendMessage(std::string msg); 00108 00109 //int sendMessage(GpsClockMessage *msg); 00110 00112 void receiveMessage(char *msg, int len); 00113 00114 00116 bool showMessage(); 00117 00119 int debug; 00120 00122 //GpsClockMessage *gpsCmds[10]; 00123 00125 int getNCmds(); 00126 00128 void displayMsg(FILE *fout, unsigned char *buf, int len); 00129 00131 void displaySelftest(FILE *fout, unsigned char *buf, int len); 00132 00133 private: 00134 00136 int fd; 00137 00139 int maxStartupRetries; 00140 00141 00143 std::string line; 00144 00146 shell *sh; 00147 00149 cmds *instrSet[1]; 00150 00152 //GpsClockMessage *msgBuffer; 00153 00155 std::string actualCmd; 00156 00158 std::string::size_type actualCmdLen; 00159 00160 }; 00161 00162 #endif