public void OnConnectedDeviceChanged(uint deviceIndex, VRModuleDeviceClass deviceClass, string deviceSN, bool connected) { if (connected) { if (IsDeviceBound(deviceSN)) { InternalInsertRoleBoundDevice(deviceSN, deviceIndex, GetBoundRoleValueByDevice(deviceSN)); } } else { if (IsDeviceMapped(deviceIndex)) { if (IsDeviceBound(deviceSN)) { InternalRemoveRoleBoundDevice(deviceSN, deviceIndex, GetBoundRoleValueByDevice(deviceSN)); } if (IsDeviceMapped(deviceIndex)) { InternalUnmapping(GetMappedRoleValueByDevice(deviceIndex), deviceIndex); } } } if (m_handler != null) { m_handler.OnConnectedDeviceChanged(deviceIndex, deviceClass, deviceSN, connected); } }
public void OnConnectedDeviceChanged(uint deviceIndex, ETrackedDeviceClass deviceClass, string deviceSN, bool connected) { var boundRoleValue = GetBoundRoleValueByDevice(deviceSN); if (m_info.IsValidRoleValue(boundRoleValue)) // if device is bound { if (connected) { InternalMapping(boundRoleValue, deviceIndex); } else { InternalUnmapping(boundRoleValue, deviceIndex); } } if (m_handler != null) { m_handler.OnConnectedDeviceChanged(deviceIndex, deviceClass, deviceSN, connected); } }