LCOV - code coverage report
Current view: top level - examples/slowcont - mscb_fe.cxx (source / functions) Coverage Total Hit
Test: coverage.info Lines: 0.0 % 18 0
Test Date: 2025-11-11 10:26:08 Functions: 0.0 % 2 0

            Line data    Source code
       1              : /********************************************************************\
       2              : 
       3              :   Name:         mscb_fe.c
       4              :   Created by:   Stefan Ritt
       5              : 
       6              :   Contents:     Example Slow control frontend for the MSCB system
       7              : 
       8              :   $Id: sc_fe.c 20457 2012-12-03 09:50:35Z ritt $
       9              : 
      10              : \********************************************************************/
      11              : 
      12              : #include <stdio.h>
      13              : #include <string.h>
      14              : #include <assert.h>
      15              : #include <math.h>
      16              : #include <pthread.h>
      17              : #include "mscb.h"
      18              : #include "midas.h"
      19              : #include "odbxx.h"
      20              : #include "msystem.h"
      21              : #include "mfe.h"
      22              : #include "mstrlcpy.h"
      23              : #include "class/multi.h"
      24              : #include "class/generic.h"
      25              : #include "device/mscbdev.h"
      26              : #include "device/mscbhvr.h"
      27              : #include "device/mdevice.h"
      28              : #include "device/mdevice_mscb.h"
      29              : 
      30              : /*-- Globals -------------------------------------------------------*/
      31              : 
      32              : /* The frontend name (client name) as seen by other MIDAS clients   */
      33              : const char *frontend_name = "SC Frontend";
      34              : /* The frontend file name, don't change it */
      35              : const char *frontend_file_name = __FILE__;
      36              : 
      37              : /*-- Equipment list ------------------------------------------------*/
      38              : 
      39              : BOOL equipment_common_overwrite = TRUE;
      40              : 
      41              : EQUIPMENT equipment[] = {
      42              :    {
      43              :       "Environment",     /* equipment name */
      44              :       {10, 0,            /* event ID, trigger mask */
      45              :        "SYSTEM",         /* event buffer */
      46              :        EQ_SLOW,          /* equipment type */
      47              :        0,                /* event source */
      48              :        "MIDAS",          /* format */
      49              :        TRUE,             /* enabled */
      50              :        RO_ALWAYS, 60000, /* read full event every 60 sec */
      51              :        100,              /* read one value every 100 msec */
      52              :        0,                /* number of sub events */
      53              :        1,                /* log history every second */
      54              :        "", "", ""},
      55              :       cd_multi_read,     /* readout routine */
      56              :       cd_multi           /* class driver main routine */
      57              :    },
      58              : 
      59              :    {""}
      60              : };
      61              : 
      62              : /*-- Error dispatcher causing communiction alarm -------------------*/
      63              : 
      64            0 : void scfe_error(const char *error) {
      65              :    char str[256];
      66              : 
      67            0 :    mstrlcpy(str, error, sizeof(str));
      68            0 :    cm_msg(MERROR, "scfe_error", "%s", str);
      69            0 :    al_trigger_alarm("MSCB", str, "MSCB Alarm", "Communication Problem", AT_INTERNAL);
      70            0 : }
      71              : 
      72              : /*-- Frontend Init -------------------------------------------------*/
      73              : 
      74            0 : INT frontend_init() {
      75              :    /* set error dispatcher for alarm functionality */
      76            0 :    mfe_set_error(scfe_error);
      77              : 
      78              :    /* set maximal retry count */
      79            0 :    mscb_set_max_retry(100);
      80              : 
      81              :    /*---- set correct ODB device addresses ----*/
      82              : 
      83            0 :    mdevice_mscb envIn("Environment", "Input", DF_INPUT, "mscbxxx.psi.ch");
      84            0 :    envIn.define_var(1, 0, "Temperature 1", 0.1);
      85            0 :    envIn.define_var(1, 1, "Temperature 2", 0.1);
      86            0 :    envIn.define_history_panel("Temperatures", 0, 1);
      87              : 
      88            0 :    mdevice_mscb envOut("Environment", "Output", DF_OUTPUT, "mscbxxx.psi.ch");
      89            0 :    envOut.define_var(1, 8, "Heat control 1");
      90            0 :    envOut.define_var(1, 9, "Heat control 2");
      91            0 :    envIn.define_history_panel("Heat Control", 0, 1);
      92              : 
      93            0 :    return CM_SUCCESS;
      94            0 : }
        

Generated by: LCOV version 2.0-1