00001
00002 #ifndef NDS1SOCKET_HH
00003 #define NDS1SOCKET_HH
00004
00005
00006
00007 #include "DAQC_api.hh"
00008
00087
00097 class NDS1Socket : public DAQC_api {
00098 public:
00099 using DAQC_api::Available;
00100 using DAQC_api::AddChannel;
00101 using DAQC_api::GetData;
00102
00105 NDS1Socket(void);
00106
00111 explicit NDS1Socket(const std::string& ipaddr, int ipport = DAQD_PORT,
00112 long RcvBufferLen = 16384);
00113
00116 ~NDS1Socket(void);
00117
00125 int open (const std::string& ipaddr, int ipport = DAQD_PORT,
00126 long RecvBufferLen = 16384);
00127
00130 void close();
00131
00134 void flush();
00135
00138 int AddChannel(const std::string& chan, chantype ty, double rate);
00139
00148 int Available(std::vector<DAQDChannel>& list, wait_time timeout = -1);
00149
00160 int Available(chantype chant, long gps, std::vector<DAQDChannel>& list,
00161 wait_time timeout = -1);
00162
00171 int GetData(wait_time timeout = -1);
00172
00178 long GetFrame(char *buf, long len);
00179
00187 long GetName(char *buf, long len);
00188
00198 int RequestData (unsigned long start, unsigned long duration,
00199 wait_time timeout = -1);
00200
00205 int RequestFrames();
00206
00210 int RequestNames(wait_time timeout = -1);
00211
00216 int RequestOnlineData (double stride=1.0, wait_time timeout = -1);
00217
00223 int RequestTrend (unsigned long start, unsigned long duration,
00224 bool mintrend = false, wait_time timeout = -1);
00225
00228 void RmChannel(const std::string& chan);
00229
00235 int StopWriter(void);
00236
00241 int Times(chantype chtyp, unsigned long& start, unsigned long& duration,
00242 wait_time timeout = -1);
00243
00248 int TimesTrend (unsigned long& start, unsigned long& duration,
00249 bool mintrend = false, wait_time timeout = -1);
00250
00258 int WaitforData (bool poll);
00259
00260 private:
00271 int SendRequest(const std::string& text, char *reply=0, long length=0,
00272 long *Size=0, wait_time maxwait=-1);
00273
00279 int RecvRec(char *buf, long len, bool readall=false,
00280 wait_time maxwait=-1);
00281
00282 int RecvReconfig(count_type block_len, wait_time maxwait);
00283
00289 int RecvData(wait_time timeout=-1);
00290
00294 int SendRec(const char *buffer, long length, wait_time maxwait=-1);
00295
00296 private:
00299 int mSocket;
00300
00304 bool mGetAll;
00305
00308 char mWriter[8];
00309
00312 int mOffline;
00313 };
00314
00317 #endif // DAQSOCKET_HH
00318