# Autogenerated file. Do not edit.
from jacdac.bus import Bus, Client, EventHandlerFn, UnsubscribeFn
from .constants import *



class ArcadeGamepadClient(Client):
    """
    This service is deprecated in favor of `gamepad` (although it is currently used by the micro:bit Arcade smart shield).
     * A gamepad with direction and action buttons for one player.
     * If a device has multiple controllers, it should have multiple gamepad services, using consecutive service identifiers.
    Implements a client for the `Arcade Gamepad <https://microsoft.github.io/jacdac-docs/services/arcadegamepad>`_ service.

    """

    def __init__(self, bus: Bus, role: str) -> None:
        super().__init__(bus, JD_SERVICE_CLASS_ARCADE_GAMEPAD, JD_ARCADE_GAMEPAD_PACK_FORMATS, role)


    def on_down(self, handler: EventHandlerFn) -> UnsubscribeFn:
        """
        Emitted when button goes from inactive to active.
        """
        return self.on_event(JD_ARCADE_GAMEPAD_EV_DOWN, handler)

    def on_up(self, handler: EventHandlerFn) -> UnsubscribeFn:
        """
        Emitted when button goes from active to inactive.
        """
        return self.on_event(JD_ARCADE_GAMEPAD_EV_UP, handler)

    
