Пример #1
0
    def calibrateIo(self, channel, persistent):
        """Calibration of the analog output channels.
            
        This method calls the CalibIo function of the module which executes
            calibration of the analog output channels.
        
        Args:
            channel: IO channel number. Must be in the range 0 ... 3
            persistent: Store calibration 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.calibrateIo(channel, 0, persistent)