def getJoystickName(self, stick: int) -> str:
        """
        Gets the name of a joystick

        :param stick: The joystick port number

        :returns: The joystick name.
        """
        if stick < 0 or stick >= self.kJoystickPorts:
            raise IndexError("Joystick index is out of range, should be 0-%s" %
                             self.kJoystickPorts)

        return hal.getJoystickName(stick)
Example #2
0
    def getJoystickName(self, stick: int) -> str:
        """
        Gets the name of a joystick

        :param stick: The joystick port number

        :returns: The joystick name.
        """
        if stick < 0 or stick >= self.kJoystickPorts:
            raise IndexError(
                "Joystick index is out of range, should be 0-%s" % self.kJoystickPorts
            )

        return hal.getJoystickName(stick)
    def getJoystickName(self, stick: int) -> str:
        """
        Gets the name of a joystick

        :param stick: The joystick port number

        :returns: The joystick name.
        """
        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].axes):
                self._reportJoystickUnpluggedError("WARNING: Joystick on port {} not avaliable, check if controller is "
                                                   "plugged in.\n".format(stick))
                return ""

        return hal.getJoystickName(stick)
    def getJoystickName(self, stick):
        """
        Gets the name of a joystick

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

        :returns The joystick name.
        """
        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._reportJoystickUnpluggedError("WARNING: Joystick on port {} not avaliable, check if controller is "
                                                   "plugged in.\n".format(stick))
                return ""

        return hal.getJoystickName(stick)