@brief For eyetracker, it will add the following interfaces to the descriptor provided that they are set to true: OSVR_Direction, OSVR_Location2D, OSVR_Tracker, OSVR_Button
| 83 | /// descriptor provided that they are set to true: |
| 84 | /// OSVR_Direction, OSVR_Location2D, OSVR_Tracker, OSVR_Button |
| 85 | void normalizeForEyeTracker(Json::Value &descriptor, |
| 86 | std::string const &ifaceName) { |
| 87 | |
| 88 | // step into the interfaces object |
| 89 | Json::Value const &iface = descriptor[INTERFACES_KEY][ifaceName]; |
| 90 | |
| 91 | // hold the count for eyetracker sensors to initialize |
| 92 | int count = descriptor[INTERFACES_KEY][ifaceName][COUNT_KEY].asInt(); |
| 93 | |
| 94 | // if we couldn't find count then return |
| 95 | if (!count) { |
| 96 | return; |
| 97 | } |
| 98 | |
| 99 | Json::Value augInterfaces(Json::objectValue); |
| 100 | // go thru details of interface and |
| 101 | for (auto &subIface : iface.getMemberNames()) { |
| 102 | // check if subinterface is set to true |
| 103 | bool enabled = |
| 104 | descriptor[INTERFACES_KEY][ifaceName][subIface].asBool(); |
| 105 | |
| 106 | if (enabled) { |
| 107 | |
| 108 | if (boost::iequals(subIface, LOCATION2D_KEY)) { |
| 109 | augInterfaces[LOCATION2D_KEY][COUNT_KEY] = count; |
| 110 | } else if (boost::iequals(subIface, DIRECTION_KEY)) { |
| 111 | augInterfaces[DIRECTION_KEY][COUNT_KEY] = count; |
| 112 | } else if (boost::iequals(subIface, TRACKER_KEY)) { |
| 113 | |
| 114 | augInterfaces[TRACKER_KEY][POSITION_KEY] = true; |
| 115 | augInterfaces[TRACKER_KEY][ORIENTATION_KEY] = false; |
| 116 | augInterfaces[TRACKER_KEY][BOUNDED_KEY] = true; |
| 117 | augInterfaces[TRACKER_KEY][COUNT_KEY] = count; |
| 118 | } else if (boost::iequals(subIface, BUTTON_KEY)) { |
| 119 | augInterfaces[BUTTON_KEY][COUNT_KEY] = count; |
| 120 | } else { |
| 121 | continue; |
| 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | if (augInterfaces.size() > 0) { |
| 127 | Json::Value &currInterfaces = descriptor[INTERFACES_KEY]; |
| 128 | |
| 129 | appendCurrentIface(augInterfaces, currInterfaces); |
| 130 | descriptor[INTERFACES_KEY] = augInterfaces; |
| 131 | } |
| 132 | } |
| 133 | |
| 134 | /// @todo process for tracker interface |
| 135 |
no test coverage detected