Пример #1
0
    def setParamCalDefault(self, channel, persistent):
        """Set the Configuration Parameter "Cal" of an analog input to the
            default value.
            
        This method calls the SetParam function of the module and sets
        the Configuration Parameter "Cal" to the default value.
        
        Args:
            channel: IO channel number. Must be in the range 0 ... 3
            persistent: Store parameter permanently if true
            
        Returns:
            IO_RETURN_OK in case of success, otherwise detailed IoReturn
            error code.
        
        Raises:
            TypeError: Passed argument types are wrong
            ValueError: Channel value is out of range
        """
        if not isinstance(channel, int):
            raise TypeError('Expected channel as int, got %s' % type(channel))

        if not isinstance(persistent, bool):
            raise TypeError('Expected persistent as bool, got %s' %
                            type(persistent))

        if (channel >= self.nrOfChannels):
            raise ValueError('Channel out of range')

        cmd = Cmd(self.com)
        return cmd.setParamDefault(_LCAI4ParamAddress.CAL, channel, persistent)