bool ofxTobiiEyeX::registerFixationEventHandler(const string& InteractorId, TX_FIXATIONDATAMODE mode)
{
	auto& handle = mFixationHandle;
	handle.hConnectionStateChangedTicket = TX_INVALID_TICKET;
	handle.hEventHandlerTicket = TX_INVALID_TICKET;
	TX_CONSTSTRING ID = InteractorId.c_str();
	TX_FIXATIONDATAPARAMS params = { mode };
	TX_HANDLE hInteractor = TX_EMPTY_HANDLE;
	bool success = true;

	success &= txCreateContext(&handle.hContext, TX_FALSE) == TX_RESULT_OK;
	success &= txCreateGlobalInteractorSnapshot(handle.hContext, ID, &handle.hGlobalInteractorSnapshot, &hInteractor) == TX_RESULT_OK;

	success &= txCreateFixationDataBehavior(hInteractor, &params) == TX_RESULT_OK;

	success &= txReleaseObject(&hInteractor) == TX_RESULT_OK;
	success &= txRegisterConnectionStateChangedHandler(handle.hContext, &handle.hConnectionStateChangedTicket, OnEngineConnectionStateChanged, handle.hGlobalInteractorSnapshot) == TX_RESULT_OK;
	success &= txRegisterEventHandler(handle.hContext, &handle.hEventHandlerTicket, HandleEvent, nullptr) == TX_RESULT_OK;
	success &= txEnableConnection(handle.hContext) == TX_RESULT_OK;

	if (!success)
	{
		ofLogError(smAddonName, "Registing fixation data event handler was failed.");
	}
	return success;
}
Beispiel #2
0
/*
 * Initializes g_hGlobalInteractorSnapshot with an interactor that has the Gaze Point behavior.
 */
