From 34a9d3691171864068a24a88442e6635ff29d738 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 10 Mar 2018 16:28:29 +0100 Subject: tracker/steamvr: reduce indentation No functional changes. --- tracker-steamvr/steamvr.cpp | 112 ++++++++++++++++++++++---------------------- 1 file changed, 56 insertions(+), 56 deletions(-) diff --git a/tracker-steamvr/steamvr.cpp b/tracker-steamvr/steamvr.cpp index 530a455e..689e0ba9 100644 --- a/tracker-steamvr/steamvr.cpp +++ b/tracker-steamvr/steamvr.cpp @@ -48,67 +48,67 @@ void device_list::fill_device_specs(QList& list) pose_t device_states[max_devices]; - if (v) + if (!v) + return; + + v->GetDeviceToAbsoluteTrackingPose(origin::TrackingUniverseSeated, 0, + device_states, vr::k_unMaxTrackedDeviceCount); + + constexpr unsigned bufsiz = vr::k_unMaxPropertyStringSize; + static char str[bufsiz+1] {}; // vr_lock prevents reentrancy + + for (unsigned k = 0; k < vr::k_unMaxTrackedDeviceCount; k++) { - v->GetDeviceToAbsoluteTrackingPose(origin::TrackingUniverseSeated, 0, - device_states, vr::k_unMaxTrackedDeviceCount); + if (v->GetTrackedDeviceClass(k) == vr::ETrackedDeviceClass::TrackedDeviceClass_Invalid) + { + qDebug() << "no device with index"; + continue; + } + + if (!device_states[k].bDeviceIsConnected) + { + qDebug() << "device not connected but proceeding"; + continue; + } - constexpr unsigned bufsiz = vr::k_unMaxPropertyStringSize; - static char str[bufsiz+1] {}; // vr_lock prevents reentrancy + unsigned len; - for (unsigned k = 0; k < vr::k_unMaxTrackedDeviceCount; k++) + len = v->GetStringTrackedDeviceProperty(k, vr::ETrackedDeviceProperty::Prop_SerialNumber_String, str, bufsiz); + if (!len) { - if (v->GetTrackedDeviceClass(k) == vr::ETrackedDeviceClass::TrackedDeviceClass_Invalid) - { - qDebug() << "no device with index"; - continue; - } - - if (!device_states[k].bDeviceIsConnected) - { - qDebug() << "device not connected but proceeding"; - continue; - } - - unsigned len; - - len = v->GetStringTrackedDeviceProperty(k, vr::ETrackedDeviceProperty::Prop_SerialNumber_String, str, bufsiz); - if (!len) - { - qDebug() << "steamvr: getting serial number failed for" << k; - continue; - } - - device_spec dev; - - dev.serial = str; - - len = v->GetStringTrackedDeviceProperty(k, vr::ETrackedDeviceProperty::Prop_ModelNumber_String, str, bufsiz); - if (!len) - { - qDebug() << "steamvr: getting model number failed for" << k; - continue; - } - - switch (v->GetTrackedDeviceClass(k)) - { - case vr::ETrackedDeviceClass::TrackedDeviceClass_HMD: - dev.type = "HMD"; break; - case vr::ETrackedDeviceClass::TrackedDeviceClass_Controller: - dev.type = "Controller"; break; - case vr::ETrackedDeviceClass::TrackedDeviceClass_TrackingReference: - dev.type = "Tracker"; break; - default: - dev.type = "Unknown"; break; - } - - dev.model = str; - dev.pose = device_states[k]; - dev.k = k; - dev.is_connected = device_states[k].bDeviceIsConnected; - - list.push_back(dev); + qDebug() << "steamvr: getting serial number failed for" << k; + continue; } + + device_spec dev; + + dev.serial = str; + + len = v->GetStringTrackedDeviceProperty(k, vr::ETrackedDeviceProperty::Prop_ModelNumber_String, str, bufsiz); + if (!len) + { + qDebug() << "steamvr: getting model number failed for" << k; + continue; + } + + switch (v->GetTrackedDeviceClass(k)) + { + case vr::ETrackedDeviceClass::TrackedDeviceClass_HMD: + dev.type = "HMD"; break; + case vr::ETrackedDeviceClass::TrackedDeviceClass_Controller: + dev.type = "Controller"; break; + case vr::ETrackedDeviceClass::TrackedDeviceClass_TrackingReference: + dev.type = "Tracker"; break; + default: + dev.type = "Unknown"; break; + } + + dev.model = str; + dev.pose = device_states[k]; + dev.k = k; + dev.is_connected = device_states[k].bDeviceIsConnected; + + list.push_back(dev); } }); } -- cgit v1.2.3