Home › Forums › Software Development › Checking whether if the eye tracker is connected › Reply To: Checking whether if the eye tracker is connected
17/11/2014 at 10:34 #2034
Benjamin Robert
Participant
Thanks for your answer.
I’m a little bit confuse here. In your C example, you have
success = (txGetStateValueAsInteger(hStateBag, TX_STATEPATH_EYETRACKINGSTATE, &eyeTrackingState) == TX_RESULT_OK);
if (success) {
switch (eyeTrackingState) {
case TX_EYETRACKINGDEVICESTATUS_TRACKING:
printf("Eye Tracking Device Status: 'TRACKING'.\n"
"That means that the eye tracker is up and running and trying to track your eyes.\n");
break;
default:
printf("The eye tracking device is not tracking.\n"
"It could be a that the eye tracker is not connected, or that a screen setup or\n"
"user calibration is missing. The status code is %d.\n", eyeTrackingState);
}
}
txGetStateValueAsInteger takes TX_STATEPATH_EYETRACKINGSTATE has an argument to check if the device is tracking. I want to check if the device is connected, I should check with the same parameter I guess because the parameter is TX_EYETRACKINGDEVICESTATUS_NOTCONNECTED and not something like TX_USERPRESENCE_NOTCONNECTED. I tried with the user presence param but it’s not working to track if the device is connected or not.
My code :
void EyeXHost::OnEngineStateChanged(TX_CONSTHANDLE hState)
{
TX_HANDLE hStateBag = TX_EMPTY_HANDLE;
TX_BOOL success;
TX_INTEGER eyeTrackingState;
TX_INTEGER presenceData;
txGetAsyncDataContent(hState, &hStateBag);
success = (txGetStateValueAsInteger(hStateBag, TX_STATEPATH_EYETRACKINGSTATE, &eyeTrackingState) == TX_RESULT_OK);
if (success) {
switch (eyeTrackingState) {
case TX_EYETRACKINGDEVICESTATUS_TRACKING:
printf("TRACKING");
break;
case TX_EYETRACKINGDEVICESTATUS_DEVICENOTCONNECTED:
printf("NOT CONNECTED");
break;
default:
printf("The status code is %d.\n", eyeTrackingState);
}
}
success = (txGetStateValueAsInteger(hStateBag, TX_STATEPATH_USERPRESENCE, &presenceData) == TX_RESULT_OK);
if (success) {
printf("User is %s\n", presenceData == TX_USERPRESENCE_PRESENT ? "present" : "NOT present");
}
txReleaseObject(&hStateBag);
}