BOOL InitializeGlobalInteractorSnapshot(TX_CONTEXTHANDLE hContext)
{
	TX_HANDLE hInteractor = TX_EMPTY_HANDLE;
	TX_HANDLE hBehavior   = TX_EMPTY_HANDLE;
	TX_HANDLE hBehaviorWithoutParameters = TX_EMPTY_HANDLE;
	TX_GAZEPOINTDATAPARAMS params = { TX_GAZEPOINTDATAMODE_LIGHTLYFILTERED };
	BOOL success;

	success = txCreateGlobalInteractorSnapshot(
		hContext,
		InteractorId,
		&g_hGlobalInteractorSnapshot,
		&hInteractor) == TX_RESULT_OK;
	success &= txCreateInteractorBehavior(hInteractor, &hBehavior, TX_BEHAVIORTYPE_GAZEPOINTDATA) == TX_RESULT_OK;
	success &= txSetGazePointDataBehaviorParams(hBehavior, &params) == TX_RESULT_OK;

    // add a second behavior to the same interactor: eye position data.
    // this one is a bit different because it doesn't take any parameters.
    // therefore we use the generic txCreateInteractorBehavior function (and remember to release the handle!)
    success &= txCreateInteractorBehavior(hInteractor, &hBehaviorWithoutParameters, TX_BEHAVIORTYPE_EYEPOSITIONDATA) == TX_RESULT_OK;
	
	// release the handles
	txReleaseObject(&hBehavior);
	txReleaseObject(&hBehaviorWithoutParameters);
	txReleaseObject(&hInteractor);

	return success;
}
BOOL EyeXGaze::InitializeGlobalInteractorSnapshot(TX_CONTEXTHANDLE hContext)
{
	TX_HANDLE hInteractor = TX_EMPTY_HANDLE;
	// Gaze데이터 출력을 위한 변수 LIGHTLY FILTERED 모드
//	TX_GAZEPOINTDATAPARAMS params = { TX_GAZEPOINTDATAMODE_LIGHTLYFILTERED };

	// Fix데이터 출력을 위한 변수 SENSITIVE 모드
	TX_FIXATIONDATAPARAMS fparams = { TX_FIXATIONDATAMODE_SENSITIVE };	// SLOW 도 있음
	BOOL success;

	// global interactor 생성 
	success = txCreateGlobalInteractorSnapshot(
		hContext,
		InteractorId,
		&g_hGlobalInteractorSnapshot,
		&hInteractor) == TX_RESULT_OK; 

	// behavior를 gaze point data로 설정
	//success &= txCreateGazePointDataBehavior(hInteractor, &params) == TX_RESULT_OK; 

	// behavior를 fixation data로 설정
	success &= txCreateFixationDataBehavior(hInteractor, &fparams) == TX_RESULT_OK;

	// interactor 사용후 release
	txReleaseObject(&hInteractor);

	return success;
}
Beispiel #4
0
bool Tobii::InitializeGlobalInteractorSnapshot(TX_CONTEXTHANDLE hContext)
{
	TX_HANDLE hInteractor = TX_EMPTY_HANDLE;
	bool success;

	success = txCreateGlobalInteractorSnapshot(
		hContext,
		InteractorId,
		&g_hGlobalInteractorSnapshot,
		&hInteractor) == TX_RESULT_OK;

	TX_FIXATIONDATAPARAMS fixationParams = { TX_FIXATIONDATAMODE_SLOW };
	success &= txCreateFixationDataBehavior(hInteractor, &fixationParams) == TX_RESULT_OK;


	TX_GAZEPOINTDATAPARAMS gazeParams = { TX_GAZEPOINTDATAMODE_LIGHTLYFILTERED };
	success &= txCreateGazePointDataBehavior(hInteractor, &gazeParams) == TX_RESULT_OK;

	TX_HANDLE hBehaviorWithoutParameters = TX_EMPTY_HANDLE;
	success &= txCreateInteractorBehavior(hInteractor, &hBehaviorWithoutParameters, TX_BEHAVIORTYPE_EYEPOSITIONDATA) == TX_RESULT_OK;


	txReleaseObject(&hInteractor);

	return success;
}
Beispiel #5
0
BOOL InitializeGlobalInteractorSnapshot(TX_CONTEXTHANDLE hContext)
{
	TX_HANDLE hInteractor = TX_EMPTY_HANDLE;
	TX_GAZEPOINTDATAPARAMS params = { TX_GAZEPOINTDATAMODE_LIGHTLYFILTERED };
	BOOL success;

	success = txCreateGlobalInteractorSnapshot(hContext, InteractorId, &g_hGlobalInteractorSnapshot, &hInteractor) == TX_RESULT_OK;
	success &= txCreateGazePointDataBehavior(hInteractor, &params) == TX_RESULT_OK;

	txReleaseObject(&hInteractor);

	return success;
}
Beispiel #6
0
BOOL InitializeGlobalInteractorSnapshot2(TX_CONTEXTHANDLE hContext)
{
	TX_HANDLE hInteractor = TX_EMPTY_HANDLE;
	TX_HANDLE hBehavior   = TX_EMPTY_HANDLE;
	BOOL success;

	success = txCreateGlobalInteractorSnapshot(
		hContext,
		Interactor2Id,
		&g_hGlobalInteractor2Snapshot,
		&hInteractor) == TX_RESULT_OK;
	    success &= txCreateInteractorBehavior(hInteractor, &hBehavior, TX_BEHAVIORTYPE_EYEPOSITIONDATA) == TX_RESULT_OK;

	txReleaseObject(&hBehavior);
	txReleaseObject(&hInteractor);

	return success;
}
/*
 * Initializes g_hGlobalInteractorSnapshot with an interactor that has the Fixation, Gaze and Position Data behavior.
 */
BOOL InitializeGlobalInteractorSnapshot(TX_CONTEXTHANDLE hContext)
{
	TX_HANDLE hInteractor = TX_EMPTY_HANDLE;
	TX_HANDLE hBehavior = TX_EMPTY_HANDLE;
	TX_FIXATIONDATAPARAMS paramsF = { TX_FIXATIONDATAMODE_SENSITIVE };
	TX_GAZEPOINTDATAPARAMS paramsG = { TX_GAZEPOINTDATAMODE_LIGHTLYFILTERED };
	
	BOOL success;

	success = txCreateGlobalInteractorSnapshot(
		hContext,
		InteractorId,
		&g_hGlobalInteractorSnapshot,
		&hInteractor) == TX_RESULT_OK;
	success &= txCreateFixationDataBehavior(hInteractor, &paramsF) == TX_RESULT_OK;
	success &= txCreateGazePointDataBehavior(hInteractor, &paramsG) == TX_RESULT_OK;
	success &= txCreateInteractorBehavior(hInteractor, &hBehavior, TX_BEHAVIORTYPE_EYEPOSITIONDATA) == TX_RESULT_OK;

	txReleaseObject(&hBehavior);
	txReleaseObject(&hInteractor);

	return success;
}