def getJoystickType(self, stick: int) -> int:
        """
        Gets the value of type on a joystick

        :param stick: The joystick port number

        :returns: An integer that returns the value of type.
        """
        if stick < 0 or stick >= self.kJoystickPorts:
            raise IndexError("Joystick index is out of range, should be 0-%s" %
                             self.kJoystickPorts)

        return hal.getJoystickType(stick)
Example #2
0
    def getJoystickType(self, stick: int) -> int:
        """
        Gets the value of type on a joystick

        :param stick: The joystick port number

        :returns: An integer that returns the value of type.
        """
        if stick < 0 or stick >= self.kJoystickPorts:
            raise IndexError(
                "Joystick index is out of range, should be 0-%s" % self.kJoystickPorts
            )

        return hal.getJoystickType(stick)
    def getJoystickType(self, stick: int) -> int:
        """
        Gets the value of type on a joystick

        :param stick: The joystick port number

        :returns: An integer that returns the value of type.
        """
        if stick < 0 or stick >= self.kJoystickPorts:
            raise IndexError("Joystick index is out of range, should be 0-%s" % self.kJoystickPorts)

        with self.cacheDataMutex:
            # TODO: Remove this when calling for descriptor on empty stick no longer crashes.
            if 1 > self.joystickButtons[stick].count and 1 > len(self.joystickAxes[stick]):
                self._reportJoystickUnpluggedWarning("Joystick on port {} not avaliable, check if controller is "
                                                     "plugged in.\n".format(stick))
                return -1

        return hal.getJoystickType(stick)
    def getJoystickType(self, stick):
        """
        Gets the value of type on a joystick

        :param stick: The joystick port number
        :type stick: int

        :returns An integer that returns the value of type.
        """
        if stick < 0 or stick >= self.kJoystickPorts:
            raise IndexError("Joystick index is out of range, should be 0-%s" % self.kJoystickPorts)
        
        with self.joystickMutex:
            # TODO: Remove this when calling for descriptor on empty stick no longer crashes.
            if 1 > self.joystickButtons[stick].count and 1 > len(self.joystickAxes[stick]):
                self._reportJoystickUnpluggedWarning("Joystick on port {} not avaliable, check if controller is "
                                                     "plugged in.\n".format(stick))
                return -1
    
        return hal.getJoystickType(stick)