mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-08-10 01:06:25 +02:00
Tidy up handling of eye tracker streaming
This commit is contained in:
parent
051a398fa2
commit
4f3c4a5312
2 changed files with 10 additions and 5 deletions
|
@ -29,9 +29,11 @@ static void CALLBACK eyeTrackerCallback(smi_CallbackDataStruct* data) {
|
||||||
|
|
||||||
EyeTracker::~EyeTracker() {
|
EyeTracker::~EyeTracker() {
|
||||||
#ifdef HAVE_IVIEWHMD
|
#ifdef HAVE_IVIEWHMD
|
||||||
int result = smi_quit();
|
if (_isStreaming) {
|
||||||
if (result != SMI_RET_SUCCESS) {
|
int result = smi_quit();
|
||||||
qCWarning(interfaceapp) << "Eye Tracker: Error terminating tracking:" << smiReturnValueToString(result);
|
if (result != SMI_RET_SUCCESS) {
|
||||||
|
qCWarning(interfaceapp) << "Eye Tracker: Error terminating tracking:" << smiReturnValueToString(result);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -131,16 +133,18 @@ void EyeTracker::setEnabled(bool enabled, bool simulate) {
|
||||||
qCDebug(interfaceapp) << "Eye Tracker: Set enabled =" << enabled << ", simulate =" << simulate;
|
qCDebug(interfaceapp) << "Eye Tracker: Set enabled =" << enabled << ", simulate =" << simulate;
|
||||||
bool success = true;
|
bool success = true;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
if (enabled) {
|
if (enabled && !_isStreaming) {
|
||||||
// There is no smi_stopStreaming() method so keep streaming once started in case tracking is re-enabled after stopping.
|
// There is no smi_stopStreaming() method so keep streaming once started in case tracking is re-enabled after stopping.
|
||||||
result = smi_startStreaming(simulate);
|
result = smi_startStreaming(simulate);
|
||||||
if (result != SMI_RET_SUCCESS) {
|
if (result != SMI_RET_SUCCESS) {
|
||||||
qCWarning(interfaceapp) << "Eye Tracker: Error starting streaming:" << smiReturnValueToString(result);
|
qCWarning(interfaceapp) << "Eye Tracker: Error starting streaming:" << smiReturnValueToString(result);
|
||||||
success = false;
|
success = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_isStreaming = success;
|
||||||
}
|
}
|
||||||
|
|
||||||
_isEnabled = enabled && success;
|
_isEnabled = enabled && _isStreaming;
|
||||||
_isSimulating = _isEnabled && simulate;
|
_isSimulating = _isEnabled && simulate;
|
||||||
|
|
||||||
if (!success && result != SMI_ERROR_HMD_NOT_SUPPORTED) {
|
if (!success && result != SMI_ERROR_HMD_NOT_SUPPORTED) {
|
||||||
|
|
|
@ -50,6 +50,7 @@ private:
|
||||||
QString smiReturnValueToString(int value);
|
QString smiReturnValueToString(int value);
|
||||||
|
|
||||||
bool _isInitialized = false;
|
bool _isInitialized = false;
|
||||||
|
bool _isStreaming = false;
|
||||||
bool _isEnabled = false;
|
bool _isEnabled = false;
|
||||||
bool _isSimulating = false;
|
bool _isSimulating = false;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue