ngc 1.5.0
 
Loading...
Searching...
No Matches
ngcdcsSRV.hpp
Go to the documentation of this file.
1
8#ifndef ngcdcsSRV_H
9#define ngcdcsSRV_H
10
11
12#ifndef __cplusplus
13#error This is a C++ include file and cannot be used from plain C
14#endif
15
16#include <ngc/core/ngcb.h>
17#include <ngc/core/ngcbShell.h>
18#include <ngc/core/ngcbSIO.hpp>
19#include <ngc/core/ngcbIFC.hpp>
21#include <ngc/core/ngcbCMD.hpp>
22#include <ngc/core/ngcbATTR.hpp>
23#include <ngc/core/ngcbDIC.hpp>
32
33#ifdef VLT_CCS
34
35/*
36 * Server states
37 */
38#include "evhStates.h"
39#define ngcdcsSTATE_OFF evhSTATE_OFF //< OFF-state
40#define ngcdcsSTATE_LOADED evhSTATE_LOADED //< LOADED-state
41#define ngcdcsSTATE_STANDBY evhSTATE_STANDBY //< STANDBY-state
42#define ngcdcsSTATE_ONLINE evhSTATE_ONLINE //< ONLINE-state
43
44/*
45 * Error definitions
46 */
47#include "ngcdcsErrors.h"
48
49#else
50
51/*
52 * Server states
53 */
54#define ngcdcsSTATE_OFF 1 //< OFF-state
55#define ngcdcsSTATE_LOADED 2 //< LOADED-state
56#define ngcdcsSTATE_STANDBY 3 //< STANDBY-state
57#define ngcdcsSTATE_ONLINE 4 //< ONLINE-state
58
59/*
60 * Error definitions
61 */
62#define ngcdcsERR_SYSTEM 1 //< general system error
63#define ngcdcsERR_IO 2 //< i/o-error
64#define ngcdcsERR_INIT 3 //< initialization error
65#define ngcdcsERR_WARNING 4 //< just a warning
66#define ngcdcsERR_FATAL 5 //< fatal error forcing exit
67#define ngcdcsERR_DB_READ 6 //< database read failed
68#define ngcdcsERR_DB_WRITE 7 //< database write failed
69#define ngcdcsERR_DB_INIT 8 //< database initialization failed
70#define ngcdcsERR_ACQ_IO 9 //< acquisition process i/o-error
71#define ngcdcsERR_ACQ_OVERRUN 10 //< run-time error: buffer overrun
72#define ngcdcsERR_ACQ_OVERFLOW 11 //< run-time error: FIFO overflow
73#define ngcdcsERR_ACQ_EXEC 12 //< acquisition process exec failed
74#define ngcdcsERR_EXP_IO 13 //< exposure data chain i/o-error
75#define ngcdcsERR_EXP_FILE 14 //< exposure file i/o-error
76#define ngcdcsERR_EXP_PROC 15 //< exposure post-processing error
77#define ngcdcsERR_ACCESS 16 //< missing access rights
78#define ngcdcsERR_MERGE 17 //< data merging failed
79#define ngcdcsERR_CLDC 18 //< CLDC protection error
80#define ngcdcsERR_AOBIAS 19 //< AOBIAS protection error
81#define ngcdcsERR_NGSDBIAS 20 //< NGSDBIAS protection error
82
83#endif
84
88#define ngcdcsGUI_DEFAULT "ngcgui"
89
90/*
91 * Server sub-states
92 */
93#define ngcdcsSUBSTATE_NONE 0 //< not yet set (unknown)
94#define ngcdcsSUBSTATE_IDLE 1 //< idle
95#define ngcdcsSUBSTATE_BUSY 2 //< busy
96#define ngcdcsSUBSTATE_ACTIVE 6 //< exposure active
97#define ngcdcsSUBSTATE_ERROR 8 //< error
98
99#define ngcdcsSUBSTATE_READY 3 //< ready
100#define ngcdcsSUBSTATE_NOT_READY 4 //< not ready
101#define ngcdcsSUBSTATE_INIT 5 //< initializing
102#define ngcdcsSUBSTATE_RECOVER 7 //< recovering
103#define ngcdcsSUBSTATE_RUNNING 9 //< acquisition running
104
105/*
106 * Server operational modes
107 */
108#define ngcdcsOPMODE_NORMAL 0 //< normal mode (accessing DFE)
109#define ngcdcsOPMODE_HWSIM 1 //< simulation mode (accessing DWS, no DFE)
110#define ngcdcsOPMODE_LCUSIM 2 //< simulation mode (local simulation, no DWS)
111
115#define ngcdcsMERGE_MAX_PROC 4
116
120#define ngcdcsMAX_LOG 50
121
122/*
123 * Log levels
124 */
125#define ngcdcsLOG_INFO 0 //< informal log
126
127/*
128 * Error test cases
129 */
130#define ngcdcsTESTERR_BLOCK 0x800 //< service blocks forever
131
136 int fd; //< File descriptor for reply
137 int id; //< Waiter id
138
140 ngcdcs_wait_t() {fd = -1; id = 0;}
141
143 virtual ~ngcdcs_wait_t() {}
144};
145
150 struct timeval startTime; //< Server start time
151 unsigned int nExpStart; //< Number of exposures started
152 unsigned int nExpCompl; //< Number of exposures completed
153 unsigned int nExpAbort; //< Number of exposures aborted
154 unsigned int nExpFail; //< Number of exposures failed
155 unsigned int nFram; //< Number of processed data frames
156 unsigned int nFile; //< Number of files stored
157
161 nExpStart = 0; nExpCompl = 0; nExpAbort = 0; nExpFail = 0;
162 nFram = 0; nFile = 0;
163 }
164};
165
170{
171public:
172 int id; //< Event id
173 int devices; //< Device list (32-bit list)
174 int status; //< Event status
175
178
180 explicit ngcdcsEVT(int i) {id = i; devices = 0x0; status = ngcbEVT_PENDING;}
181
183 ngcdcsEVT(int i, int d) {id = i; devices = d; status = ngcbEVT_PENDING;}
184
186 virtual ~ngcdcsEVT() {}
187
188protected:
189private:
190};
191
196{
197public:
198 ngcbSERVICE *services; //< System services
199 int verboseLevel; //< Verbose level
200 int logLevel; //< Logging level
201
204 verboseLevel(0),
205 logLevel(0),
206 id_((ngcb_alarm_id)0L) {}
207
209 virtual ~ngcdcsALARM_SYS() {}
210
213 Store(a, ++id_);
214 if (services != NULL)
215 {
216 char logMsg[512];
217 sprintf(logMsg, "ALARM(%s)-%lu: %s (%s)\n", a->Name(), id_,
218 a->Msg(), a->Value(1));
219 if (verboseLevel > 0) services->Logger(ngcbVB_PRINT, logMsg);
220 services->Logger(ngcbVB_LOG, logMsg); // we always log the alarm
221 }
222 return (id_);
223 }
224
227 ngcbALARM *a = Get(id);
228 if (a != NULL)
229 {
230 if ((services != NULL) && ((verboseLevel > 0) || (logLevel > 0)))
231 {
232 char logMsg[64];
233 sprintf(logMsg, "ALARM(%s)-%lu: cancelled\n", a->Name(), id);
234 if (verboseLevel > 0) services->Logger(ngcbVB_PRINT, logMsg);
235 if (logLevel > 0) services->Logger(ngcbVB_LOG, logMsg);
236 }
237 }
238 Remove(id);
239 }
240
243 ngcbALARM *a = Get(id);
244 if (a != NULL)
245 {
246 a->Ack();
247
248 if ((services != NULL) && ((verboseLevel > 0) || (logLevel > 0)))
249 {
250 char logMsg[64];
251 sprintf(logMsg, "ALARM(%s)-%lu: acknowledged\n", a->Name(), id);
252 if (verboseLevel > 0) services->Logger(ngcbVB_PRINT, logMsg);
253 if (logLevel > 0) services->Logger(ngcbVB_LOG, logMsg);
254 }
255 }
256 Remove(id);
257 }
258
259protected:
260private:
262 ngcb_alarm_id id_;
263};
264
268class ngcdcsSRV: public ngcbSIO, public ngcbCMD_SRV, private ngcdcsACQ_SERVICE
269{
270public:
272 ngcdcsSRV();
273
275 explicit ngcdcsSRV(ngcdcsCTRL *controller);
276
278 virtual ~ngcdcsSRV();
279
280
281 /*
282 * System configuration
283 */
284
287
290
292 char thisHost[64];
293
296
299
302
304 int EvtAddWait(int fd, int id);
305
308
310 char configDir[256];
311
313 int CfgPath(char *path, const char *cfgFile);
314
316 int ConfigureSystem(ngcdcs_syscfg_t newCfg, int copy = 1);
317
319 int Check(const ngcdcs_syscfg_t &cfg);
320
322 int SysCfg(const char *cfgFile);
323
325 void SysCfgDefault(const char *cfg);
326
328 int InitSysCfg(const char *cfgFile);
329
331 int StoreCfg(const char *fileName);
332
333
334 /*
335 * System shutdown
336 */
337
339 void Release();
340
342 void Shutdown();
343
345 FILE *watchdog;
346
347
348 /*
349 * System info
350 */
351
353 void Info(char *s);
354
356 void SysInfo(char *s);
357
359 void ModInfo(char *s);
360
362 void BoardInfo(char *s);
363
365 int AdcInfo(int id, char *s);
366
368 int AcqInfo(int id, char *s);
369
371 void RpcTranslate(void *payload, size_t size, int request, int how, char *s);
372
374 void CheckDev(int idx, char *s);
375
377 int GetPat(int id, int num, char *s);
378
380 int GetPrg(int id, int num, char *s);
381
383 int CheckTriggerPeriod(int id, double period);
384
385
386 /*
387 * Detector configuration
388 */
389
392
394 int Check(const ngcdcs_detcfg_t &cfg);
395
397 int DetCfg(const char *cfgFile);
398
399
400 /*
401 * Controller Interface
402 */
403
406
409
411 int RouteComp(ngcbMOD *, ngcbMOD *);
412
415
418
419
420 /*
421 * Acquisition module
422 */
423
426
429
431 int FrameHandler(void *buffer, ngcdcs_finfo_t *finfo, char *erms);
432
434 int FitsMerger(ngcbFITS *hdr, char *erms);
435
437 int Statistics(int id, char *s);
438
440 int AcqProc(int id, const char *procName);
441
443 int Rtd(int idx);
444
446 int FrameGen(int id, const char *name, int flag);
447
449 int FrameStore(int id, const char *name, int flag);
450
452 int FrameLocal(int id, const char *name, int flag);
453
455 int FrameExport(int id, const char *name, int flag);
456
458 int FrameBreak(int id, const char *name, int n);
459
461 int FrameWin(int id, const char *name, int sx, int sy, int nx, int ny);
462
464 void GetFrames(int id, char *s);
465
466
467 /*
468 * Read-out modes
469 */
470
473
475 char readModeName[64];
476
479
481 int ReadModeIdx(int id);
482
484 int ReadModeIdx(const char *name);
485
487 int ReadMode(int idx);
488
489
490 /*
491 * Exposure handling
492 */
493
496
498 int FitsBlock();
499
501 int PrepareFits(int refresh = 1);
502
504 int DumpFits(const char *fileName = NULL);
505
507 int CheckExp();
508
510 void ExpStatus(unsigned int newStat, const char *erms = NULL);
511
513 void ExpStatus2String(char *s, int stat);
514
516 void ExpStatus2String(char *s);
517
519 char *ExpStatusString();
520
522 int RecStart(const char *id, double absTime = 0.0);
523
525 int ExpStart(int acqId = 0, double absTime = 0.0);
526
528 int ExpAbort(int acqId = 0);
529
531 int ExpEnd(int acqId = 0);
532
534 int ExpPause(int id = 0);
535
537 int ExpCont(int id = 0);
538
540 int ExpAddWait(int fd, int id);
541
543 void ExpPoll();
544
546 int PostProcEnabled();
547
549 void Publish(const ngcdcs_exp_topic &topic);
550
552 uint64_t FramesProcessed();
553
555 uint64_t SizeRecorded();
556
558 double TimeElapsed();
559
561 double RemainingTime();
562
563
564 /*
565 * Exposure driver
566 */
567
570
572 void ExpDrvStatus(unsigned int newStat);
573
575 int ExpDrvLoad(const char *module, const char *name = NULL);
576
578 int ExpDrvUnload(const char *name, const char *symbol = NULL);
579
581 int ExpDrvUnload();
582
584 int ExpDrvLoaded(const char *module);
585
587 int ExpDrvCfg(const char *s);
588
590 void ExpDrvList(char *s);
591
593 void ExpDrvModList(char *s);
594
596 char expDrvFeedBack[128];
597
599 int ExpDrvSelect(const char *name);
600
602 int ExpDrvClose();
603
605 int ExpDrvStart();
606
608 int ExpDrvAbort();
609
611 int ExpDrvAddWait(int fd);
612
613
614 /*
615 * Data merger
616 */
617
620
623
626
629
632
635
638
640 char mergeArg[128];
641
643 virtual void MergeReset(int relaunch = 0);
644
646 virtual int MergeStart(const char *name, int display, int id, int cleanup=0);
647
649 virtual int MergeStop(int id);
650
652 virtual int MergeStatus(int id, char *stat = NULL);
653
655 virtual int MergeMsg(int id, char *msg);
656
658 virtual void MergeNext();
659
661 int MergeAlign();
662
663
664 /*
665 * Server state
666 */
667
669 char opMode[32];
670
673
675 int state;
676
678 char stateString[32];
679
681 void State(int newState, int update = 1);
682
685
687 char subStateString[32];
688
690 void SubState(int newState);
691
693 void ClearSubState();
694
696 int ErrState();
697
699 int OpMode(int level);
700
702 int OpMode(const char *mode);
703
706
709
712
715
718
720 void DevPoll();
721
723 int HaveLocalEvents();
724
726 virtual void Query();
727
729 virtual void PollStatConfigure(int enable, int interval);
730
732 virtual void HiResTimer(int enable);
733
735 void FatalError(const char *erms);
736
738 int FatalError();
739
741 double LifeTime();
742
744 int Disable();
745
747 int NeedEnableCycle();
748
750 int Enable(int check);
751
753 int Off();
754
756 int Recover();
757
759 int ResetDfe();
760
762 int ResetSensors();
763
764
765 /*
766 * Server setup
767 */
768
770 void Profile(const char *name = NULL);
771
773 void ProcName(const char *name);
774
776 const char *ProcName();
777
779 void PrintUsage();
780
782 int ParseArguments(int argc, char **argv);
783
785 const char *Version();
786
788 void ExportVersion(const char *newVersion);
789
791 void Port(int port);
792
794 void Instance(const char *name);
795
797 char *Instance();
798
800 void ExecShell(const char *name);
801
803 const char *DicList();
804
806 char *ErrMsg();
807
809 void SaveErr(const char *erms);
810
812 const char *LastErr();
813
815 int ShutdownService(int port);
816
818 char gui[256];
819
820
821 /*
822 * Verbose output and logging
823 */
824
827
830
833
836
838 void Logger(int flag, const char *msg);
839
841 int Xterm();
842
844 int VerboseLevel();
845
847 void VerboseLevel(int level);
848
850 int LogLevel();
851
853 void LogLevel(int level);
854
856 void Verbose(int level, const char *format, ...)
857 __attribute__ ((format(printf, 3, 4)));
858
860 void Verbose(const char *fromat, ...)
861 __attribute__ ((format(printf, 2, 3)));
862
864 void Log(int level, const char *format, ...)
865 __attribute__ ((format(printf, 3, 4)));
866
868 void Log(const char *format, ...)
869 __attribute__ ((format(printf, 2, 3)));
870
872 void ErrLog(int severity, const char *format, ...)
873 __attribute__ ((format(printf, 3, 4)));
874
876 void Print(const char *format, ...)
877 __attribute__ ((format(printf, 2, 3)));
878
880 void AddLog(const char *format, ...)
881 __attribute__ ((format(printf, 2, 3)));
882
884 int ConfigureLogging(int vb, int log, int xt);
885
887 int DebugStream(int flag);
888
890 void BroadcastAlarm(const char *msg);
891
893 void ClrLog();
894
896 void CatLog(char *s);
897
898
899 /*
900 * Module event handlers
901 */
902
904 void DeviceEvent(void *origin, void *event);
905
907 void DevError(const char *erms, int id, void *descriptor);
908
910 void AcqError(const char *erms, int id, void *descriptor);
911
912
913 /*
914 * Database
915 */
916
918 char dbPoint[256];
919
921 void DisableDbMirror();
922
924 int DbAdd(ngcbATTR *attr);
925
927 void DbExport();
928
930 int DbConfigure();
931
933 int Update();
934
936 virtual void DbLock();
937
939 virtual void DbUnlock();
940
941
942 /*
943 * Command services
944 */
945
947 int AddCmd(const char *cmd, ngcb_function_t function, int flags,
948 const char *syntax, const char *help);
949
951 void DelCmd(const char *cmd);
952
954 int Execute(const char *cmd, char *reply, int protect = 0, int fd = -1);
955
957 int Execute(const char *cmd, int protect = 0, int fd = -1);
958
960 int Macro(const char *fileName, char *reply, int protection = 0);
961
963 int SimError(int error, int idx = 0);
964
965
966 /*
967 * Server main-loop
968 */
969
971 virtual void ExitSignal(int sig);
972
974 int Initialize();
975
977 int Reset();
978
980 void Abort();
981
983 int InMainLoop();
984
986 int SrvPortOrig();
987
989 int CoreShell();
990
992 int MainLoop();
993
995 void LockService();
996
998 void UnlockService();
999
1000
1001 /*
1002 * Run-Control
1003 */
1004
1007
1009 int AcqStop(int id = 0);
1010
1012 int AcqStart(int id = 0);
1013
1015 int SeqIdle(int id = 0);
1016
1018 int SeqWaiting();
1019
1021 int SeqStop(int id = 0);
1022
1024 int SeqStart(int id = 0, struct timeval *ts = NULL, double absTime = 0.0);
1025
1027 int SeqTrigger(int id);
1028
1030 int SeqPause(int id = 0);
1031
1033 int SeqContinue(int id = 0);
1034
1036 int SeqBreak(int id = 0);
1037
1039 int SeqWait(int id, int event, int timeout, int interval);
1040
1042 void ClearState(int id = 0);
1043
1045 void StoreState();
1046
1048 int RestoreState();
1049
1051 int ShutterAction(int id, const char *action, char *reply);
1052
1054 int TecAction(int id, const char *action, char *reply);
1055
1057 int GeosnapAction(int id, const char *action, char *reply);
1058
1059
1060 /*
1061 * Parameter handling
1062 */
1063
1066
1069
1071 int ParamDefault();
1072
1074 int LoadSetup(const char *fileName, char **list, int *listLength,
1075 int max = -1);
1076
1078 int LoadSetup(const char *fileName);
1079
1081 ngcbPARAM *ParamDefine(const char *name, const char *value, int id,
1082 int *status = NULL);
1083
1085 int ParamDefine(const char *name, const char *value, const char *unit);
1086
1088 void ParamUndefine(const char *name, int id);
1089
1091 int SetupList(const char *paramBuf);
1092
1094 int SetupList(char **paramBuf, int size);
1095
1097 int SetupList(ngcbPARAM_LIST *list);
1098
1100 int SetupParam(const char *name, const char *value);
1101
1103 int StatusList(const char *list, char *reply);
1104
1106 int StatusList(char **list, int size, char *reply);
1107
1109 int StatusParam(const char *name, char *value);
1110
1112 int ParamLookup(const char *name, char *value, int flag = 0);
1113
1116
1117
1118 /*
1119 * Module factories
1120 */
1121
1123 ngcdcsCLDC *CldcMod(const char *spec, ngcbIFC *dev,
1124 const ngcb_route_t &route,
1125 int nc, int nb, double extRef);
1126
1128 ngcdcsSEQ *SeqMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route,
1129 ngcbPARAM_LIST *p);
1130
1132 ngcdcsADC *AdcMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route,
1133 int num, int bitPix);
1134
1136 virtual ngcdcsSHUTTER *ShutterMod(const char *spec, ngcbIFC *dev,
1137 const ngcb_route_t &route);
1138
1140 virtual ngcdcsPREAMP *PreampMod(const char *spec, ngcbIFC *dev,
1141 const ngcb_route_t &route);
1142
1144 ngcdcsNGC2 *NGC2Mod(const char *spec, ngcbIFC *dev,
1145 const ngcb_route_t &route);
1146
1148 ngcdcsAO *AOMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route);
1149
1151 ngcdcsLISA *LISAMod(const char *spec, ngcbIFC *dev,
1152 const ngcb_route_t &route);
1153
1155 ngcdcsNGSD *NGSDMod(const char *spec, ngcbIFC *dev,
1156 const ngcb_route_t &route, double extRef);
1157
1159 ngcdcsTEC *TECMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route);
1160
1162 ngcdcsGEOSNAP *GeosnapMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route);
1163
1165 ngcdcsSCA *ScaMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route,
1166 ngcbPARAM_LIST *p);
1167
1169 ngcdcsACQ *AcqMod(const char *spec, const ngcdcs_acq_cfg_t &cfg,
1170 ngcbPARAM_LIST *p);
1171
1172
1173 /*
1174 * ASIC mapping
1175 */
1176
1179
1182
1184 ngcdcsSEQ0* SeqFn(int idx);
1185
1187 ngcdcsCLDC0* CldcFn(int idx);
1188
1189
1190 /*
1191 * CLDC functions
1192 */
1193
1195 int CldcEnable(int id);
1196
1198 int CldcDisable(int id);
1199
1201 int CldcDefault(int id);
1202
1204 int CldcCheck(int id);
1205
1207 int CldcCalibrate(int id);
1208
1210 int CldcClearCalibration(int id);
1211
1213 int CldcRestore(int id, const char *key = NULL);
1214
1216 int Snapshot(int id, char *s);
1217
1219 int Telemetry(int id, char *s);
1220
1222 void Voltages(ngcdcsCLDC0 *mod, char *s);
1223
1224
1225 /*
1226 * Selftests
1227 */
1228
1230 int SelftestCldc(int id);
1231
1233 int SelftestSeq(int id);
1234
1236 int SelftestAdc(int id);
1237
1239 int SelftestShutter(int id);
1240
1242 int SelftestPreamp(int id);
1243
1245 int SelftestSca(int id);
1246
1248 int SelftestAcq(int id);
1249
1250protected:
1252 virtual ngcbCMD_LIST *CreateCmdList();
1253
1255 virtual void InstallSignalHandlers();
1256
1258 virtual int ResolvePath(char *resolved, const char *fileName);
1259
1261 virtual void SysCfgOverride(ngcdcs_syscfg_t *newCfg);
1262
1264 virtual int ConfigureSystemCB1(ngcdcs_syscfg_t &newCfg);
1265
1267 virtual int ConfigureSystemCB2(ngcdcs_syscfg_t &newCfg);
1268
1270 virtual int LoadSysCfg(ngcdcs_syscfg_t *newCfg, const char *fileName);
1271
1273 virtual int LoadDetCfg(ngcdcs_detcfg_t *newCfg, const char *fileName);
1274
1276 virtual void ShutdownSystemCB1();
1277
1279 virtual void ShutdownSystemCB2();
1280
1282 virtual void MergeInit();
1283
1285 virtual int LookupCB(const char *paramName, char *value);
1286
1289
1291 virtual int FrameHandlerCB(void *buffer, ngcdcs_finfo_t *finfo, char *erms);
1292
1294 virtual int FitsMergerCB(ngcbFITS *hdr, char *erms);
1295
1297 int HandleExpEvt();
1298
1300 virtual int ExpStartCB();
1301
1303 virtual int ExpCountDownCB();
1304
1306 ngcdcsEXPDRV *ExpDrv(const char *name, const ngcb_fb_t &feedBackChannel);
1307
1309 virtual void AgEvent(int acqInst, ngcdcs_2ag_t ag, int errorId,
1310 const char *erms);
1311
1313 virtual void ErrorEvent(int id, const char *erms);
1314
1316 virtual void ErrLogEvent(int id, const char *erms);
1317
1319 virtual void VerboseCB(const char *msg, int level = ngcdcsLOG_INFO);
1320
1322 virtual void LogCB(const char *msg, int level = ngcdcsLOG_INFO);
1323
1325 virtual void DbLogCB(const char *msg);
1326
1328 void DbLog(const char *format, ...)
1329 __attribute__ ((format(printf, 2, 3)));
1330
1332 virtual int DbConfCB();
1333
1335 virtual int DbUpdateCB();
1336
1338 virtual void PublishExpEvent(int errorId, unsigned int newStat,
1339 const char *fileName, int merge,
1340 const char *erms);
1341
1343 virtual void PublishLogPars();
1344
1346 virtual void PublishState();
1347
1349 virtual void PublishSubState();
1350
1352 virtual void PublishExpDrvStatus();
1353
1354
1355 /*
1356 * TCP/IP services
1357 */
1358
1360 virtual int AddSockCB(int fd);
1361
1363 virtual int DelSockCB(int fd);
1364
1365
1366 /*
1367 * Module creation hooks
1368 */
1369
1371 virtual ngcdcsCLDC *MakeCLDC(ngcbIFC *dev, const ngcb_route_t &route,
1372 int nc, int nb);
1373
1375 virtual ngcdcsC20B20 *MakeC20B20(ngcbIFC *dev, const ngcb_route_t &route,
1376 int nc, int nb);
1377
1379 virtual ngcdcsB24 *MakeB24(ngcbIFC *dev, const ngcb_route_t &route, int nb);
1380
1382 virtual ngcdcsC24 *MakeC24(ngcbIFC *dev, const ngcb_route_t &route);
1383
1385 virtual ngcdcsAPD *MakeAPD(ngcbIFC *dev, const ngcb_route_t &route, int nb);
1386
1388 virtual ngcdcsAOBIAS *MakeAOBIAS(ngcbIFC *dev, const ngcb_route_t &route,
1389 int nb);
1390
1392 virtual ngcdcsALBIAS *MakeALBIAS(ngcbIFC *dev, const ngcb_route_t &route,
1393 int nb);
1394
1396 virtual ngcdcsLISABIAS *MakeLISABIAS(ngcbIFC *dev, const ngcb_route_t &route,
1397 int nb);
1398
1400 virtual ngcdcsNGSDBIAS *MakeNGSDBIAS(ngcbIFC *dev,
1401 const ngcb_route_t &route,
1402 int nb, double extRef);
1403
1405 virtual ngcdcsSEQ *MakeSEQ(ngcbIFC *dev, const ngcb_route_t &route,
1406 ngcbPARAM_LIST *p);
1407
1409 virtual ngcdcsADC *MakeADC(ngcbIFC *dev, const ngcb_route_t &route, int num,
1410 int bitPix);
1411
1413 virtual ngcdcsSHUTTER *MakeSHUTTER(ngcbIFC *dev, const ngcb_route_t &route);
1414
1416 virtual ngcdcsPREAMP *MakePREAMP(ngcbIFC *dev, const ngcb_route_t &route);
1417
1419 virtual ngcdcsNGC2 *MakeNGC2(ngcbIFC *dev, const ngcb_route_t &route);
1420
1422 virtual ngcdcsAO *MakeAO(ngcbIFC *dev, const ngcb_route_t &route);
1423
1425 virtual ngcdcsLISA *MakeLISA(ngcbIFC *dev, const ngcb_route_t &route);
1426
1428 virtual ngcdcsNGSD *MakeNGSD(ngcbIFC *dev, const ngcb_route_t &route,
1429 double extRef);
1430
1432 virtual ngcdcsTEC *MakeTEC(ngcbIFC *dev, const ngcb_route_t &route);
1433
1435 virtual ngcdcsGEOSNAP *MakeGeosnap(ngcbIFC *dev, const ngcb_route_t &route);
1436
1438 virtual ngcdcsSCA *MakeSCA(ngcbIFC *dev, const ngcb_route_t &route,
1439 ngcbPARAM_LIST *p);
1440
1442 virtual ngcdcsACQ *MakeACQ(const ngcdcs_acq_cfg_t &cfg, ngcbPARAM_LIST *p);
1443
1444
1445 /*
1446 * Call-backs from ngcbSIO
1447 */
1448
1450 int ProtocolAscii(int fd);
1451
1453 int ProtocolBin(int fd);
1454
1456 int FdCB(int fd);
1457
1459 int NewEventConnection(int fd);
1460
1462 int TimerCB();
1463
1464private:
1466 void Init_();
1467
1469 int initialized_;
1470
1472 char erms_[256];
1473
1475 char versionString_[256];
1476
1478 char thisVersion_[256];
1479
1481 struct timeval t0_;
1482
1484 char testParam_[256];
1485
1487 char procName_[128];
1488
1490 int srvCmdPort_;
1491
1493 int srvEvtPort_;
1494
1496 char profile_[32];
1497
1499 ngcb_port_t service_[8];
1500
1502 int services_;
1503
1505 ngcbSEM *semService_;
1506
1508 int endian_;
1509
1511 ngcbSHMDB *tcpdb_;
1512
1514 int executor_;
1515
1517 char instance_[64];
1518
1520 int nativeCtrl_;
1521
1523 int aborted_;
1524
1525 pthread_t serviceThread_;
1526
1527 /*
1528 * Debugging functions
1529 */
1530
1532 ngcbSEM *semVerbose_;
1533
1535 ngcbSEM *semFrame_;
1536
1538 void VbLock_();
1539
1541 void VbUnlock_();
1542
1544 int debugConnection_;
1545
1547 int OpenDebugStream_();
1548
1550 void CloseDebugStream_();
1551
1553 void AlignLogging_();
1554
1556 void InternalLog_(const char *msg);
1557
1559 char lastErrMsg_[512];
1560
1562 int verboseLevel_;
1563
1565 int logLevel_;
1566
1568 char *logMsg_[ngcdcsMAX_LOG];
1569
1571 int nlog_;
1572
1574 int plog_;
1575
1577 ngcdcsALARM_SYS alarmSystem_;
1578
1580 int localHost_;
1581
1583 int xterm_;
1584
1586 ngcdcs_srvinfo_t info_;
1587
1589 ngcbTMPFILE *sdebug_;
1590
1592 int debugPort_;
1593
1594
1595 /*
1596 * User Interfaces
1597 */
1598
1600 int shell_;
1601
1603 int coreShell_;
1604
1606 int shellPid_;
1607
1609 void ExternalShell_();
1610
1612 int guiPid_;
1613
1615 void GUI_();
1616
1617
1618 /*
1619 * Error handling
1620 */
1621
1623 int fatalError_;
1624
1626 int telemetryError_;
1627
1629 int acqRtError_;
1630
1632 int MapError_(int id, ngcbOBJ *obj);
1633
1635 void DevErrState_(const char *msg, int id, ngcbIFC *dev, ngcbMOD *mod);
1636
1638 void AcqErrState_(const char *msg, int id, ngcdcsACQ *mod);
1639
1640
1641 /*
1642 * Parameter handling
1643 */
1644
1646 char dicList_[256];
1647
1649 char *dicBuf_;
1650
1652 int dicIdx_;
1653
1655 ngcbPARAM_LIST paramList_;
1656
1658 ngcbPARAM_LIST dicParam_;
1659
1661 int locked_;
1662
1664 void AttachDic_(ngcbPARAM_LIST *list);
1665
1667 int ApplyParamList_(ngcbPARAM_LIST *list, int noBackup = 0);
1668
1670 int ApplyDefaultSetup_(const char *fileName, int id);
1671
1673 int SetupParam_(const char *name, const char *value, int *status = NULL);
1674
1676 int SetupDEV_(const char *name, const char *value, int *status = NULL);
1677
1679 int SetupSEQ_(const char *name, const char *value, int *status = NULL);
1680
1682 int SetupCLDC_(const char *name, const char *value, int *status = NULL);
1683
1685 int SetupADC_(const char *name, const char *value, int *status = NULL);
1686
1688 int SetupNGC2_(const char *name, const char *value, int *status = NULL);
1689
1691 int SetupAO_(const char *name, const char *value, int *status = NULL);
1692
1694 int SetupLISA_(const char *name, const char *value, int *status = NULL);
1695
1697 int SetupNGSD_(const char *name, const char *value, int *status = NULL);
1698
1700 int SetupTEC_(const char *name, const char *value, int *status = NULL);
1701
1703 int SetupGeosnap_(const char *name, const char *value, int *status = NULL);
1704
1706 int SetupPREAMP_(const char *name, const char *value, int *status = NULL);
1707
1709 int SetupSHUT_(const char *name, const char *value, int *status = NULL);
1710
1712 int SetupSCA_(const char *name, const char *value, int *status = NULL);
1713
1715 int SetupSCA_();
1716
1718 int SetupACQ_(const char *name, const char *value, int *status = NULL);
1719
1721 int StatusParam_(const char *name, char *value);
1722
1724 int StatusDEV_(const char *name, char *value, int *status);
1725
1727 int StatusSEQ_(const char *name, char *value, int *status);
1728
1730 int StatusCLDC_(const char *name, char *value, int *status);
1731
1733 int StatusADC_(const char *name, char *value, int *status);
1734
1736 int StatusNGC2_(const char *name, char *value, int *status);
1737
1739 int StatusAO_(const char *name, char *value, int *status);
1740
1742 int StatusLISA_(const char *name, char *value, int *status);
1743
1745 int StatusNGSD_(const char *name, char *value, int *status);
1746
1748 int StatusTEC_(const char *name, char *value, int *status);
1749
1751 int StatusGeosnap_(const char *name, char *value, int *status);
1752
1754 int StatusPREAMP_(const char *name, char *value, int *status);
1755
1757 int StatusSHUT_(const char *name, char *value, int *status);
1758
1760 int StatusSCA_(const char *name, char *value, int *status);
1761
1763 int StatusACQ_(const char *name, char *value, int *status);
1764
1766 int StatusCHIP_(const char *name, char *value, int *status);
1767
1769 int GroupList_(ngcbPARAM_LIST *list);
1770
1772 void IgnoreErr_(int flag);
1773
1775 int ParamList2PP_();
1776
1778 int SlxCfg_();
1779
1780
1781 /*
1782 * Configuration
1783 */
1784
1786 char sysCfgFile_[256];
1787
1789 ngcbPARAM_LIST *sysCfgPreset_;
1790
1792 ngcdcsRTD *rtd_;
1793
1795 int aoCameraType_;
1796
1798 int InitialCfg_();
1799
1801 void SysCfgPreset_(const char *name, const char *value);
1802
1804 int AcqChipMap_(int *n, int *d, ngcdcs_detcfg_t cfg);
1805
1807 void DefaultFrames_(ngcdcs_syscfg_t *cfg);
1808
1810 int configured_;
1811
1813 int needShutdown_;
1814
1816 ngcbCMD_LIST *cmdList_;
1817
1819 int InstallCommands_();
1820
1822 int ReferenceCheck_();
1823
1825 int haveLoadedState_;
1826
1827 /*
1828 * Exposure handling
1829 */
1830
1832 char expStatStr_[32];
1833
1835 double lastExposureTime_;
1836
1838 int fitsBlock_;
1839
1841 ngcdcsSUBFRM subFrames_;
1842
1845
1847 ngcdcs_wait_t expDrvWaitObj_[ngcbSIO_MAX_CON];
1848
1850 ngcdcs_wait_t evtWaitObj_[ngcbSIO_MAX_CON];
1851
1853 void ComputeExpTime_();
1854
1856 char expLastFile_[256];
1857
1859 int postProcEnabled_;
1860
1862 int hires_;
1863
1865 int hiresSkip_;
1866
1868 int mrgEvtPid_;
1869
1871 int Chip2Fits_(ngcbFITS *f, int idx);
1872
1874 int expDrvSetup_;
1875
1877 int HaveFrame_();
1878
1880 int HaveBreakCond_();
1881
1883 int ExpDrvFeedBack_(ngcb_fb_t *fb);
1884
1886 void ExpDrvInit_();
1887
1889 void ExpDrvNext_();
1890
1892 int MergeList_();
1893
1894
1895 /*
1896 * Some convenience functions
1897 */
1898
1900 int SeqDwellTime_(int id, int factor, int add);
1901
1903 int SeqClkFile_(int id, const char *fileName);
1904
1906 int SeqPrgFile_(ngcdcsSEQ0 *mod, const char *fileName = NULL);
1907
1909 int SeqWin_(int id, ngcdcs_win_t win);
1910
1912 int AcqProc_(int id, const char *procName);
1913
1915 int AcqBurst_(int id, int num);
1916
1918 void AcqWinMap_(int id, int *fx, int *fy, int *sx, int *sy);
1919
1921 int AcqCheckRestart_(ngcbPARAM *p);
1922
1923
1924 /*
1925 * Run-control
1926 */
1928 int resetFlag_;
1929
1931 int Online_(int update = 1);
1932
1934 int SeqBreakTmo_(int id = 0);
1935
1937 int SeqStartSync_(int id);
1938
1940 int SeqStopSync_(int id, int force = 0);
1941
1943 int seqRestart_[ngcdcsCTRL_MAX_SEQ];
1944
1946 int AcqStop_(int id);
1947
1949 int subStateSaved_;
1950
1952 int traceSubState_;
1953
1955 int dbSubState_;
1956
1958 void SubState2String_(int st, char *s);
1959
1961 int seqBreak_;
1962
1964 int seqBreakTmo_;
1965
1967 int acqExecMap_[ngcdcsACQ_MAX_PROC];
1968
1970 ngcdcsSEQ_EMU *seqEmu_;
1971
1972
1973 /*
1974 * Database
1975 */
1976
1978 int dbMirror_;
1979
1981 ngcbDB db_;
1982
1984 ngcbATTR *attr_[ngcbDB_MAX_ATTR];
1985
1987 ngcbSEM *semDb_;
1988
1990 int DbUpdate_();
1991
1993 void DbUpdateParam_(int fd = -1);
1994
1996 void DbUpdateReadModeList_(int fd = -1);
1997
1999 void DbUpdateFrames_(int id, int fd = -1);
2000
2001 /*
2002 * Implemented commands
2003 */
2004
2005 int ExecAck_(ngcb_cmd_handle_t *handle, char *reply);
2006 int ExecAcq_(ngcb_cmd_handle_t *handle, char *reply);
2007 int ExecAcqCmd_(ngcb_cmd_handle_t *handle, char *reply);
2008 int ExecAcqInfo_(ngcb_cmd_handle_t *handle, char *reply);
2009 int ExecAcqProc_(ngcb_cmd_handle_t *handle, char *reply);
2010 int ExecAdc_(ngcb_cmd_handle_t *handle, char *reply);
2011 int ExecAdcInfo_(ngcb_cmd_handle_t *handle, char *reply);
2012 int ExecAoClk_(ngcb_cmd_handle_t *handle, char *reply);
2013 int ExecAoGain_(ngcb_cmd_handle_t *handle, char *reply);
2014 int ExecAoReset_(ngcb_cmd_handle_t *handle, char *reply);
2015 int ExecAoShift_(ngcb_cmd_handle_t *handle, char *reply);
2016 int ExecBoardInfo_(ngcb_cmd_handle_t *handle, char *reply);
2017 int ExecCatLog_(ngcb_cmd_handle_t *handle, char *reply);
2018 int ExecCheckDev_(ngcb_cmd_handle_t *handle, char *reply);
2019 int ExecCheckPat_(ngcb_cmd_handle_t *handle, char *reply);
2020 int ExecCheckSeq_(ngcb_cmd_handle_t *handle, char *reply);
2021 int ExecCheckTim_(ngcb_cmd_handle_t *handle, char *reply);
2022 int ExecCldc_(ngcb_cmd_handle_t *handle, char *reply);
2023 int ExecClkMon_(ngcb_cmd_handle_t *handle, char *reply);
2024 int ExecClose_(ngcb_cmd_handle_t *handle, char *reply);
2025 int ExecDacChan_(ngcb_cmd_handle_t *handle, char *reply);
2026 int ExecDataKill_(ngcb_cmd_handle_t *handle, char *reply);
2027 int ExecDictionary_(ngcb_cmd_handle_t *handle, char *reply);
2028 int ExecDisable_(ngcb_cmd_handle_t *handle, char *reply);
2029 int ExecDiskCreat_(ngcb_cmd_handle_t *handle, char *reply);
2030 int ExecDiskDel_(ngcb_cmd_handle_t *handle, char *reply);
2031 int ExecDwellTime_(ngcb_cmd_handle_t *handle, char *reply);
2032 int ExecHelp_(ngcb_cmd_handle_t *handle, char *reply);
2033 int ExecDebug_(ngcb_cmd_handle_t *handle, char *reply);
2034 int ExecDefine_(ngcb_cmd_handle_t *handle, char *reply);
2035 int ExecEnable_(ngcb_cmd_handle_t *handle, char *reply);
2036 int ExecEvtPort_(ngcb_cmd_handle_t *handle, char *reply);
2037 int ExecEvtWait_(ngcb_cmd_handle_t *handle, char *reply);
2038 int ExecExit_(ngcb_cmd_handle_t *handle, char *reply);
2039 int ExecExpDrv_(ngcb_cmd_handle_t *handle, char *reply);
2040 int ExecExpStart_(ngcb_cmd_handle_t *handle, char *reply);
2041 int ExecExpEnd_(ngcb_cmd_handle_t *handle, char *reply);
2042 int ExecExpAbort_(ngcb_cmd_handle_t *handle, char *reply);
2043 int ExecExpPause_(ngcb_cmd_handle_t *handle, char *reply);
2044 int ExecExpCont_(ngcb_cmd_handle_t *handle, char *reply);
2045 int ExecDump_(ngcb_cmd_handle_t *handle, char *reply);
2046 int ExecFrame_(ngcb_cmd_handle_t *handle, char *reply);
2047 int ExecGetFrames_(ngcb_cmd_handle_t *handle, char *reply);
2048 int ExecGetPat_(ngcb_cmd_handle_t *handle, char *reply);
2049 int ExecGetSeq_(ngcb_cmd_handle_t *handle, char *reply);
2050 int ExecInfo_(ngcb_cmd_handle_t *handle, char *reply);
2051 int ExecInit_(ngcb_cmd_handle_t *handle, char *reply);
2052 int ExecIor_(ngcb_cmd_handle_t *handle, char *reply);
2053 int ExecIoTest_(ngcb_cmd_handle_t *handle, char *reply);
2054 int ExecIow_(ngcb_cmd_handle_t *handle, char *reply);
2055 int ExecLastErr_(ngcb_cmd_handle_t *handle, char *reply);
2056 int ExecLd_(ngcb_cmd_handle_t *handle, char *reply);
2057 int ExecLdClk_(ngcb_cmd_handle_t *handle, char *reply);
2058 int ExecLdSeq_(ngcb_cmd_handle_t *handle, char *reply);
2059 int ExecLock_(ngcb_cmd_handle_t *handle, char *reply);
2060 int ExecUnlock_(ngcb_cmd_handle_t *handle, char *reply);
2061 int ExecLogin_(ngcb_cmd_handle_t *handle, char *reply);
2062 int ExecLogout_(ngcb_cmd_handle_t *handle, char *reply);
2063 int ExecMacro_(ngcb_cmd_handle_t *handle, char *reply);
2064 int ExecMerge_(ngcb_cmd_handle_t *handle, char *reply);
2065 int ExecMinPulse_(ngcb_cmd_handle_t *handle, char *reply);
2066 int ExecModInfo_(ngcb_cmd_handle_t *handle, char *reply);
2067 int ExecNop_(ngcb_cmd_handle_t *handle, char *reply);
2068 int ExecOff_(ngcb_cmd_handle_t *handle, char *reply);
2069 int ExecOpen_(ngcb_cmd_handle_t *handle, char *reply);
2070 int ExecPatClk_(ngcb_cmd_handle_t *handle, char *reply);
2071 int ExecPinfo_(ngcb_cmd_handle_t *handle, char *reply);
2072 int ExecPing_(ngcb_cmd_handle_t *handle, char *reply);
2073 int ExecPrgInit_(ngcb_cmd_handle_t *handle, char *reply);
2074 int ExecPrgParam_(ngcb_cmd_handle_t *handle, char *reply);
2075 int ExecPrgRun_(ngcb_cmd_handle_t *handle, char *reply);
2076 int ExecPrgStep_(ngcb_cmd_handle_t *handle, char *reply);
2077 int ExecPulseCnt_(ngcb_cmd_handle_t *handle, char *reply);
2078 int ExecRecover_(ngcb_cmd_handle_t *handle, char *reply);
2079 int ExecReadAddr_(ngcb_cmd_handle_t *handle, char *reply);
2080 int ExecReset_(ngcb_cmd_handle_t *handle, char *reply);
2081 int ExecResetDfe_(ngcb_cmd_handle_t *handle, char *reply);
2082 int ExecResetDev_(ngcb_cmd_handle_t *handle, char *reply);
2083 int ExecRestore_(ngcb_cmd_handle_t *handle, char *reply);
2084 int ExecRpc_(ngcb_cmd_handle_t *handle, char *reply);
2085 int ExecRtd_(ngcb_cmd_handle_t *handle, char *reply);
2086 int ExecSave_(ngcb_cmd_handle_t *handle, char *reply);
2087 int ExecSaveClk_(ngcb_cmd_handle_t *handle, char *reply);
2088 int ExecSaveVoltages_(ngcb_cmd_handle_t *handle, char *reply);
2089 int ExecSaveErrVoltages_(ngcb_cmd_handle_t *handle, char *reply);
2090 int ExecScaRead_(ngcb_cmd_handle_t *handle, char *reply);
2091 int ExecScaWrite_(ngcb_cmd_handle_t *handle, char *reply);
2092 int ExecSDebug_(ngcb_cmd_handle_t *handle, char *reply);
2093 int ExecSensReset_(ngcb_cmd_handle_t *handle, char *reply);
2094 int ExecSeq_(ngcb_cmd_handle_t *handle, char *reply);
2095 int ExecSeqWait_(ngcb_cmd_handle_t *handle, char *reply);
2096 int ExecSetTime_(ngcb_cmd_handle_t *handle, char *reply);
2097 int ExecSetup_(ngcb_cmd_handle_t *handle, char *reply);
2098 int ExecShutter_(ngcb_cmd_handle_t *handle, char *reply);
2099 int ExecSimErr_(ngcb_cmd_handle_t *handle, char *reply);
2100 int ExecSimulat_(ngcb_cmd_handle_t *handle, char *reply);
2101 int ExecStart_(ngcb_cmd_handle_t *handle, char *reply);
2102 int ExecState_(ngcb_cmd_handle_t *handle, char *reply);
2103 int ExecStatistics_(ngcb_cmd_handle_t *handle, char *reply);
2104 int ExecStatus_(ngcb_cmd_handle_t *handle, char *reply);
2105 int ExecStop_(ngcb_cmd_handle_t *handle, char *reply);
2106 int ExecStopSim_(ngcb_cmd_handle_t *handle, char *reply);
2107 int ExecGeosnap_(ngcb_cmd_handle_t *handle, char *reply);
2108 int ExecSysInfo_(ngcb_cmd_handle_t *handle, char *reply);
2109 int ExecTask_(ngcb_cmd_handle_t *handle, char *reply);
2110 int ExecTec_(ngcb_cmd_handle_t *handle, char *reply);
2111 int ExecTel_(ngcb_cmd_handle_t *handle, char *reply);
2112 int ExecTelChan_(ngcb_cmd_handle_t *handle, char *reply);
2113 int ExecTelData_(ngcb_cmd_handle_t *handle, char *reply);
2114 int ExecTest_(ngcb_cmd_handle_t *handle, char *reply);
2115 int ExecTestAddr_(ngcb_cmd_handle_t *handle, char *reply);
2116 int ExecTsu_(ngcb_cmd_handle_t *handle, char *reply);
2117 int ExecTimeout_(ngcb_cmd_handle_t *handle, char *reply);
2118 int ExecVersion_(ngcb_cmd_handle_t *handle, char *reply);
2119 int ExecVget_(ngcb_cmd_handle_t *handle, char *reply);
2120 int ExecWait_(ngcb_cmd_handle_t *handle, char *reply);
2121 int ExecWriteAddr_(ngcb_cmd_handle_t *handle, char *reply);
2122
2124 int inMacro_;
2125
2127 int Execute_(const char *cmd, char *reply, int protect, int fd);
2128
2130 int EventHandler_(const char *msg, char *reply);
2131
2133 void DeviceEvent_(ngcbIFC *dev, ngcb_evt_st_t *event);
2134
2135 /*
2136 * Exposure steps
2137 */
2138 int ExpStepInit_(); //< initialize exposure
2139 int ExpStepWiping_(); //< wiping step
2140 int ExpStepIntegrating_(); //< integrating step
2141 int ExpStepReading_(); //< reading step
2142
2144 int ExpStateHandler_();
2145
2147 int ExpStepTriggered_(int stat);
2148
2149};
2150
2154void ngcdcsSrvBreakHandler(int sig);
2155
2159void ngcdcsSrvExitHandler(int sig);
2160
2164int ngcdcsCfg2Arg(int argc, char **argv, char *argStr);
2165
2166#endif
Definition ngcbALARM.hpp:61
void Remove(ngcb_alarm_id id)
Remove item from built-in alarm container.
Definition ngcbALARM_SYS.cpp:31
void Store(ngcbALARM *alarm, ngcb_alarm_id id)
Store alarm to built-in alarm container.
Definition ngcbALARM_SYS.cpp:26
ngcbALARM * Get(ngcb_alarm_id id)
Get item from built-in alarm container.
Definition ngcbALARM_SYS.cpp:36
ngcbALARM_SYS()
Constructor.
Definition ngcbALARM_SYS.cpp:13
Definition ngcbALARM.hpp:100
void Ack()
Acknowledge alarm.
Definition ngcbALARM.cpp:199
const char * Msg()
Return alarm message.
Definition ngcbALARM.cpp:149
const char * Name()
Return alarm name.
Definition ngcbALARM.cpp:145
const char * Value(int showUnit)
Return formatted value string.
Definition ngcbALARM.cpp:155
Definition ngcbATTR.hpp:63
Definition ngcbCMD.hpp:380
ngcbCMD_SRV()
Constructor.
Definition ngcbCMD_SRV.cpp:29
Definition ngcbATTR.hpp:207
Definition ngcbDIC.hpp:51
Definition ngcbFITS.hpp:25
Definition ngcbIFC.hpp:760
Definition ngcbLIST.hpp:34
Definition ngcbMOD.hpp:25
Definition ngcbOBJ.hpp:34
Definition ngcbPARAM.hpp:201
Definition ngcbPARAM.hpp:41
Definition ngcbTHREAD.hpp:68
Definition ngcbSERVICE.hpp:36
Definition ngcbSHMDB.hpp:55
ngcbSIO()
Constructor.
Definition ngcbSIO.cpp:31
Definition ngcbTMPFILE.hpp:26
Definition ngcbCMD.hpp:42
ngcdcsACQ_SERVICE()
Constructor.
Definition ngcdcsACQ.hpp:310
Definition ngcdcsACQ.hpp:343
Definition ngcdcsADC.hpp:55
Definition ngcdcsSRV.hpp:196
virtual ~ngcdcsALARM_SYS()
Destructor.
Definition ngcdcsSRV.hpp:209
ngcdcsALARM_SYS()
Constructor.
Definition ngcdcsSRV.hpp:203
int verboseLevel
Definition ngcdcsSRV.hpp:199
ngcbSERVICE * services
Definition ngcdcsSRV.hpp:198
void Cancel(ngcb_alarm_id id)
Cancel alarm.
Definition ngcdcsSRV.hpp:226
ngcb_alarm_id Issue(ngcbALARM *a)
Send alarm.
Definition ngcdcsSRV.hpp:212
int logLevel
Definition ngcdcsSRV.hpp:200
void Ack(ngcb_alarm_id id)
Acknowledge alarm.
Definition ngcdcsSRV.hpp:242
Definition ngcdcsALBIAS.hpp:27
Definition ngcdcsAOBIAS.hpp:27
Definition ngcdcsAO.hpp:312
Definition ngcdcsAPD.hpp:39
Definition ngcdcsB24.hpp:27
Definition ngcdcsC20B20.hpp:27
Definition ngcdcsC24.hpp:69
Definition ngcdcsCLDC.hpp:129
Definition ngcdcsCLDC.hpp:595
Definition ngcdcsCTRL.hpp:68
int status
Definition ngcdcsSRV.hpp:174
virtual ~ngcdcsEVT()
Destructor.
Definition ngcdcsSRV.hpp:186
int id
Definition ngcdcsSRV.hpp:172
ngcdcsEVT(int i, int d)
Constructor with id and device list.
Definition ngcdcsSRV.hpp:183
ngcdcsEVT()
Constructor.
Definition ngcdcsSRV.hpp:177
ngcdcsEVT(int i)
Constructor with id.
Definition ngcdcsSRV.hpp:180
int devices
Definition ngcdcsSRV.hpp:173
Definition ngcdcsEXPDRV.hpp:31
Definition ngcdcsEXP.hpp:179
Definition ngcdcsGEOSNAP.hpp:29
Definition ngcdcsLISABIAS.hpp:27
Definition ngcdcsLISA.hpp:35
Definition ngcdcsMRGLIST.hpp:63
Definition ngcdcsNGC2.hpp:40
Definition ngcdcsNGSDBIAS.hpp:27
Definition ngcdcsNGSD.hpp:37
Definition ngcdcsPREAMP.hpp:63
Definition ngcdcsRTD.hpp:58
Definition ngcdcsSCA.hpp:183
Definition ngcdcsSEQ.hpp:186
Definition ngcdcsSEQ_PRG.hpp:205
Definition ngcdcsSEQ.hpp:582
Definition ngcdcsSHUTTER.hpp:36
int EvtAddWait(int fd, int id)
Add event waiting client.
Definition ngcdcsSrvStateCtrl.cpp:524
int ExpDrvAddWait(int fd)
Add exposure driver waiting client (socket)
Definition ngcdcsSrvExpDrv.cpp:751
virtual ngcdcsGEOSNAP * MakeGeosnap(ngcbIFC *dev, const ngcb_route_t &route)
Create GEOSNAP module.
Definition ngcdcsSrvMod.cpp:146
void GetFrames(int id, char *s)
Get frame configuration (debugging function)
Definition ngcdcsSrvFrames.cpp:354
virtual int MergeStatus(int id, char *stat=NULL)
Get status of exposure data file merger.
Definition ngcdcsSrvMrg.cpp:235
int SeqBreak(int id=0)
Break sequence.
Definition ngcdcsSrvRunCtrl.cpp:1641
ngcdcsTEC * TECMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
TEC module factory.
Definition ngcdcsSrvMod.cpp:338
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:39
FILE * debugStream
Debug stream.
Definition ngcdcsSRV.hpp:826
int FrameBreak(int id, const char *name, int n)
Set exposure break condition for frame.
Definition ngcdcsSrvFrames.cpp:228
void BoardInfo(char *s)
Formatted board info.
Definition ngcdcsSrvInfo.cpp:766
virtual void AgEvent(int acqInst, ngcdcs_2ag_t ag, int errorId, const char *erms)
Auto-guiding event.
Definition ngcdcsSrvExp.cpp:251
void Verbose(int level, const char *format,...) __attribute__((format(printf
Verbose method depending on level.
Definition ngcdcsSrvLog.cpp:203
double LifeTime()
Server life time (seconds)
Definition ngcdcsSrvMain.cpp:2578
ngcdcsCTRL * ctrl
Controller object.
Definition ngcdcsSRV.hpp:405
int DebugStream(int flag)
Enable/disable debug-stream.
Definition ngcdcsSrvLog.cpp:164
int InMainLoop()
Function called before entering main-loop.
Definition ngcdcsSrvMain.cpp:2510
void PrintUsage()
Print command line options.
Definition ngcdcsSrvArgs.cpp:36
int pollInterval
Polling interval in ms.
Definition ngcdcsSRV.hpp:714
int SelftestAcq(int id)
Selftest function for acquisition module.
Definition ngcdcsSrvSelftest.cpp:342
int maxDfeMod
Maximum number of DFE modules.
Definition ngcdcsSRV.hpp:295
int Off()
Switch off.
Definition ngcdcsSrvStateCtrl.cpp:1437
char gui[256]
GUI to be started.
Definition ngcdcsSRV.hpp:818
int PostProcEnabled()
Returns 1 if post-processor is enabled.
Definition ngcdcsSrvExp.cpp:192
int ShutdownService(int port)
Shutdown service port.
Definition ngcdcsSrvProtocol.cpp:884
void DeviceEvent(void *origin, void *event)
Device event (from ngcbSERVICE)
Definition ngcdcsSrvStateCtrl.cpp:303
int AcqStop(int id=0)
Stop (acquisition process)
Definition ngcdcsSrvRunCtrl.cpp:741
void Voltages(ngcdcsCLDC0 *mod, char *s)
Formatted voltages.
Definition ngcdcsSrvInfo.cpp:2125
void void void void void void void int ConfigureLogging(int vb, int log, int xt)
Configure logging parameters.
Definition ngcdcsSrvLog.cpp:133
int DbAdd(ngcbATTR *attr)
Add attribute to database.
Definition ngcdcsSrvDb.cpp:133
int MergeAlign()
Align merger file-list with backup file.
Definition ngcdcsSrvMrg.cpp:303
void ExpPoll()
Exposure polling.
Definition ngcdcsSrvExp.cpp:1476
virtual int FitsMergerCB(ngcbFITS *hdr, char *erms)
FITS-merger call-back.
Definition ngcdcsSrvFits.cpp:57
ngcdcsEXPDRV * ExpDrv(const char *name, const ngcb_fb_t &feedBackChannel)
Exposure driver installation hook.
Definition ngcdcsSrvExpDrv.cpp:226
virtual ~ngcdcsSRV()
Destructor.
Definition ngcdcsSrvMain.cpp:114
int CldcClearCalibration(int id)
Clear voltage calibration.
Definition ngcdcsSrvSetupCLDC.cpp:387
virtual ngcdcsC24 * MakeC24(ngcbIFC *dev, const ngcb_route_t &route)
Create NGC2 C24 bias generator.
Definition ngcdcsSrvMod.cpp:47
int ExpEnd(int acqId=0)
End exposure.
Definition ngcdcsSrvExp.cpp:1283
void Publish(const ngcdcs_exp_topic &topic)
Publish exposure event.
Definition ngcdcsSrvExp.cpp:322
int ExpDrvLoad(const char *module, const char *name=NULL)
Load exposure driver.
Definition ngcdcsSrvExpDrv.cpp:246
int TecAction(int id, const char *action, char *reply)
Perform TEC action.
Definition ngcdcsSrvRunCtrl.cpp:1750
virtual int FrameHandlerCB(void *buffer, ngcdcs_finfo_t *finfo, char *erms)
Frame handler call-back.
Definition ngcdcsSrvExp.cpp:223
int Xterm()
Flag to start in new window.
Definition ngcdcsSrvLog.cpp:101
void DevPoll()
Device events polling cycle.
Definition ngcdcsSrvTimer.cpp:226
ngcbPARAM_LIST * ParamList()
Global parameter list.
Definition ngcdcsSrvParam.cpp:500
virtual void PublishSubState()
Publish server sub-state.
Definition ngcdcsSrvDb.cpp:1028
int ReadMode(int idx)
Set new read-mode.
Definition ngcdcsSrvReadMode.cpp:289
virtual int ExpStartCB()
Hook at exposure start.
Definition ngcdcsSrvExp.cpp:247
int SetupParam(const char *name, const char *value)
Set single parameter.
Definition ngcdcsSrvSetupParam.cpp:916
int OpenDebugConnection()
Open error-state debug connection.
Definition ngcdcsSrvOpMode.cpp:113
void CatLog(char *s)
Copy built-in log to string.
Definition ngcdcsSrvLog.cpp:354
int SetupList(const char *paramBuf)
Setup parameter list (string)
Definition ngcdcsSrvSetupList.cpp:2204
int mergeInvalidate
Flag to invalidate source-data after merging.
Definition ngcdcsSRV.hpp:634
void DbExport()
Export database.
Definition ngcdcsSrvDb.cpp:147
void DbLog(const char *format,...) __attribute__((format(printf
Action log in database.
Definition ngcdcsSrvDb.cpp:1069
ngcdcsMRGLIST mergeList
Merger file-list handler.
Definition ngcdcsSRV.hpp:625
virtual void ShutdownSystemCB2()
Shutdown callback 2.
Definition ngcdcsSrvMain.cpp:1259
ngcdcsSEQ * SeqMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, ngcbPARAM_LIST *p)
Sequencer module factory.
Definition ngcdcsSrvMod.cpp:232
int FitsMerger(ngcbFITS *hdr, char *erms)
FITS merger (from ngcbACQ_SERVICE)
Definition ngcdcsSrvFits.cpp:26
virtual ngcdcsSCA * MakeSCA(ngcbIFC *dev, const ngcb_route_t &route, ngcbPARAM_LIST *p)
Create Sidecar ASIC module.
Definition ngcdcsSrvMod.cpp:152
virtual void VerboseCB(const char *msg, int level=ngcdcsLOG_INFO)
Verbose output callback.
Definition ngcdcsSrvLog.cpp:330
int SelftestSeq(int id)
Selftest function for sequencer module.
Definition ngcdcsSrvSelftest.cpp:123
int RouteComp(ngcbMOD *, ngcbMOD *)
Compare module routes.
Definition ngcdcsSrvSysCfg.cpp:3366
const char * ProcName()
Return process name.
Definition ngcdcsSrvArgs.cpp:29
virtual int DelSockCB(int fd)
Remove file descriptor from socket event list.
Definition ngcdcsSrvProtocol.cpp:361
void SubState(int newState)
set new sub-state
Definition ngcdcsSrvStateCtrl.cpp:416
int FrameHandler(void *buffer, ngcdcs_finfo_t *finfo, char *erms)
Frame handler (from ngcbACQ_SERVICE)
Definition ngcdcsSrvExp.cpp:194
ngcdcsAO * AOMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
AO camera module factory.
Definition ngcdcsSrvMod.cpp:289
int SrvPortOrig()
Get original server port number.
Definition ngcdcsSrvMain.cpp:431
int SimError(int error, int idx=0)
Simulate various error test cases.
Definition ngcdcsSrvProtocol.cpp:1011
char thisHost[64]
Our hostname.
Definition ngcdcsSRV.hpp:292
int CloseDebugConnection()
Close error-state debug connection.
Definition ngcdcsSrvOpMode.cpp:177
FILE * watchdog
Watchdog.
Definition ngcdcsSRV.hpp:345
virtual int ConfigureSystemCB2(ngcdcs_syscfg_t &newCfg)
System configuration call-back 2 (after re-configuration)
Definition ngcdcsSrvSysCfg.cpp:62
void ClearSubState()
Clear sub-state (error or active)
Definition ngcdcsSrvStateCtrl.cpp:508
virtual int ResolvePath(char *resolved, const char *fileName)
Resolve full path name by parsing search paths etc.
Definition ngcdcsSrvSysCfg.cpp:69
int ShutterAction(int id, const char *action, char *reply)
Perform shutter action.
Definition ngcdcsSrvRunCtrl.cpp:1717
virtual ngcdcsPREAMP * PreampMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
Preamplifier module factory.
Definition ngcdcsSrvMod.cpp:264
int RecStart(const char *id, double absTime=0.0)
Start recording sequence (shortcut to series of function calls)
Definition ngcdcsSrvExp.cpp:1491
ngcdcsLISA * LISAMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
LISA camera module factory.
Definition ngcdcsSrvMod.cpp:316
int FdCB(int fd)
File descriptor event.
Definition ngcdcsSrvProtocol.cpp:287
ngcdcsSRV()
Constructors.
Definition ngcdcsSrvMain.cpp:79
int detIndex
Detector category index.
Definition ngcdcsSRV.hpp:289
void void void void void void Print(const char *format,...) __attribute__((format(printf
Print verbose message.
Definition ngcdcsSrvLog.cpp:297
virtual ngcdcsNGSD * MakeNGSD(ngcbIFC *dev, const ngcb_route_t &route, double extRef)
Create NGSD module.
Definition ngcdcsSrvMod.cpp:133
int Check(const ngcdcs_syscfg_t &cfg)
Check system configuration.
Definition ngcdcsSrvSysCfg.cpp:2994
void Abort()
Abort server.
Definition ngcdcsSrvMain.cpp:930
ngcdcsCLDC * CldcMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, int nc, int nb, double extRef)
CLDC module factory.
Definition ngcdcsSrvMod.cpp:165
int Statistics(int id, char *s)
Formatted acquisition process statistics.
Definition ngcdcsSrvInfo.cpp:2191
int ProtocolAscii(int fd)
ASCII command protocol.
Definition ngcdcsSrvProtocol.cpp:144
int Macro(const char *fileName, char *reply, int protection=0)
Execute macro file.
Definition ngcdcsSrvProtocol.cpp:919
int mergeVerify
Enable/disable verification run before merging.
Definition ngcdcsSRV.hpp:631
int ResetSensors()
Reset sensors.
Definition ngcdcsSrvStateCtrl.cpp:1651
virtual int DbUpdateCB()
Update database call-back.
Definition ngcdcsSrvDb.cpp:968
int CldcCheck(int id)
Telemetry check.
Definition ngcdcsSrvSetupCLDC.cpp:304
void ClrLog()
Clear built-in log.
Definition ngcdcsSrvLog.cpp:340
int mergeChunk
Merger chunk size (bytes)
Definition ngcdcsSRV.hpp:637
int Enable(int check)
Go to operational state with or without integrity check.
Definition ngcdcsSrvStateCtrl.cpp:779
virtual void PublishExpEvent(int errorId, unsigned int newStat, const char *fileName, int merge, const char *erms)
Publish exposure event.
Definition ngcdcsSrvDb.cpp:972
ngcdcsADC * AdcMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, int num, int bitPix)
ADC module factory.
Definition ngcdcsSrvMod.cpp:246
virtual void DbLogCB(const char *msg)
Database log callback.
Definition ngcdcsSrvDb.cpp:970
int CfgPath(char *path, const char *cfgFile)
Get cfg-file path.
Definition ngcdcsSrvSysCfg.cpp:81
int ExpStart(int acqId=0, double absTime=0.0)
Start exposure.
Definition ngcdcsSrvExp.cpp:811
void UnlockService()
Unlock service loop.
Definition ngcdcsSrvMain.cpp:2504
int Reset()
Reset system.
Definition ngcdcsSrvStateCtrl.cpp:1548
int SysCfg(const char *cfgFile)
Apply system configuration.
Definition ngcdcsSrvSysCfg.cpp:238
char mergeArg[128]
Additional merger arguments.
Definition ngcdcsSRV.hpp:640
void State(int newState, int update=1)
Set new server state.
Definition ngcdcsSrvStateCtrl.cpp:382
int FrameGen(int id, const char *name, int flag)
Set frame attribute: generate.
Definition ngcdcsSrvFrames.cpp:29
int DumpFits(const char *fileName=NULL)
Dump FITS-header to file.
Definition ngcdcsSrvFits.cpp:3028
virtual int MergeStart(const char *name, int display, int id, int cleanup=0)
Start exposure data file merger with requested id.
Definition ngcdcsSrvMrg.cpp:119
int SelftestCldc(int id)
Selftest function for CLDC module.
Definition ngcdcsSrvSelftest.cpp:25
void SaveErr(const char *erms)
Save last error message.
Definition ngcdcsSrvLog.cpp:395
int MainLoop()
Run service-loop.
Definition ngcdcsSrvMain.cpp:2532
virtual ngcdcsAPD * MakeAPD(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create APD bias generator.
Definition ngcdcsSrvMod.cpp:53
int Recover()
Recover from error state.
Definition ngcdcsSrvStateCtrl.cpp:720
int ExpDrvStart()
Activate exposure driver.
Definition ngcdcsSrvExpDrv.cpp:583
int GetPat(int id, int num, char *s)
Formatted clock pattern.
Definition ngcdcsSrvInfo.cpp:2281
int concurrentMerge
Concurrent merging.
Definition ngcdcsSRV.hpp:622
virtual void PollStatConfigure(int enable, int interval)
Configure status polling (milliseconds)
Definition ngcdcsSrvTimer.cpp:270
int ReadModeIdx(int id)
Get read-mode index by id.
Definition ngcdcsSrvReadMode.cpp:255
void DevError(const char *erms, int id, void *descriptor)
Device error (from ngcbSERVICE)
Definition ngcdcsSrvStateCtrl.cpp:313
ngcbDIC dictionary
Global dictionary.
Definition ngcdcsSRV.hpp:1065
virtual int ConfigureSystemCB1(ngcdcs_syscfg_t &newCfg)
System configuration call-back 1 (before re-configuration)
Definition ngcdcsSrvSysCfg.cpp:55
virtual void PublishLogPars()
Publish logging parameters.
Definition ngcdcsSrvDb.cpp:1007
void ExportVersion(const char *newVersion)
Export version.
Definition ngcdcsSrvArgs.cpp:789
int LogLevel()
Get logging level.
Definition ngcdcsSrvLog.cpp:105
int AdcInfo(int id, char *s)
Formatted ADC module info.
Definition ngcdcsSrvInfo.cpp:856
int SeqWaiting()
Check if all sequencers are in WAITING state.
Definition ngcdcsSrvRunCtrl.cpp:167
int CldcDefault(int id)
Restore default voltages.
Definition ngcdcsSrvSetupCLDC.cpp:249
char expDrvFeedBack[128]
Feed-back channel selection.
Definition ngcdcsSRV.hpp:596
int integrityCheck
Integrity check when going online.
Definition ngcdcsSRV.hpp:672
int InitSysCfg(const char *cfgFile)
Initialize default system configuration from file.
Definition ngcdcsSrvSysCfg.cpp:210
virtual ngcdcsTEC * MakeTEC(ngcbIFC *dev, const ngcb_route_t &route)
Create TEC module.
Definition ngcdcsSrvMod.cpp:140
ngcbIFC * ctrlDev[ngcdcsCTRL_MAX_DEV]
Mirror of controller devices.
Definition ngcdcsSRV.hpp:408
int SeqContinue(int id=0)
Sequencer continue.
Definition ngcdcsSrvRunCtrl.cpp:1562
int PrepareFits(int refresh=1)
Prepare FITS-header.
Definition ngcdcsSrvFits.cpp:86
void ExpStatus2String(char *s, int stat)
Convert exposure status to string.
Definition ngcdcsSrvExp.cpp:152
int LoadSetup(const char *fileName, char **list, int *listLength, int max=-1)
Load setup from file into string array.
Definition ngcdcsSrvParam.cpp:918
int ExpPause(int id=0)
Pause exosure.
Definition ngcdcsSrvExp.cpp:1353
int Update()
Update database.
Definition ngcdcsSrvStateCtrl.cpp:1686
void SysInfo(char *s)
Formatted system info.
Definition ngcdcsSrvInfo.cpp:88
int SeqIdle(int id=0)
Check sequencer idle states.
Definition ngcdcsSrvRunCtrl.cpp:126
int fitsLogPeriod
FITS logging period (seconds)
Definition ngcdcsSRV.hpp:835
virtual void DbLock()
Lock database.
Definition ngcdcsSrvDb.cpp:31
void AcqError(const char *erms, int id, void *descriptor)
Device error (from ngcbACQ_SERVICE)
Definition ngcdcsSrvStateCtrl.cpp:321
int OpMode(int level)
Set operational mode.
Definition ngcdcsSrvOpMode.cpp:25
ngcbPARAM * ParamDefine(const char *name, const char *value, int id, int *status=NULL)
Define parameter.
Definition ngcdcsSrvParam.cpp:504
virtual void MergeReset(int relaunch=0)
Reset data merger interface.
Definition ngcdcsSrvMrg.cpp:435
int Initialize()
Initialize system.
Definition ngcdcsSrvMain.cpp:559
char opMode[32]
Operation mode string.
Definition ngcdcsSRV.hpp:669
virtual ngcdcsLISABIAS * MakeLISABIAS(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create LISA bias generator.
Definition ngcdcsSrvMod.cpp:73
int FrameExport(int id, const char *name, int flag)
Set frame attribute: export.
Definition ngcdcsSrvFrames.cpp:180
int HaveLocalEvents()
Local events configured.
Definition ngcdcsSrvTimer.cpp:210
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:281
ngcbALARM_SYS * alarmSystem
Alarm system.
Definition ngcdcsSRV.hpp:829
int ResetDfe()
Reset detector front-end.
Definition ngcdcsSrvStateCtrl.cpp:1590
void ExpStatus(unsigned int newStat, const char *erms=NULL)
Update exposure status.
Definition ngcdcsSrvExp.cpp:288
const char * DicList()
Get dictionary list.
Definition ngcdcsSrvParam.cpp:502
int numAcqMod
Number of acquisition modules.
Definition ngcdcsSRV.hpp:428
int CheckExp()
Return an error when an exposure is still active.
Definition ngcdcsSrvExp.cpp:257
virtual ngcdcsPREAMP * MakePREAMP(ngcbIFC *dev, const ngcb_route_t &route)
Create preamplifier module.
Definition ngcdcsSrvMod.cpp:109
ngcdcsACQ * acq[ngcdcsACQ_MAX_PROC]
Acquisition modules.
Definition ngcdcsSRV.hpp:425
int FitsBlock()
Number of FITS blocks from system.
Definition ngcdcsSrvFits.cpp:84
char * ErrMsg()
Global error message.
Definition ngcdcsSrvMain.cpp:461
size_t ppStackSize
Post-processor stack size in bytes (0 = use system default)
Definition ngcdcsSRV.hpp:1288
int CldcRestore(int id, const char *key=NULL)
Restore voltage defined by voltage-keyword.
Definition ngcdcsSrvSetupCLDC.cpp:437
virtual int MergeStop(int id)
Stop exposure data file merger.
Definition ngcdcsSrvMrg.cpp:212
int RestoreState()
Restore sequencer states.
Definition ngcdcsSrvStateCtrl.cpp:602
int AcqProc(int id, const char *procName)
Set acquisition process on multiple instances.
Definition ngcdcsSrvSetupACQ.cpp:25
virtual ngcdcsADC * MakeADC(ngcbIFC *dev, const ngcb_route_t &route, int num, int bitPix)
Create ADC module.
Definition ngcdcsSrvMod.cpp:96
void ExpDrvModList(char *s)
Print list of loaded exposure driver modules to string.
Definition ngcdcsSrvExpDrv.cpp:292
int ProtocolBin(int fd)
Binary command protocol.
Definition ngcdcsSrvProtocol.cpp:620
int SeqTrigger(int id)
Sequencer sync trigger.
Definition ngcdcsSrvRunCtrl.cpp:1397
void Release()
Release server.
Definition ngcdcsSrvMain.cpp:885
void Port(int port)
Set core service port.
Definition ngcdcsSrvMain.cpp:448
virtual ngcdcsSHUTTER * MakeSHUTTER(ngcbIFC *dev, const ngcb_route_t &route)
Create shutter module.
Definition ngcdcsSrvMod.cpp:103
void Profile(const char *name=NULL)
Apply profile.
Definition ngcdcsSrvMain.cpp:465
virtual void Query()
Query system status.
Definition ngcdcsSrvTimer.cpp:29
int StatusParam(const char *name, char *value)
Get single parameter.
Definition ngcdcsSrvStatus.cpp:1565
ngcdcsNGC2 * NGC2Mod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
NGC2 basic module factory.
Definition ngcdcsSrvMod.cpp:273
int ExpDrvCfg(const char *s)
Configue exposure driver from either a file a parameter string.
Definition ngcdcsSrvExpDrv.cpp:491
ngcdcsEXP exposure
Exposure handler.
Definition ngcdcsSRV.hpp:495
int ExpDrvUnload()
Unload all dynamically loaded driver modules.
Definition ngcdcsSrvExpDrv.cpp:259
uint64_t SizeRecorded()
Recorded data size during current exposure (in bytes)
Definition ngcdcsSrvExp.cpp:117
virtual void PublishState()
Publish server state.
Definition ngcdcsSrvDb.cpp:1016
virtual void ErrorEvent(int id, const char *erms)
Error event handler.
Definition ngcdcsSrvStateCtrl.cpp:336
char * ExpStatusString()
Return current exposure status as string.
Definition ngcdcsSrvExp.cpp:186
virtual void PublishExpDrvStatus()
Publish exposure driver status.
Definition ngcdcsSrvDb.cpp:1040
virtual ngcdcsACQ * MakeACQ(const ngcdcs_acq_cfg_t &cfg, ngcbPARAM_LIST *p)
Create acquisition module.
Definition ngcdcsSrvMod.cpp:159
void void void void void void void AddLog(const char *format,...) __attribute__((format(printf
Add message to the logging system.
Definition ngcdcsSrvLog.cpp:313
void ModInfo(char *s)
Formatted module info.
Definition ngcdcsSrvInfo.cpp:346
int ExpAbort(int acqId=0)
Abort exposure.
Definition ngcdcsSrvExp.cpp:1253
virtual void DbUnlock()
Unlock database.
Definition ngcdcsSrvDb.cpp:36
int StatusList(const char *list, char *reply)
Get parameter status (parameter names string)
Definition ngcdcsSrvStatus.cpp:1499
void ExecShell(const char *name)
Set remote execution shell.
Definition ngcdcsSrvMain.cpp:443
virtual void LogCB(const char *msg, int level=ngcdcsLOG_INFO)
Logging output callback.
Definition ngcdcsSrvLog.cpp:338
void BroadcastAlarm(const char *msg)
Broadcast alarm.
Definition ngcdcsSrvProtocol.cpp:870
ngcdcsCLDC0 * CldcFn(int idx)
Get index of CLDC functional module.
Definition ngcdcsSrvMod.cpp:396
int Execute(const char *cmd, char *reply, int protect=0, int fd=-1)
Command handler.
Definition ngcdcsSrvProtocol.cpp:586
virtual void MergeNext()
Merge next item in the data merger list.
Definition ngcdcsSrvMrg.cpp:284
virtual int AddSockCB(int fd)
Add file descriptor to socket event list.
Definition ngcdcsSrvProtocol.cpp:345
int Telemetry(int id, char *s)
Formatted telemetry.
Definition ngcdcsSrvInfo.cpp:1981
void Logger(int flag, const char *msg)
Logger (from ngcbSERVICE)
Definition ngcdcsSrvLog.cpp:186
virtual void ExitSignal(int sig)
Exit handler.
Definition ngcdcsSrvMain.cpp:1243
int forceStartup
Enforce system startup even when instance check fails.
Definition ngcdcsSRV.hpp:286
const char * LastErr()
Last error message.
Definition ngcdcsSrvMain.cpp:463
virtual void InstallSignalHandlers()
Install signal handlers.
Definition ngcdcsSrvMain.cpp:436
virtual int ExpCountDownCB()
Exposure countdown start call-back.
Definition ngcdcsSrvExp.cpp:249
virtual void HiResTimer(int enable)
Enable/disable hi-res timer.
Definition ngcdcsSrvTimer.cpp:287
int VerboseLevel()
Get verbose level.
Definition ngcdcsSrvLog.cpp:103
int NeedEnableCycle()
Return a flag indicating whether an enabling cycle is needed.
Definition ngcdcsSrvStateCtrl.cpp:774
ngcdcsSCA * ScaMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, ngcbPARAM_LIST *p)
Sidecar ASIC module factory.
Definition ngcdcsSrvMod.cpp:356
int FrameWin(int id, const char *name, int sx, int sy, int nx, int ny)
Set frame window.
Definition ngcdcsSrvFrames.cpp:278
int SeqWait(int id, int event, int timeout, int interval)
Wait for status event.
Definition ngcdcsSrvRunCtrl.cpp:1679
int updateReadModeList
Read-out mode list update flag.
Definition ngcdcsSRV.hpp:478
int readModeId
Current read-mode id.
Definition ngcdcsSRV.hpp:472
int CheckTriggerPeriod(int id, double period)
Check, if the trigger period matches the current read-out sequence.
Definition ngcdcsSrvInfo.cpp:2385
virtual ngcdcsNGSDBIAS * MakeNGSDBIAS(ngcbIFC *dev, const ngcb_route_t &route, int nb, double extRef)
Create NGSD bias generator.
Definition ngcdcsSrvMod.cpp:81
ngcdcs_syscfg_t sysCfg
Current configuration structure.
Definition ngcdcsSRV.hpp:307
int fitsLogLevel
FITS logging level.
Definition ngcdcsSRV.hpp:832
virtual int MergeMsg(int id, char *msg)
Get status message of exposure data file merger.
Definition ngcdcsSrvMrg.cpp:261
int numCldcFn
Number of CLDC functions.
Definition ngcdcsSRV.hpp:1181
ngcbLIST evtList
Event list.
Definition ngcdcsSRV.hpp:301
virtual ngcdcsALBIAS * MakeALBIAS(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create ALICE bias generator.
Definition ngcdcsSrvMod.cpp:66
int ParamDefault()
Set default values.
Definition ngcdcsSrvParam.cpp:811
int numSeqFn
Number of sequencer functions.
Definition ngcdcsSRV.hpp:1178
int ExpDrvAbort()
Abort exposure driver.
Definition ngcdcsSrvExpDrv.cpp:701
void LockService()
Lock service loop.
Definition ngcdcsSrvMain.cpp:2498
int SeqPause(int id=0)
Sequencer pause.
Definition ngcdcsSrvRunCtrl.cpp:1505
int TimerCB()
Timer call-back.
Definition ngcdcsSrvTimer.cpp:236
virtual ngcdcsAO * MakeAO(ngcbIFC *dev, const ngcb_route_t &route)
Create AO camera module.
Definition ngcdcsSrvMod.cpp:121
virtual void MergeInit()
Initialize file-merger interface.
Definition ngcdcsSrvMrg.cpp:387
ngcdcs_detcfg_t detCfg
Current configuration structure.
Definition ngcdcsSRV.hpp:391
int ExpDrvSelect(const char *name)
Install exposure driver.
Definition ngcdcsSrvExpDrv.cpp:294
virtual void ShutdownSystemCB1()
Shutdown callback 1.
Definition ngcdcsSrvMain.cpp:1257
int HandleExpEvt()
Handle exposure event.
Definition ngcdcsSrvExp.cpp:327
int FrameLocal(int id, const char *name, int flag)
Set frame attribute: store to local medi.
Definition ngcdcsSrvFrames.cpp:132
int Disable()
Go to not operational state.
Definition ngcdcsSrvStateCtrl.cpp:1280
ngcdcsTCCD * tccd[ngcdcsTCCD_MAX_PROC]
TCCD modules.
Definition ngcdcsSRV.hpp:414
void Shutdown()
Dhutdown all modules.
Definition ngcdcsSrvMain.cpp:1261
double TimeElapsed()
Time elapsed in current exposure.
Definition ngcdcsSrvExp.cpp:125
virtual ngcdcsNGC2 * MakeNGC2(ngcbIFC *dev, const ngcb_route_t &route)
Create NGC2 basic module.
Definition ngcdcsSrvMod.cpp:115
int SeqStop(int id=0)
Stop (sequencer + acquisition process)
Definition ngcdcsSrvRunCtrl.cpp:833
void DelCmd(const char *cmd)
Delete command from server command list.
Definition ngcdcsSrvCmd.cpp:62
int updateParam
Parameter update flag.
Definition ngcdcsSRV.hpp:1115
int SelftestAdc(int id)
Selftest function for ADC module.
Definition ngcdcsSrvSelftest.cpp:174
int DbConfigure()
Configure database.
Definition ngcdcsSrvDb.cpp:152
virtual ngcdcsCLDC * MakeCLDC(ngcbIFC *dev, const ngcb_route_t &route, int nc, int nb)
Create standard CLDC module.
Definition ngcdcsSrvMod.cpp:26
char dbPoint[256]
Actual data base point.
Definition ngcdcsSRV.hpp:918
void virtual int DbConfCB()
Configure database call-back.
Definition ngcdcsSrvDb.cpp:966
int ExpDrvClose()
Uninstall exposure driver.
Definition ngcdcsSrvExpDrv.cpp:470
int ParamLookup(const char *name, char *value, int flag=0)
Handler for parameter lookup (from ngcbSERVICE)
Definition ngcdcsSrvParam.cpp:865
int ExpCont(int id=0)
Continue paused exosure.
Definition ngcdcsSrvExp.cpp:1407
void StoreState()
Store sequencer states.
Definition ngcdcsSrvStateCtrl.cpp:561
void CheckDev(int idx, char *s)
Device check.
Definition ngcdcsSrvInfo.cpp:1082
int polling
Enable/disable polling.
Definition ngcdcsSRV.hpp:711
char configDir[256]
Configuration directory.
Definition ngcdcsSRV.hpp:310
virtual ngcdcsAOBIAS * MakeAOBIAS(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create AO bias generator.
Definition ngcdcsSrvMod.cpp:59
int autoRestart
Enable automatic restart mechanism.
Definition ngcdcsSRV.hpp:1006
int StoreCfg(const char *fileName)
Store configuration.
Definition ngcdcsSrvStoreCfg.cpp:29
int mergeDisplay
Flag to launch merger status display.
Definition ngcdcsSRV.hpp:628
int SelftestShutter(int id)
Selftest function for shutter module.
Definition ngcdcsSrvSelftest.cpp:216
int CldcDisable(int id)
Disable CLDC outputs.
Definition ngcdcsSrvSetupCLDC.cpp:152
int numTccdMod
Number of acquisition modules.
Definition ngcdcsSRV.hpp:417
void ExpDrvList(char *s)
Print exposure driver list to string.
Definition ngcdcsSrvExpDrv.cpp:290
int ConfigureSystem(ngcdcs_syscfg_t newCfg, int copy=1)
Configure system.
Definition ngcdcsSrvMain.cpp:1386
int Snapshot(int id, char *s)
Formatted bias snapshot.
Definition ngcdcsSrvInfo.cpp:1889
virtual void ErrLogEvent(int id, const char *erms)
Error logging event.
Definition ngcdcsSrvLog.cpp:402
void ExpDrvStatus(unsigned int newStat)
Exposure driver status update.
Definition ngcdcsSrvExpDrv.cpp:574
ngcdcsNGSD * NGSDMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route, double extRef)
NGSD module factory.
Definition ngcdcsSrvMod.cpp:329
int GeosnapAction(int id, const char *action, char *reply)
Perform GEOSNAP action.
Definition ngcdcsSrvRunCtrl.cpp:1792
int NewEventConnection(int fd)
New event connection.
Definition ngcdcsSrvDb.cpp:41
virtual ngcbCMD_LIST * CreateCmdList()
Command list factory.
Definition ngcdcsSrvCmd.cpp:33
void ParamUndefine(const char *name, int id)
Undefine (remove) parameter.
Definition ngcdcsSrvParam.cpp:779
char stateString[32]
Server state string (STANDBY,ONLINE,...
Definition ngcdcsSRV.hpp:678
int ErrState()
Check if we are in error state.
Definition ngcdcsSrvStateCtrl.cpp:553
int state
Server state value.
Definition ngcdcsSRV.hpp:675
double RemainingTime()
Time remaining in current exposure.
Definition ngcdcsSrvExp.cpp:139
char * Instance()
Get instance.
Definition ngcdcsSrvMain.cpp:459
virtual ngcdcsB24 * MakeB24(ngcbIFC *dev, const ngcb_route_t &route, int nb)
Create NGC2 B24 bias generator.
Definition ngcdcsSrvMod.cpp:41
int FrameStore(int id, const char *name, int flag)
Set frame attribute: store.
Definition ngcdcsSrvFrames.cpp:84
virtual int LoadSysCfg(ngcdcs_syscfg_t *newCfg, const char *fileName)
System configuration file loader.
Definition ngcdcsSrvSysCfg.cpp:463
virtual ngcdcsSHUTTER * ShutterMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
Shutter module factory.
Definition ngcdcsSrvMod.cpp:255
void SysCfgDefault(const char *cfg)
Apply default system configuration.
Definition ngcdcsSrvSysCfg.cpp:191
int ExpDrvLoaded(const char *module)
Check if exposure driver module is loaded.
Definition ngcdcsSrvExpDrv.cpp:285
ngcdcsSEQ0 * SeqFn(int idx)
Get index of sequencer functional module.
Definition ngcdcsSrvMod.cpp:376
void void void Log(int level, const char *format,...) __attribute__((format(printf
Logging method depending on level.
Definition ngcdcsSrvLog.cpp:243
int CoreShell()
Core shell.
Definition ngcdcsSrvUI.cpp:149
int HIRES_TIMER
High resolution polling interval.
Definition ngcdcsSRV.hpp:717
virtual ngcdcsLISA * MakeLISA(ngcbIFC *dev, const ngcb_route_t &route)
Create LISA camera module.
Definition ngcdcsSrvMod.cpp:127
int ExpAddWait(int fd, int id)
Add exposure waiting client (socket)
Definition ngcdcsSrvExp.cpp:1447
void Info(char *s)
Formatted server info.
Definition ngcdcsSrvInfo.cpp:30
int subState
Server sub-state value.
Definition ngcdcsSRV.hpp:684
char readModeName[64]
Current read-mode name.
Definition ngcdcsSRV.hpp:475
const char * Version()
Current version.
Definition ngcdcsSrvMain.cpp:429
void RpcTranslate(void *payload, size_t size, int request, int how, char *s)
Translate RPC payload to string.
Definition ngcdcsSrvInfo.cpp:2432
virtual int LoadDetCfg(ngcdcs_detcfg_t *newCfg, const char *fileName)
Detector configuration file loader.
Definition ngcdcsSrvDetCfg.cpp:720
int FatalError()
Check for fatal error.
Definition ngcdcsSrvStateCtrl.cpp:326
uint64_t FramesProcessed()
Number of processed frames during current exposure.
Definition ngcdcsSrvExp.cpp:109
virtual ngcdcsSEQ * MakeSEQ(ngcbIFC *dev, const ngcb_route_t &route, ngcbPARAM_LIST *p)
Create sequencer module.
Definition ngcdcsSrvMod.cpp:89
int autoMerge
Automatic merging.
Definition ngcdcsSRV.hpp:619
char subStateString[32]
Sub-state string (IDLE,BUSY,...)
Definition ngcdcsSRV.hpp:687
int Rtd(int idx)
Start RTD for acquistion module.
Definition ngcdcsSrvUI.cpp:384
int CldcEnable(int id)
Enable CLDC outputs.
Definition ngcdcsSrvSetupCLDC.cpp:25
void ClearState(int id=0)
Clear stored sequencer states.
Definition ngcdcsSrvStateCtrl.cpp:659
int CldcCalibrate(int id)
Calibrate voltages.
Definition ngcdcsSrvSetupCLDC.cpp:344
int DetCfg(const char *cfgFile)
Apply detector configuration.
Definition ngcdcsSrvDetCfg.cpp:153
ngcdcsGEOSNAP * GeosnapMod(const char *spec, ngcbIFC *dev, const ngcb_route_t &route)
GEOSNAP module factory.
Definition ngcdcsSrvMod.cpp:347
int deviceEvents
Enable/disable device events.
Definition ngcdcsSRV.hpp:298
void DisableDbMirror()
Disable internal databse mirror.
Definition ngcdcsSrvDb.cpp:26
int SeqStart(int id=0, struct timeval *ts=NULL, double absTime=0.0)
Start (sequencer + acquisition process)
Definition ngcdcsSrvRunCtrl.cpp:1104
int GetPrg(int id, int num, char *s)
Formatted sequencer program.
Definition ngcdcsSrvInfo.cpp:2322
ngcdcsACQ * AcqMod(const char *spec, const ngcdcs_acq_cfg_t &cfg, ngcbPARAM_LIST *p)
Acquisition module factory.
Definition ngcdcsSrvMod.cpp:366
int AcqStart(int id=0)
Start (acquisition process)
Definition ngcdcsSrvRunCtrl.cpp:781
int ParseArguments(int argc, char **argv)
Parse options.
Definition ngcdcsSrvArgs.cpp:90
ngcdcsEXPDRV * expDrv
Exposure sequence driver.
Definition ngcdcsSRV.hpp:569
int SelftestSca(int id)
Selftest function for Sidecar ASIC module.
Definition ngcdcsSrvSelftest.cpp:300
virtual int LookupCB(const char *paramName, char *value)
Call-back for parameter lookup.
Definition ngcdcsSrvStatus.cpp:1615
int SelftestPreamp(int id)
Selftest function for preamplifier module.
Definition ngcdcsSrvSelftest.cpp:258
int AcqInfo(int id, char *s)
Formatted acquisition process info.
Definition ngcdcsSrvInfo.cpp:955
virtual ngcdcsC20B20 * MakeC20B20(ngcbIFC *dev, const ngcb_route_t &route, int nc, int nb)
Create NGC2 bias generator.
Definition ngcdcsSrvMod.cpp:33
virtual void SysCfgOverride(ngcdcs_syscfg_t *newCfg)
Overrride system configuration (call-back)
Definition ngcdcsSrvSysCfg.cpp:233
Definition ngcdcsSUBFRM.hpp:49
Definition ngcdcsTCCD.hpp:28
Definition ngcdcsTEC.hpp:137
unsigned long int ngcb_alarm_id
Definition ngcbALARM.hpp:50
#define ngcbDB_MAX_ATTR
Definition ngcbATTR.hpp:21
int(ngcbCMD_SRV::* ngcb_function_t)(ngcb_cmd_handle_t *handle, char *reply)
Definition ngcbCMD.hpp:308
#define ngcbEVT_PENDING
Definition ngcbIFC.hpp:49
#define ngcbVB_LOG
Definition ngcbSERVICE.hpp:26
#define ngcbVB_PRINT
Definition ngcbSERVICE.hpp:25
#define ngcbSIO_MAX_CON
Definition ngcbSIO.hpp:24
int ngcbGetTime(struct timeval *t)
Definition ngcbTime.c:41
#define ngcdcsACQ_MAX_PROC
Definition ngcdcsACQ.hpp:71
#define ngcdcsCTRL_MAX_SEQ
Definition ngcdcsCTRL.hpp:44
#define ngcdcsCTRL_MAX_DEV
Definition ngcdcsCTRL.hpp:56
int ngcdcsCfg2Arg(int argc, char **argv, char *argStr)
Definition ngcdcsSrvArgs.cpp:809
void ngcdcsSrvBreakHandler(int sig)
Definition ngcdcsSrvMain.cpp:37
#define ngcdcsLOG_INFO
Definition ngcdcsSRV.hpp:125
void ngcdcsSrvExitHandler(int sig)
Definition ngcdcsSrvMain.cpp:56
#define ngcdcsMAX_LOG
Definition ngcdcsSRV.hpp:120
#define ngcdcsTCCD_MAX_PROC
Definition ngcdcsTCCD.hpp:22
Definition ngcbIFC.hpp:581
Definition ngcbSTREAM.hpp:28
Definition ngcbSIO.hpp:64
Definition ngcbIFC.hpp:78
Definition ngcdcsEXP.hpp:103
Definition ngcdcsACQ_DATA.hpp:25
Definition ngcdcsCFG.hpp:1194
Definition ngcdcsEXP.hpp:142
Definition ngcdcsFINFO.hpp:468
Definition ngcdcsSRV.hpp:149
unsigned int nExpStart
Definition ngcdcsSRV.hpp:151
ngcdcs_srvinfo_t()
Constructor.
Definition ngcdcsSRV.hpp:159
unsigned int nExpCompl
Definition ngcdcsSRV.hpp:152
unsigned int nFile
Definition ngcdcsSRV.hpp:156
struct timeval startTime
Definition ngcdcsSRV.hpp:150
unsigned int nFram
Definition ngcdcsSRV.hpp:155
unsigned int nExpFail
Definition ngcdcsSRV.hpp:154
unsigned int nExpAbort
Definition ngcdcsSRV.hpp:153
Definition ngcdcsCFG.hpp:951
Definition ngcdcsSRV.hpp:135
virtual ~ngcdcs_wait_t()
Destructor.
Definition ngcdcsSRV.hpp:143
int id
Definition ngcdcsSRV.hpp:137
ngcdcs_wait_t()
Constructor.
Definition ngcdcsSRV.hpp:140
int fd
Definition ngcdcsSRV.hpp:136
Definition ngcdcsSEQ.hpp:157