top

GAMEPAD

This class receives gamepad instances and defines administrator call setting that can manage instances.

This class gets the gamepad's instance calling sucessCallback function for using gamepad and calls the manager to receive a gamepad's constant like connection/disconnection.

Add the following line for gamepad class into a html file your own :

  script type="text/javascript" src="$MANAGER_WIDGET/Common/webapi/1.0/deviceapis.js">/script>

You can declare gamepad class like this :

  ex) var gamepad = deviceapis.gamepad;


Constants

NameValueDescription
MGR_EVENT_DEV_DISCONNECT12device disconnection event
EV_KEY1Key Event
EV_ABS3ABS Event
ABS_X0X axis
ABS_Y1Y axis
ABS_Z2Z axis
ABS_RX3X rotation
ABS_RY4Y rotation
ABS_RZ5Z rotation
ABS_THROTTLE6Throttle
ABS_RUDDER7Rudder
ABS_WHEEL8Wheel
ABS_GAS9Gas
ABS_BRAKE10Brake
ABS_HAT0X16HAT0 X axis
ABS_HAT0Y17HAT0 Y axis
ABS_HAT1X18HAT1 X axis
ABS_HAT1Y19HAT1 Y axis
ABS_HAT2X20HAT2 X axis
ABS_HAT2Y21HAT2 Y axis
ABS_HAT3X22HAT3 X axis
ABS_HAT3Y23HAT3 Y axis
BTN_10Button #1, A
BTN_21Button #2, B
BTN_32Button #3, X
BTN_43Button #4, Y
BTN_54Button #5, LB
BTN_65Button #6, RB
BTN_76Button #7, BACK
BTN_87Button #8, START
BTN_98Button #9, Left Stic
BTN_109Button #10, Right Stick
BTN_1110Button #11
BTN_1211Button #12
BTN_1312Button #13
BTN_1413Button #14
BTN_1514Button #15
BTN_1615Button #16
MAX_ABS_VALUE255Maximum ABS value
MIN_ABS_VALUE0Minimum ABS value
XINPUT_MAX_ABS_VALUE32767Maximum ABS value of Xinput
XINPUT_MIN_ABS_VALUE-32768Minimum ABS value of Xinput
KEY_PRESSED1Pressed status
KEY_RELEASED0Released status
KEY_REPEATED2Continous pressed status

Methods

getGamepads

Description
request to get gamepad instances.
Parameters
■successCallback 
  - Function 
■errorCallback 
  - Function
Return■Void
Emulator SupportY
SDK ConstraintNone
Example
deviceapis.gamepad.getGamepads(successCallback, errorCallback);

registerManagerCallback

Description
request to set callback function to receive gamepad manager event such as EVENT_DEV_DISCONNECT.
Parameters
■callbackFn 
  - Function 
  - callback function that has prototype given as “void callbackFn( ManagerEvent )”
Return■Void
Emulator SupportY
SDK ConstraintNone
Example
deviceapis.gamepad.registerManagerCallback(cbFunc);