eyeXHost::~eyeXHost() { if (_context != TX_EMPTY_HANDLE) { txDisableConnection(_context); txReleaseObject(&g_hGlobalInteractorSnapshot); txShutdownContext(_context, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE); txReleaseContext(&_context); } }
EyeXHost::~EyeXHost() { if (_context != TX_EMPTY_HANDLE) { // shut down, then release the context. txShutdownContext(_context, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE); txReleaseContext(&_context); } }
void Disconnect(void) { // disable and delete the context. txDisableConnection(hContext); txReleaseObject(&g_hGlobalInteractorSnapshot); txShutdownContext(hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE); txReleaseContext(&hContext); q_destroy(); }
void Tobii::DestroyTobii() { txDisableConnection(hContext); txReleaseObject(&g_hGlobalInteractorSnapshot); bool success = txShutdownContext(hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE) == TX_RESULT_OK; success &= txReleaseContext(&hContext) == TX_RESULT_OK; success &= txUninitializeEyeX() == TX_RESULT_OK; if (!success) { printf("EyeX could not be shut down cleanly. Did you remember to release all handles?\n"); } }
BOOL ShutdownEyeX() { BOOL success; txDisableConnection(eyeXContext); txReleaseObject(&g_hGlobalInteractorSnapshot); success = txShutdownContext(eyeXContext, TX_CLEANUPTIMEOUT_FORCEIMMEDIATE, TX_FALSE) == TX_RESULT_OK; success &= txReleaseContext(&eyeXContext) == TX_RESULT_OK; success &= txUninitializeEyeX() == TX_RESULT_OK; return success; }
EyeXGaze::~EyeXGaze() { //connection disable 및 global interactor release txDisableConnection(_hContext); txReleaseObject(&g_hGlobalInteractorSnapshot); // context shutdown 및 release txShutdownContext(_hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE); txReleaseContext(&_hContext); // client library 연결 해제 txUninitializeEyeX(); }
int stopEyeX(void) { printf("Exiting.\n"); // disable and delete the context. txDisableConnection(hContext); txReleaseObject(&g_hGlobalInteractor1Snapshot); txReleaseObject(&g_hGlobalInteractor2Snapshot); txShutdownContext(hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE); txReleaseContext(&hContext); return 0; }
bool ofxTobiiEyeX::unregisterEventHandler(Handle& handle) { bool success = true; success &= txUnregisterConnectionStateChangedHandler(handle.hContext, handle.hConnectionStateChangedTicket) == TX_RESULT_OK; success &= txUnregisterEventHandler(handle.hContext, handle.hEventHandlerTicket) == TX_RESULT_OK; success &= txDisableConnection(handle.hContext) == TX_RESULT_OK; success &= txReleaseObject(&handle.hGlobalInteractorSnapshot) == TX_RESULT_OK; //success &= txShutdownContext(handle.hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE) == TX_RESULT_OK; TX_RESULT res = txShutdownContext(handle.hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE); success &= txReleaseContext(&handle.hContext) == TX_RESULT_OK; if (!success) { ofLogError(smAddonName, "EyeX could not be shut down cleanly."); } return success; }
/* * Application entry point. */ int main(int argc, char* argv[]) { TX_CONTEXTHANDLE hContext = TX_EMPTY_HANDLE; TX_TICKET hConnectionStateChangedTicket = TX_INVALID_TICKET; TX_TICKET hEventHandlerTicket = TX_INVALID_TICKET; BOOL success; // initialize and enable the context that is our link to the EyeX Engine. success = txInitializeEyeX(TX_EYEXCOMPONENTOVERRIDEFLAG_NONE, NULL, NULL, NULL, NULL) == TX_RESULT_OK; success &= txCreateContext(&hContext, TX_FALSE) == TX_RESULT_OK; success &= InitializeGlobalInteractorSnapshot(hContext); success &= txRegisterConnectionStateChangedHandler(hContext, &hConnectionStateChangedTicket, OnEngineConnectionStateChanged, NULL) == TX_RESULT_OK; success &= txRegisterEventHandler(hContext, &hEventHandlerTicket, HandleEvent, NULL) == TX_RESULT_OK; success &= txEnableConnection(hContext) == TX_RESULT_OK; // let the events flow until a key is pressed. if (success) { printf("Initialization was successful.\n"); } else { printf("Initialization failed.\n"); } printf("Press any key to exit...\n"); _getch(); printf("Exiting.\n"); // disable and delete the context. txDisableConnection(hContext); txReleaseObject(&g_hGlobalInteractorSnapshot); success = txShutdownContext(hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE) == TX_RESULT_OK; success &= txReleaseContext(&hContext) == TX_RESULT_OK; success &= txUninitializeEyeX() == TX_RESULT_OK; if (!success) { printf("EyeX could not be shut down cleanly. Did you remember to release all handles?\n"); } return 0; }
/* * Application entry point. */ int main(int argc, char* argv[]) { char *ip = NULL; char *port = NULL; int iResult = 0; system("cls"); // Check input arguments for IP and PORT and open client socket if required if (argc != 3) { printf("Usage: %s <IP> <PORT>\n", argv[0]); printf("EyeX data will not be streamed\n"); } else { ip = argv[1]; port = argv[2]; printf("Trying connection with %s : %s\n", ip, port); clientSocket = OpenClientSocket(ip, port); if (clientSocket == INVALID_SOCKET) { printf("Error at connection with %s : %s\n", ip, port); printf("EyeX data will not be streamed\n"); } else { streaming = TRUE; } } Sleep(2000); TX_CONTEXTHANDLE hContext = TX_EMPTY_HANDLE; TX_TICKET hConnectionStateChangedTicket = TX_INVALID_TICKET; TX_TICKET hEventHandlerTicket = TX_INVALID_TICKET; BOOL success; // initialize and enable the context that is our link to the EyeX Engine. success = txInitializeEyeX(TX_EYEXCOMPONENTOVERRIDEFLAG_NONE, NULL, NULL, NULL, NULL) == TX_RESULT_OK; success &= txCreateContext(&hContext, TX_FALSE) == TX_RESULT_OK; success &= InitializeGlobalInteractorSnapshot(hContext); success &= txRegisterConnectionStateChangedHandler(hContext, &hConnectionStateChangedTicket, OnEngineConnectionStateChanged, NULL) == TX_RESULT_OK; success &= txRegisterEventHandler(hContext, &hEventHandlerTicket, HandleEvent, NULL) == TX_RESULT_OK; success &= txEnableConnection(hContext) == TX_RESULT_OK; // let the events flow until a key is pressed. if (success) { printf("Initialization was successful.\n"); } else { printf("Initialization failed.\n"); } printf("Press X to exit...\n"); _getch(); printf("Exiting.\n"); // disable and delete the context. txDisableConnection(hContext); txReleaseObject(&g_hGlobalInteractorSnapshot); txShutdownContext(hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE); txReleaseContext(&hContext); if (streaming) { SendFloatClientSocket(clientSocket, -1); CloseClientSocket(clientSocket); } Beep(300, 750); return 0; }