ngc 1.4.0
 
Loading...
Searching...
No Matches
ngcdcsSRV.hpp
Go to the documentation of this file.
1
7#ifndef ngcdcsSRV_H
8#define ngcdcsSRV_H
9
10
11#ifndef __cplusplus
12#error This is a C++ include file and cannot be used from plain C
13#endif
14
15#include <ngc/core/ngcb.h>
16#include <ngc/core/ngcbShell.h>
17#include <ngc/core/ngcbSIO.hpp>
18#include <ngc/core/ngcbIFC.hpp>
20#include <ngc/core/ngcbCMD.hpp>
21#include <ngc/core/ngcbATTR.hpp>
22#include <ngc/core/ngcbDIC.hpp>
31
32#ifdef VLT_CCS
33
34/*
35 * Server states
36 */
37#include "evhStates.h"
38#define ngcdcsSTATE_OFF evhSTATE_OFF //< OFF-state
39#define ngcdcsSTATE_LOADED evhSTATE_LOADED //< LOADED-state
40#define ngcdcsSTATE_STANDBY evhSTATE_STANDBY //< STANDBY-state
41#define ngcdcsSTATE_ONLINE evhSTATE_ONLINE //< ONLINE-state
42
43/*
44 * Error definitions
45 */
46#include "ngcdcsErrors.h"
47
48#else
49
50/*
51 * Server states
52 */
53#define ngcdcsSTATE_OFF 1 //< OFF-state
54#define ngcdcsSTATE_LOADED 2 //< LOADED-state
55#define ngcdcsSTATE_STANDBY 3 //< STANDBY-state
56#define ngcdcsSTATE_ONLINE 4 //< ONLINE-state
57
58/*
59 * Error definitions
60 */
61#define ngcdcsERR_SYSTEM 1 //< general system error
62#define ngcdcsERR_IO 2 //< i/o-error
63#define ngcdcsERR_INIT 3 //< initialization error
64#define ngcdcsERR_WARNING 4 //< just a warning
65#define ngcdcsERR_FATAL 5 //< fatal error forcing exit
66#define ngcdcsERR_DB_READ 6 //< database read failed
67#define ngcdcsERR_DB_WRITE 7 //< database write failed
68#define ngcdcsERR_DB_INIT 8 //< database initialization failed
69#define ngcdcsERR_ACQ_IO 9 //< acquisition process i/o-error
70#define ngcdcsERR_ACQ_OVERRUN 10 //< run-time error: buffer overrun
71#define ngcdcsERR_ACQ_OVERFLOW 11 //< run-time error: FIFO overflow
72#define ngcdcsERR_ACQ_EXEC 12 //< acquisition process exec failed
73#define ngcdcsERR_EXP_IO 13 //< exposure data chain i/o-error
74#define ngcdcsERR_EXP_FILE 14 //< exposure file i/o-error
75#define ngcdcsERR_EXP_PROC 15 //< exposure post-processing error
76#define ngcdcsERR_ACCESS 16 //< missing access rights
77#define ngcdcsERR_MERGE 17 //< data merging failed
78#define ngcdcsERR_CLDC 18 //< CLDC protection error
79#define ngcdcsERR_AOBIAS 19 //< AOBIAS protection error
80#define ngcdcsERR_NGSDBIAS 20 //< NGSDBIAS protection error
81
82#endif
83
87#define ngcdcsGUI_DEFAULT "ngcgui"
88
89/*
90 * Server sub-states
91 */
92#define ngcdcsSUBSTATE_NONE 0 //< not yet set (unknown)
93#define ngcdcsSUBSTATE_IDLE 1 //< idle
94#define ngcdcsSUBSTATE_BUSY 2 //< busy
95#define ngcdcsSUBSTATE_ACTIVE 6 //< exposure active
96#define ngcdcsSUBSTATE_ERROR 8 //< error
97
98#define ngcdcsSUBSTATE_READY 3 //< ready
99#define ngcdcsSUBSTATE_NOT_READY 4 //< not ready
100#define ngcdcsSUBSTATE_INIT 5 //< initializing
101#define ngcdcsSUBSTATE_RECOVER 7 //< recovering
102#define ngcdcsSUBSTATE_RUNNING 9 //< acquisition running
103
104/*
105 * Server operational modes
106 */
107#define ngcdcsOPMODE_NORMAL 0 //< normal mode (accessing DFE)
108#define ngcdcsOPMODE_HWSIM 1 //< simulation mode (accessing DWS, no DFE)
109#define ngcdcsOPMODE_LCUSIM 2 //< simulation mode (local simulation, no DWS)
110
114#define ngcdcsMERGE_MAX_PROC 4
115
119#define ngcdcsMAX_LOG 50
120
121/*
122 * Log levels
123 */
124#define ngcdcsLOG_INFO 0 //< informal log
125
126/*
127 * Error test cases
128 */
129#define ngcdcsTESTERR_BLOCK 0x800 //< service blocks forever
130
135 int fd; //< File descriptor for reply
136 int id; //< Waiter id
137
139 ngcdcs_wait_t() {fd = -1; id = 0;}
140
142 virtual ~ngcdcs_wait_t() {}
143};
144
149 struct timeval startTime; //< Server start time
150 unsigned int nExpStart; //< Number of exposures started
151 unsigned int nExpCompl; //< Number of exposures completed
152 unsigned int nExpAbort; //< Number of exposures aborted
153 unsigned int nExpFail; //< Number of exposures failed
154 unsigned int nFram; //< Number of processed data frames
155 unsigned int nFile; //< Number of files stored
156
160 nExpStart = 0; nExpCompl = 0; nExpAbort = 0; nExpFail = 0;
161 nFram = 0; nFile = 0;
162 }
163};
164
169{
170public:
171 int id; //< Event id
172 int devices; //< Device list (32-bit list)
173 int status; //< Event status
174
177
179 explicit ngcdcsEVT(int i) {id = i; devices = 0x0; status = ngcbEVT_PENDING;}
180
182 ngcdcsEVT(int i, int d) {id = i; devices = d; status = ngcbEVT_PENDING;}
183
185 virtual ~ngcdcsEVT() {}
186
187protected:
188private:
189};
190
195{
196public:
197 ngcbSERVICE *services; //< System services
198 int verboseLevel; //< Verbose level
199 int logLevel; //< Logging level
200
203 verboseLevel(0),
204 logLevel(0),
205 id_((ngcb_alarm_id)0L) {}
206
208 virtual ~ngcdcsALARM_SYS() {}
209
212 Store(a, ++id_);
213 if (services != NULL)
214 {
215 char logMsg[512];
216 sprintf(logMsg, "ALARM(%s)-%lu: %s (%s)\n", a->Name(), id_,
217 a->Msg(), a->Value(1));
218 if (verboseLevel > 0) services->Logger(ngcbVB_PRINT, logMsg);
219 services->Logger(ngcbVB_LOG, logMsg); // we always log the alarm
220 }
221 return (id_);
222 }
223
226 ngcbALARM *a = Get(id);
227 if (a != NULL)
228 {
229 if ((services != NULL) && ((verboseLevel > 0) || (logLevel > 0)))
230 {
231 char logMsg[64];
232 sprintf(logMsg, "ALARM(%s)-%lu: cancelled\n", a->Name(), id);
233 if (verboseLevel > 0) services->Logger(ngcbVB_PRINT, logMsg);
234 if (logLevel > 0) services->Logger(ngcbVB_LOG, logMsg);
235 }
236 }
237 Remove(id);
238 }
239
242 ngcbALARM *a = Get(id);
243 if (a != NULL)
244 {
245 a->Ack();
246
247 if ((services != NULL) && ((verboseLevel > 0) || (logLevel > 0)))
248 {
249 char logMsg[64];
250 sprintf(logMsg, "ALARM(%s)-%lu: acknowledged\n", a->Name(), id);
251 if (verboseLevel > 0) services->Logger(ngcbVB_PRINT, logMsg);
252 if (logLevel > 0) services->Logger(ngcbVB_LOG, logMsg);
253 }
254 }
255 Remove(id);
256 }
257
258protected:
259private:
261 ngcb_alarm_id id_;
262};
263
267class ngcdcsSRV: public ngcbSIO, public ngcbCMD_SRV, private ngcdcsACQ_SERVICE
268{
269public:
271 ngcdcsSRV();
272
274 explicit ngcdcsSRV(ngcdcsCTRL *controller);
275
277 virtual ~ngcdcsSRV();
278
279
280 /*
281 * System configuration
282 */
283
286
289
291 char thisHost[64];
292
295
298
301
303 int EvtAddWait(int fd, int id);
304
307
309 char configDir[256];
310
312 int CfgPath(char *path, const char *cfgFile);
313
315 int ConfigureSystem(ngcdcs_syscfg_t newCfg, int copy = 1);
316
318 int Check(const ngcdcs_syscfg_t &cfg);
319
321 int SysCfg(const char *cfgFile);
322
324 void SysCfgDefault(const char *cfg);
325
327 int InitSysCfg(const char *cfgFile);
328
330 int StoreCfg(const char *fileName);
331
332
333 /*
334 * System shutdown
335 */
336
338 void Release();
339
341 void Shutdown();
342
344 FILE *watchdog;
345
346
347 /*
348 * System info
349 */
350
352 void Info(char *s);
353
355 void SysInfo(char *s);
356
358 void ModInfo(char *s);
359
361 void BoardInfo(char *s);
362
364 int AdcInfo(int id, char *s);
365
367 int AcqInfo(int id, char *s);
368
370 void RpcTranslate(void *payload, size_t size, int request, int how, char *s);
371
373 void CheckDev(int idx, char *s);
374
376 int GetPat(int id, int num, char *s);
377
379 int GetPrg(int id, int num, char *s);
380
382 int CheckTriggerPeriod(int id, double period);
383
384
385 /*
386 * Detector configuration
387 */
388
391
393 int Check(const ngcdcs_detcfg_t &cfg);
394
396 int DetCfg(const char *cfgFile);
397
398
399 /*
400 * Controller Interface
401 */
402
405
408
410 int RouteComp(ngcbMOD *, ngcbMOD *);
411
414
417
418
419 /*
420 * Acquisition module
421 */
422
425
428
430 int FrameHandler(void *buffer, ngcdcs_finfo_t *finfo, char *erms);
431
433 int FitsMerger(ngcbFITS *hdr, char *erms);
434
436 int Statistics(int id, char *s);
437
439 int AcqProc(int id, const char *procName);
440
442 int Rtd(int idx);
443
445 int FrameGen(int id, const char *name, int flag);
446
448 int FrameStore(int id, const char *name, int flag);
449
451 int FrameLocal(int id, const char *name, int flag);
452
454 int FrameExport(int id, const char *name, int flag);
455
457 int FrameBreak(int id, const char *name, int n);
458
460 int FrameWin(int id, const char *name, int sx, int sy, int nx, int ny);
461
463 void GetFrames(int id, char *s);
464
465
466 /*
467 * Read-out modes
468 */
469
472
474 char readModeName[64];
475
478
480 int ReadModeIdx(int id);
481
483 int ReadModeIdx(const char *name);
484
486 int ReadMode(int idx);
487
488
489 /*
490 * Exposure handling
491 */
492
495
498
500 int FitsBlock();
501
503 int PrepareFits(int refresh = 1);
504
506 int DumpFits(const char *fileName = NULL);
507
509 int CheckExp();
510
512 void ExpStatus(unsigned int newStat, const char *erms = NULL);
513
515 void ExpStatus2String(char *s, int stat);
516
518 void ExpStatus2String(char *s);
519
521 char *ExpStatusString();
522
524 int RecStart(const char *id, double absTime = 0.0);
525
527 int ExpStart(int acqId = 0, double absTime = 0.0);
528
530 int ExpAbort(int acqId = 0);
531
533 int ExpEnd(int acqId = 0);
534
536 int ExpPause(int id = 0);
537
539 int ExpCont(int id = 0);
540
542 int ExpAddWait(int fd, int id);
543
545 void ExpPoll();
546
548 int PostProcEnabled();
549
551 void Publish(const ngcdcs_exp_topic &topic);
552
554 uint64_t FramesProcessed();
555
557 uint64_t SizeRecorded();
558
560 double TimeElapsed();
561
563 double RemainingTime();
564
565
566 /*
567 * Exposure driver
568 */
569
572
574 void ExpDrvStatus(unsigned int newStat);
575
577 int ExpDrvLoad(const char *module, const char *name = NULL);
578
580 int ExpDrvUnload(const char *name, const char *symbol = NULL);
581
583 int ExpDrvUnload();
584
586 int ExpDrvLoaded(const char *module);
587
589 int ExpDrvCfg(const char *s);
590
592 void ExpDrvList(char *s);
593
595 void ExpDrvModList(char *s);
596
598 char expDrvFeedBack[128];
599
601 int ExpDrvSelect(const char *name);
602
604 int ExpDrvClose();
605
607 int ExpDrvStart();
608
610 int ExpDrvAbort();
611
613 int ExpDrvAddWait(int fd);
614
615
616 /*
617 * Data merger
618 */
619
622
625
628
631
634
637
640
642 char mergeArg[128];
643
645 virtual void MergeReset(int relaunch = 0);
646
648 virtual int MergeStart(const char *name, int display, int id, int cleanup=0);
649
651 virtual int MergeStop(int id);
652
654 virtual int MergeStatus(int id, char *stat = NULL);
655
657 virtual int MergeMsg(int id, char *msg);
658
660 virtual void MergeNext();
661
663 int MergeAlign();
664
665
666 /*
667 * Server state
668 */
669
671 char opMode[32];
672
675
677 int state;
678
680 char stateString[32];
681
683 void State(int newState, int update = 1);
684
687
689 char subStateString[32];
690
692 void SubState(int newState);
693
695 void ClearSubState();
696
698 int ErrState();
699
701 int OpMode(int level);
702
704 int OpMode(const char *mode);
705
708
711
714
717
720
722 void DevPoll();
723
725 int HaveLocalEvents();
726
728 virtual void Query();
729
731 virtual void PollStatConfigure(int enable, int interval);
732
734 virtual void HiResTimer(int enable);
735
737 void FatalError(const char *erms);
738
740 int FatalError();
741
743 double LifeTime();
744
746 int Disable();
747
749 int NeedEnableCycle();
750
752 int Enable(int check);
753
755 int Off();
756
758 int Recover();
759
761 int ResetDfe();
762
764 int ResetSensors();
765
766
767 /*
768 * Server setup
769 */
770
772 void Profile(const char *name = NULL);
773
775 void ProcName(const char *name);
776
778 const char *ProcName();
779
781 void PrintUsage();
782
784 int ParseArguments(int argc, char **argv);
785
787 const char *Version();
788
790 void ExportVersion(const char *newVersion);
791
793 void Port(int port);
794
796 void Instance(const char *name);
797
799 char *Instance();
800
802 void ExecShell(const char *name);
803
805 const char *DicList();
806
808 char *ErrMsg();
809
811 void SaveErr(const char *erms);
812
814 const char *LastErr();
815
817 int ShutdownService(int port);
818
820 char gui[256];
821
822
823 /*
824 * Verbose output and logging
825 */
826
829
832
835
838
840 void Logger(int flag, const char *msg);
841
843 int Xterm();
844
846 int VerboseLevel();
847
849 void VerboseLevel(int level);
850
852 int LogLevel();
853
855 void LogLevel(int level);
856
858 void Verbose(int level, const char *format, ...)
859 __attribute__ ((format(printf, 3, 4)));
860
862 void Verbose(const char *fromat, ...)
863 __attribute__ ((format(printf, 2, 3)));
864
866 void Log(int level, const char *format, ...)
867 __attribute__ ((format(printf, 3, 4)));
868
870 void Log(const char *format, ...)
871 __attribute__ ((format(printf, 2, 3)));
872
874 void ErrLog(int severity, const char *format, ...)
875 __attribute__ ((format(printf, 3, 4)));
876
878 void Print(const char *format, ...)
879 __attribute__ ((format(printf, 2, 3)));
880
882 void AddLog(const char *format, ...)
883 __attribute__ ((format(printf, 2, 3)));
884
886 int ConfigureLogging(int vb, int log, int xt);
887
889 int DebugStream(int flag);
890
892 void BroadcastAlarm(const char *msg);
893
895 void ClrLog();
896
898 void CatLog(char *s);
899
900
901 /*
902 * Module event handlers
903 */
904
906 void DeviceEvent(void *origin, void *event);
907
909 void DevError(const char *erms, int id, void *descriptor);
910
912 void AcqError(const char *erms, int id, void *descriptor);
913
914
915 /*
916 * Database
917 */
918
920 char dbPoint[256];
921
923 void DisableDbMirror();
924
926 int DbAdd(ngcbATTR *attr);
927
929 void DbExport();
930
932 int DbConfigure();
933
935 int Update();
936
938 virtual void DbLock();
939
941 virtual void DbUnlock();
942
943
944 /*
945 * Command services
946 */
947
949 int AddCmd(const char *cmd, ngcb_function_t function, int flags,
950 const char *syntax, const char *help);
951
953 void DelCmd(const char *cmd);
954
956 int Execute(const char *cmd, char *reply, int protect = 0, int fd = -1);
957
959 int Execute(const char *cmd, int protect = 0, int fd = -1);
960
962 int Macro(const char *fileName, char *reply, int protection = 0);
963
965 int SimError(int error, int idx = 0);
966
967
968 /*
969 * Server main-loop
970 */
971
973 virtual void ExitSignal(int sig);
974
976 int Initialize();
977
979 int Reset();
980
982 void Abort();
983
985 int InMainLoop();
986
988 int SrvPortOrig();
989
991 int CoreShell();
992
994 int MainLoop();
995
997 void LockService();
998
1000 void UnlockService();
1001
1002
1003 /*
1004 * Run-Control
1005 */
1006
1009
1011 int AcqStop(int id = 0);
1012
1014 int AcqStart(int id = 0);
1015
1017 int SeqIdle(int id = 0);
1018
1020 int SeqWaiting();
1021
1023 int SeqStop(int id = 0);
1024
1026 int SeqStart(int id = 0, struct timeval *ts = NULL, double absTime = 0.0);
1027
1029 int SeqTrigger(int id);
1030
1032 int SeqPause(int id = 0);
1033
1035 int SeqContinue(int id = 0);
1036
1038 int SeqBreak(int id = 0);
1039
1041 int SeqWait(int id, int event, int timeout, int interval);
1042
1044 void ClearState(int id = 0);
1045
1047 void StoreState();
1048
1050 int RestoreState();
1051
1053 int ShutterAction(int id, const char *action, char *reply);
1054
1056 int TecAction(int id, const char *action, char *reply);
1057
1059 int SvsAction(int id, const char *action, char *reply);
1060
1061
1062 /*
1063 * Parameter handling
1064 */
1065
1068
1071
1073 int ParamDefault();
1074
1076 int LoadSetup(const char *fileName, char **list, int *listLength,
1077 int max = -1);
1078
1080 int LoadSetup(const char *fileName);
1081
1083 ngcbPARAM *ParamDefine(const char *name, const char *value, int id,
1084 int *status = NULL);
1085
1087 int ParamDefine(const char *name, const char *value, const char *unit);
1088
1090 void ParamUndefine(const char *name, int id);
1091
1093 int SetupList(const char *paramBuf);
1094
1096 int SetupList(char **paramBuf, int size);
1097
1099 int SetupList(ngcbPARAM_LIST *list);
1100
1102 int SetupParam(const char *name, const char *value);
1103
1105 int StatusList(const char *list, char *reply);
1106
1108 int StatusList(char **list, int size, char *reply);
1109
1111 int StatusParam(const char *name, char *value);
1112
1114 int ParamLookup(const char *name, char *value);
1115
1118
1119
1120 /*
1121 * Module factories
1122 */
1123
1125 ngcdcsCLDC *CldcMod(const char *spec, ngcbIFC *dev,
1126 const ngcb_route_t &route,
1127 int nc, int nb, double extRef);
1128
1130 ngcdcsSEQ *SeqMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route,
1131 ngcbPARAM_LIST *p);
1132
1134 ngcdcsADC *AdcMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route,
1135 int num, int bitPix);
1136
1138 virtual ngcdcsSHUTTER *ShutterMod(const char *spec, ngcbIFC *dev,
1139 const ngcb_route_t &route);
1140
1142 virtual ngcdcsPREAMP *PreampMod(const char *spec, ngcbIFC *dev,
1143 const ngcb_route_t &route);
1144
1146 ngcdcsNGC2 *NGC2Mod(const char *spec, ngcbIFC *dev,
1147 const ngcb_route_t &route);
1148
1150 ngcdcsAO *AOMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route);
1151
1153 ngcdcsLISA *LISAMod(const char *spec, ngcbIFC *dev,
1154 const ngcb_route_t &route);
1155
1157 ngcdcsNGSD *NGSDMod(const char *spec, ngcbIFC *dev,
1158 const ngcb_route_t &route, double extRef);
1159
1161 ngcdcsTEC *TECMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route);
1162
1164 ngcdcsSVS *SVSMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route);
1165
1167 ngcdcsSCA *ScaMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route,
1168 ngcbPARAM_LIST *p);
1169
1171 ngcdcsACQ *AcqMod(const char *spec, const ngcdcs_acq_cfg_t &cfg,
1172 ngcbPARAM_LIST *p);
1173
1174
1175 /*
1176 * ASIC mapping
1177 */
1178
1181
1184
1186 ngcdcsSEQ0* SeqFn(int idx);
1187
1189 ngcdcsCLDC0* CldcFn(int idx);
1190
1191
1192 /*
1193 * CLDC functions
1194 */
1195
1197 int CldcEnable(int id);
1198
1200 int CldcDisable(int id);
1201
1203 int CldcDefault(int id);
1204
1206 int CldcCheck(int id);
1207
1209 int CldcCalibrate(int id);
1210
1212 int CldcClearCalibration(int id);
1213
1215 int CldcRestore(int id, const char *key = NULL);
1216
1218 int Snapshot(int id, char *s);
1219
1221 int Telemetry(int id, char *s);
1222
1224 void Voltages(ngcdcsCLDC0 *mod, char *s);
1225
1226
1227 /*
1228 * Selftests
1229 */
1230
1232 int SelftestCldc(int id);
1233
1235 int SelftestSeq(int id);
1236
1238 int SelftestAdc(int id);
1239
1241 int SelftestShutter(int id);
1242
1244 int SelftestPreamp(int id);
1245
1247 int SelftestSca(int id);
1248
1250 int SelftestAcq(int id);
1251
1252protected:
1254 virtual ngcbCMD_LIST *CreateCmdList();
1255
1257 virtual void InstallSignalHandlers();
1258
1260 virtual int ResolvePath(char *resolved, const char *fileName);
1261
1263 virtual void SysCfgOverride(ngcdcs_syscfg_t *newCfg);
1264
1266 virtual int ConfigureSystemCB1(ngcdcs_syscfg_t &newCfg);
1267
1269 virtual int ConfigureSystemCB2(ngcdcs_syscfg_t &newCfg);
1270
1272 virtual int LoadSysCfg(ngcdcs_syscfg_t *newCfg, const char *fileName);
1273
1275 virtual int LoadDetCfg(ngcdcs_detcfg_t *newCfg, const char *fileName);
1276
1278 virtual void ShutdownSystemCB1();
1279
1281 virtual void ShutdownSystemCB2();
1282
1284 virtual void MergeInit();
1285
1287 virtual int LookupCB(const char *paramName, char *value);
1288
1291
1293 virtual int FrameHandlerCB(void *buffer, ngcdcs_finfo_t *finfo, char *erms);
1294
1296 virtual int FitsMergerCB(ngcbFITS *hdr, char *erms);
1297
1299 int HandleExpEvt();
1300
1302 virtual int ExpStartCB();
1303
1305 virtual int ExpCountDownCB();
1306
1308 ngcdcsEXPDRV *ExpDrv(const char *name, const ngcb_fb_t &feedBackChannel);
1309
1311 virtual void AgEvent(int acqInst, ngcdcs_2ag_t ag, int errorId,
1312 const char *erms);
1313
1315 virtual void ErrorEvent(int id, const char *erms);
1316
1318 virtual void ErrLogEvent(int id, const char *erms);
1319
1321 virtual void VerboseCB(const char *msg, int level = ngcdcsLOG_INFO);
1322
1324 virtual void LogCB(const char *msg, int level = ngcdcsLOG_INFO);
1325
1327 virtual void DbLogCB(const char *msg);
1328
1330 void DbLog(const char *format, ...)
1331 __attribute__ ((format(printf, 2, 3)));
1332
1334 virtual int DbConfCB();
1335
1337 virtual int DbUpdateCB();
1338
1340 virtual void PublishExpEvent(int errorId, unsigned int newStat,
1341 const char *fileName, int merge,
1342 const char *erms);
1343
1345 virtual void PublishLogPars();
1346
1348 virtual void PublishState();
1349
1351 virtual void PublishSubState();
1352
1354 virtual void PublishExpDrvStatus();
1355
1356
1357 /*
1358 * TCP/IP services
1359 */
1360
1362 virtual int AddSockCB(int fd);
1363
1365 virtual int DelSockCB(int fd);
1366
1367
1368 /*
1369 * Module creation hooks
1370 */
1371
1373 virtual ngcdcsCLDC *MakeCLDC(ngcbIFC *dev, const ngcb_route_t &route,
1374 int nc, int nb);
1375
1377 virtual ngcdcsC20B20 *MakeC20B20(ngcbIFC *dev, const ngcb_route_t &route,
1378 int nc, int nb);
1379
1381 virtual ngcdcsB24 *MakeB24(ngcbIFC *dev, const ngcb_route_t &route, int nb);
1382
1384 virtual ngcdcsC24 *MakeC24(ngcbIFC *dev, const ngcb_route_t &route);
1385
1387 virtual ngcdcsAPD *MakeAPD(ngcbIFC *dev, const ngcb_route_t &route, int nb);
1388
1390 virtual ngcdcsAOBIAS *MakeAOBIAS(ngcbIFC *dev, const ngcb_route_t &route,
1391 int nb);
1392
1394 virtual ngcdcsALBIAS *MakeALBIAS(ngcbIFC *dev, const ngcb_route_t &route,
1395 int nb);
1396
1398 virtual ngcdcsLISABIAS *MakeLISABIAS(ngcbIFC *dev, const ngcb_route_t &route,
1399 int nb);
1400
1402 virtual ngcdcsNGSDBIAS *MakeNGSDBIAS(ngcbIFC *dev,
1403 const ngcb_route_t &route,
1404 int nb, double extRef);
1405
1407 virtual ngcdcsSEQ *MakeSEQ(ngcbIFC *dev, const ngcb_route_t &route,
1408 ngcbPARAM_LIST *p);
1409
1411 virtual ngcdcsADC *MakeADC(ngcbIFC *dev, const ngcb_route_t &route, int num,
1412 int bitPix);
1413
1415 virtual ngcdcsSHUTTER *MakeSHUTTER(ngcbIFC *dev, const ngcb_route_t &route);
1416
1418 virtual ngcdcsPREAMP *MakePREAMP(ngcbIFC *dev, const ngcb_route_t &route);
1419
1421 virtual ngcdcsNGC2 *MakeNGC2(ngcbIFC *dev, const ngcb_route_t &route);
1422
1424 virtual ngcdcsAO *MakeAO(ngcbIFC *dev, const ngcb_route_t &route);
1425
1427 virtual ngcdcsLISA *MakeLISA(ngcbIFC *dev, const ngcb_route_t &route);
1428
1430 virtual ngcdcsNGSD *MakeNGSD(ngcbIFC *dev, const ngcb_route_t &route,
1431 double extRef);
1432
1434 virtual ngcdcsTEC *MakeTEC(ngcbIFC *dev, const ngcb_route_t &route);
1435
1437 virtual ngcdcsSVS *MakeSVS(ngcbIFC *dev, const ngcb_route_t &route);
1438
1440 virtual ngcdcsSCA *MakeSCA(ngcbIFC *dev, const ngcb_route_t &route,
1441 ngcbPARAM_LIST *p);
1442
1444 virtual ngcdcsACQ *MakeACQ(const ngcdcs_acq_cfg_t &cfg, ngcbPARAM_LIST *p);
1445
1446
1447 /*
1448 * Call-backs from ngcbSIO
1449 */
1450
1452 int ProtocolAscii(int fd);
1453
1455 int ProtocolBin(int fd);
1456
1458 int FdCB(int fd);
1459
1461 int NewEventConnection(int fd);
1462
1464 int TimerCB();
1465
1466private:
1468 void Init_();
1469
1471 int initialized_;
1472
1474 char erms_[256];
1475
1477 char versionString_[256];
1478
1480 char thisVersion_[256];
1481
1483 struct timeval t0_;
1484
1486 char testParam_[256];
1487
1489 char procName_[128];
1490
1492 int srvCmdPort_;
1493
1495 int srvEvtPort_;
1496
1498 char profile_[32];
1499
1501 ngcb_port_t service_[8];
1502
1504 int services_;
1505
1507 ngcbSEM *semService_;
1508
1510 int endian_;
1511
1513 ngcbSHMDB *tcpdb_;
1514
1516 int executor_;
1517
1519 char instance_[64];
1520
1522 int nativeCtrl_;
1523
1525 int aborted_;
1526
1527 pthread_t serviceThread_;
1528
1529 /*
1530 * Debugging functions
1531 */
1532
1534 ngcbSEM *semVerbose_;
1535
1537 ngcbSEM *semFrame_;
1538
1540 void VbLock_();
1541
1543 void VbUnlock_();
1544
1546 int debugConnection_;
1547
1549 int OpenDebugStream_();
1550
1552 void CloseDebugStream_();
1553
1555 void AlignLogging_();
1556
1558 void InternalLog_(const char *msg);
1559
1561 char lastErrMsg_[512];
1562
1564 int verboseLevel_;
1565
1567 int logLevel_;
1568
1570 char *logMsg_[ngcdcsMAX_LOG];
1571
1573 int nlog_;
1574
1576 int plog_;
1577
1579 ngcdcsALARM_SYS alarmSystem_;
1580
1582 int localHost_;
1583
1585 int xterm_;
1586
1588 ngcdcs_srvinfo_t info_;
1589
1591 ngcbTMPFILE *sdebug_;
1592
1594 int debugPort_;
1595
1596
1597 /*
1598 * User Interfaces
1599 */
1600
1602 int shell_;
1603
1605 int coreShell_;
1606
1608 int shellPid_;
1609
1611 void ExternalShell_();
1612
1614 int guiPid_;
1615
1617 void GUI_();
1618
1619
1620 /*
1621 * Error handling
1622 */
1623
1625 int fatalError_;
1626
1628 int telemetryError_;
1629
1631 int acqRtError_;
1632
1634 int MapError_(int id, ngcbOBJ *obj);
1635
1637 void DevErrState_(const char *msg, int id, ngcbIFC *dev, ngcbMOD *mod);
1638
1640 void AcqErrState_(const char *msg, int id, ngcdcsACQ *mod);
1641
1642
1643 /*
1644 * Parameter handling
1645 */
1646
1648 char dicList_[256];
1649
1651 char *dicBuf_;
1652
1654 int dicIdx_;
1655
1657 ngcbPARAM_LIST paramList_;
1658
1660 ngcbPARAM_LIST dicParam_;
1661
1663 int locked_;
1664
1666 void AttachDic_(ngcbPARAM_LIST *list);
1667
1669 int ApplyParamList_(ngcbPARAM_LIST *list, int noBackup = 0);
1670
1672 int ApplyDefaultSetup_(const char *fileName, int id);
1673
1675 int SetupParam_(const char *name, const char *value, int *status = NULL);
1676
1678 int SetupDEV_(const char *name, const char *value, int *status = NULL);
1679
1681 int SetupSEQ_(const char *name, const char *value, int *status = NULL);
1682
1684 int SetupCLDC_(const char *name, const char *value, int *status = NULL);
1685
1687 int SetupADC_(const char *name, const char *value, int *status = NULL);
1688
1690 int SetupNGC2_(const char *name, const char *value, int *status = NULL);
1691
1693 int SetupAO_(const char *name, const char *value, int *status = NULL);
1694
1696 int SetupLISA_(const char *name, const char *value, int *status = NULL);
1697
1699 int SetupNGSD_(const char *name, const char *value, int *status = NULL);
1700
1702 int SetupTEC_(const char *name, const char *value, int *status = NULL);
1703
1705 int SetupSVS_(const char *name, const char *value, int *status = NULL);
1706
1708 int SetupPREAMP_(const char *name, const char *value, int *status = NULL);
1709
1711 int SetupSHUT_(const char *name, const char *value, int *status = NULL);
1712
1714 int SetupSCA_(const char *name, const char *value, int *status = NULL);
1715
1717 int SetupSCA_();
1718
1720 int SetupACQ_(const char *name, const char *value, int *status = NULL);
1721
1723 int StatusParam_(const char *name, char *value);
1724
1726 int StatusDEV_(const char *name, char *value, int *status);
1727
1729 int StatusSEQ_(const char *name, char *value, int *status);
1730
1732 int StatusCLDC_(const char *name, char *value, int *status);
1733
1735 int StatusADC_(const char *name, char *value, int *status);
1736
1738 int StatusNGC2_(const char *name, char *value, int *status);
1739
1741 int StatusAO_(const char *name, char *value, int *status);
1742
1744 int StatusLISA_(const char *name, char *value, int *status);
1745
1747 int StatusNGSD_(const char *name, char *value, int *status);
1748
1750 int StatusTEC_(const char *name, char *value, int *status);
1751
1753 int StatusSVS_(const char *name, char *value, int *status);
1754
1756 int StatusPREAMP_(const char *name, char *value, int *status);
1757
1759 int StatusSHUT_(const char *name, char *value, int *status);
1760
1762 int StatusSCA_(const char *name, char *value, int *status);
1763
1765 int StatusACQ_(const char *name, char *value, int *status);
1766
1768 int StatusCHIP_(const char *name, char *value, int *status);
1769
1771 int GroupList_(ngcbPARAM_LIST *list);
1772
1774 void IgnoreErr_(int flag);
1775
1777 int ParamList2PP_();
1778
1780 int SlxCfg_();
1781
1782
1783 /*
1784 * Configuration
1785 */
1786
1788 char sysCfgFile_[256];
1789
1791 ngcbPARAM_LIST *sysCfgPreset_;
1792
1794 ngcdcsRTD *rtd_;
1795
1797 int aoCameraType_;
1798
1800 int InitialCfg_();
1801
1803 void SysCfgPreset_(const char *name, const char *value);
1804
1806 int AcqChipMap_(int *n, int *d, ngcdcs_detcfg_t cfg);
1807
1809 void DefaultFrames_(ngcdcs_syscfg_t *cfg);
1810
1812 int configured_;
1813
1815 int needShutdown_;
1816
1818 ngcbCMD_LIST *cmdList_;
1819
1821 int InstallCommands_();
1822
1824 int ReferenceCheck_();
1825
1827 int haveLoadedState_;
1828
1829 /*
1830 * Exposure handling
1831 */
1832
1834 char expStatStr_[32];
1835
1837 double lastExposureTime_;
1838
1840 int fitsBlock_;
1841
1843 ngcdcsSUBFRM subFrames_;
1844
1847
1849 ngcdcs_wait_t expDrvWaitObj_[ngcbSIO_MAX_CON];
1850
1852 ngcdcs_wait_t evtWaitObj_[ngcbSIO_MAX_CON];
1853
1855 void ComputeExpTime_();
1856
1858 char expLastFile_[256];
1859
1861 int postProcEnabled_;
1862
1864 int hires_;
1865
1867 int hiresSkip_;
1868
1870 int mrgEvtPid_;
1871
1873 int Chip2Fits_(ngcbFITS *f, int idx);
1874
1876 int expDrvSetup_;
1877
1879 int HaveFrame_();
1880
1882 int HaveBreakCond_();
1883
1885 int ExpDrvFeedBack_(ngcb_fb_t *fb);
1886
1888 void ExpDrvInit_();
1889
1891 void ExpDrvNext_();
1892
1894 int MergeList_();
1895
1896
1897 /*
1898 * Some convenience functions
1899 */
1900
1902 int SeqDwellTime_(int id, int factor, int add);
1903
1905 int SeqClkFile_(int id, const char *fileName);
1906
1908 int SeqPrgFile_(ngcdcsSEQ0 *mod, const char *fileName = NULL);
1909
1911 int SeqWin_(int id, ngcdcs_win_t win);
1912
1914 int AcqProc_(int id, const char *procName);
1915
1917 int AcqBurst_(int id, int num);
1918
1920 void AcqWinMap_(int id, int *fx, int *fy, int *sx, int *sy);
1921
1923 int AcqCheckRestart_(ngcbPARAM *p);
1924
1925
1926 /*
1927 * Run-control
1928 */
1930 int resetFlag_;
1931
1933 int Online_(int update = 1);
1934
1936 int SeqBreakTmo_(int id = 0);
1937
1939 int SeqStartSync_(int id);
1940
1942 int SeqStopSync_(int id, int force = 0);
1943
1945 int seqRestart_[ngcdcsCTRL_MAX_SEQ];
1946
1948 int AcqStop_(int id);
1949
1951 int subStateSaved_;
1952
1954 int traceSubState_;
1955
1957 int dbSubState_;
1958
1960 void SubState2String_(int st, char *s);
1961
1963 int seqBreak_;
1964
1966 int seqBreakTmo_;
1967
1969 int acqExecMap_[ngcdcsACQ_MAX_PROC];
1970
1972 ngcdcsSEQ_EMU *seqEmu_;
1973
1974
1975 /*
1976 * Database
1977 */
1978
1980 int dbMirror_;
1981
1983 ngcbDB db_;
1984
1986 ngcbATTR *attr_[ngcbDB_MAX_ATTR];
1987
1989 ngcbSEM *semDb_;
1990
1992 int DbUpdate_();
1993
1995 void DbUpdateParam_(int fd = -1);
1996
1998 void DbUpdateReadModeList_(int fd = -1);
1999
2001 void DbUpdateFrames_(int id, int fd = -1);
2002
2003 /*
2004 * Implemented commands
2005 */
2006
2007 int ExecAck_(ngcb_cmd_handle_t *handle, char *reply);
2008 int ExecAcq_(ngcb_cmd_handle_t *handle, char *reply);
2009 int ExecAcqCmd_(ngcb_cmd_handle_t *handle, char *reply);
2010 int ExecAcqInfo_(ngcb_cmd_handle_t *handle, char *reply);
2011 int ExecAcqProc_(ngcb_cmd_handle_t *handle, char *reply);
2012 int ExecAdc_(ngcb_cmd_handle_t *handle, char *reply);
2013 int ExecAdcInfo_(ngcb_cmd_handle_t *handle, char *reply);
2014 int ExecAoClk_(ngcb_cmd_handle_t *handle, char *reply);
2015 int ExecAoGain_(ngcb_cmd_handle_t *handle, char *reply);
2016 int ExecAoReset_(ngcb_cmd_handle_t *handle, char *reply);
2017 int ExecAoShift_(ngcb_cmd_handle_t *handle, char *reply);
2018 int ExecBoardInfo_(ngcb_cmd_handle_t *handle, char *reply);
2019 int ExecCatLog_(ngcb_cmd_handle_t *handle, char *reply);
2020 int ExecCheckDev_(ngcb_cmd_handle_t *handle, char *reply);
2021 int ExecCheckPat_(ngcb_cmd_handle_t *handle, char *reply);
2022 int ExecCheckSeq_(ngcb_cmd_handle_t *handle, char *reply);
2023 int ExecCheckTim_(ngcb_cmd_handle_t *handle, char *reply);
2024 int ExecCldc_(ngcb_cmd_handle_t *handle, char *reply);
2025 int ExecClkMon_(ngcb_cmd_handle_t *handle, char *reply);
2026 int ExecClose_(ngcb_cmd_handle_t *handle, char *reply);
2027 int ExecDacChan_(ngcb_cmd_handle_t *handle, char *reply);
2028 int ExecDataKill_(ngcb_cmd_handle_t *handle, char *reply);
2029 int ExecDictionary_(ngcb_cmd_handle_t *handle, char *reply);
2030 int ExecDisable_(ngcb_cmd_handle_t *handle, char *reply);
2031 int ExecDiskCreat_(ngcb_cmd_handle_t *handle, char *reply);
2032 int ExecDiskDel_(ngcb_cmd_handle_t *handle, char *reply);
2033 int ExecDwellTime_(ngcb_cmd_handle_t *handle, char *reply);
2034 int ExecHelp_(ngcb_cmd_handle_t *handle, char *reply);
2035 int ExecDebug_(ngcb_cmd_handle_t *handle, char *reply);
2036 int ExecDefine_(ngcb_cmd_handle_t *handle, char *reply);
2037 int ExecEnable_(ngcb_cmd_handle_t *handle, char *reply);
2038 int ExecEvtPort_(ngcb_cmd_handle_t *handle, char *reply);
2039 int ExecEvtWait_(ngcb_cmd_handle_t *handle, char *reply);
2040 int ExecExit_(ngcb_cmd_handle_t *handle, char *reply);
2041 int ExecExpDrv_(ngcb_cmd_handle_t *handle, char *reply);
2042 int ExecExpStart_(ngcb_cmd_handle_t *handle, char *reply);
2043 int ExecExpEnd_(ngcb_cmd_handle_t *handle, char *reply);
2044 int ExecExpAbort_(ngcb_cmd_handle_t *handle, char *reply);
2045 int ExecExpPause_(ngcb_cmd_handle_t *handle, char *reply);
2046 int ExecExpCont_(ngcb_cmd_handle_t *handle, char *reply);
2047 int ExecDump_(ngcb_cmd_handle_t *handle, char *reply);
2048 int ExecFrame_(ngcb_cmd_handle_t *handle, char *reply);
2049 int ExecGetFrames_(ngcb_cmd_handle_t *handle, char *reply);
2050 int ExecGetPat_(ngcb_cmd_handle_t *handle, char *reply);
2051 int ExecGetSeq_(ngcb_cmd_handle_t *handle, char *reply);
2052 int ExecInfo_(ngcb_cmd_handle_t *handle, char *reply);
2053 int ExecInit_(ngcb_cmd_handle_t *handle, char *reply);
2054 int ExecIor_(ngcb_cmd_handle_t *handle, char *reply);
2055 int ExecIoTest_(ngcb_cmd_handle_t *handle, char *reply);
2056 int ExecIow_(ngcb_cmd_handle_t *handle, char *reply);
2057 int ExecLastErr_(ngcb_cmd_handle_t *handle, char *reply);
2058 int ExecLd_(ngcb_cmd_handle_t *handle, char *reply);
2059 int ExecLdClk_(ngcb_cmd_handle_t *handle, char *reply);
2060 int ExecLdSeq_(ngcb_cmd_handle_t *handle, char *reply);
2061 int ExecLock_(ngcb_cmd_handle_t *handle, char *reply);
2062 int ExecUnlock_(ngcb_cmd_handle_t *handle, char *reply);
2063 int ExecLogin_(ngcb_cmd_handle_t *handle, char *reply);
2064 int ExecLogout_(ngcb_cmd_handle_t *handle, char *reply);
2065 int ExecMacro_(ngcb_cmd_handle_t *handle, char *reply);
2066 int ExecMerge_(ngcb_cmd_handle_t *handle, char *reply);
2067 int ExecMinPulse_(ngcb_cmd_handle_t *handle, char *reply);
2068 int ExecModInfo_(ngcb_cmd_handle_t *handle, char *reply);
2069 int ExecNop_(ngcb_cmd_handle_t *handle, char *reply);
2070 int ExecOff_(ngcb_cmd_handle_t *handle, char *reply);
2071 int ExecOpen_(ngcb_cmd_handle_t *handle, char *reply);
2072 int ExecPatClk_(ngcb_cmd_handle_t *handle, char *reply);
2073 int ExecPinfo_(ngcb_cmd_handle_t *handle, char *reply);
2074 int ExecPing_(ngcb_cmd_handle_t *handle, char *reply);
2075 int ExecPrgInit_(ngcb_cmd_handle_t *handle, char *reply);
2076 int ExecPrgParam_(ngcb_cmd_handle_t *handle, char *reply);
2077 int ExecPrgRun_(ngcb_cmd_handle_t *handle, char *reply);
2078 int ExecPrgStep_(ngcb_cmd_handle_t *handle, char *reply);
2079 int ExecPulseCnt_(ngcb_cmd_handle_t *handle, char *reply);
2080 int ExecRecover_(ngcb_cmd_handle_t *handle, char *reply);
2081 int ExecReadAddr_(ngcb_cmd_handle_t *handle, char *reply);
2082 int ExecReset_(ngcb_cmd_handle_t *handle, char *reply);
2083 int ExecResetDfe_(ngcb_cmd_handle_t *handle, char *reply);
2084 int ExecResetDev_(ngcb_cmd_handle_t *handle, char *reply);
2085 int ExecRestore_(ngcb_cmd_handle_t *handle, char *reply);
2086 int ExecRpc_(ngcb_cmd_handle_t *handle, char *reply);
2087 int ExecRtd_(ngcb_cmd_handle_t *handle, char *reply);
2088 int ExecSave_(ngcb_cmd_handle_t *handle, char *reply);
2089 int ExecSaveClk_(ngcb_cmd_handle_t *handle, char *reply);
2090 int ExecSaveVoltages_(ngcb_cmd_handle_t *handle, char *reply);
2091 int ExecSaveErrVoltages_(ngcb_cmd_handle_t *handle, char *reply);
2092 int ExecScaRead_(ngcb_cmd_handle_t *handle, char *reply);
2093 int ExecScaWrite_(ngcb_cmd_handle_t *handle, char *reply);
2094 int ExecSDebug_(ngcb_cmd_handle_t *handle, char *reply);
2095 int ExecSensReset_(ngcb_cmd_handle_t *handle, char *reply);
2096 int ExecSeq_(ngcb_cmd_handle_t *handle, char *reply);
2097 int ExecSeqWait_(ngcb_cmd_handle_t *handle, char *reply);
2098 int ExecSetTime_(ngcb_cmd_handle_t *handle, char *reply);
2099 int ExecSetup_(ngcb_cmd_handle_t *handle, char *reply);
2100 int ExecShutter_(ngcb_cmd_handle_t *handle, char *reply);
2101 int ExecSimErr_(ngcb_cmd_handle_t *handle, char *reply);
2102 int ExecSimulat_(ngcb_cmd_handle_t *handle, char *reply);
2103 int ExecStart_(ngcb_cmd_handle_t *handle, char *reply);
2104 int ExecState_(ngcb_cmd_handle_t *handle, char *reply);
2105 int ExecStatistics_(ngcb_cmd_handle_t *handle, char *reply);
2106 int ExecStatus_(ngcb_cmd_handle_t *handle, char *reply);
2107 int ExecStop_(ngcb_cmd_handle_t *handle, char *reply);
2108 int ExecStopSim_(ngcb_cmd_handle_t *handle, char *reply);
2109 int ExecSvs_(ngcb_cmd_handle_t *handle, char *reply);
2110 int ExecSysInfo_(ngcb_cmd_handle_t *handle, char *reply);
2111 int ExecTec_(ngcb_cmd_handle_t *handle, char *reply);
2112 int ExecTel_(ngcb_cmd_handle_t *handle, char *reply);
2113 int ExecTelChan_(ngcb_cmd_handle_t *handle, char *reply);
2114 int ExecTelData_(ngcb_cmd_handle_t *handle, char *reply);
2115 int ExecTest_(ngcb_cmd_handle_t *handle, char *reply);
2116 int ExecTestAddr_(ngcb_cmd_handle_t *handle, char *reply);
2117 int ExecTsu_(ngcb_cmd_handle_t *handle, char *reply);
2118 int ExecTimeout_(ngcb_cmd_handle_t *handle, char *reply);
2119 int ExecVersion_(ngcb_cmd_handle_t *handle, char *reply);
2120 int ExecVget_(ngcb_cmd_handle_t *handle, char *reply);
2121 int ExecWait_(ngcb_cmd_handle_t *handle, char *reply);
2122 int ExecWriteAddr_(ngcb_cmd_handle_t *handle, char *reply);
2123
2125 int inMacro_;
2126
2128 int Execute_(const char *cmd, char *reply, int protect, int fd);
2129
2131 int EventHandler_(const char *msg, char *reply);
2132
2134 void DeviceEvent_(ngcbIFC *dev, ngcb_evt_st_t *event);
2135
2136 /*
2137 * Exposure steps
2138 */
2139 int ExpStepInit_(); //< initialize exposure
2140 int ExpStepWiping_(); //< wiping step
2141 int ExpStepIntegrating_(); //< integrating step
2142 int ExpStepReading_(); //< reading step
2143
2145 int ExpStateHandler_();
2146
2148 int ExpStepTriggered_(int stat);
2149
2150};
2151
2155void ngcdcsSrvBreakHandler(int sig);
2156
2160void ngcdcsSrvExitHandler(int sig);
2161
2165int ngcdcsCfg2Arg(int argc, char **argv, char *argStr);
2166
2167#endif
Definition ngcbALARM.hpp:60
void Remove(ngcb_alarm_id id)
Remove item from built-in alarm container.
Definition ngcbALARM_SYS.cpp:30
void Store(ngcbALARM *alarm, ngcb_alarm_id id)
Store alarm to built-in alarm container.
Definition ngcbALARM_SYS.cpp:25
ngcbALARM * Get(ngcb_alarm_id id)
Get item from built-in alarm container.
Definition ngcbALARM_SYS.cpp:35
ngcbALARM_SYS()
Constructor.
Definition ngcbALARM_SYS.cpp:12
Definition ngcbALARM.hpp:99
void Ack()
Acknowledge alarm.
Definition ngcbALARM.cpp:198
const char * Msg()
Return alarm message.
Definition ngcbALARM.cpp:148
const char * Name()
Return alarm name.
Definition ngcbALARM.cpp:144
const char * Value(int showUnit)
Return formatted value string.
Definition ngcbALARM.cpp:154
Definition ngcbATTR.hpp:62
Definition ngcbCMD.hpp:379
ngcbCMD_SRV()
Constructor.
Definition ngcbCMD_SRV.cpp:28
Definition ngcbATTR.hpp:206
Definition ngcbDIC.hpp:50
Definition ngcbFITS.hpp:24
Definition ngcbIFC.hpp:754
Definition ngcbLIST.hpp:33
Definition ngcbMOD.hpp:24
Definition ngcbOBJ.hpp:33
Definition ngcbPARAM.hpp:200
Definition ngcbPARAM.hpp:40
Definition ngcbTHREAD.hpp:67
Definition ngcbSERVICE.hpp:35
Definition ngcbSHMDB.hpp:54
ngcbSIO()
Constructor.
Definition ngcbSIO.cpp:30
Definition ngcbTMPFILE.hpp:25
Definition ngcbCMD.hpp:41
ngcdcsACQ_SERVICE()
Constructor.
Definition ngcdcsACQ.hpp:309
Definition ngcdcsACQ.hpp:342
Definition ngcdcsADC.hpp:54
Definition ngcdcsSRV.hpp:195
virtual ~ngcdcsALARM_SYS()
Destructor.
Definition ngcdcsSRV.hpp:208
ngcdcsALARM_SYS()
Constructor.
Definition ngcdcsSRV.hpp:202
int verboseLevel
Definition ngcdcsSRV.hpp:198
ngcbSERVICE * services
Definition ngcdcsSRV.hpp:197
void Cancel(ngcb_alarm_id id)
Cancel alarm.
Definition ngcdcsSRV.hpp:225
ngcb_alarm_id Issue(ngcbALARM *a)
Send alarm.
Definition ngcdcsSRV.hpp:211
int logLevel
Definition ngcdcsSRV.hpp:199
void Ack(ngcb_alarm_id id)
Acknowledge alarm.
Definition ngcdcsSRV.hpp:241
Definition ngcdcsALBIAS.hpp:26
Definition ngcdcsAOBIAS.hpp:26
Definition ngcdcsAO.hpp:311
Definition ngcdcsAPD.hpp:38
Definition ngcdcsB24.hpp:26
Definition ngcdcsC20B20.hpp:26
Definition ngcdcsC24.hpp:68
Definition ngcdcsCLDC.hpp:128
Definition ngcdcsCLDC.hpp:594
Definition ngcdcsCTRL.hpp:67
int status
Definition ngcdcsSRV.hpp:173
virtual ~ngcdcsEVT()
Destructor.
Definition ngcdcsSRV.hpp:185
int id
Definition ngcdcsSRV.hpp:171
ngcdcsEVT(int i, int d)
Constructor with id and device list.
Definition ngcdcsSRV.hpp:182
ngcdcsEVT()
Constructor.
Definition ngcdcsSRV.hpp:176
ngcdcsEVT(int i)
Constructor with id.
Definition ngcdcsSRV.hpp:179
int devices
Definition ngcdcsSRV.hpp:172
Definition ngcdcsEXPDRV.hpp:30
Definition ngcdcsEXP.hpp:178
Definition ngcdcsLISABIAS.hpp:26
Definition ngcdcsLISA.hpp:34
Definition ngcdcsMRGLIST.hpp:62
Definition ngcdcsNGC2.hpp:39
Definition ngcdcsNGSDBIAS.hpp:26
Definition ngcdcsNGSD.hpp:36
Definition ngcdcsPREAMP.hpp:62
Definition ngcdcsRTD.hpp:57
Definition ngcdcsSCA.hpp:182
Definition ngcdcsSEQ.hpp:185
Definition ngcdcsSEQ_PRG.hpp:204
Definition ngcdcsSEQ.hpp:574
Definition ngcdcsSHUTTER.hpp:35
int EvtAddWait(int fd, int id)
Add event waiting client.
Definition ngcdcsSrvStateCtrl.cpp:523
int ExpDrvAddWait(int fd)
Add exposure driver waiting client (socket)
Definition ngcdcsSrvExpDrv.cpp:750
void GetFrames(int id, char *s)
Get frame configuration (debugging function)
Definition ngcdcsSrvFrames.cpp:353
virtual int MergeStatus(int id, char *stat=NULL)
Get status of exposure data file merger.
Definition ngcdcsSrvMrg.cpp:234
int SeqBreak(int id=0)
Break sequence.
Definition ngcdcsSrvRunCtrl.cpp:1640
ngcdcsTEC * TECMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
TEC module factory.
Definition ngcdcsSrvMod.cpp:337
int AddCmd(const char *cmd, ngcb_function_t function, int flags, const char *syntax, const char *help)
Add command to server command list.
Definition ngcdcsSrvCmd.cpp:38
FILE * debugStream
Debug stream.
Definition ngcdcsSRV.hpp:828
int FrameBreak(int id, const char *name, int n)
Set exposure break condition for frame.
Definition ngcdcsSrvFrames.cpp:227
void BoardInfo(char *s)
Formatted board info.
Definition ngcdcsSrvInfo.cpp:817
virtual void AgEvent(int acqInst, ngcdcs_2ag_t ag, int errorId, const char *erms)
Auto-guiding event.
Definition ngcdcsSrvExp.cpp:231
void Verbose(int level, const char *format,...) __attribute__((format(printf
Verbose method depending on level.
Definition ngcdcsSrvLog.cpp:202
double LifeTime()
Server life time (seconds)
Definition ngcdcsSrvMain.cpp:2567
ngcdcsCTRL * ctrl
Controller object.
Definition ngcdcsSRV.hpp:404
int DebugStream(int flag)
Enable/disable debug-stream.
Definition ngcdcsSrvLog.cpp:163
int InMainLoop()
Function called before entering main-loop.
Definition ngcdcsSrvMain.cpp:2499
void PrintUsage()
Print command line options.
Definition ngcdcsSrvArgs.cpp:35
int pollInterval
Polling interval in ms.
Definition ngcdcsSRV.hpp:716
int SelftestAcq(int id)
Selftest function for acquisition module.
Definition ngcdcsSrvSelftest.cpp:341
int maxDfeMod
Maximum number of DFE modules.
Definition ngcdcsSRV.hpp:294
int Off()
Switch off.
Definition ngcdcsSrvStateCtrl.cpp:1452
double expTimeFactor
Exposure time factor.
Definition ngcdcsSRV.hpp:497
char gui[256]
GUI to be started.
Definition ngcdcsSRV.hpp:820
int PostProcEnabled()
Returns 1 if post-processor is enabled.
Definition ngcdcsSrvExp.cpp:172
int ShutdownService(int port)
Shutdown service port.
Definition ngcdcsSrvProtocol.cpp:883
void DeviceEvent(void *origin, void *event)
Device event (from ngcbSERVICE)
Definition ngcdcsSrvStateCtrl.cpp:302
int AcqStop(int id=0)
Stop (acquisition process)
Definition ngcdcsSrvRunCtrl.cpp:740
void Voltages(ngcdcsCLDC0 *mod, char *s)
Formatted voltages.
Definition ngcdcsSrvInfo.cpp:2133
void void void void void void void int ConfigureLogging(int vb, int log, int xt)
Configure logging parameters.
Definition ngcdcsSrvLog.cpp:132
int DbAdd(ngcbATTR *attr)
Add attribute to database.
Definition ngcdcsSrvDb.cpp:132
int MergeAlign()
Align merger file-list with backup file.
Definition ngcdcsSrvMrg.cpp:302
void ExpPoll()
Exposure polling.
Definition ngcdcsSrvExp.cpp:1456
virtual int FitsMergerCB(ngcbFITS *hdr, char *erms)
FITS-merger call-back.
Definition ngcdcsSrvFits.cpp:56
ngcdcsEXPDRV * ExpDrv(const char *name, const ngcb_fb_t &feedBackChannel)
Exposure driver installation hook.
Definition ngcdcsSrvExpDrv.cpp:225
virtual ~ngcdcsSRV()
Destructor.
Definition ngcdcsSrvMain.cpp:112
int CldcClearCalibration(int id)
Clear voltage calibration.
Definition ngcdcsSrvSetupCLDC.cpp:365
virtual ngcdcsC24 * MakeC24(ngcbIFC *dev, const ngcb_route_t &route)
Create NGC2 C24 bias generator.
Definition ngcdcsSrvMod.cpp:46
int ExpEnd(int acqId=0)
End exposure.
Definition ngcdcsSrvExp.cpp:1263
void Publish(const ngcdcs_exp_topic &topic)
Publish exposure event.
Definition ngcdcsSrvExp.cpp:302
int ExpDrvLoad(const char *module, const char *name=NULL)
Load exposure driver.
Definition ngcdcsSrvExpDrv.cpp:245
int TecAction(int id, const char *action, char *reply)
Perform TEC action.
Definition ngcdcsSrvRunCtrl.cpp:1749
virtual int FrameHandlerCB(void *buffer, ngcdcs_finfo_t *finfo, char *erms)
Frame handler call-back.
Definition ngcdcsSrvExp.cpp:203
int Xterm()
Flag to start in new window.
Definition ngcdcsSrvLog.cpp:100
void DevPoll()
Device events polling cycle.
Definition ngcdcsSrvTimer.cpp:243
ngcbPARAM_LIST * ParamList()
Global parameter list.
Definition ngcdcsSrvParam.cpp:493
virtual void PublishSubState()
Publish server sub-state.
Definition ngcdcsSrvDb.cpp:1027
int ReadMode(int idx)
Set new read-mode.
Definition ngcdcsSrvReadMode.cpp:288
virtual int ExpStartCB()
Hook at exposure start.
Definition ngcdcsSrvExp.cpp:227
int SetupParam(const char *name, const char *value)
Set single parameter.
Definition ngcdcsSrvSetupParam.cpp:898
int OpenDebugConnection()
Open error-state debug connection.
Definition ngcdcsSrvOpMode.cpp:112
void CatLog(char *s)
Copy built-in log to string.
Definition ngcdcsSrvLog.cpp:353
int SetupList(const char *paramBuf)
Setup parameter list (string)
Definition ngcdcsSrvSetupList.cpp:2185
int mergeInvalidate
Flag to invalidate source-data after merging.
Definition ngcdcsSRV.hpp:636
void DbExport()
Export database.
Definition ngcdcsSrvDb.cpp:146
void DbLog(const char *format,...) __attribute__((format(printf
Action log in database.
Definition ngcdcsSrvDb.cpp:1068
ngcdcsMRGLIST mergeList
Merger file-list handler.
Definition ngcdcsSRV.hpp:627
virtual void ShutdownSystemCB2()
Shutdown callback 2.
Definition ngcdcsSrvMain.cpp:1258
ngcdcsSEQ * SeqMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, ngcbPARAM_LIST *p)
Sequencer module factory.
Definition ngcdcsSrvMod.cpp:231
int FitsMerger(ngcbFITS *hdr, char *erms)
FITS merger (from ngcbACQ_SERVICE)
Definition ngcdcsSrvFits.cpp:25
virtual ngcdcsSCA * MakeSCA(ngcbIFC *dev, const ngcb_route_t &route, ngcbPARAM_LIST *p)
Create Sidecar ASIC module.
Definition ngcdcsSrvMod.cpp:151
virtual void VerboseCB(const char *msg, int level=ngcdcsLOG_INFO)
Verbose output callback.
Definition ngcdcsSrvLog.cpp:329
int SelftestSeq(int id)
Selftest function for sequencer module.
Definition ngcdcsSrvSelftest.cpp:122
int RouteComp(ngcbMOD *, ngcbMOD *)
Compare module routes.
Definition ngcdcsSrvSysCfg.cpp:3365
const char * ProcName()
Return process name.
Definition ngcdcsSrvArgs.cpp:28
virtual int DelSockCB(int fd)
Remove file descriptor from socket event list.
Definition ngcdcsSrvProtocol.cpp:360
void SubState(int newState)
set new sub-state
Definition ngcdcsSrvStateCtrl.cpp:415
int FrameHandler(void *buffer, ngcdcs_finfo_t *finfo, char *erms)
Frame handler (from ngcbACQ_SERVICE)
Definition ngcdcsSrvExp.cpp:174
ngcdcsAO * AOMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
AO camera module factory.
Definition ngcdcsSrvMod.cpp:288
int SrvPortOrig()
Get original server port number.
Definition ngcdcsSrvMain.cpp:430
int SimError(int error, int idx=0)
Simulate various error test cases.
Definition ngcdcsSrvProtocol.cpp:1010
char thisHost[64]
Our hostname.
Definition ngcdcsSRV.hpp:291
int CloseDebugConnection()
Close error-state debug connection.
Definition ngcdcsSrvOpMode.cpp:176
FILE * watchdog
Watchdog.
Definition ngcdcsSRV.hpp:344
virtual int ConfigureSystemCB2(ngcdcs_syscfg_t &newCfg)
System configuration call-back 2 (after re-configuration)
Definition ngcdcsSrvSysCfg.cpp:61
void ClearSubState()
Clear sub-state (error or active)
Definition ngcdcsSrvStateCtrl.cpp:507
virtual int ResolvePath(char *resolved, const char *fileName)
Resolve full path name by parsing search paths etc.
Definition ngcdcsSrvSysCfg.cpp:68
int ShutterAction(int id, const char *action, char *reply)
Perform shutter action.
Definition ngcdcsSrvRunCtrl.cpp:1716
virtual ngcdcsPREAMP * PreampMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
Preamplifier module factory.
Definition ngcdcsSrvMod.cpp:263
int RecStart(const char *id, double absTime=0.0)
Start recording sequence (shortcut to series of function calls)
Definition ngcdcsSrvExp.cpp:1471
ngcdcsLISA * LISAMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
LISA camera module factory.
Definition ngcdcsSrvMod.cpp:315
int FdCB(int fd)
File descriptor event.
Definition ngcdcsSrvProtocol.cpp:286
ngcdcsSRV()
Constructors.
Definition ngcdcsSrvMain.cpp:77
int detIndex
Detector category index.
Definition ngcdcsSRV.hpp:288
void void void void void void Print(const char *format,...) __attribute__((format(printf
Print verbose message.
Definition ngcdcsSrvLog.cpp:296
virtual ngcdcsNGSD * MakeNGSD(ngcbIFC *dev, const ngcb_route_t &route, double extRef)
Create NGSD module.
Definition ngcdcsSrvMod.cpp:132
int Check(const ngcdcs_syscfg_t &cfg)
Check system configuration.
Definition ngcdcsSrvSysCfg.cpp:2993
void Abort()
Abort server.
Definition ngcdcsSrvMain.cpp:929
ngcdcsCLDC * CldcMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, int nc, int nb, double extRef)
CLDC module factory.
Definition ngcdcsSrvMod.cpp:164
int Statistics(int id, char *s)
Formatted acquisition process statistics.
Definition ngcdcsSrvInfo.cpp:2199
int ProtocolAscii(int fd)
ASCII command protocol.
Definition ngcdcsSrvProtocol.cpp:143
int Macro(const char *fileName, char *reply, int protection=0)
Execute macro file.
Definition ngcdcsSrvProtocol.cpp:918
int mergeVerify
Enable/disable verification run before merging.
Definition ngcdcsSRV.hpp:633
int ResetSensors()
Reset sensors.
Definition ngcdcsSrvStateCtrl.cpp:1666
virtual int DbUpdateCB()
Update database call-back.
Definition ngcdcsSrvDb.cpp:967
int CldcCheck(int id)
Telemetry check.
Definition ngcdcsSrvSetupCLDC.cpp:282
void ClrLog()
Clear built-in log.
Definition ngcdcsSrvLog.cpp:339
int mergeChunk
Merger chunk size (bytes)
Definition ngcdcsSRV.hpp:639
int Enable(int check)
Go to operational state with or without integrity check.
Definition ngcdcsSrvStateCtrl.cpp:778
virtual void PublishExpEvent(int errorId, unsigned int newStat, const char *fileName, int merge, const char *erms)
Publish exposure event.
Definition ngcdcsSrvDb.cpp:971
ngcdcsADC * AdcMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, int num, int bitPix)
ADC module factory.
Definition ngcdcsSrvMod.cpp:245
virtual void DbLogCB(const char *msg)
Database log callback.
Definition ngcdcsSrvDb.cpp:969
int CfgPath(char *path, const char *cfgFile)
Get cfg-file path.
Definition ngcdcsSrvSysCfg.cpp:80
int ExpStart(int acqId=0, double absTime=0.0)
Start exposure.
Definition ngcdcsSrvExp.cpp:791
void UnlockService()
Unlock service loop.
Definition ngcdcsSrvMain.cpp:2493
int Reset()
Reset system.
Definition ngcdcsSrvStateCtrl.cpp:1563
int SysCfg(const char *cfgFile)
Apply system configuration.
Definition ngcdcsSrvSysCfg.cpp:237
char mergeArg[128]
Additional merger arguments.
Definition ngcdcsSRV.hpp:642
void State(int newState, int update=1)
Set new server state.
Definition ngcdcsSrvStateCtrl.cpp:381
int FrameGen(int id, const char *name, int flag)
Set frame attribute: generate.
Definition ngcdcsSrvFrames.cpp:28
int DumpFits(const char *fileName=NULL)
Dump FITS-header to file.
Definition ngcdcsSrvFits.cpp:3027
virtual int MergeStart(const char *name, int display, int id, int cleanup=0)
Start exposure data file merger with requested id.
Definition ngcdcsSrvMrg.cpp:118
int ParamLookup(const char *name, char *value)
Handler for parameter lookup (from ngcbSERVICE)
Definition ngcdcsSrvParam.cpp:858
int SelftestCldc(int id)
Selftest function for CLDC module.
Definition ngcdcsSrvSelftest.cpp:24
void SaveErr(const char *erms)
Save last error message.
Definition ngcdcsSrvLog.cpp:394
int MainLoop()
Run service-loop.
Definition ngcdcsSrvMain.cpp:2521
virtual ngcdcsAPD * MakeAPD(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create APD bias generator.
Definition ngcdcsSrvMod.cpp:52
int Recover()
Recover from error state.
Definition ngcdcsSrvStateCtrl.cpp:719
int ExpDrvStart()
Activate exposure driver.
Definition ngcdcsSrvExpDrv.cpp:582
int GetPat(int id, int num, char *s)
Formatted clock pattern.
Definition ngcdcsSrvInfo.cpp:2289
int concurrentMerge
Concurrent merging.
Definition ngcdcsSRV.hpp:624
virtual ngcdcsSVS * MakeSVS(ngcbIFC *dev, const ngcb_route_t &route)
Create SVS module.
Definition ngcdcsSrvMod.cpp:145
virtual void PollStatConfigure(int enable, int interval)
Configure status polling (milliseconds)
Definition ngcdcsSrvTimer.cpp:287
int ReadModeIdx(int id)
Get read-mode index by id.
Definition ngcdcsSrvReadMode.cpp:254
void DevError(const char *erms, int id, void *descriptor)
Device error (from ngcbSERVICE)
Definition ngcdcsSrvStateCtrl.cpp:312
ngcbDIC dictionary
Global dictionary.
Definition ngcdcsSRV.hpp:1067
virtual int ConfigureSystemCB1(ngcdcs_syscfg_t &newCfg)
System configuration call-back 1 (before re-configuration)
Definition ngcdcsSrvSysCfg.cpp:54
virtual void PublishLogPars()
Publish logging parameters.
Definition ngcdcsSrvDb.cpp:1006
void ExportVersion(const char *newVersion)
Export version.
Definition ngcdcsSrvArgs.cpp:782
int LogLevel()
Get logging level.
Definition ngcdcsSrvLog.cpp:104
int AdcInfo(int id, char *s)
Formatted ADC module info.
Definition ngcdcsSrvInfo.cpp:906
int SeqWaiting()
Check if all sequencers are in WAITING state.
Definition ngcdcsSrvRunCtrl.cpp:166
int CldcDefault(int id)
Restore default voltages.
Definition ngcdcsSrvSetupCLDC.cpp:227
char expDrvFeedBack[128]
Feed-back channel selection.
Definition ngcdcsSRV.hpp:598
int integrityCheck
Integrity check when going online.
Definition ngcdcsSRV.hpp:674
int InitSysCfg(const char *cfgFile)
Initialize default system configuration from file.
Definition ngcdcsSrvSysCfg.cpp:209
virtual ngcdcsTEC * MakeTEC(ngcbIFC *dev, const ngcb_route_t &route)
Create TEC module.
Definition ngcdcsSrvMod.cpp:139
ngcbIFC * ctrlDev[ngcdcsCTRL_MAX_DEV]
Mirror of controller devices.
Definition ngcdcsSRV.hpp:407
int SeqContinue(int id=0)
Sequencer continue.
Definition ngcdcsSrvRunCtrl.cpp:1561
int PrepareFits(int refresh=1)
Prepare FITS-header.
Definition ngcdcsSrvFits.cpp:85
void ExpStatus2String(char *s, int stat)
Convert exposure status to string.
Definition ngcdcsSrvExp.cpp:132
int LoadSetup(const char *fileName, char **list, int *listLength, int max=-1)
Load setup from file into string array.
Definition ngcdcsSrvParam.cpp:893
int ExpPause(int id=0)
Pause exosure.
Definition ngcdcsSrvExp.cpp:1333
int Update()
Update database.
Definition ngcdcsSrvStateCtrl.cpp:1701
void SysInfo(char *s)
Formatted system info.
Definition ngcdcsSrvInfo.cpp:87
int SeqIdle(int id=0)
Check sequencer idle states.
Definition ngcdcsSrvRunCtrl.cpp:125
int fitsLogPeriod
FITS logging period (seconds)
Definition ngcdcsSRV.hpp:837
virtual void DbLock()
Lock database.
Definition ngcdcsSrvDb.cpp:30
void AcqError(const char *erms, int id, void *descriptor)
Device error (from ngcbACQ_SERVICE)
Definition ngcdcsSrvStateCtrl.cpp:320
int OpMode(int level)
Set operational mode.
Definition ngcdcsSrvOpMode.cpp:24
ngcbPARAM * ParamDefine(const char *name, const char *value, int id, int *status=NULL)
Define parameter.
Definition ngcdcsSrvParam.cpp:497
virtual void MergeReset(int relaunch=0)
Reset data merger interface.
Definition ngcdcsSrvMrg.cpp:434
int Initialize()
Initialize system.
Definition ngcdcsSrvMain.cpp:558
char opMode[32]
Operation mode string.
Definition ngcdcsSRV.hpp:671
virtual ngcdcsLISABIAS * MakeLISABIAS(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create LISA bias generator.
Definition ngcdcsSrvMod.cpp:72
int FrameExport(int id, const char *name, int flag)
Set frame attribute: export.
Definition ngcdcsSrvFrames.cpp:179
int HaveLocalEvents()
Local events configured.
Definition ngcdcsSrvTimer.cpp:227
void void void void void ErrLog(int severity, const char *format,...) __attribute__((format(printf
Error log, severity is one of ngcbWARNING, ngcbFAILURE and ngcbERR_SEVERE.
Definition ngcdcsSrvLog.cpp:280
ngcbALARM_SYS * alarmSystem
Alarm system.
Definition ngcdcsSRV.hpp:831
int ResetDfe()
Reset detector front-end.
Definition ngcdcsSrvStateCtrl.cpp:1605
void ExpStatus(unsigned int newStat, const char *erms=NULL)
Update exposure status.
Definition ngcdcsSrvExp.cpp:268
const char * DicList()
Get dictionary list.
Definition ngcdcsSrvParam.cpp:495
int numAcqMod
Number of acquisition modules.
Definition ngcdcsSRV.hpp:427
int CheckExp()
Return an error when an exposure is still active.
Definition ngcdcsSrvExp.cpp:237
virtual ngcdcsPREAMP * MakePREAMP(ngcbIFC *dev, const ngcb_route_t &route)
Create preamplifier module.
Definition ngcdcsSrvMod.cpp:108
ngcdcsACQ * acq[ngcdcsACQ_MAX_PROC]
Acquisition modules.
Definition ngcdcsSRV.hpp:424
int FitsBlock()
Number of FITS blocks from system.
Definition ngcdcsSrvFits.cpp:83
char * ErrMsg()
Global error message.
Definition ngcdcsSrvMain.cpp:460
size_t ppStackSize
Post-processor stack size in bytes (0 = use system default)
Definition ngcdcsSRV.hpp:1290
int CldcRestore(int id, const char *key=NULL)
Restore voltage defined by voltage-keyword.
Definition ngcdcsSrvSetupCLDC.cpp:415
virtual int MergeStop(int id)
Stop exposure data file merger.
Definition ngcdcsSrvMrg.cpp:211
int RestoreState()
Restore sequencer states.
Definition ngcdcsSrvStateCtrl.cpp:601
int AcqProc(int id, const char *procName)
Set acquisition process on multiple instances.
Definition ngcdcsSrvSetupACQ.cpp:24
virtual ngcdcsADC * MakeADC(ngcbIFC *dev, const ngcb_route_t &route, int num, int bitPix)
Create ADC module.
Definition ngcdcsSrvMod.cpp:95
void ExpDrvModList(char *s)
Print list of loaded exposure driver modules to string.
Definition ngcdcsSrvExpDrv.cpp:291
int ProtocolBin(int fd)
Binary command protocol.
Definition ngcdcsSrvProtocol.cpp:619
int SeqTrigger(int id)
Sequencer sync trigger.
Definition ngcdcsSrvRunCtrl.cpp:1396
void Release()
Release server.
Definition ngcdcsSrvMain.cpp:884
void Port(int port)
Set core service port.
Definition ngcdcsSrvMain.cpp:447
virtual ngcdcsSHUTTER * MakeSHUTTER(ngcbIFC *dev, const ngcb_route_t &route)
Create shutter module.
Definition ngcdcsSrvMod.cpp:102
void Profile(const char *name=NULL)
Apply profile.
Definition ngcdcsSrvMain.cpp:464
ngcdcsSVS * SVSMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
SVS module factory.
Definition ngcdcsSrvMod.cpp:346
virtual void Query()
Query system status.
Definition ngcdcsSrvTimer.cpp:28
int StatusParam(const char *name, char *value)
Get single parameter.
Definition ngcdcsSrvStatus.cpp:1548
ngcdcsNGC2 * NGC2Mod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
NGC2 basic module factory.
Definition ngcdcsSrvMod.cpp:272
int ExpDrvCfg(const char *s)
Configue exposure driver from either a file a parameter string.
Definition ngcdcsSrvExpDrv.cpp:490
ngcdcsEXP exposure
Exposure handler.
Definition ngcdcsSRV.hpp:494
int ExpDrvUnload()
Unload all dynamically loaded driver modules.
Definition ngcdcsSrvExpDrv.cpp:258
uint64_t SizeRecorded()
Recorded data size during current exposure (in bytes)
Definition ngcdcsSrvExp.cpp:97
virtual void PublishState()
Publish server state.
Definition ngcdcsSrvDb.cpp:1015
virtual void ErrorEvent(int id, const char *erms)
Error event handler.
Definition ngcdcsSrvStateCtrl.cpp:335
char * ExpStatusString()
Return current exposure status as string.
Definition ngcdcsSrvExp.cpp:166
virtual void PublishExpDrvStatus()
Publish exposure driver status.
Definition ngcdcsSrvDb.cpp:1039
virtual ngcdcsACQ * MakeACQ(const ngcdcs_acq_cfg_t &cfg, ngcbPARAM_LIST *p)
Create acquisition module.
Definition ngcdcsSrvMod.cpp:158
void void void void void void void AddLog(const char *format,...) __attribute__((format(printf
Add message to the logging system.
Definition ngcdcsSrvLog.cpp:312
void ModInfo(char *s)
Formatted module info.
Definition ngcdcsSrvInfo.cpp:345
int ExpAbort(int acqId=0)
Abort exposure.
Definition ngcdcsSrvExp.cpp:1233
virtual void DbUnlock()
Unlock database.
Definition ngcdcsSrvDb.cpp:35
int StatusList(const char *list, char *reply)
Get parameter status (parameter names string)
Definition ngcdcsSrvStatus.cpp:1482
void ExecShell(const char *name)
Set remote execution shell.
Definition ngcdcsSrvMain.cpp:442
virtual void LogCB(const char *msg, int level=ngcdcsLOG_INFO)
Logging output callback.
Definition ngcdcsSrvLog.cpp:337
void BroadcastAlarm(const char *msg)
Broadcast alarm.
Definition ngcdcsSrvProtocol.cpp:869
ngcdcsCLDC0 * CldcFn(int idx)
Get index of CLDC functional module.
Definition ngcdcsSrvMod.cpp:395
int Execute(const char *cmd, char *reply, int protect=0, int fd=-1)
Command handler.
Definition ngcdcsSrvProtocol.cpp:585
virtual void MergeNext()
Merge next item in the data merger list.
Definition ngcdcsSrvMrg.cpp:283
virtual int AddSockCB(int fd)
Add file descriptor to socket event list.
Definition ngcdcsSrvProtocol.cpp:344
int Telemetry(int id, char *s)
Formatted telemetry.
Definition ngcdcsSrvInfo.cpp:1989
void Logger(int flag, const char *msg)
Logger (from ngcbSERVICE)
Definition ngcdcsSrvLog.cpp:185
virtual void ExitSignal(int sig)
Exit handler.
Definition ngcdcsSrvMain.cpp:1242
int forceStartup
Enforce system startup even when instance check fails.
Definition ngcdcsSRV.hpp:285
const char * LastErr()
Last error message.
Definition ngcdcsSrvMain.cpp:462
virtual void InstallSignalHandlers()
Install signal handlers.
Definition ngcdcsSrvMain.cpp:435
virtual int ExpCountDownCB()
Exposure countdown start call-back.
Definition ngcdcsSrvExp.cpp:229
virtual void HiResTimer(int enable)
Enable/disable hi-res timer.
Definition ngcdcsSrvTimer.cpp:304
int VerboseLevel()
Get verbose level.
Definition ngcdcsSrvLog.cpp:102
int SvsAction(int id, const char *action, char *reply)
Perform SVS action.
Definition ngcdcsSrvRunCtrl.cpp:1791
int NeedEnableCycle()
Return a flag indicating whether an enabling cycle is needed.
Definition ngcdcsSrvStateCtrl.cpp:773
ngcdcsSCA * ScaMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, ngcbPARAM_LIST *p)
Sidecar ASIC module factory.
Definition ngcdcsSrvMod.cpp:355
int FrameWin(int id, const char *name, int sx, int sy, int nx, int ny)
Set frame window.
Definition ngcdcsSrvFrames.cpp:285
int SeqWait(int id, int event, int timeout, int interval)
Wait for status event.
Definition ngcdcsSrvRunCtrl.cpp:1678
int updateReadModeList
Read-out mode list update flag.
Definition ngcdcsSRV.hpp:477
int readModeId
Current read-mode id.
Definition ngcdcsSRV.hpp:471
int CheckTriggerPeriod(int id, double period)
Check, if the trigger period matches the current read-out sequence.
Definition ngcdcsSrvInfo.cpp:2393
virtual ngcdcsNGSDBIAS * MakeNGSDBIAS(ngcbIFC *dev, const ngcb_route_t &route, int nb, double extRef)
Create NGSD bias generator.
Definition ngcdcsSrvMod.cpp:80
ngcdcs_syscfg_t sysCfg
Current configuration structure.
Definition ngcdcsSRV.hpp:306
int fitsLogLevel
FITS logging level.
Definition ngcdcsSRV.hpp:834
virtual int MergeMsg(int id, char *msg)
Get status message of exposure data file merger.
Definition ngcdcsSrvMrg.cpp:260
int numCldcFn
Number of CLDC functions.
Definition ngcdcsSRV.hpp:1183
ngcbLIST evtList
Event list.
Definition ngcdcsSRV.hpp:300
virtual ngcdcsALBIAS * MakeALBIAS(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create ALICE bias generator.
Definition ngcdcsSrvMod.cpp:65
int ParamDefault()
Set default values.
Definition ngcdcsSrvParam.cpp:804
int numSeqFn
Number of sequencer functions.
Definition ngcdcsSRV.hpp:1180
int ExpDrvAbort()
Abort exposure driver.
Definition ngcdcsSrvExpDrv.cpp:700
void LockService()
Lock service loop.
Definition ngcdcsSrvMain.cpp:2487
int SeqPause(int id=0)
Sequencer pause.
Definition ngcdcsSrvRunCtrl.cpp:1504
int TimerCB()
Timer call-back.
Definition ngcdcsSrvTimer.cpp:253
virtual ngcdcsAO * MakeAO(ngcbIFC *dev, const ngcb_route_t &route)
Create AO camera module.
Definition ngcdcsSrvMod.cpp:120
virtual void MergeInit()
Initialize file-merger interface.
Definition ngcdcsSrvMrg.cpp:386
ngcdcs_detcfg_t detCfg
Current configuration structure.
Definition ngcdcsSRV.hpp:390
int ExpDrvSelect(const char *name)
Install exposure driver.
Definition ngcdcsSrvExpDrv.cpp:293
virtual void ShutdownSystemCB1()
Shutdown callback 1.
Definition ngcdcsSrvMain.cpp:1256
int HandleExpEvt()
Handle exposure event.
Definition ngcdcsSrvExp.cpp:307
int FrameLocal(int id, const char *name, int flag)
Set frame attribute: store to local medi.
Definition ngcdcsSrvFrames.cpp:131
int Disable()
Go to not operational state.
Definition ngcdcsSrvStateCtrl.cpp:1295
ngcdcsTCCD * tccd[ngcdcsTCCD_MAX_PROC]
TCCD modules.
Definition ngcdcsSRV.hpp:413
void Shutdown()
Dhutdown all modules.
Definition ngcdcsSrvMain.cpp:1260
double TimeElapsed()
Time elapsed in current exposure.
Definition ngcdcsSrvExp.cpp:105
virtual ngcdcsNGC2 * MakeNGC2(ngcbIFC *dev, const ngcb_route_t &route)
Create NGC2 basic module.
Definition ngcdcsSrvMod.cpp:114
int SeqStop(int id=0)
Stop (sequencer + acquisition process)
Definition ngcdcsSrvRunCtrl.cpp:832
void DelCmd(const char *cmd)
Delete command from server command list.
Definition ngcdcsSrvCmd.cpp:61
int updateParam
Parameter update flag.
Definition ngcdcsSRV.hpp:1117
int SelftestAdc(int id)
Selftest function for ADC module.
Definition ngcdcsSrvSelftest.cpp:173
int DbConfigure()
Configure database.
Definition ngcdcsSrvDb.cpp:151
virtual ngcdcsCLDC * MakeCLDC(ngcbIFC *dev, const ngcb_route_t &route, int nc, int nb)
Create standard CLDC module.
Definition ngcdcsSrvMod.cpp:25
char dbPoint[256]
Actual data base point.
Definition ngcdcsSRV.hpp:920
void virtual int DbConfCB()
Configure database call-back.
Definition ngcdcsSrvDb.cpp:965
int ExpDrvClose()
Uninstall exposure driver.
Definition ngcdcsSrvExpDrv.cpp:469
int ExpCont(int id=0)
Continue paused exosure.
Definition ngcdcsSrvExp.cpp:1387
void StoreState()
Store sequencer states.
Definition ngcdcsSrvStateCtrl.cpp:560
void CheckDev(int idx, char *s)
Device check.
Definition ngcdcsSrvInfo.cpp:1090
int polling
Enable/disable polling.
Definition ngcdcsSRV.hpp:713
char configDir[256]
Configuration directory.
Definition ngcdcsSRV.hpp:309
virtual ngcdcsAOBIAS * MakeAOBIAS(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create AO bias generator.
Definition ngcdcsSrvMod.cpp:58
int autoRestart
Enable automatic restart mechanism.
Definition ngcdcsSRV.hpp:1008
int StoreCfg(const char *fileName)
Store configuration.
Definition ngcdcsSrvStoreCfg.cpp:28
int mergeDisplay
Flag to launch merger status display.
Definition ngcdcsSRV.hpp:630
int SelftestShutter(int id)
Selftest function for shutter module.
Definition ngcdcsSrvSelftest.cpp:215
int CldcDisable(int id)
Disable CLDC outputs.
Definition ngcdcsSrvSetupCLDC.cpp:142
int numTccdMod
Number of acquisition modules.
Definition ngcdcsSRV.hpp:416
void ExpDrvList(char *s)
Print exposure driver list to string.
Definition ngcdcsSrvExpDrv.cpp:289
int ConfigureSystem(ngcdcs_syscfg_t newCfg, int copy=1)
Configure system.
Definition ngcdcsSrvMain.cpp:1385
int Snapshot(int id, char *s)
Formatted bias snapshot.
Definition ngcdcsSrvInfo.cpp:1897
virtual void ErrLogEvent(int id, const char *erms)
Error logging event.
Definition ngcdcsSrvLog.cpp:401
void ExpDrvStatus(unsigned int newStat)
Exposure driver status update.
Definition ngcdcsSrvExpDrv.cpp:573
ngcdcsNGSD * NGSDMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, double extRef)
NGSD module factory.
Definition ngcdcsSrvMod.cpp:328
int NewEventConnection(int fd)
New event connection.
Definition ngcdcsSrvDb.cpp:40
virtual ngcbCMD_LIST * CreateCmdList()
Command list factory.
Definition ngcdcsSrvCmd.cpp:32
void ParamUndefine(const char *name, int id)
Undefine (remove) parameter.
Definition ngcdcsSrvParam.cpp:772
char stateString[32]
Server state string (STANDBY,ONLINE,...
Definition ngcdcsSRV.hpp:680
int ErrState()
Check if we are in error state.
Definition ngcdcsSrvStateCtrl.cpp:552
int state
Server state value.
Definition ngcdcsSRV.hpp:677
double RemainingTime()
Time remaining in current exposure.
Definition ngcdcsSrvExp.cpp:119
char * Instance()
Get instance.
Definition ngcdcsSrvMain.cpp:458
virtual ngcdcsB24 * MakeB24(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create NGC2 B24 bias generator.
Definition ngcdcsSrvMod.cpp:40
int FrameStore(int id, const char *name, int flag)
Set frame attribute: store.
Definition ngcdcsSrvFrames.cpp:83
virtual int LoadSysCfg(ngcdcs_syscfg_t *newCfg, const char *fileName)
System configuration file loader.
Definition ngcdcsSrvSysCfg.cpp:462
virtual ngcdcsSHUTTER * ShutterMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
Shutter module factory.
Definition ngcdcsSrvMod.cpp:254
void SysCfgDefault(const char *cfg)
Apply default system configuration.
Definition ngcdcsSrvSysCfg.cpp:190
int ExpDrvLoaded(const char *module)
Check if exposure driver module is loaded.
Definition ngcdcsSrvExpDrv.cpp:284
ngcdcsSEQ0 * SeqFn(int idx)
Get index of sequencer functional module.
Definition ngcdcsSrvMod.cpp:375
void void void Log(int level, const char *format,...) __attribute__((format(printf
Logging method depending on level.
Definition ngcdcsSrvLog.cpp:242
int CoreShell()
Core shell.
Definition ngcdcsSrvUI.cpp:148
int HIRES_TIMER
High resolution polling interval.
Definition ngcdcsSRV.hpp:719
virtual ngcdcsLISA * MakeLISA(ngcbIFC *dev, const ngcb_route_t &route)
Create LISA camera module.
Definition ngcdcsSrvMod.cpp:126
int ExpAddWait(int fd, int id)
Add exposure waiting client (socket)
Definition ngcdcsSrvExp.cpp:1427
void Info(char *s)
Formatted server info.
Definition ngcdcsSrvInfo.cpp:29
int subState
Server sub-state value.
Definition ngcdcsSRV.hpp:686
char readModeName[64]
Current read-mode name.
Definition ngcdcsSRV.hpp:474
const char * Version()
Current version.
Definition ngcdcsSrvMain.cpp:428
void RpcTranslate(void *payload, size_t size, int request, int how, char *s)
Translate RPC payload to string.
Definition ngcdcsSrvInfo.cpp:2440
virtual int LoadDetCfg(ngcdcs_detcfg_t *newCfg, const char *fileName)
Detector configuration file loader.
Definition ngcdcsSrvDetCfg.cpp:719
int FatalError()
Check for fatal error.
Definition ngcdcsSrvStateCtrl.cpp:325
uint64_t FramesProcessed()
Number of processed frames during current exposure.
Definition ngcdcsSrvExp.cpp:89
virtual ngcdcsSEQ * MakeSEQ(ngcbIFC *dev, const ngcb_route_t &route, ngcbPARAM_LIST *p)
Create sequencer module.
Definition ngcdcsSrvMod.cpp:88
int autoMerge
Automatic merging.
Definition ngcdcsSRV.hpp:621
char subStateString[32]
Sub-state string (IDLE,BUSY,...)
Definition ngcdcsSRV.hpp:689
int Rtd(int idx)
Start RTD for acquistion module.
Definition ngcdcsSrvUI.cpp:383
int CldcEnable(int id)
Enable CLDC outputs.
Definition ngcdcsSrvSetupCLDC.cpp:24
void ClearState(int id=0)
Clear stored sequencer states.
Definition ngcdcsSrvStateCtrl.cpp:658
int CldcCalibrate(int id)
Calibrate voltages.
Definition ngcdcsSrvSetupCLDC.cpp:322
int DetCfg(const char *cfgFile)
Apply detector configuration.
Definition ngcdcsSrvDetCfg.cpp:152
int deviceEvents
Enable/disable device events.
Definition ngcdcsSRV.hpp:297
void DisableDbMirror()
Disable internal databse mirror.
Definition ngcdcsSrvDb.cpp:25
int SeqStart(int id=0, struct timeval *ts=NULL, double absTime=0.0)
Start (sequencer + acquisition process)
Definition ngcdcsSrvRunCtrl.cpp:1103
int GetPrg(int id, int num, char *s)
Formatted sequencer program.
Definition ngcdcsSrvInfo.cpp:2330
ngcdcsACQ * AcqMod(const char *spec, const ngcdcs_acq_cfg_t &cfg, ngcbPARAM_LIST *p)
Acquisition module factory.
Definition ngcdcsSrvMod.cpp:365
int AcqStart(int id=0)
Start (acquisition process)
Definition ngcdcsSrvRunCtrl.cpp:780
int ParseArguments(int argc, char **argv)
Parse options.
Definition ngcdcsSrvArgs.cpp:89
ngcdcsEXPDRV * expDrv
Exposure sequence driver.
Definition ngcdcsSRV.hpp:571
int SelftestSca(int id)
Selftest function for Sidecar ASIC module.
Definition ngcdcsSrvSelftest.cpp:299
virtual int LookupCB(const char *paramName, char *value)
Call-back for parameter lookup.
Definition ngcdcsSrvStatus.cpp:1598
int SelftestPreamp(int id)
Selftest function for preamplifier module.
Definition ngcdcsSrvSelftest.cpp:257
int AcqInfo(int id, char *s)
Formatted acquisition process info.
Definition ngcdcsSrvInfo.cpp:1005
virtual ngcdcsC20B20 * MakeC20B20(ngcbIFC *dev, const ngcb_route_t &route, int nc, int nb)
Create NGC2 bias generator.
Definition ngcdcsSrvMod.cpp:32
virtual void SysCfgOverride(ngcdcs_syscfg_t *newCfg)
Overrride system configuration (call-back)
Definition ngcdcsSrvSysCfg.cpp:232
Definition ngcdcsSUBFRM.hpp:48
Definition ngcdcsSVS.hpp:157
Definition ngcdcsTCCD.hpp:27
Definition ngcdcsTEC.hpp:136
unsigned long int ngcb_alarm_id
Definition ngcbALARM.hpp:49
#define ngcbDB_MAX_ATTR
Definition ngcbATTR.hpp:20
int(ngcbCMD_SRV::* ngcb_function_t)(ngcb_cmd_handle_t *handle, char *reply)
Definition ngcbCMD.hpp:307
#define ngcbEVT_PENDING
Definition ngcbIFC.hpp:43
#define ngcbVB_LOG
Definition ngcbSERVICE.hpp:25
#define ngcbVB_PRINT
Definition ngcbSERVICE.hpp:24
#define ngcbSIO_MAX_CON
Definition ngcbSIO.hpp:23
int ngcbGetTime(struct timeval *t)
Definition ngcbTime.c:40
#define ngcdcsACQ_MAX_PROC
Definition ngcdcsACQ.hpp:70
#define ngcdcsCTRL_MAX_SEQ
Definition ngcdcsCTRL.hpp:43
#define ngcdcsCTRL_MAX_DEV
Definition ngcdcsCTRL.hpp:55
int ngcdcsCfg2Arg(int argc, char **argv, char *argStr)
Definition ngcdcsSrvArgs.cpp:802
void ngcdcsSrvBreakHandler(int sig)
Definition ngcdcsSrvMain.cpp:35
#define ngcdcsLOG_INFO
Definition ngcdcsSRV.hpp:124
void ngcdcsSrvExitHandler(int sig)
Definition ngcdcsSrvMain.cpp:54
#define ngcdcsMAX_LOG
Definition ngcdcsSRV.hpp:119
#define ngcdcsTCCD_MAX_PROC
Definition ngcdcsTCCD.hpp:21
Definition ngcbIFC.hpp:575
Definition ngcbSTREAM.hpp:27
Definition ngcbSIO.hpp:63
Definition ngcbIFC.hpp:72
Definition ngcdcsEXP.hpp:102
Definition ngcdcsACQ_DATA.hpp:24
Definition ngcdcsCFG.hpp:1193
Definition ngcdcsEXP.hpp:141
Definition ngcdcsFINFO.hpp:462
Definition ngcdcsSRV.hpp:148
unsigned int nExpStart
Definition ngcdcsSRV.hpp:150
ngcdcs_srvinfo_t()
Constructor.
Definition ngcdcsSRV.hpp:158
unsigned int nExpCompl
Definition ngcdcsSRV.hpp:151
unsigned int nFile
Definition ngcdcsSRV.hpp:155
struct timeval startTime
Definition ngcdcsSRV.hpp:149
unsigned int nFram
Definition ngcdcsSRV.hpp:154
unsigned int nExpFail
Definition ngcdcsSRV.hpp:153
unsigned int nExpAbort
Definition ngcdcsSRV.hpp:152
Definition ngcdcsCFG.hpp:950
Definition ngcdcsSRV.hpp:134
virtual ~ngcdcs_wait_t()
Destructor.
Definition ngcdcsSRV.hpp:142
int id
Definition ngcdcsSRV.hpp:136
ngcdcs_wait_t()
Constructor.
Definition ngcdcsSRV.hpp:139
int fd
Definition ngcdcsSRV.hpp:135
Definition ngcdcsSEQ.hpp:156