HTTP API for bHaptics Player (Windows only) - bhaptics/haptic-library GitHub Wiki

Enabld Web UI must be checked!

image

By enabling the option, you can use HTTP requests which can fetch data from the bHaptics' Player, such as all of the paired devices as well as information about each device, such as the connection status and battery status. You can also make function calls to each device, to pair, unpair, ping, and enable/disable each device.

Some example calls using this interface: to poll for the device information the interface sends a request to http://localhost:15881/v1/api/devices, while to ping a device it calls http://localhost:15881/v1/api/ping?id=273463469948831. We use the localhost for our tests, as we test on the same computer, but by changing to the IP of the connected PCs this call will allow you to get the info from each remote computer directly. For the actions calls, such as ping, pair, and unpair, the id of the device is passed so that the action is applied to that specific device.

An example web user interface we used to test at this link, however the web-ui currently only runs on Google Chrome and isn't supported by other browsers.

1. Getting device list

  • Request
http://localhost:15881/v1/api/devices
  • Expected Response
[{"paired":true,"id":"263687056127014","enabled":true,"connected":"Disconnected","name":"Tactot3_V1.1","battery":-1,"positionType":"Vest"}]

2. Pair the device

  • Request
http://localhost:15881/v1/api/pair?id={}

3. Unpair the device

  • Request
http://localhost:15881/v1/api/unpair?id={}

4. Ping the device

  • Request
http://localhost:15881/v1/api/ping?id={}

5. Unpair all the devices

  • Request
http://localhost:15881/v1/api/unpairAll

6. Get configurations of audio to haptic

  • Supported from bhaptics player 1.6.0

  • Request

http://localhost:15881/v1/api/audio-to-haptic/configurations

  • Response
[
{"id":"c4c44fba-be6d-bc35-7580-ecbf2d1f4355","name":"Pop"},
{"id":"9bc87dec-56c5-f116-f199-aea369040127","name":"Bass"},
{"id":"15e0e6c7-ee75-c52b-7893-249b96186d51","name":"PUBG"},
{"id":"b3feb930-6b3c-f6ee-a892-760c9f915d22","name":"OVERWATCH"},
{"id":"4ea8a539-4dd7-3e14-9f00-7c44c625b0dc","name":"RainbowSix"},
{"id":"f4c36cfc-7386-9107-c6f6-3d13e2fd8353","name":"CounterStrike"},
...]

7. Turn on audio-to-haptic

  • Supported from bhaptics player 1.6.0

  • conf-index is optional parameter and you can select the configuration of audio-to-haptic. If you want to select Beat Saber, for example, you can set conf-index=8

  • Request

http://localhost:15881/v1/api/audio-to-haptic/on?conf-index={index-of-conf}
  • Response
success

8. Turn off audio-to-haptic

  • Supported from bhaptics player 1.6.0

  • Request

http://localhost:15881/v1/api/audio-to-haptic/off
  • Response
success

9. Enable/Diable device

  • Supported from bhaptics player 1.6.0

  • Request

http://localhost:15881/v1/api/enable?id={}
http://localhost:15881/v1/api/disable?id={}