don't include Standard device in Controllers.Hardware

This commit is contained in:
Brad Hefta-Gaub 2015-10-17 13:00:43 -07:00
parent 251a55b1fb
commit 7d48fe9187

View file

@ -481,31 +481,34 @@ namespace controller {
auto devices = userInputMapper->getDevices(); auto devices = userInputMapper->getDevices();
QSet<QString> foundDevices; QSet<QString> foundDevices;
for (const auto& deviceMapping : devices) { for (const auto& deviceMapping : devices) {
auto device = deviceMapping.second.get(); auto deviceID = deviceMapping.first;
auto deviceName = QString(device->getName()).remove(ScriptingInterface::SANITIZE_NAME_EXPRESSION); if (deviceID != userInputMapper->getStandardDeviceID()) {
qCDebug(controllers) << "Device" << deviceMapping.first << ":" << deviceName; auto device = deviceMapping.second.get();
foundDevices.insert(device->getName()); auto deviceName = QString(device->getName()).remove(ScriptingInterface::SANITIZE_NAME_EXPRESSION);
if (_hardware.contains(deviceName)) { qCDebug(controllers) << "Device" << deviceMapping.first << ":" << deviceName;
continue; foundDevices.insert(device->getName());
} if (_hardware.contains(deviceName)) {
// Expose the IDs to JS
_hardware.insert(deviceName, createDeviceMap(device));
// Create the endpoints
for (const auto& inputMapping : device->getAvailabeInputs()) {
const auto& input = inputMapping.first;
// Ignore aliases
if (_endpoints.count(input)) {
continue; continue;
} }
_endpoints[input] = std::make_shared<LambdaEndpoint>([=] {
auto deviceProxy = userInputMapper->getDeviceProxy(input); // Expose the IDs to JS
if (!deviceProxy) { _hardware.insert(deviceName, createDeviceMap(device));
return 0.0f;
// Create the endpoints
for (const auto& inputMapping : device->getAvailabeInputs()) {
const auto& input = inputMapping.first;
// Ignore aliases
if (_endpoints.count(input)) {
continue;
} }
return deviceProxy->getValue(input, 0); _endpoints[input] = std::make_shared<LambdaEndpoint>([=] {
}); auto deviceProxy = userInputMapper->getDeviceProxy(input);
if (!deviceProxy) {
return 0.0f;
}
return deviceProxy->getValue(input, 0);
});
}
} }
} }
} }