14.23. Common: the DeadbandSettings class and .set_parms method

[Note]

This class and method are located in the lib/common.g file.

   /*--------------------------------------------------------------------
    * Class:       DeadbandSettings
    * Description: The instance variables of this class correspond to the
    *              four possible types of Cascade Historian deadbands.
    *              They are set by entry values in the Parameters window,
    *              and sent to the Historian by the set_parms() method.
    *------------------------------------------------------------------*/
   class DeadbandSettings
   {
     history;
     absolute = 5;
     percent = 0;
     timelimit = 1;
     countlimit = 0;
   }
   
   /*--------------------------------------------------------------------
    * Method:      DeadbandSettings.set_parms
    * Returns:     The return from the Cascade Historian,  or nil
    * Description: Assigns the values from the parameter array to the
    *              appropriate instance variables of the class, and sends
    *              them to the Cascade Historian using the send_hs_command()
    *              function.  Activated by the "OK" button.
    *------------------------------------------------------------------*/
   method DeadbandSettings.set_parms(button, p_array)
   {
     .absolute = p_array[0];
     .percent = p_array[1];
     .timelimit = p_array[2];
     .countlimit = p_array[3];
     send_hs_command(button, "deadband", .history,
                  array(.absolute, .percent, .timelimit, .countlimit));
   }