joystick#

class platypush.message.event.joystick.JoystickConnectedEvent(device: dict, *args, **kwargs)[source]#

Bases: JoystickEvent

Event triggered upon joystick connection.

__init__(device: dict, *args, **kwargs)#
Parameters:

device

Joystick device info as a dictionary:

{
  "name": "Xbox 360 Controller",
  "number": "Joystick number",
  "path": "/dev/input/event0",
  "protocol": "usb"
}

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.joystick.JoystickDisconnectedEvent(device: dict, *args, **kwargs)[source]#

Bases: JoystickEvent

Event triggered upon joystick disconnection.

__init__(device: dict, *args, **kwargs)#
Parameters:

device

Joystick device info as a dictionary:

{
  "name": "Xbox 360 Controller",
  "number": "Joystick number",
  "path": "/dev/input/event0",
  "protocol": "usb"
}

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.joystick.JoystickEvent(device: dict, *args, **kwargs)[source]#

Bases: Event, ABC

Base joystick event class.

__init__(device: dict, *args, **kwargs)[source]#
Parameters:

device

Joystick device info as a dictionary:

{
  "name": "Xbox 360 Controller",
  "number": "Joystick number",
  "path": "/dev/input/event0",
  "protocol": "usb"
}

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object

class platypush.message.event.joystick.JoystickStateEvent(*args, state: dict, **kwargs)[source]#

Bases: JoystickEvent

Base joystick state event class.

__init__(*args, state: dict, **kwargs)[source]#
Parameters:

state

Joystick state as a dictionary:

{
  "a": 1,
  "b": 1,
  "back": 1,
  "down_dir_pad": 1,
  "left_bumper": 1,
  "left_dir_pad": 1,
  "left_joystick_x": 0.5,
  "left_joystick_y": 0.5,
  "left_thumb": 1,
  "left_trigger": 0.5,
  "right_bumper": 1,
  "right_dir_pad": 1,
  "right_joystick_x": 0.5,
  "right_joystick_y": 0.5,
  "right_thumb": 1,
  "right_trigger": 0.5,
  "start": 1,
  "up_dir_pad": 1,
  "x": 1,
  "y": 1
}

as_dict()#

Converts the event into a dictionary

classmethod build(msg)#

Builds an event message from a JSON UTF-8 string/bytearray, a dictionary, or another Event

matches_condition(condition)#

If the event matches an event condition, it will return an EventMatchResult :param condition: The platypush.event.hook.EventCondition object

classmethod parse(msg)#

Parse a generic message into a key-value dictionary

Parameters:

msg – Original message. It can be a dictionary, a Message, or a string/bytearray, as long as it’s valid UTF-8 JSON

classmethod to_dict(msg)#

Converts a Message object into a dictionary

Parameters:

msg – Message object