Signal when Leap Motion is connected

This commit is contained in:
David Rowe 2017-06-17 14:43:32 +12:00
parent 8d84e86d19
commit 0d986b8dc2
2 changed files with 16 additions and 0 deletions

View file

@ -32,7 +32,21 @@ void LeapMotionPlugin::pluginUpdate(float deltaTime, const controller::InputCali
return;
}
const auto frame = _controller.frame();
const auto frameID = frame.id();
if (_lastFrameID >= frameID) {
// Leap Motion not connected or duplicate frame.
return;
}
if (!_hasLeapMotionBeenConnected) {
emit deviceConnected(getName());
_hasLeapMotionBeenConnected = true;
}
// TODO
_lastFrameID = frameID;
}
controller::Input::NamedVector LeapMotionPlugin::InputDevice::getAvailableInputs() const {

View file

@ -63,6 +63,8 @@ private:
Leap::Controller _controller;
bool _hasLeapMotionBeenConnected { false };
int64_t _lastFrameID { -1 };
};
#endif // hifi_LeapMotionPlugin_h