DeviceMapper Component
The DeviceMapper component in the Haply Inverse Unity plugin is designed to manage the discovery, mapping and connection of Haply devices, such as the Inverse3 and VerseGrip, with the scene's GameObjects and Device Controllers. It provides a unified interface for interacting with these devices, allowing for dynamic control and configuration based on runtime conditions.
Overview
The primary function of the DeviceMapper is to list connected devices and map them to the scene's Device Controllers.
Basic Settings
The DeviceMapper component includes the following basic settings:
- Auto Fetch Devices List: When enabled, the DeviceMapper automatically fetches the list of connected devices at startup using http request.
- Auto Assign: When enabled, the DeviceMapper automatically maps connected devices to the scene's Device Controllers.
- Auto Connect: When enabled, the DeviceMapper automatically opens websocket connection to the devices.
Advanced Settings
By clicking the Show Advanced Settings
button, you can access additional settings for the DeviceMapper component:
- Device List URI: The URI to fetch the list of connected devices. The default value is
http://localhost:10000/3.1/devices
. - Fetch Retry Delay: The delay in seconds before retrying to fetch the device list if the initial request fails. The default value is
5
. - Server URI: The URI to connect to the device server. The default value is
ws://localhost:10001
.
Statistics
Once the foldout Statistics
is expanded, the DeviceMapper provides statistics on the connection rate and the JSON payload contents aiding developers in monitoring and managing devices and facilitating troubleshooting during development.
Ready Event
The DeviceMapper
component triggers a Ready
event when all connected devices are mapped and connected.
This event signals that it is safe to start using device getters methods, such as GetInverse3Controller
or GetVerseGripController
, to retrieve scene's device controllers for further interaction.
Device Controllers List
In the Unity Editor, the DeviceMapper
provides a dynamic list of the scene's Device Controllers associated with connected devices.
This list includes details such as device type, ID, and connection status.
Advanced Usage
See the Device Mapping tutorial for a step-by-step guide on using the DeviceMapper component in a script to manually list, map, and connect devices.