cacao  Release 0.1.03-dev
Compute And Control For Adaptive Optics
function_parameters.h
Go to the documentation of this file.
1 
10 #ifndef FUNCTION_PARAMETERS_H
11 
12 #define FUNCTION_PARAMETERS_H
13 
14 
15 
16 
17 
18 /* ===============================================================================================
19  */
20 /* ===============================================================================================
21  */
22 /* DEFINES, MACROS */
23 /* ===============================================================================================
24  */
25 /* ===============================================================================================
26  */
27 
28 
29 #define STRINGMAXLEN_FPS_LOGMSG 1000
30 #define STRINGMAXLEN_FPS_CMDLINE 1000
31 
32 
33 
34 #define NB_FPS_MAX 100
35 
36 #define MAXNBLEVELS 20
37 
38 #define FPSCONNECT_SIMPLE 0
39 #define FPSCONNECT_CONF 1
40 #define FPSCONNECT_RUN 2
41 
42 
43 // CMCODE type is uint32_t
44 #define FPSCMDCODE_CONFSTART 0x00000001 // start configuration process
45 #define FPSCMDCODE_CONFSTOP 0x00000002 // stop configuration process
46 #define FPSCMDCODE_FPSINIT 0x00000004 // initialize FPS if does not exist
47 #define FPSCMDCODE_FPSINITCREATE 0x00000008 // (re-)create FPS even if it exists
48 #define FPSCMDCODE_RUNSTART 0x00000010 // start run process
49 #define FPSCMDCODE_RUNSTOP 0x00000020 // stop run process
50 
51 
52 // function can use this structure to expose parameters for external control or monitoring
53 // the structure describes how user can interact with parameter, so it allows for control GUIs to connect to parameters
54 
55 #define FUNCTION_PARAMETER_KEYWORD_STRMAXLEN 64
56 #define FUNCTION_PARAMETER_KEYWORD_MAXLEVEL 20
57 
58 // Note that notation allows parameter to have more than one type
59 // ... to be used with caution: most of the time, use type exclusively
60 // type is uint32_t
61 
62 #define FPTYPE_UNDEF 0x00000001
63 #define FPTYPE_INT32 0x00000002
64 #define FPTYPE_UINT32 0x00000004
65 #define FPTYPE_INT64 0x00000008
66 #define FPTYPE_UINT64 0x00000010
67 #define FPTYPE_FLOAT32 0x00000020
68 #define FPTYPE_FLOAT64 0x00000040
69 
70 #define FPTYPE_PID 0x00000080
71 #define FPTYPE_TIMESPEC 0x00000100
72 
73 #define FPTYPE_FILENAME 0x00000200 // generic filename
74 #define FPTYPE_FITSFILENAME 0x00000400 // FITS file
75 #define FPTYPE_EXECFILENAME 0x00000800 // executable file
76 
77 #define FPTYPE_DIRNAME 0x00001000 // directory name
78 #define FPTYPE_STREAMNAME 0x00002000 // stream name -> process may load from shm if required. See loading stream section below and associated flags
79 #define FPTYPE_STRING 0x00004000 // generic string
80 #define FPTYPE_ONOFF 0x00008000 // uses ONOFF bit flag, string[0] and string[1] for OFF and ON descriptions respectively. setval saves ONOFF as integer
81 #define FPTYPE_PROCESS 0x00010000
82 
83 
84 #define FPTYPE_FPSNAME 0x00020000 // connection to another FPS
85 
86 
87 
88 #define FUNCTION_PARAMETER_DESCR_STRMAXLEN 64
89 #define FUNCTION_PARAMETER_STRMAXLEN 64
90 
91 
92 
93 // STATUS FLAGS
94 
95 // parameter use and visibility
96 #define FPFLAG_ACTIVE 0x0000000000000001 // is this entry registered ?
97 #define FPFLAG_USED 0x0000000000000002 // is this entry used ? if not, skip all checks
98 #define FPFLAG_VISIBLE 0x0000000000000004 // is this entry visible (=displayed) ?
99 
100 // write permission
101 #define FPFLAG_WRITE 0x0000000000000010 // is value writable when neither CONF and RUN are active
102 #define FPFLAG_WRITECONF 0x0000000000000020 // can user change value at configuration time ?
103 #define FPFLAG_WRITERUN 0x0000000000000040 // can user change value at run time ?
104 #define FPFLAG_WRITESTATUS 0x0000000000000080 // current write status (computed from above flags)
105 
106 // logging and saving
107 #define FPFLAG_LOG 0x0000000000000100 // log on change
108 #define FPFLAG_SAVEONCHANGE 0x0000000000000200 // save to disk on change
109 #define FPFLAG_SAVEONCLOSE 0x0000000000000400 // save to disk on close
110 
111 // special types
112 #define FPFLAG_IMPORTED 0x0000000000001000 // is this entry imported from another parameter ?
113 #define FPFLAG_FEEDBACK 0x0000000000002000 // is there a separate current value feedback ?
114 #define FPFLAG_ONOFF 0x0000000000004000 // bit controlled under TYPE_ONOFF
115 
116 // parameter testing
117 #define FPFLAG_CHECKINIT 0x0000000000010000 // should parameter be initialized prior to function start ?
118 #define FPFLAG_MINLIMIT 0x0000000000020000 // enforce min limit
119 #define FPFLAG_MAXLIMIT 0x0000000000040000 // enforce max limit
120 #define FPFLAG_ERROR 0x0000000000080000 // is current parameter value OK ?
121 
122 
123 
124 // if FPTYPE_STREAMNAME
125 // STREAM FLAGS: actions and tests related to streams
126 
127 // The stream location may be in :
128 // --- convention : this is downstream ---
129 // [a]-LOCALMEM local process memory
130 // [b]-SHAREMEM system shared memory .. which may itself be a link to another shared memory
131 // [c]-CONFFITS fits file in conf: a file ./conf/shmim.<stream>.fits, which may itself be a link to another FITS file
132 // [d]-CONFNAME name of fits file configuration: a file ./conf/shmim.<stream>.fname.conf contains the name of the disk file to be loaded as the stream, relative to current running directory
133 // --- convention : this is upstream ---
134 
135 
136 // what is the source from which a stream was successfully loaded
137 #define STREAM_LOAD_SOURCE_NOTFOUND 0
138 #define STREAM_LOAD_SOURCE_NOTFOUND_STRING "STREAM_LOAD_SOURCE_NOTFOUND"
139 
140 #define STREAM_LOAD_SOURCE_LOCALMEM 1
141 #define STREAM_LOAD_SOURCE_LOCALMEM_STRING "STREAM_LOAD_SOURCE_LOCALMEM"
142 
143 #define STREAM_LOAD_SOURCE_SHAREMEM 2
144 #define STREAM_LOAD_SOURCE_SHAREMEM_STRING "STREAM_LOAD_SOURCE_SHAREMEM"
145 
146 #define STREAM_LOAD_SOURCE_CONFFITS 3
147 #define STREAM_LOAD_SOURCE_CONFFITS_STRING "STREAM_LOAD_SOURCE_CONFFITS"
148 
149 #define STREAM_LOAD_SOURCE_CONFNAME 4
150 #define STREAM_LOAD_SOURCE_CONFNAME_STRING "STREAM_LOAD_SOURCE_CONFNAME"
151 
152 #define STREAM_LOAD_SOURCE_NULL 5
153 #define STREAM_LOAD_SOURCE_NULL_STRING "STREAM_LOAD_SOURCE_NULL"
154 
155 #define STREAM_LOAD_SOURCE_EXITFAILURE -1
156 #define STREAM_LOAD_SOURCE_EXITFAILURE_STRING "STREAM_LOAD_SOURCE_EXITFAILURE"
157 
158 //
159 // The default policy is to look for the source location first in [a], then [b], etc..., until [d]
160 // Once source location is found, the downstream locations are updated. For example: search[a]; search[b], find[c]->update[b]->update[a]
161 //
162 //
163 //
164 // Important scripts (should be in PATH):
165 // - milkstreamlink : build sym link between streams
166 // - milkFits2shm : smart loading/updating of FITS to SHM
167 //
168 // loading CONF to SHM must use script milkFits2shm
169 //
170 //
171 
172 
173 // STREAM LOADING POLICY FLAGS
174 // These flags modify the default stream load policy
175 // Default load policy: FORCE flags = 0, SKIPSEARCH flags = 0, UPDATE flags = 0
176 //
177 // FORCE flags will force a location to be used and all downstream locations to be updated
178 // if the FORCE location does not exist, it will fail
179 // only one such flag should be specified. If several force flags are specified, the first one ((a) over (b)) will be considered
180 #define FPFLAG_STREAM_LOAD_FORCE_LOCALMEM 0x0000000000100000
181 #define FPFLAG_STREAM_LOAD_FORCE_SHAREMEM 0x0000000000200000
182 #define FPFLAG_STREAM_LOAD_FORCE_CONFFITS 0x0000000000400000
183 #define FPFLAG_STREAM_LOAD_FORCE_CONFNAME 0x0000000000800000
184 
185 // SKIPSEARCH flags will skip search location
186 // multiple such flags can be specified
187 //
188 // Note that the FORCE flags have priority over the SKIPSEARCH flags
189 // If a FORCE flag is active, the SKIPSEARCH flags will be ignored
190 //
191 #define FPFLAG_STREAM_LOAD_SKIPSEARCH_LOCALMEM 0x0000000001000000
192 #define FPFLAG_STREAM_LOAD_SKIPSEARCH_SHAREMEM 0x0000000002000000
193 #define FPFLAG_STREAM_LOAD_SKIPSEARCH_CONFFITS 0x0000000004000000
194 #define FPFLAG_STREAM_LOAD_SKIPSEARCH_CONFNAME 0x0000000008000000
195 
196 // UPDATE flags will update upstream locations
197 #define FPFLAG_STREAM_LOAD_UPDATE_SHAREMEM 0x0000000010000000
198 #define FPFLAG_STREAM_LOAD_UPDATE_CONFFITS 0x0000000020000000
199 
200 
201 
202 
203 // Additionally, the following flags specify what to do if stream properties do not match the required properties
204 //
205 
206 
207 #define FPFLAG_FILE_CONF_REQUIRED 0x0000000040000000 // file must exist for CONF process to proceed
208 #define FPFLAG_FILE_RUN_REQUIRED 0x0000000080000000 // file must exist for RUN process to proceed
209 // note: we can reuse same codes
210 
211 #define FPFLAG_FPS_CONF_REQUIRED 0x0000000040000000 // file must exist for CONF process to proceed
212 #define FPFLAG_FPS_RUN_REQUIRED 0x0000000080000000 // file must exist for RUN process to proceed
213 
214 #define FPFLAG_STREAM_CONF_REQUIRED 0x0000000040000000 // stream has to be in MEM for CONF process to proceed
215 #define FPFLAG_STREAM_RUN_REQUIRED 0x0000000080000000 // stream has to be in MEM for RUN process to proceed
216 
217 
218 
219 
220 // Additional notes on load functions in AOloopControl_IOtools
221 //
222 /* AOloopControl_IOtools_2Dloadcreate_shmim( const char *name,
223  const char *fname,
224  long xsize,
225  long ysize,
226  float DefaultValue)
227 */
228 //
229 
230 
231 
232 
233 #define FPFLAG_STREAM_ENFORCE_DATATYPE 0x0000000100000000 // enforce stream datatype
234 // stream type requirement: one of the following tests must succeed (OR) if FPFLAG_STREAM_ENFORCE_DATATYPE
235 // If creating image, the first active entry is used
236 #define FPFLAG_STREAM_TEST_DATATYPE_UINT8 0x0000000200000000 // test if stream of type UINT8 (OR test)
237 #define FPFLAG_STREAM_TEST_DATATYPE_INT8 0x0000000400000000 // test if stream of type INT8 (OR test)
238 #define FPFLAG_STREAM_TEST_DATATYPE_UINT16 0x0000000800000000 // test if stream of type UINT16 (OR test)
239 #define FPFLAG_STREAM_TEST_DATATYPE_INT16 0x0000001000000000 // test if stream of type INT16 (OR test)
240 #define FPFLAG_STREAM_TEST_DATATYPE_UINT32 0x0000002000000000 // test if stream of type UINT32 (OR test)
241 #define FPFLAG_STREAM_TEST_DATATYPE_INT32 0x0000004000000000 // test if stream of type INT32 (OR test)
242 #define FPFLAG_STREAM_TEST_DATATYPE_UINT64 0x0000008000000000 // test if stream of type UINT64 (OR test)
243 #define FPFLAG_STREAM_TEST_DATATYPE_INT64 0x0000010000000000 // test if stream of type INT64 (OR test)
244 #define FPFLAG_STREAM_TEST_DATATYPE_HALF 0x0000020000000000 // test if stream of type HALF (OR test)
245 #define FPFLAG_STREAM_TEST_DATATYPE_FLOAT 0x0000040000000000 // test if stream of type FLOAT (OR test)
246 #define FPFLAG_STREAM_TEST_DATATYPE_DOUBLE 0x0000080000000000 // test if stream of type DOUBLE (OR test)
247 
248 #define FPFLAG_STREAM_ENFORCE_1D 0x0000100000000000 // enforce 1D image
249 #define FPFLAG_STREAM_ENFORCE_2D 0x0000200000000000 // enforce 2D image
250 #define FPFLAG_STREAM_ENFORCE_3D 0x0000400000000000 // enforce 3D image
251 #define FPFLAG_STREAM_ENFORCE_XSIZE 0x0008000000000000 // enforce X size
252 #define FPFLAG_STREAM_ENFORCE_YSIZE 0x0010000000000000 // enforce Y size
253 #define FPFLAG_STREAM_ENFORCE_ZSIZE 0x0020000000000000 // enforce Z size
254 
255 #define FPFLAG_CHECKSTREAM 0x0040000000000000 // check and display stream status in GUI
256 #define FPFLAG_STREAM_MEMLOADREPORT 0x0080000000000000 // Write stream load report (for debugging)
257 
258 
259 
260 
261 
262 
263 
264 
265 // PRE-ASSEMBLED DEFAULT FLAGS
266 
267 // input parameter (used as default when adding entry)
268 #define FPFLAG_DEFAULT_INPUT FPFLAG_ACTIVE|FPFLAG_USED|FPFLAG_VISIBLE|FPFLAG_WRITE|FPFLAG_WRITECONF|FPFLAG_SAVEONCHANGE|FPFLAG_FEEDBACK|FPFLAG_CHECKINIT
269 #define FPFLAG_DEFAULT_OUTPUT FPFLAG_ACTIVE|FPFLAG_USED|FPFLAG_VISIBLE
270 #define FPFLAG_DEFAULT_INPUT_STREAM FPFLAG_DEFAULT_INPUT|FPFLAG_STREAM_RUN_REQUIRED|FPFLAG_CHECKSTREAM
271 #define FPFLAG_DEFAULT_OUTPUT_STREAM FPFLAG_DEFAULT_INPUT|FPFLAG_CHECKSTREAM
272 
273 
274 // status parameters, no logging, read only
275 #define FPFLAG_DEFAULT_STATUS FPFLAG_ACTIVE|FPFLAG_USED|FPFLAG_VISIBLE
276 
277 
278 
279 
280 
281 #define FUNCTION_PARAMETER_NBPARAM_DEFAULT 100 // size of dynamically allocated array of parameters
282 
283 
284 
285 typedef struct
286 {
287  long streamID; // if type is stream and MASK_CHECKSTREAM. For CONF only
288  uint8_t stream_atype;
289 
290  // these have two entries. First is actual/measured, second is required (0 if dimension not active)
291  // tests are specified by flags FPFLAG_STREAM_ENFORCE_1D/2D/3D/XSIZE/YSIZE/ZSIZE
292  uint32_t stream_naxis[2];
293  uint32_t stream_xsize[2]; // xsize
294  uint32_t stream_ysize[2]; // ysize
295  uint32_t stream_zsize[2]; // zsize
296  uint8_t stream_sourceLocation; // where has the stream been loaded from ?
298 
299 
300 
301 typedef struct
302 {
303  long FPSNBparamMAX; // to be written by connect function
307 
308 
309 
310 typedef struct
311 {
312  uint64_t fpflag;// 64 binary flags, see FUNCTION_PARAMETER_MASK_XXXX
313 
314  // Parameter name
315  char keywordfull[FUNCTION_PARAMETER_KEYWORD_STRMAXLEN *
318  int keywordlevel; // number of levels in keyword
319 
320  // if this parameter value imported from another parameter, source is:
321  char keywordfrom[FUNCTION_PARAMETER_KEYWORD_STRMAXLEN *
323 
325 
326  uint32_t type; // one of FUNCTION_PARAMETER_TYPE_XXXX
327 
328  union
329  {
330  int64_t
331  l[4]; // value, min (inclusive), max (inclusive), current state (if different from request)
332  double
333  f[4]; // value, min, max, current state (if different from request)
334  float s[4];
335  pid_t pid[2]; // first value is set point, second is current state
336  struct timespec ts[2]; // first value is set point, second is current state
337 
338  char
339  string[2][FUNCTION_PARAMETER_STRMAXLEN]; // first value is set point, second is current state
340  // if TYPE = PROCESS, string[0] is tmux session, string[1] is launch command
341  } val;
342 
343 
344  union
345  {
347  FUNCTION_PARAMETER_SUBINFO_FPS fps; // if FPTYPE_FPSNAME
348  } info;
349 
350 
351  long cnt0; // increments when changed
352 
354 
355 
356 
357 
358 
359 
360 #define FUNCTION_PARAMETER_STRUCT_MSG_SIZE 500
361 
362 #define FUNCTION_PARAMETER_STRUCT_STATUS_CONF 0x0001 // is configuration running ?
363 #define FUNCTION_PARAMETER_STRUCT_STATUS_RUN 0x0002 // is process running ?
364 
365 #define FUNCTION_PARAMETER_STRUCT_STATUS_CMDCONF 0x0010 // should configuration be running ?
366 #define FUNCTION_PARAMETER_STRUCT_STATUS_CMDRUN 0x0020 // should process be running ?
367 
368 #define FUNCTION_PARAMETER_STRUCT_STATUS_RUNLOOP 0x0100 // is process loop running ?
369 #define FUNCTION_PARAMETER_STRUCT_STATUS_CHECKOK 0x0200 // Are parameter values OK to run loop process ? (1=OK, 0=not OK)
370 
371 
372 
373 
374 #define FUNCTION_PARAMETER_STRUCT_SIGNAL_CONFRUN 0x0001 // configuration process
375 //#define FUNCTION_PARAMETER_STRUCT_SIGNAL_CONFSTOP 0x0002 // stop configuration process
376 #define FUNCTION_PARAMETER_STRUCT_SIGNAL_UPDATE 0x0004 // re-run check of parameter
377 
378 #define FUNCTION_PARAMETER_STRUCT_SIGNAL_CHECKED 0x0008 // CheckParametersAll been completed.
379 // Toggles to 1 upon update request
380 // Toggles to 0 when update completed (in function CheckParametersAll)
381 
382 
383 
384 
385 
386 // ERROR AND WARNING MESSAGES
387 
388 #define FPS_NB_MSG 100 // max number of messages
389 #define FUNCTION_PARAMETER_STRUCT_MSG_LEN 500
390 
391 
392 #define FPS_MSG_FLAG_NOTINITIALIZED 0x0001
393 #define FPS_MSG_FLAG_BELOWMIN 0x0002
394 #define FPS_MSG_FLAG_ABOVEMAX 0x0004
395 
396 // by default, a message is a warning
397 #define FPS_MSG_FLAG_ERROR 0x0008 // if ERROR, then cannot start function
398 #define FPS_MSG_FLAG_INFO 0x0010
399 
400 
401 #define FPS_NAME_STRMAXLEN 100
402 #define FPS_CWD_STRLENMAX 200
403 #define FPS_SRCDIR_STRLENMAX 200
404 #define FPS_PNAME_STRMAXLEN 100
405 #define FPS_DESCR_STRMAXLEN 200
406 
407 // metadata
408 typedef struct
409 {
410  // process name
411  // Name can include numbers in the format -XX-YY to allow for multiple structures be created by the same process function and to pass arguments (XX, YY) to process function
412  char name[FPS_NAME_STRMAXLEN]; // example: pname-01-32
413 
414  char description[FPS_DESCR_STRMAXLEN];
415  char
416  fpsdirectory[FPS_CWD_STRLENMAX]; // where should the parameter values be saved to disk ?
417  char sourcefname[FPS_SRCDIR_STRLENMAX]; // source code location
419 
420  // the name and indices are automatically parsed in the following format
421  char pname[FPS_PNAME_STRMAXLEN]; // example: pname
422  char nameindexW[16][10]; // subnames
423  int NBnameindex; // example: 2
424 
425  // configuration will run in tmux session pname-XX-conf
426  // process will run in tmux session pname-XX-run
427  // expected commands to start and stop process :
428  // ./cmdproc/<pname>-conf-start XX YY (in tmux session)
429  // ./cmdproc/<pname>-run-start XX YY (in tmux session)
430  // ./cmdproc/<pname>-run-stop XX YY
431  //
432 
433  pid_t
434  confpid; // PID of process owning parameter structure configuration
435  pid_t runpid; // PID of process running on this fps
436 
437 
438  uint64_t
439  signal; // Used to send signals to configuration process
440  uint64_t confwaitus; // configuration wait timer value [us]
441 
442  uint32_t status; // conf and process status
443 
444  long
445  NBparamMAX; // size of parameter array (= max number of parameter supported)
446 
447 
448  char
450  int
451  msgpindex[FPS_NB_MSG]; // to which entry does the message refer to ?
452  uint32_t
453  msgcode[FPS_NB_MSG]; // What is the nature of the message/error ?
454  long msgcnt;
455  uint32_t conferrcnt;
456 
458 
459 
460 
461 
462 typedef struct
463 {
464  // these two structures are shared
466  FUNCTION_PARAMETER *parray; // array of function parameters
467 
468  // these variables are local to each process
469  uint16_t loopstatus;
470  int SMfd;
471  uint32_t CMDmode;
472 
474 
475 
476 
477 
478 
479 
480 
481 //
482 // Tasks can be sequenced
483 // Typically these are read from command fifo
484 // The structure is meant to provide basic scheduling functionality
485 //
486 #define NB_FPSCTRL_TASK_MAX 1024
487 //#define FPSCMD_MAXCHAR 1024
488 #define NB_FPSCTRL_TASKQUEUE_MAX 10
489 
490 #define FPSTASK_STATUS_ACTIVE 0x0000000000000001 // is the task entry in the array used ?
491 #define FPSTASK_STATUS_RUNNING 0x0000000000000002
492 #define FPSTASK_STATUS_WAITING 0x0000000000000004
493 #define FPSTASK_STATUS_SHOW 0x0000000000000008
494 
495 // use WAITONRUN to ensure the queue is blocked until the current run process is done
496 #define FPSTASK_FLAG_WAITONRUN 0x0000000000000001
497 #define FPSTASK_FLAG_WAITONCONF 0x0000000000000002
498 
499 // If ON, the task is a wait point, and will only proceed if the FPS pointed to by fpsindex is NOT running
500 #define FPSTASK_FLAG_WAIT_FOR_FPS_NORUN 0x0000000000000004
501 
502 
503 #define FPSTASK_MAX_NBQUEUE 10
504 
505 typedef struct
506 {
507  int priority;
508  // high number = high priority
509  // 0 = queue not active
510 
512 
513 
514 typedef struct
515 {
516 
517  char cmdstring[STRINGMAXLEN_FPS_CMDLINE];
518 
519 
520  uint64_t inputindex; // order in which tasks are submitted
521 
522  // Tasks in separate queues can run in parallel (not waiting for last task to run new one)
523  // Tasks within a queue run sequentially
524  uint32_t queue;
525  // Default queue is 0
526 
527  uint64_t status;
528  uint64_t flag;
529 
530  int fpsindex; // used to track status
531 
532  struct timespec creationtime;
533  struct timespec activationtime;
534  struct timespec completiontime;
535 
537 
538 
539 
540 
541 
542 
543 
544 typedef struct
545 {
546  int fpsCTRL_DisplayMode; // Display mode
547  uint32_t mode; // GUI mode
548  int NBfps; // Number of FPS entries
549  int NBkwn; // Number of keyword nodes
550  long NBindex;
551  char fpsnamemask[100];
555  int GUIlineSelected[100];
559  char fpsCTRLfifoname[200];
563 
564 
565 
566 
567 
568 
569 // ===========================
570 // CONVENIENT MACROS FOR FPS
571 // ===========================
572 
573 
589 #define FPS_SETUP_INIT(VARfpsname,VARCMDmode) FUNCTION_PARAMETER_STRUCT fps; do { \
590 fps.SMfd = -1; \
591 fps = function_parameter_FPCONFsetup((VARfpsname), (VARCMDmode)); \
592 strncpy(fps.md->sourcefname, __FILE__, FPS_SRCDIR_STRLENMAX);\
593 fps.md->sourceline = __LINE__; \
594 { \
595 char msgstring[STRINGMAXLEN_FPS_LOGMSG]; \
596 SNPRINTF_CHECK(msgstring, STRINGMAXLEN_FPS_LOGMSG, "LOGSTART %s %d %s %d", (VARfpsname), (VARCMDmode), fps.md->sourcefname, fps.md->sourceline); \
597 functionparameter_outlog("FPSINIT", msgstring); \
598 functionparameter_outlog_namelink((VARfpsname), (VARCMDmode)); \
599 } \
600 } while(0)
601 
602 
603 #define FPS_CONNECT( VARfpsname, VARCMDmode ) FUNCTION_PARAMETER_STRUCT fps; do { \
604 fps.SMfd = -1; \
605 if(function_parameter_struct_connect( (VARfpsname) , &fps, (VARCMDmode) ) == -1) { \
606 printf("ERROR: fps \"%s\" does not exist -> running without FPS interface\n", VARfpsname); \
607 return RETURN_FAILURE; \
608 }} while(0)
609 
610 
611 
612 #define FPS_CONFLOOP_START if(fps.loopstatus == 0) { \
613 return RETURN_SUCCESS; \
614 } \
615 while(fps.loopstatus == 1) { \
616 { \
617 struct timespec treq, trem; \
618 treq.tv_sec = 0; \
619 treq.tv_nsec = 50000; \
620 nanosleep(&treq, &trem); \
621 } \
622 if(function_parameter_FPCONFloopstep(&fps) == 1) {
623 
624 
625 #define FPS_CONFLOOP_END functionparameter_CheckParametersAll(&fps);}} function_parameter_FPCONFexit(&fps);
626 
627 
628 #define FPS_ADDPARAM_FLT64_IN(key, pname, pdescr, dflt) long fp_##key = 0; do{ \
629 fp_##key = function_parameter_add_entry(&fps, (pname), (pdescr), FPTYPE_FLOAT64, FPFLAG_DEFAULT_OUTPUT, (dflt));\
630 (void) fp_##key;\
631 } while(0)
632 
633 
634 
635 #define FPS_ADDPARAM_INT64_IN(key, pname, pdescr, dflt) long fp_##key = 0; do{ \
636 fp_##key = function_parameter_add_entry(&fps, (pname), (pdescr), FPTYPE_INT64, FPFLAG_DEFAULT_INPUT, (dflt));\
637 (void) fp_##key;\
638 } while(0)
639 
640 #define FPS_ADDPARAM_INT64_OUT(key, pname, pdescr) long fp_##key = 0; do{ \
641 fp_##key = function_parameter_add_entry(&fps, (pname), (pdescr), FPTYPE_INT64, FPFLAG_DEFAULT_OUTPUT, pNull);\
642 (void) fp_##key;\
643 } while(0)
644 
645 
646 
647 #define FPS_ADDPARAM_STREAM_IN(key, pname, pdescr) long fp_##key = 0; do{ \
648 fp_##key = function_parameter_add_entry(&fps, (pname), (pdescr), FPTYPE_STREAMNAME, FPFLAG_DEFAULT_INPUT_STREAM, pNull);\
649 (void) fp_##key;\
650 } while(0)
651 
652 #define FPS_ADDPARAM_STREAM_OUT(key, pname, pdescr) long fp_##key = 0; do{ \
653 fp_##key = function_parameter_add_entry(&fps, (pname), (pdescr), FPTYPE_STREAMNAME, FPFLAG_DEFAULT_OUTPUT_STREAM, pNull);\
654 (void) fp_##key;\
655 } while(0)
656 
657  // end group fpsmacro
659 
660 
661 //long fp_stream_inname = function_parameter_add_entry(&fps, ".in_name", "input stream", FPTYPE_STREAMNAME, FPFLAG_DEFAULT_INPUT_STREAM, pNull);
662 
663 
664 
665 
666 
667 
668 #ifdef __cplusplus
669 extern "C" {
670 #endif
671 
672 
674 
676 
677 
678 errno_t function_parameter_struct_create(int NBparamMAX, const char *name);
679 
680 
682  const char *name,
684  int fpsconnectmode
685 );
686 
687 
689  *funcparamstruct);
690 
691 
693  long NBparamMAX);
694 
696  const char *paramname);
697 
699  const char *paramname);
700 
702  const char *paramname, long value);
703 
705  const char *paramname);
706 
708  const char *paramname);
709 
711  const char *paramname, double value);
712 
714  const char *paramname);
715 
717  const char *paramname);
718 
720  const char *paramname, float value);
721 
723  const char *paramname);
724 
726  const char *paramname);
727 
729  const char *paramname, const char *stringvalue);
730 
732  const char *paramname);
733 
735  const char *paramname, int ONOFFvalue);
736 
738  const char *paramname);
739 
740 
741 
744  int pindex,
745  int fpsconnectmode
746 );
747 
749  const char *keywordstring, const char *descriptionstring, uint64_t type,
750  uint64_t fpflag, void *dataptr);
751 
753  int pindex);
755 
756 
758  int pindex, FUNCTION_PARAMETER_STRUCT *FPSext);
759 errno_t functionparameter_GetTypeString(uint32_t type, char *typestring);
761  int pindex);
762 
763 
764 
766  uint32_t CMDmode);
770 
772  const char *paramname);
773 
775  int pindex, char *tagname, char *commentstr);
776 
778  int fpsindex);
780  int fpsindex);
782  int fpsindex);
785  int fpsindex);
786 
787 
788 errno_t functionparameter_outlog_file(char *keyw, char *msgstring, FILE *fpout);
789 errno_t functionparameter_outlog(char *keyw, char *msgstring);
790 errno_t functionparameter_outlog_namelink(const char *fpsname, int cmdcode);
791 
792 errno_t functionparameter_CTRLscreen(uint32_t mode, char *fpsname,
793  char *fpsCTRLfifoname);
794 
795 
796 #ifdef __cplusplus
797 }
798 #endif
799 
800 #endif // FUNCTION_PARAMETERS_H
int functionparameter_GetParamValue_ONOFF(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1287
#define FPS_NAME_STRMAXLEN
Definition: function_parameters.h:401
FUNCTION_PARAMETER_SUBINFO_FPS fps
Definition: function_parameters.h:347
char * functionparameter_GetParamPtr_STRING(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1260
int functionparameter_SaveParam2disk(FUNCTION_PARAMETER_STRUCT *fpsentry, const char *paramname)
Definition: function_parameters.c:3904
long FPSNBparamActive
Definition: function_parameters.h:304
int direction
Definition: function_parameters.h:561
int currentlevel
Definition: function_parameters.h:556
int directorynodeSelected
Definition: function_parameters.h:557
int fpsindex
Definition: function_parameters.h:530
pid_t runpid
Definition: function_parameters.h:435
int pindexSelected
Definition: function_parameters.h:558
int keywordlevel
Definition: function_parameters.h:318
uint32_t queue
Definition: function_parameters.h:524
int SMfd
Definition: function_parameters.h:470
uint32_t conferrcnt
Definition: function_parameters.h:455
uint32_t CMDmode
Definition: function_parameters.h:471
long FPSNBparamMAX
Definition: function_parameters.h:303
int functionparameter_CheckParametersAll(FUNCTION_PARAMETER_STRUCT *fpsentry)
Definition: function_parameters.c:2928
uint64_t fpflag
Definition: function_parameters.h:312
uint16_t function_parameter_RUNexit(FUNCTION_PARAMETER_STRUCT *fps)
Definition: function_parameters.c:2218
Definition: function_parameters.h:408
errno_t function_parameter_getFPSname_from_CLIfunc(char *fpsname_default)
Definition: function_parameters.c:361
long function_parameter_struct_connect(const char *name, FUNCTION_PARAMETER_STRUCT *fps, int fpsconnectmode)
Definition: function_parameters.c:674
uint64_t * functionparameter_GetParamPtr_fpflag(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1332
FUNCTION_PARAMETER_SUBINFO_STREAM stream
Definition: function_parameters.h:346
Definition: function_parameters.h:505
int functionparameter_GetParamIndex(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1091
int nodeSelected
Definition: function_parameters.h:552
int function_parameter_printlist(FUNCTION_PARAMETER *funcparamarray, long NBparamMAX)
Definition: function_parameters.c:882
uint8_t stream_atype
Definition: function_parameters.h:288
Definition: function_parameters.h:285
uint32_t mode
Definition: function_parameters.h:547
#define FUNCTION_PARAMETER_KEYWORD_MAXLEVEL
Definition: function_parameters.h:56
errno_t functionparameter_CONFstart(FUNCTION_PARAMETER_STRUCT *fps, int fpsindex)
Definition: function_parameters.c:5693
long FPSNBparamUsed
Definition: function_parameters.h:305
#define FUNCTION_PARAMETER_STRMAXLEN
Definition: function_parameters.h:89
int functionparameter_SetParamValue_INT64(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname, long value)
Definition: function_parameters.c:1146
Definition: function_parameters.h:301
uint64_t confwaitus
Definition: function_parameters.h:440
Definition: function_parameters.h:462
errno_t function_parameter_execFPScmd()
Definition: function_parameters.c:481
uint32_t status
Definition: function_parameters.h:442
float functionparameter_GetParamValue_FLOAT32(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1218
float * functionparameter_GetParamPtr_FLOAT32(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1245
long cnt0
Definition: function_parameters.h:351
int NBfps
Definition: function_parameters.h:548
int NBnameindex
Definition: function_parameters.h:423
long * functionparameter_GetParamPtr_INT64(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1160
int errno_t
Definition: AOloopControl_IOtools.h:20
int sourceline
Definition: function_parameters.h:418
long imageID
Definition: CLIcore.h:54
FUNCTION_PARAMETER * parray
Definition: function_parameters.h:466
imageID functionparameter_LoadStream(FUNCTION_PARAMETER_STRUCT *fps, int pindex, int fpsconnectmode)
Definition: function_parameters.c:1352
uint64_t signal
Definition: function_parameters.h:439
#define FUNCTION_PARAMETER_DESCR_STRMAXLEN
Definition: function_parameters.h:88
long functionparameter_GetParamValue_INT64(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1131
errno_t functionparameter_outlog_file(char *keyw, char *msgstring, FILE *fpout)
Definition: function_parameters.c:5908
uint64_t status
Definition: function_parameters.h:527
errno_t functionparameter_GetTypeString(uint32_t type, char *typestring)
Definition: function_parameters.c:3065
int functionparameter_ConnectExternalFPS(FUNCTION_PARAMETER_STRUCT *FPS, int pindex, FUNCTION_PARAMETER_STRUCT *FPSext)
Definition: function_parameters.c:3034
#define FPS_SRCDIR_STRLENMAX
Definition: function_parameters.h:403
errno_t functionparameter_RUNstart(FUNCTION_PARAMETER_STRUCT *fps, int fpsindex)
Definition: function_parameters.c:5561
int functionparameter_PrintParameterInfo(FUNCTION_PARAMETER_STRUCT *fpsentry, int pindex)
Definition: function_parameters.c:3136
pid_t confpid
Definition: function_parameters.h:434
Definition: function_parameters.h:544
errno_t functionparameter_CONFstop(FUNCTION_PARAMETER_STRUCT *fps, int fpsindex)
Definition: function_parameters.c:5764
int fpsCTRL_DisplayMode
Definition: function_parameters.h:546
int priority
Definition: function_parameters.h:507
FUNCTION_PARAMETER_STRUCT_MD * md
Definition: function_parameters.h:465
#define FUNCTION_PARAMETER_STRUCT_MSG_LEN
Definition: function_parameters.h:389
int functionparameter_SetParamValue_FLOAT32(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname, float value)
Definition: function_parameters.c:1232
errno_t functionparameter_outlog_namelink(const char *fpsname, int cmdcode)
Establish sym link for convenience.
Definition: function_parameters.c:5990
uint8_t stream_sourceLocation
Definition: function_parameters.h:296
uint32_t type
Definition: function_parameters.h:326
Definition: function_parameters.h:310
int functionparameter_SetParamValue_STRING(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname, const char *stringvalue)
Definition: function_parameters.c:1269
#define FUNCTION_PARAMETER_KEYWORD_STRMAXLEN
Definition: function_parameters.h:55
errno_t functionparameter_RUNstop(FUNCTION_PARAMETER_STRUCT *fps, int fpsindex)
Definition: function_parameters.c:5638
double functionparameter_GetParamValue_FLOAT64(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1177
uint16_t loopstatus
Definition: function_parameters.h:469
int functionparameter_CheckParameter(FUNCTION_PARAMETER_STRUCT *fpsentry, int pindex)
Definition: function_parameters.c:2552
errno_t function_parameter_struct_create(int NBparamMAX, const char *name)
Definition: function_parameters.c:528
int function_parameter_struct_disconnect(FUNCTION_PARAMETER_STRUCT *funcparamstruct)
Definition: function_parameters.c:816
int functionparameter_WriteParameterToDisk(FUNCTION_PARAMETER_STRUCT *fpsentry, int pindex, char *tagname, char *commentstr)
Definition: function_parameters.c:2309
long NBparamMAX
Definition: function_parameters.h:445
errno_t functionparameter_CTRLscreen(uint32_t mode, char *fpsname, char *fpsCTRLfifoname)
Definition: function_parameters.c:7168
double * functionparameter_GetParamPtr_FLOAT64(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname)
Definition: function_parameters.c:1204
uint16_t function_parameter_FPCONFexit(FUNCTION_PARAMETER_STRUCT *fps)
Definition: function_parameters.c:2205
uint64_t flag
Definition: function_parameters.h:528
int run_display
Definition: function_parameters.h:553
Definition: function_parameters.h:514
long NBindex
Definition: function_parameters.h:550
uint16_t function_parameter_FPCONFloopstep(FUNCTION_PARAMETER_STRUCT *fps)
Definition: function_parameters.c:2120
int function_parameter_add_entry(FUNCTION_PARAMETER_STRUCT *fps, const char *keywordstring, const char *descriptionstring, uint64_t type, uint64_t fpflag, void *dataptr)
Definition: function_parameters.c:1421
#define FPS_NB_MSG
Definition: function_parameters.h:388
#define STRINGMAXLEN_FPS_CMDLINE
Definition: function_parameters.h:30
int functionparameter_SetParamValue_FLOAT64(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname, double value)
Definition: function_parameters.c:1191
#define FPS_CWD_STRLENMAX
Definition: function_parameters.h:402
int fpsCTRLfifofd
Definition: function_parameters.h:560
errno_t functionparameter_FPSremove(FUNCTION_PARAMETER_STRUCT *fps, int fpsindex)
Definition: function_parameters.c:5793
int functionparameter_SetParamValue_ONOFF(FUNCTION_PARAMETER_STRUCT *fps, const char *paramname, int ONOFFvalue)
Definition: function_parameters.c:1306
int fpsindexSelected
Definition: function_parameters.h:554
long msgcnt
Definition: function_parameters.h:454
int NBkwn
Definition: function_parameters.h:549
errno_t functionparameter_outlog(char *keyw, char *msgstring)
Definition: function_parameters.c:5946
#define FPS_PNAME_STRMAXLEN
Definition: function_parameters.h:404
#define FPS_DESCR_STRMAXLEN
Definition: function_parameters.h:405
uint64_t inputindex
Definition: function_parameters.h:520
long streamID
Definition: function_parameters.h:287
FUNCTION_PARAMETER_STRUCT function_parameter_FPCONFsetup(const char *fpsname, uint32_t CMDmode)
Definition: function_parameters.c:2045