From be2926499af2e372c313d965533be3a7ee0dcf4d Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 16 May 2016 11:19:10 +0200 Subject: add tobii eyex sdk --- Tobii EyeX/Developer's Guide C & Cpp.pdf | Bin 0 -> 1405388 bytes Tobii EyeX/Getting Started.pdf | Bin 0 -> 185205 bytes Tobii EyeX/Readme.txt | 212 ++++ Tobii EyeX/Samples License Agreement.txt | 23 + Tobii EyeX/Tobii EyeX SDK License Agreement.pdf | Bin 0 -> 246105 bytes Tobii EyeX/include/eyex-cpp/APIException.hpp | 83 ++ Tobii EyeX/include/eyex-cpp/AsyncData.hpp | 36 + Tobii EyeX/include/eyex-cpp/AsyncData.inl | 54 + Tobii EyeX/include/eyex-cpp/Behavior.hpp | 64 ++ Tobii EyeX/include/eyex-cpp/Behavior.inl | 198 ++++ Tobii EyeX/include/eyex-cpp/Bounds.hpp | 43 + Tobii EyeX/include/eyex-cpp/Bounds.inl | 86 ++ Tobii EyeX/include/eyex-cpp/Callbacks.hpp | 26 + Tobii EyeX/include/eyex-cpp/Command.hpp | 38 + Tobii EyeX/include/eyex-cpp/Command.inl | 70 ++ Tobii EyeX/include/eyex-cpp/Context.hpp | 91 ++ Tobii EyeX/include/eyex-cpp/Context.inl | 427 ++++++++ Tobii EyeX/include/eyex-cpp/Environment.hpp | 45 + Tobii EyeX/include/eyex-cpp/Environment.inl | 70 ++ Tobii EyeX/include/eyex-cpp/EyeX.hpp | 105 ++ Tobii EyeX/include/eyex-cpp/HandleWrapper.hpp | 44 + Tobii EyeX/include/eyex-cpp/HandleWrapper.inl | 61 ++ .../include/eyex-cpp/InteractionAgentBase.hpp | 79 ++ .../include/eyex-cpp/InteractionAgentBase.inl | 183 ++++ Tobii EyeX/include/eyex-cpp/InteractionContext.cpp | 28 + Tobii EyeX/include/eyex-cpp/InteractionEvent.hpp | 35 + Tobii EyeX/include/eyex-cpp/InteractionEvent.inl | 63 ++ Tobii EyeX/include/eyex-cpp/InteractionObject.hpp | 63 ++ Tobii EyeX/include/eyex-cpp/InteractionObject.inl | 162 +++ Tobii EyeX/include/eyex-cpp/Interactor.hpp | 67 ++ Tobii EyeX/include/eyex-cpp/Interactor.inl | 257 +++++ Tobii EyeX/include/eyex-cpp/Mask.hpp | 34 + Tobii EyeX/include/eyex-cpp/Mask.inl | 58 ++ Tobii EyeX/include/eyex-cpp/Notification.hpp | 34 + Tobii EyeX/include/eyex-cpp/Notification.inl | 49 + Tobii EyeX/include/eyex-cpp/Property.cpp | 19 + Tobii EyeX/include/eyex-cpp/Property.hpp | 46 + Tobii EyeX/include/eyex-cpp/Property.inl | 90 ++ Tobii EyeX/include/eyex-cpp/PropertyBag.hpp | 32 + Tobii EyeX/include/eyex-cpp/PropertyBag.inl | 36 + .../include/eyex-cpp/PropertyValueResolver.hpp | 34 + .../include/eyex-cpp/PropertyValueResolver.inl | 266 +++++ Tobii EyeX/include/eyex-cpp/Query.hpp | 34 + Tobii EyeX/include/eyex-cpp/Query.inl | 58 ++ Tobii EyeX/include/eyex-cpp/Snapshot.hpp | 53 + Tobii EyeX/include/eyex-cpp/Snapshot.inl | 159 +++ Tobii EyeX/include/eyex-cpp/StateBag.hpp | 44 + Tobii EyeX/include/eyex-cpp/StateBag.inl | 82 ++ Tobii EyeX/include/eyex/EyeX.h | 46 + Tobii EyeX/include/eyex/EyeXActions.h | 344 +++++++ Tobii EyeX/include/eyex/EyeXAsyncData.h | 86 ++ Tobii EyeX/include/eyex/EyeXBehavior.h | 764 ++++++++++++++ Tobii EyeX/include/eyex/EyeXBounds.h | 292 ++++++ Tobii EyeX/include/eyex/EyeXClientTypes.h | 954 ++++++++++++++++++ Tobii EyeX/include/eyex/EyeXCommand.h | 211 ++++ Tobii EyeX/include/eyex/EyeXConstants.h | 33 + Tobii EyeX/include/eyex/EyeXContext.h | 773 ++++++++++++++ Tobii EyeX/include/eyex/EyeXEnv.h | 236 +++++ Tobii EyeX/include/eyex/EyeXEvent.h | 139 +++ Tobii EyeX/include/eyex/EyeXFrameworkTypes.h | 967 ++++++++++++++++++ Tobii EyeX/include/eyex/EyeXInteractor.h | 1058 ++++++++++++++++++++ Tobii EyeX/include/eyex/EyeXInternalLiterals.h | 84 ++ Tobii EyeX/include/eyex/EyeXInternalTypes.h | 44 + Tobii EyeX/include/eyex/EyeXLiterals.h | 373 +++++++ Tobii EyeX/include/eyex/EyeXMacros.h | 234 +++++ Tobii EyeX/include/eyex/EyeXNotification.h | 82 ++ Tobii EyeX/include/eyex/EyeXObject.h | 194 ++++ Tobii EyeX/include/eyex/EyeXProperty.h | 795 +++++++++++++++ Tobii EyeX/include/eyex/EyeXQuery.h | 136 +++ Tobii EyeX/include/eyex/EyeXSharedLiterals.h | 67 ++ Tobii EyeX/include/eyex/EyeXSnapshot.h | 670 +++++++++++++ Tobii EyeX/include/eyex/EyeXStates.h | 933 +++++++++++++++++ Tobii EyeX/include/eyex/EyeXUtils.h | 351 +++++++ Tobii EyeX/lib/x64/Tobii.EyeX.Client.dll | Bin 0 -> 1228504 bytes Tobii EyeX/lib/x64/Tobii.EyeX.Client.lib | Bin 0 -> 227924 bytes Tobii EyeX/lib/x86/Tobii.EyeX.Client.dll | Bin 0 -> 824536 bytes Tobii EyeX/lib/x86/Tobii.EyeX.Client.lib | Bin 0 -> 226636 bytes Tobii EyeX/samples/.vs/Samples/v14/.suo | Bin 0 -> 19456 bytes .../ActivatableBoardGame/ActivatableBoardGame.cpp | 54 + .../ActivatableBoardGame/ActivatableBoardGame.ico | Bin 0 -> 2998 bytes .../ActivatableBoardGame/ActivatableBoardGame.rc | Bin 0 -> 8056 bytes .../ActivatableBoardGame.vcxproj | 193 ++++ .../ActivatableBoardGame.vcxproj.filters | 70 ++ Tobii EyeX/samples/ActivatableBoardGame/Board.cpp | 220 ++++ Tobii EyeX/samples/ActivatableBoardGame/Board.h | 110 ++ .../samples/ActivatableBoardGame/BoardWindow.cpp | 488 +++++++++ .../samples/ActivatableBoardGame/BoardWindow.h | 94 ++ .../ActivatableBoardGame.lastbuildstate | 2 + .../Debug/Activata.2732E876.tlog/CL.command.1.tlog | Bin 0 -> 4002 bytes .../Debug/Activata.2732E876.tlog/CL.read.1.tlog | Bin 0 -> 97924 bytes .../Debug/Activata.2732E876.tlog/CL.write.1.tlog | Bin 0 -> 2792 bytes .../Activata.2732E876.tlog/link.command.1.tlog | Bin 0 -> 2284 bytes .../Debug/Activata.2732E876.tlog/link.read.1.tlog | Bin 0 -> 4972 bytes .../Debug/Activata.2732E876.tlog/link.write.1.tlog | Bin 0 -> 1100 bytes .../Debug/Activata.2732E876.tlog/rc.command.1.tlog | Bin 0 -> 432 bytes .../Debug/Activata.2732E876.tlog/rc.read.1.tlog | Bin 0 -> 2714 bytes .../Debug/Activata.2732E876.tlog/rc.write.1.tlog | Bin 0 -> 286 bytes .../Debug/ActivatableBoardGame.log | 8 + .../Debug/ActivatableBoardGame.obj | Bin 0 -> 131239 bytes .../Debug/ActivatableBoardGame.pch | Bin 0 -> 8323072 bytes .../Debug/ActivatableBoardGame.res | Bin 0 -> 7312 bytes .../samples/ActivatableBoardGame/Debug/Board.obj | Bin 0 -> 257029 bytes .../ActivatableBoardGame/Debug/BoardWindow.obj | Bin 0 -> 348456 bytes .../ActivatableBoardGame/Debug/EyeXHost.obj | Bin 0 -> 353721 bytes .../samples/ActivatableBoardGame/Debug/stdafx.obj | Bin 0 -> 142759 bytes .../samples/ActivatableBoardGame/Debug/vc140.idb | Bin 0 -> 1330176 bytes .../samples/ActivatableBoardGame/Debug/vc140.pdb | Bin 0 -> 1552384 bytes .../samples/ActivatableBoardGame/EyeXHost.cpp | 377 +++++++ Tobii EyeX/samples/ActivatableBoardGame/EyeXHost.h | 111 ++ Tobii EyeX/samples/ActivatableBoardGame/Observer.h | 13 + Tobii EyeX/samples/ActivatableBoardGame/Resource.h | Bin 0 -> 2126 bytes Tobii EyeX/samples/ActivatableBoardGame/small.ico | Bin 0 -> 2998 bytes Tobii EyeX/samples/ActivatableBoardGame/stdafx.cpp | 3 + Tobii EyeX/samples/ActivatableBoardGame/stdafx.h | 17 + .../samples/ActivatableBoardGame/targetver.h | 8 + .../ActivatableButtons/ActivatableButtons.cpp | 357 +++++++ .../ActivatableButtons/ActivatableButtons.ico | Bin 0 -> 2998 bytes .../ActivatableButtons/ActivatableButtons.rc | Bin 0 -> 5276 bytes .../ActivatableButtons/ActivatableButtons.vcxproj | 188 ++++ .../ActivatableButtons.vcxproj.filters | 55 + .../ActivatableButtons.lastbuildstate | 2 + .../Debug/Activata.3E2A1867.tlog/CL.command.1.tlog | Bin 0 -> 2374 bytes .../Debug/Activata.3E2A1867.tlog/CL.read.1.tlog | Bin 0 -> 62318 bytes .../Debug/Activata.3E2A1867.tlog/CL.write.1.tlog | Bin 0 -> 1784 bytes .../Activata.3E2A1867.tlog/link.command.1.tlog | Bin 0 -> 1924 bytes .../Debug/Activata.3E2A1867.tlog/link.read.1.tlog | Bin 0 -> 4432 bytes .../Debug/Activata.3E2A1867.tlog/link.write.1.tlog | Bin 0 -> 820 bytes .../Debug/Activata.3E2A1867.tlog/rc.command.1.tlog | Bin 0 -> 412 bytes .../Debug/Activata.3E2A1867.tlog/rc.read.1.tlog | Bin 0 -> 2686 bytes .../Debug/Activata.3E2A1867.tlog/rc.write.1.tlog | Bin 0 -> 270 bytes .../Debug/ActivatableButtons.log | 6 + .../Debug/ActivatableButtons.obj | Bin 0 -> 286795 bytes .../Debug/ActivatableButtons.pch | Bin 0 -> 8323072 bytes .../Debug/ActivatableButtons.res | Bin 0 -> 6584 bytes .../samples/ActivatableButtons/Debug/EyeXHost.obj | Bin 0 -> 344750 bytes .../samples/ActivatableButtons/Debug/stdafx.obj | Bin 0 -> 142737 bytes .../samples/ActivatableButtons/Debug/vc140.idb | Bin 0 -> 1289216 bytes .../samples/ActivatableButtons/Debug/vc140.pdb | Bin 0 -> 1486848 bytes Tobii EyeX/samples/ActivatableButtons/EyeXHost.cpp | 294 ++++++ Tobii EyeX/samples/ActivatableButtons/EyeXHost.h | 79 ++ Tobii EyeX/samples/ActivatableButtons/Resource.h | Bin 0 -> 1814 bytes Tobii EyeX/samples/ActivatableButtons/small.ico | Bin 0 -> 2998 bytes Tobii EyeX/samples/ActivatableButtons/stdafx.cpp | 3 + Tobii EyeX/samples/ActivatableButtons/stdafx.h | 17 + Tobii EyeX/samples/ActivatableButtons/targetver.h | 8 + .../samples/CopyEyeXDllToOutputDirectory.targets | 19 + Tobii EyeX/samples/Debug/ActivatableBoardGame.exe | Bin 0 -> 170496 bytes Tobii EyeX/samples/Debug/ActivatableBoardGame.ilk | Bin 0 -> 836812 bytes Tobii EyeX/samples/Debug/ActivatableBoardGame.pdb | Bin 0 -> 2412544 bytes Tobii EyeX/samples/Debug/ActivatableButtons.exe | Bin 0 -> 123904 bytes Tobii EyeX/samples/Debug/ActivatableButtons.ilk | Bin 0 -> 668848 bytes Tobii EyeX/samples/Debug/ActivatableButtons.pdb | Bin 0 -> 2142208 bytes .../samples/Debug/MinimalEyePositionDataStream.exe | Bin 0 -> 48128 bytes .../samples/Debug/MinimalEyePositionDataStream.ilk | Bin 0 -> 376208 bytes .../samples/Debug/MinimalEyePositionDataStream.pdb | Bin 0 -> 634880 bytes .../samples/Debug/MinimalFixationDataStream.exe | Bin 0 -> 46080 bytes .../samples/Debug/MinimalFixationDataStream.ilk | Bin 0 -> 368880 bytes .../samples/Debug/MinimalFixationDataStream.pdb | Bin 0 -> 634880 bytes Tobii EyeX/samples/Debug/MinimalGazeDataStream.exe | Bin 0 -> 46080 bytes Tobii EyeX/samples/Debug/MinimalGazeDataStream.ilk | Bin 0 -> 368508 bytes Tobii EyeX/samples/Debug/MinimalGazeDataStream.pdb | Bin 0 -> 634880 bytes .../samples/Debug/MinimalStatusNotifications.exe | Bin 0 -> 48128 bytes .../samples/Debug/MinimalStatusNotifications.ilk | Bin 0 -> 373656 bytes .../samples/Debug/MinimalStatusNotifications.pdb | Bin 0 -> 634880 bytes Tobii EyeX/samples/Debug/MinimalUserProfiles.exe | Bin 0 -> 109568 bytes Tobii EyeX/samples/Debug/MinimalUserProfiles.ilk | Bin 0 -> 542504 bytes Tobii EyeX/samples/Debug/MinimalUserProfiles.pdb | Bin 0 -> 1249280 bytes Tobii EyeX/samples/Debug/Tobii.EyeX.Client.dll | Bin 0 -> 824536 bytes .../Debug/MinimalE.6D2CFFFE.tlog/CL.command.1.tlog | Bin 0 -> 798 bytes .../Debug/MinimalE.6D2CFFFE.tlog/CL.read.1.tlog | Bin 0 -> 23524 bytes .../Debug/MinimalE.6D2CFFFE.tlog/CL.write.1.tlog | Bin 0 -> 616 bytes .../MinimalEyePositionDataStream.lastbuildstate | 2 + .../MinimalE.6D2CFFFE.tlog/link.command.1.tlog | Bin 0 -> 1336 bytes .../Debug/MinimalE.6D2CFFFE.tlog/link.read.1.tlog | Bin 0 -> 3182 bytes .../Debug/MinimalE.6D2CFFFE.tlog/link.write.1.tlog | Bin 0 -> 550 bytes .../Debug/MinimalEyePositionDataStream.log | 2 + .../Debug/MinimalEyePositionDataStream.obj | Bin 0 -> 76309 bytes .../MinimalEyePositionDataStream/Debug/vc140.idb | Bin 0 -> 265216 bytes .../MinimalEyePositionDataStream/Debug/vc140.pdb | Bin 0 -> 86016 bytes .../MinimalEyePositionDataStream.c | 199 ++++ .../MinimalEyePositionDataStream.vcxproj | 160 +++ .../MinimalEyePositionDataStream.vcxproj.filters | 6 + .../Debug/MinimalF.9345876F.tlog/CL.command.1.tlog | Bin 0 -> 764 bytes .../Debug/MinimalF.9345876F.tlog/CL.read.1.tlog | Bin 0 -> 23366 bytes .../Debug/MinimalF.9345876F.tlog/CL.write.1.tlog | Bin 0 -> 580 bytes .../MinimalFixationDataStream.lastbuildstate | 2 + .../MinimalF.9345876F.tlog/link.command.1.tlog | Bin 0 -> 1300 bytes .../Debug/MinimalF.9345876F.tlog/link.read.1.tlog | Bin 0 -> 3158 bytes .../Debug/MinimalF.9345876F.tlog/link.write.1.tlog | Bin 0 -> 520 bytes .../Debug/MinimalFixationDataStream.log | 2 + .../Debug/MinimalFixationDataStream.obj | Bin 0 -> 72441 bytes .../MinimalFixationDataStream/Debug/vc140.idb | Bin 0 -> 265216 bytes .../MinimalFixationDataStream/Debug/vc140.pdb | Bin 0 -> 86016 bytes .../MinimalFixationDataStream.c | 181 ++++ .../MinimalFixationDataStream.vcxproj | 156 +++ .../MinimalFixationDataStream.vcxproj.filters | 6 + .../Debug/MinimalG.CB99F84F.tlog/CL.command.1.tlog | Bin 0 -> 742 bytes .../Debug/MinimalG.CB99F84F.tlog/CL.read.1.tlog | Bin 0 -> 23350 bytes .../Debug/MinimalG.CB99F84F.tlog/CL.write.1.tlog | Bin 0 -> 532 bytes .../MinimalGazeDataStream.lastbuildstate | 2 + .../MinimalG.CB99F84F.tlog/link.command.1.tlog | Bin 0 -> 1252 bytes .../Debug/MinimalG.CB99F84F.tlog/link.read.1.tlog | Bin 0 -> 3126 bytes .../Debug/MinimalG.CB99F84F.tlog/link.write.1.tlog | Bin 0 -> 480 bytes .../Debug/MinimalGazeDataStream.log | 2 + .../Debug/MinimalGazeDataStream.obj | Bin 0 -> 71927 bytes .../samples/MinimalGazeDataStream/Debug/vc140.idb | Bin 0 -> 265216 bytes .../samples/MinimalGazeDataStream/Debug/vc140.pdb | Bin 0 -> 86016 bytes .../MinimalGazeDataStream/MinimalGazeDataStream.c | 171 ++++ .../MinimalGazeDataStream.vcxproj | 160 +++ .../MinimalGazeDataStream.vcxproj.filters | 6 + .../Debug/MinimalS.30C25EF3.tlog/CL.command.1.tlog | Bin 0 -> 782 bytes .../Debug/MinimalS.30C25EF3.tlog/CL.read.1.tlog | Bin 0 -> 23370 bytes .../Debug/MinimalS.30C25EF3.tlog/CL.write.1.tlog | Bin 0 -> 592 bytes .../MinimalStatusNotifications.lastbuildstate | 2 + .../MinimalS.30C25EF3.tlog/link.command.1.tlog | Bin 0 -> 1312 bytes .../Debug/MinimalS.30C25EF3.tlog/link.read.1.tlog | Bin 0 -> 3166 bytes .../Debug/MinimalS.30C25EF3.tlog/link.write.1.tlog | Bin 0 -> 530 bytes .../Debug/MinimalStatusNotifications.log | 2 + .../Debug/MinimalStatusNotifications.obj | Bin 0 -> 72743 bytes .../MinimalStatusNotifications/Debug/vc140.idb | Bin 0 -> 265216 bytes .../MinimalStatusNotifications/Debug/vc140.pdb | Bin 0 -> 86016 bytes .../MinimalStatusNotifications.c | 186 ++++ .../MinimalStatusNotifications.vcxproj | 156 +++ .../MinimalStatusNotifications.vcxproj.filters | 6 + .../Debug/MinimalU.7644167B.tlog/CL.command.1.tlog | Bin 0 -> 1394 bytes .../Debug/MinimalU.7644167B.tlog/CL.read.1.tlog | Bin 0 -> 39772 bytes .../Debug/MinimalU.7644167B.tlog/CL.write.1.tlog | Bin 0 -> 1208 bytes .../MinimalUserProfiles.lastbuildstate | 2 + .../MinimalU.7644167B.tlog/link.command.1.tlog | Bin 0 -> 1376 bytes .../Debug/MinimalU.7644167B.tlog/link.read.1.tlog | Bin 0 -> 3490 bytes .../Debug/MinimalU.7644167B.tlog/link.write.1.tlog | Bin 0 -> 576 bytes .../Debug/MinimalUserProfiles.log | 4 + .../Debug/MinimalUserProfiles.obj | Bin 0 -> 408719 bytes .../samples/MinimalUserProfiles/Debug/stdafx.obj | Bin 0 -> 4286 bytes .../samples/MinimalUserProfiles/Debug/vc140.idb | Bin 0 -> 887808 bytes .../samples/MinimalUserProfiles/Debug/vc140.pdb | Bin 0 -> 552960 bytes .../MinimalUserProfiles/MinimalUserProfiles.cpp | 269 +++++ .../MinimalUserProfiles.vcxproj | 163 +++ .../MinimalUserProfiles.vcxproj.filters | 36 + Tobii EyeX/samples/MinimalUserProfiles/ReadMe.txt | 40 + Tobii EyeX/samples/MinimalUserProfiles/stdafx.cpp | 3 + Tobii EyeX/samples/MinimalUserProfiles/stdafx.h | 13 + Tobii EyeX/samples/MinimalUserProfiles/targetver.h | 8 + Tobii EyeX/samples/Samples.VC.db | Bin 0 -> 36241408 bytes Tobii EyeX/samples/Samples.sln | 85 ++ 245 files changed, 18535 insertions(+) create mode 100755 Tobii EyeX/Developer's Guide C & Cpp.pdf create mode 100755 Tobii EyeX/Getting Started.pdf create mode 100755 Tobii EyeX/Readme.txt create mode 100755 Tobii EyeX/Samples License Agreement.txt create mode 100755 Tobii EyeX/Tobii EyeX SDK License Agreement.pdf create mode 100755 Tobii EyeX/include/eyex-cpp/APIException.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/AsyncData.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/AsyncData.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Behavior.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Behavior.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Bounds.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Bounds.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Callbacks.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Command.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Command.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Context.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Context.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Environment.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Environment.inl create mode 100755 Tobii EyeX/include/eyex-cpp/EyeX.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/HandleWrapper.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/HandleWrapper.inl create mode 100755 Tobii EyeX/include/eyex-cpp/InteractionAgentBase.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/InteractionAgentBase.inl create mode 100755 Tobii EyeX/include/eyex-cpp/InteractionContext.cpp create mode 100755 Tobii EyeX/include/eyex-cpp/InteractionEvent.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/InteractionEvent.inl create mode 100755 Tobii EyeX/include/eyex-cpp/InteractionObject.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/InteractionObject.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Interactor.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Interactor.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Mask.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Mask.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Notification.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Notification.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Property.cpp create mode 100755 Tobii EyeX/include/eyex-cpp/Property.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Property.inl create mode 100755 Tobii EyeX/include/eyex-cpp/PropertyBag.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/PropertyBag.inl create mode 100755 Tobii EyeX/include/eyex-cpp/PropertyValueResolver.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/PropertyValueResolver.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Query.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Query.inl create mode 100755 Tobii EyeX/include/eyex-cpp/Snapshot.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/Snapshot.inl create mode 100755 Tobii EyeX/include/eyex-cpp/StateBag.hpp create mode 100755 Tobii EyeX/include/eyex-cpp/StateBag.inl create mode 100755 Tobii EyeX/include/eyex/EyeX.h create mode 100755 Tobii EyeX/include/eyex/EyeXActions.h create mode 100755 Tobii EyeX/include/eyex/EyeXAsyncData.h create mode 100755 Tobii EyeX/include/eyex/EyeXBehavior.h create mode 100755 Tobii EyeX/include/eyex/EyeXBounds.h create mode 100755 Tobii EyeX/include/eyex/EyeXClientTypes.h create mode 100755 Tobii EyeX/include/eyex/EyeXCommand.h create mode 100755 Tobii EyeX/include/eyex/EyeXConstants.h create mode 100755 Tobii EyeX/include/eyex/EyeXContext.h create mode 100755 Tobii EyeX/include/eyex/EyeXEnv.h create mode 100755 Tobii EyeX/include/eyex/EyeXEvent.h create mode 100755 Tobii EyeX/include/eyex/EyeXFrameworkTypes.h create mode 100755 Tobii EyeX/include/eyex/EyeXInteractor.h create mode 100755 Tobii EyeX/include/eyex/EyeXInternalLiterals.h create mode 100755 Tobii EyeX/include/eyex/EyeXInternalTypes.h create mode 100755 Tobii EyeX/include/eyex/EyeXLiterals.h create mode 100755 Tobii EyeX/include/eyex/EyeXMacros.h create mode 100755 Tobii EyeX/include/eyex/EyeXNotification.h create mode 100755 Tobii EyeX/include/eyex/EyeXObject.h create mode 100755 Tobii EyeX/include/eyex/EyeXProperty.h create mode 100755 Tobii EyeX/include/eyex/EyeXQuery.h create mode 100755 Tobii EyeX/include/eyex/EyeXSharedLiterals.h create mode 100755 Tobii EyeX/include/eyex/EyeXSnapshot.h create mode 100755 Tobii EyeX/include/eyex/EyeXStates.h create mode 100755 Tobii EyeX/include/eyex/EyeXUtils.h create mode 100755 Tobii EyeX/lib/x64/Tobii.EyeX.Client.dll create mode 100755 Tobii EyeX/lib/x64/Tobii.EyeX.Client.lib create mode 100755 Tobii EyeX/lib/x86/Tobii.EyeX.Client.dll create mode 100755 Tobii EyeX/lib/x86/Tobii.EyeX.Client.lib create mode 100755 Tobii EyeX/samples/.vs/Samples/v14/.suo create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.cpp create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.ico create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.rc create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.vcxproj create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.vcxproj.filters create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Board.cpp create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Board.h create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/BoardWindow.cpp create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/BoardWindow.h create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/ActivatableBoardGame.lastbuildstate create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.command.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.read.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.write.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.command.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.read.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.write.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.command.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.read.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.write.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.log create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.obj create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.pch create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.res create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/Board.obj create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/BoardWindow.obj create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/EyeXHost.obj create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/stdafx.obj create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/vc140.idb create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Debug/vc140.pdb create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/EyeXHost.cpp create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/EyeXHost.h create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Observer.h create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/Resource.h create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/small.ico create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/stdafx.cpp create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/stdafx.h create mode 100755 Tobii EyeX/samples/ActivatableBoardGame/targetver.h create mode 100755 Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.cpp create mode 100755 Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.ico create mode 100755 Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.rc create mode 100755 Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.vcxproj create mode 100755 Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.vcxproj.filters create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/ActivatableButtons.lastbuildstate create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.command.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.read.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.write.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.command.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.read.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.write.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.command.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.read.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.write.1.tlog create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.log create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.obj create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.pch create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.res create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/EyeXHost.obj create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/stdafx.obj create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/vc140.idb create mode 100755 Tobii EyeX/samples/ActivatableButtons/Debug/vc140.pdb create mode 100755 Tobii EyeX/samples/ActivatableButtons/EyeXHost.cpp create mode 100755 Tobii EyeX/samples/ActivatableButtons/EyeXHost.h create mode 100755 Tobii EyeX/samples/ActivatableButtons/Resource.h create mode 100755 Tobii EyeX/samples/ActivatableButtons/small.ico create mode 100755 Tobii EyeX/samples/ActivatableButtons/stdafx.cpp create mode 100755 Tobii EyeX/samples/ActivatableButtons/stdafx.h create mode 100755 Tobii EyeX/samples/ActivatableButtons/targetver.h create mode 100755 Tobii EyeX/samples/CopyEyeXDllToOutputDirectory.targets create mode 100755 Tobii EyeX/samples/Debug/ActivatableBoardGame.exe create mode 100755 Tobii EyeX/samples/Debug/ActivatableBoardGame.ilk create mode 100755 Tobii EyeX/samples/Debug/ActivatableBoardGame.pdb create mode 100755 Tobii EyeX/samples/Debug/ActivatableButtons.exe create mode 100755 Tobii EyeX/samples/Debug/ActivatableButtons.ilk create mode 100755 Tobii EyeX/samples/Debug/ActivatableButtons.pdb create mode 100755 Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.exe create mode 100755 Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.ilk create mode 100755 Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.pdb create mode 100755 Tobii EyeX/samples/Debug/MinimalFixationDataStream.exe create mode 100755 Tobii EyeX/samples/Debug/MinimalFixationDataStream.ilk create mode 100755 Tobii EyeX/samples/Debug/MinimalFixationDataStream.pdb create mode 100755 Tobii EyeX/samples/Debug/MinimalGazeDataStream.exe create mode 100755 Tobii EyeX/samples/Debug/MinimalGazeDataStream.ilk create mode 100755 Tobii EyeX/samples/Debug/MinimalGazeDataStream.pdb create mode 100755 Tobii EyeX/samples/Debug/MinimalStatusNotifications.exe create mode 100755 Tobii EyeX/samples/Debug/MinimalStatusNotifications.ilk create mode 100755 Tobii EyeX/samples/Debug/MinimalStatusNotifications.pdb create mode 100755 Tobii EyeX/samples/Debug/MinimalUserProfiles.exe create mode 100755 Tobii EyeX/samples/Debug/MinimalUserProfiles.ilk create mode 100755 Tobii EyeX/samples/Debug/MinimalUserProfiles.pdb create mode 100755 Tobii EyeX/samples/Debug/Tobii.EyeX.Client.dll create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/MinimalEyePositionDataStream.lastbuildstate create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalEyePositionDataStream.log create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalEyePositionDataStream.obj create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/vc140.idb create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/vc140.pdb create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.c create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.vcxproj create mode 100755 Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.vcxproj.filters create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/MinimalFixationDataStream.lastbuildstate create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalFixationDataStream.log create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalFixationDataStream.obj create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/vc140.idb create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/Debug/vc140.pdb create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.c create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.vcxproj create mode 100755 Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.vcxproj.filters create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/MinimalGazeDataStream.lastbuildstate create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalGazeDataStream.log create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalGazeDataStream.obj create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/vc140.idb create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/Debug/vc140.pdb create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.c create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.vcxproj create mode 100755 Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.vcxproj.filters create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/MinimalStatusNotifications.lastbuildstate create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalStatusNotifications.log create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalStatusNotifications.obj create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/vc140.idb create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/Debug/vc140.pdb create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.c create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.vcxproj create mode 100755 Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.vcxproj.filters create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/MinimalUserProfiles.lastbuildstate create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.command.1.tlog create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.read.1.tlog create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.write.1.tlog create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalUserProfiles.log create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalUserProfiles.obj create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/stdafx.obj create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/vc140.idb create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/Debug/vc140.pdb create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.cpp create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.vcxproj create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.vcxproj.filters create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/ReadMe.txt create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/stdafx.cpp create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/stdafx.h create mode 100755 Tobii EyeX/samples/MinimalUserProfiles/targetver.h create mode 100755 Tobii EyeX/samples/Samples.VC.db create mode 100755 Tobii EyeX/samples/Samples.sln diff --git a/Tobii EyeX/Developer's Guide C & Cpp.pdf b/Tobii EyeX/Developer's Guide C & Cpp.pdf new file mode 100755 index 0000000..4484449 Binary files /dev/null and b/Tobii EyeX/Developer's Guide C & Cpp.pdf differ diff --git a/Tobii EyeX/Getting Started.pdf b/Tobii EyeX/Getting Started.pdf new file mode 100755 index 0000000..ace4a59 Binary files /dev/null and b/Tobii EyeX/Getting Started.pdf differ diff --git a/Tobii EyeX/Readme.txt b/Tobii EyeX/Readme.txt new file mode 100755 index 0000000..2f865a3 --- /dev/null +++ b/Tobii EyeX/Readme.txt @@ -0,0 +1,212 @@ +Tobii EyeX Software Development Kit for C/C++ +============================================= + +README + + This package contains everything a developer needs for building games + and applications using the Tobii EyeX Engine API and the C and C++ + programming languages: the C header files for accessing the API, libraries, + documentation, and code samples. + + Note that Tobii offers several SDK packages targeted at different programming + languages and frameworks, so be sure to pick the one that fits your needs best. + +CONTACT + + If you have problems, questions, ideas, or suggestions, please use the forums + on the Tobii Developer Zone (link below). That's what they are for! + +WEB SITE + + Visit the Tobii Developer Zone web site for the latest news and downloads: + + http://developer.tobii.com/ + +COMPATIBILITY + + This version of the EyeX SDK requires EyeX Engine version 1.0 or later. + Specific features will require newer versions of the EyeX Engine as listed + in the revision history below. + +REVISION HISTORY + + 2016-03-14 + Version 1.7: No changes. + + 2015-11-19 + Version 1.6: + - Removed all dependencies on the EyeXButton for activatable behavior. The + samples using the activatable behavior now hook their own keyboard keys + for activation, and send action commands to trigger activation. The + board game sample also illustrates how to trigger activation mode on. + - Rewrote and restructured parts of the Developer Guide, and added more + detailed inforation about action commands for the activatable and the + pannable behaviors. + + 2015-06-12 + Version 1.5: + - Added support for new EyeTracking state TX_STATEPATH_GAZETRACKING. Updated + the MinimalStatusNotifications sample to include this state. Requires EyeX + Engine 1.4.0. + - Added support for new states introduced with EyeX Engine 1.3.0. Some of + the new states replace deprecated states. The new state path names + correspond to a logical hierarchy where a number of states are sorted + under so called root nodes (for example TX_STATEPATH_EYETRACKING). The + list below is incomplete, for a full list of available state paths and + their descriptions, see EyeXLiterals.h. Samples have been updated to use + the new states where applicable. + + New state | Replaces deprecated state + ------------------------------------------- | -------------------------------- + TX_STATEPATH_EYETRACKINGSCREENBOUNDS | TX_STATEPATH_SCREENBOUNDS *) + TX_STATEPATH_EYETRACKINGDISPLAYSIZE | TX_STATEPATH_DISPLAYSIZE *) + TX_STATEPATH_EYETRACKINGCONFIGURATIONSTATUS | TX_STATEPATH_CONFIGURATIONSTATUS *) + TX_STATEPATH_ENGINEINFOVERSION | TX_STATEPATH_ENGINEVERSION **) + TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME | TX_STATEPATH_PROFILENAME **) + TX_STATEPATH_EYETRACKINGPROFILES | + TX_STATEPATH_EYETRACKINGINFO | + TX_STATEPATH_EYETRACKINGINFOMODELNAME | + TX_STATEPATH_EYETRACKINGINFOSERIALNUMBER | + TX_STATEPATH_EYETRACKINGINFOFIRMWAREVERSION | + + *) The new state path is identical to the old, only the name differs. This + new state path is backwards compatible with older EyeX Engines. + **) The new state path is different from the old. You may want to keep + using the old path for a while for compatibility with pre-1.3.0 EyeX + Engines. + + - Added support for new EyeX Engine API function: txSetCurrentProfile. + Requires EyeX Engine 1.3.0. + - Added a MinimalUserProfiles sample to demonstrate how to list profiles + and change current profile. Requires EyeX Engine 1.3.0. + - New semantic behavior for TX_STATEPATH_USERPRESENCE state: the user will + be detected as present in more cases than before. The user's eyes do not + have to be open. + - New enum value for the TX_STATEPATH_USERPRESENCE state: + TX_USERPRESENCE_UNKNOWN. + + 2015-04-14 + Version 1.4: No changes. + + 2015-01-15 + Version 1.3: No changes. + + 2014-12-16 + Version 1.2: + - Added support for launching EyeX configuration tools. This function + requires EyeX Engine 1.1. + - New code sample to demonstrate the EyePosition data stream. + - New EyeX Engine API function: txGetEyeXAvailability. This function is + implemented in the client library and works with all Engine versions. + - Added a check for engine availability to the MinimalStatusNotifications + sample app. + + 2014-11-20 + Version 1.1: + - Improved error handling in the shutdown sequence of the C samples. + + 2014-10-27 + Version 1.0: + - Client library compatible with EyeX Engine 1.0. + - Updated the MinimalStatusNotifications sample to use asynchronous state + queries in the engine-connection-state-changed event handler. + - Updated samples and documentation for the new direct click modes in + EyeX Interaction settings. + + 2014-09-23 + Version 0.32: Client library compatible with both EyeX Engine 0.10 and 1.0. + + 2014-09-05 + Version 0.31: Updated package for Tobii EyeX Engine 0.10.0: + - Client libraries updated with some breaking API changes (see below). + - All samples are updated to the new client libraries. + + 2014-08-22 + Version 0.24: No changes. + + 2014-06-19 + Version 0.23: Improved the readability of the API header files by expanding + some of the macros. + + 2014-05-21 + Version 0.22: Improvements to the Developer's Guide. Bug fixes in the client + library. + + 2014-05-07 + Version 0.21: Updated package for Tobii EyeX Engine 0.8.14: + - Client libraries updated with some breaking API changes (see below). + - All samples are updated to the new client libraries. + - Improvements to the C/C++ code samples. + + 2014-04-08 + Version 0.20: Updated package for Tobii EyeX Engine 0.8.11: + - Client libraries updated with some breaking API changes (see below). + - All samples are updated to the new client libraries. + - MinimalFixationDataStream sample now works as expected. + - MinimalStatusNotifications sample now also displays presence data. + - The Developer's Guide is updated. + + 2014-03-05 + Version 0.17: Changes to the custom threading and logging API. Added the + txEnableMonoCallbacks function. + + 2014-02-28 + Version 0.16: Added additional notification handlers in the + MinimalStatusNotifications sample to show how to retrieve display size and + screen bounds settings. Added new experimental sample to demonstrate the + Fixation data stream. + + 2014-02-26 + Version 0.15: No changes. + + 2014-02-21 + Version 0.14.40: Minor improvements. + + 2014-02-12 + Version 0.13.39: Bug fixes: Settings retrieval bug fixed in client library. + + 2014-02-06 + Version 0.13.38: Added samples licence agreement. Added missing copyright + texts to C++ binding. + + 2014-01-03 + Version 0.13.37: This is the first official alpha release of the SDK. APIs + may change and backward compatibility isn't guaranteed. As a rule of thumb, + the APIs used in the samples are the most mature and less likely to change + much. + +EYEX ENGINE API CHANGES + + 2014-10-22 + EyeX Engine 1.0 + - No actual API changes, but functional changes related to the Activatable + behavior, direct click and key bindings: + - If EyeX Interaction is disabled, no default keys are mapped to direct click. + - ActivationFocus and Activated events are sent simultaneously if EyeX Button + interaction is configured in EyeX Interaction settings. + + 2014-09-05 + EyeX Engine Developer Preview 0.10.0 + - Name changes: + TX_STATEPATH_STATE => TX_STATEPATH_EYETRACKINGSTATE + TX_STATEPATH_PRESENCEDATA => TX_STATEPATH_USERPRESENCE + TX_PRESENCEDATA_PRESENT => TX_USERPRESENCE_PRESENT + txInitializeSystem => txInitializeEyeX + txSet[Xyz]Behavior => txCreate[Xyz]Behavior + TX_SYSTEMCOMPONENTOVERRIDEFLAG* => TX_EYEXCOMPONENTOVERRIDEFLAG* + TX_INTERACTIONBEHAVIORTYPE* => TX_BEHAVIORTYPE* + - Features that are tentative are now documented as "internal" and may + disappear in future releases. + - txInitializeEyeX takes an additional parameter. Currently it is only a + placeholder, so pass in a null pointer. + - The handle passed to txCreateContext must be initialized to TX_EMPTY_HANDLE. + - Registration methods may no longer be called from API callbacks. + - The ScopedConstHandle type has been removed. + - More than one state observer can now be registered for the same state path. + + 2014-05-07 + EyeX Engine Developer Preview 0.8.14 + - AsyncData objects are used also in query and event handlers. + - Type of AsyncData objects is of type TX_CONSTHANDLE and should not be released. + - The third and last parameter of txUnregisterStateChangedHandler has been removed. + - The signature of the txInitializeSystem function has been changed. diff --git a/Tobii EyeX/Samples License Agreement.txt b/Tobii EyeX/Samples License Agreement.txt new file mode 100755 index 0000000..0f5e2f3 --- /dev/null +++ b/Tobii EyeX/Samples License Agreement.txt @@ -0,0 +1,23 @@ +The code samples in the Tobii EyeX SDK packages are licensed under the OSI- +approved zlib/libpng License. It is as permissive as the MIT license, and does +not require a copyright notice or attribution in binary distributions. + +Copyright (c) 2013-2014 Tobii Technology AB. + +This software is provided 'as-is', without any express or implied warranty. In +no event will the authors be held liable for any damages arising from the use +of this software. + +Permission is granted to anyone to use this software for any purpose, including +commercial applications, and to alter it and redistribute it freely, subject to +the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software in + a product, an acknowledgement in the product documentation would be + appreciated but is not required. + + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + + 3. This notice may not be removed or altered from any source distribution. diff --git a/Tobii EyeX/Tobii EyeX SDK License Agreement.pdf b/Tobii EyeX/Tobii EyeX SDK License Agreement.pdf new file mode 100755 index 0000000..3424afb Binary files /dev/null and b/Tobii EyeX/Tobii EyeX SDK License Agreement.pdf differ diff --git a/Tobii EyeX/include/eyex-cpp/APIException.hpp b/Tobii EyeX/include/eyex-cpp/APIException.hpp new file mode 100755 index 0000000..d270c04 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/APIException.hpp @@ -0,0 +1,83 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * APIException.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_APIEXCEPTION__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_APIEXCEPTION__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class APIException +{ +public: + APIException(TX_RESULT result, const std::string& message = "") + : _result(result), _message(message) + { } + + TX_RESULT GetResult() const + { + return _result; + } + + std::string GetMessage() const + { + return _message; + } + +private: + TX_RESULT _result; + std::string _message; +}; + +/*********************************************************************************************************************/ + +inline bool TX_VALIDATE(TX_RESULT result) +{ + if(result == TX_RESULT_OK) + return true; + + throw EyeX::APIException(result, "Error"); +} + +/*********************************************************************************************************************/ + +inline bool TX_VALIDATE(TX_RESULT result, TX_RESULT falseResult) +{ + if(result == falseResult) + return false; + + return TX_VALIDATE(result); +} + +/*********************************************************************************************************************/ + +inline bool TX_VALIDATE(TX_RESULT result, TX_RESULT falseResult1, TX_RESULT falseResult2) +{ + if(result == falseResult2) + return false; + + return TX_VALIDATE(result, falseResult1); +} + +template +inline std::string GetString(TX_RESULT (*pFn)(THandle1, TX_STRING, TX_SIZE*), THandle2 handle, TX_SIZE estimatedLength = 0) +{ + std::string str; + TX_VALIDATE(GetString(&str, pFn, handle, estimatedLength)); + return str; +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_APIEXCEPTION__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/AsyncData.hpp b/Tobii EyeX/include/eyex-cpp/AsyncData.hpp new file mode 100755 index 0000000..6ce342f --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/AsyncData.hpp @@ -0,0 +1,36 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * CommandResult.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_ASYNCDATA__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_ASYNCDATA__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class AsyncData : + public InteractionObjectBase +{ +public: + AsyncData(const std::shared_ptr& spContext, TX_CONSTHANDLE hAsyncData); + + bool TryGetResultCode(TX_RESULT* pResultCode) const; + std::shared_ptr GetData() const; + + template + std::shared_ptr GetDataAs() const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_ASYNCDATA__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/AsyncData.inl b/Tobii EyeX/include/eyex-cpp/AsyncData.inl new file mode 100755 index 0000000..55f42f5 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/AsyncData.inl @@ -0,0 +1,54 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * AsyncData.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_ASYNCDATA__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_ASYNC__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline AsyncData::AsyncData(const std::shared_ptr& spContext, TX_CONSTHANDLE hAsyncData) +: InteractionObjectBase(spContext, hAsyncData) +{ } + +/*********************************************************************************************************************/ + +inline bool AsyncData::TryGetResultCode(TX_RESULT* pResultCode) const +{ + return TX_VALIDATE(txGetAsyncDataResultCode(_hObject, pResultCode), TX_RESULT_NOTFOUND); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr AsyncData::GetData() const +{ + Tx::Utils::ScopedHandle hData; + if(!TX_VALIDATE(txGetAsyncDataContent(_hObject, &hData), TX_RESULT_NOTFOUND)) + return nullptr; + + auto spData = _spContext->CreateObject(hData); + return spData; +} + +/*********************************************************************************************************************/ + +template +std::shared_ptr AsyncData::GetDataAs() const +{ + return std::dynamic_pointer_cast(GetData()); +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_ASYNCDATA__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Behavior.hpp b/Tobii EyeX/include/eyex-cpp/Behavior.hpp new file mode 100755 index 0000000..c40d7bc --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Behavior.hpp @@ -0,0 +1,64 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Behavior.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Behavior__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Behavior__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Behavior : + public InteractionObject +{ +public: + Behavior(const std::shared_ptr& spContext, TX_HANDLE hBehavior); + + TX_BEHAVIORTYPE GetType() const; + +public: + void SetData(const std::shared_ptr& spData); + std::shared_ptr GetData() const; + + void SetGazePointDataBehaviorParams(const TX_GAZEPOINTDATAPARAMS& pParams); + bool TryGetGazePointDataBehaviorParams(TX_GAZEPOINTDATAPARAMS* pParams) const; + bool TryGetGazePointDataEventParams(TX_GAZEPOINTDATAEVENTPARAMS* pEventParams) const; + + void SetActivatableBehaviorParams(const TX_ACTIVATABLEPARAMS& pParams); + bool TryGetActivatableBehaviorParams(TX_ACTIVATABLEPARAMS* pParams) const; + + void SetPannableBehaviorParams(const TX_PANNABLEPARAMS& pParams); + bool TryGetPannableBehaviorParams(TX_PANNABLEPARAMS* pParams) const; + bool TryGetPannableEventType(TX_PANNABLEEVENTTYPE* pEventType) const; + bool TryGetPannablePanEvent(TX_PANNABLEPANEVENTPARAMS* pEventParams) const; + bool TryGetPannableStepEvent(TX_PANNABLESTEPEVENTPARAMS* pEventParams) const; + bool TryGetPannableHandsFreeEvent(TX_PANNABLEHANDSFREEEVENTPARAMS* pEventParams) const; + + bool TryGetActivatableEventType(TX_ACTIVATABLEEVENTTYPE* pEventType) const; + bool TryGetActivationFocusChangedEventParams(TX_ACTIVATIONFOCUSCHANGEDEVENTPARAMS* pEventParams) const; + + void SetGazeAwareBehaviorParams(const TX_GAZEAWAREPARAMS& pParams); + bool TryGetGazeAwareBehaviorParams(TX_GAZEAWAREPARAMS* pParams) const; + bool TryGetGazeAwareEventParams(TX_GAZEAWAREEVENTPARAMS* pEventParams) const; + + void SetFixationDataBehaviorParams(const TX_FIXATIONDATAPARAMS& params); + bool TryGetFixationDataBehaviorParams(TX_FIXATIONDATAPARAMS* pParams) const; + bool TryGetFixationDataEventParams(TX_FIXATIONDATAEVENTPARAMS* pEventParams) const; + + bool TryGetEyePositionDataEventParams(TX_EYEPOSITIONDATAEVENTPARAMS* pEventParams) const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Behavior__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Behavior.inl b/Tobii EyeX/include/eyex-cpp/Behavior.inl new file mode 100755 index 0000000..5e4f71b --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Behavior.inl @@ -0,0 +1,198 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Behavior.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Behavior__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Behavior__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline Behavior::Behavior(const std::shared_ptr& spContext, TX_HANDLE hBehavior) +: InteractionObject(spContext, hBehavior) +{} + +/*********************************************************************************************************************/ + +inline TX_BEHAVIORTYPE Behavior::GetType() const +{ + TX_BEHAVIORTYPE behaviorType; + TX_VALIDATE(txGetBehaviorType(_hObject, &behaviorType)); + return behaviorType; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Behavior::GetData() const +{ + auto spProperty = GetProperty(TX_LITERAL_DATA); + + std::shared_ptr spData; + if(spProperty->TryGetValue(&spData)) + return spData; + + return nullptr; +} + +/*********************************************************************************************************************/ + +inline void Behavior::SetData(const std::shared_ptr& spData) +{ + auto spProperty = GetProperty(TX_LITERAL_DATA); + spProperty->SetValue(spData); +} + +/*********************************************************************************************************************/ + +inline void Behavior::SetGazePointDataBehaviorParams(const TX_GAZEPOINTDATAPARAMS& params) +{ + TX_VALIDATE(txSetGazePointDataBehaviorParams(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetGazePointDataBehaviorParams(TX_GAZEPOINTDATAPARAMS* pParams) const +{ + return TX_VALIDATE(txGetGazePointDataBehaviorParams(_hObject, pParams), TX_RESULT_INVALIDBEHAVIORTYPE); +} + +/*********************************************************************************************************************/ + +inline void Behavior::SetActivatableBehaviorParams(const TX_ACTIVATABLEPARAMS& params) +{ + TX_VALIDATE(txSetActivatableBehaviorParams(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetActivatableBehaviorParams(TX_ACTIVATABLEPARAMS* pParams) const +{ + return TX_VALIDATE(txGetActivatableBehaviorParams(_hObject, pParams), TX_RESULT_INVALIDBEHAVIORTYPE); +} + +/*********************************************************************************************************************/ + +inline void Behavior::SetPannableBehaviorParams(const TX_PANNABLEPARAMS& params) +{ + TX_VALIDATE(txSetPannableBehaviorParams(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetPannableBehaviorParams(TX_PANNABLEPARAMS* pParams) const +{ + return TX_VALIDATE(txGetPannableBehaviorParams(_hObject, pParams), TX_RESULT_INVALIDBEHAVIORTYPE); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetPannableEventType(TX_PANNABLEEVENTTYPE* pEventType) const +{ + return TX_VALIDATE(txGetPannableEventType(_hObject, pEventType), TX_RESULT_INVALIDBEHAVIORTYPE); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetPannablePanEvent(TX_PANNABLEPANEVENTPARAMS* pEventParams) const +{ + return TX_VALIDATE(txGetPannablePanEventParams(_hObject, pEventParams), TX_RESULT_INVALIDBEHAVIORTYPE, TX_RESULT_NOTFOUND); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetPannableStepEvent(TX_PANNABLESTEPEVENTPARAMS* pEventParams) const +{ + return TX_VALIDATE(txGetPannableStepEventParams(_hObject, pEventParams), TX_RESULT_INVALIDBEHAVIORTYPE, TX_RESULT_NOTFOUND); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetPannableHandsFreeEvent(TX_PANNABLEHANDSFREEEVENTPARAMS* pEventParams) const +{ + return TX_VALIDATE(txGetPannableHandsFreeEventParams(_hObject, pEventParams), TX_RESULT_INVALIDBEHAVIORTYPE, TX_RESULT_NOTFOUND); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetActivatableEventType(TX_ACTIVATABLEEVENTTYPE* pEventType) const +{ + return TX_VALIDATE(txGetActivatableEventType(_hObject, pEventType), TX_RESULT_INVALIDBEHAVIORTYPE); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetActivationFocusChangedEventParams(TX_ACTIVATIONFOCUSCHANGEDEVENTPARAMS* pEventParams) const +{ + return TX_VALIDATE(txGetActivationFocusChangedEventParams(_hObject, pEventParams), TX_RESULT_INVALIDBEHAVIORTYPE, TX_RESULT_NOTFOUND); +} + +/*********************************************************************************************************************/ + +inline void Behavior::SetGazeAwareBehaviorParams(const TX_GAZEAWAREPARAMS& params) +{ + TX_VALIDATE(txSetGazeAwareBehaviorParams(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetGazeAwareBehaviorParams(TX_GAZEAWAREPARAMS* pParams) const +{ + return TX_VALIDATE(txGetGazeAwareBehaviorParams(_hObject, pParams), TX_RESULT_INVALIDBEHAVIORTYPE, TX_RESULT_NOTFOUND); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetGazeAwareEventParams(TX_GAZEAWAREEVENTPARAMS* pEventParams) const +{ + return TX_VALIDATE(txGetGazeAwareBehaviorEventParams(_hObject, pEventParams), TX_RESULT_INVALIDBEHAVIORTYPE); +} + +/*********************************************************************************************************************/ + +inline void Behavior::SetFixationDataBehaviorParams(const TX_FIXATIONDATAPARAMS& params) +{ + TX_VALIDATE(txSetFixationDataBehaviorParams(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetFixationDataBehaviorParams(TX_FIXATIONDATAPARAMS* pParams) const +{ + return TX_VALIDATE(txGetFixationDataBehaviorParams(_hObject, pParams), TX_RESULT_INVALIDBEHAVIORTYPE); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetFixationDataEventParams(TX_FIXATIONDATAEVENTPARAMS* pEventParams) const +{ + return TX_VALIDATE(txGetFixationDataEventParams(_hObject, pEventParams), TX_RESULT_INVALIDBEHAVIORTYPE, TX_RESULT_NOTFOUND); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetGazePointDataEventParams(TX_GAZEPOINTDATAEVENTPARAMS* pEventParams) const +{ + return TX_VALIDATE(txGetGazePointDataEventParams(_hObject, pEventParams), TX_RESULT_INVALIDBEHAVIORTYPE, TX_RESULT_NOTFOUND); +} + +/*********************************************************************************************************************/ + +inline bool Behavior::TryGetEyePositionDataEventParams(TX_EYEPOSITIONDATAEVENTPARAMS* pEventParams) const +{ + return TX_VALIDATE(txGetEyePositionDataEventParams(_hObject, pEventParams), TX_RESULT_INVALIDBEHAVIORTYPE, TX_RESULT_NOTFOUND); +} + +/*********************************************************************************************************************/ + + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Behavior__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Bounds.hpp b/Tobii EyeX/include/eyex-cpp/Bounds.hpp new file mode 100755 index 0000000..f355ac4 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Bounds.hpp @@ -0,0 +1,43 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Bounds.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Bounds__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Bounds__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Bounds : + public InteractionObject +{ +public: + Bounds(const std::shared_ptr& spContext, TX_HANDLE hBounds); + + TX_BOUNDSTYPE GetType() const; + +public: + bool TryGetRectangularData(TX_REAL* pX, TX_REAL* pY, TX_REAL* pWidth, TX_REAL* pHeight) const; + void SetRectangularData(TX_REAL x, TX_REAL y, TX_REAL width, TX_REAL height); + + bool TryGetRectangularData(TX_RECT* pData) const; + void SetRectangularData(const TX_RECT& data); + + std::shared_ptr GetData() const; + void SetData(const std::shared_ptr& spData); +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Bounds__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Bounds.inl b/Tobii EyeX/include/eyex-cpp/Bounds.inl new file mode 100755 index 0000000..495e779 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Bounds.inl @@ -0,0 +1,86 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Bounds.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Bounds__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Bounds__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline Bounds::Bounds(const std::shared_ptr& spContext, TX_HANDLE hBounds) +: InteractionObject(spContext, hBounds) +{} + +/*********************************************************************************************************************/ + +inline TX_BOUNDSTYPE Bounds::GetType() const +{ + TX_BOUNDSTYPE boundsType; + TX_VALIDATE(txGetBoundsType(_hObject, &boundsType)); + return boundsType; +} + +/*********************************************************************************************************************/ + + +inline bool Bounds::TryGetRectangularData(TX_REAL* pX, TX_REAL* pY, TX_REAL* pWidth, TX_REAL* pHeight) const +{ + return txGetRectangularBoundsData(_hObject, pX, pY, pWidth, pHeight) == TX_RESULT_OK; +} + +/*********************************************************************************************************************/ + +inline void Bounds::SetRectangularData(TX_REAL x, TX_REAL y, TX_REAL width, TX_REAL height) +{ + txSetRectangularBoundsData(_hObject, x, y, width, height); +} + +/*********************************************************************************************************************/ + +inline bool Bounds::TryGetRectangularData(TX_RECT* pData) const +{ + return TryGetRectangularData(&pData->X, &pData->Y, &pData->Width, &pData->Height); +} + +/*********************************************************************************************************************/ + +inline void Bounds::SetRectangularData(const TX_RECT& data) +{ + SetRectangularData(data.X, data.Y, data.Width, data.Height); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Bounds::GetData() const +{ + auto spProperty = GetProperty(TX_LITERAL_DATA); + + std::shared_ptr spData; + if(spProperty->TryGetValue(&spData)) + return spData; + + return nullptr; +} + +/*********************************************************************************************************************/ + +inline void Bounds::SetData(const std::shared_ptr& spData) +{ + auto spProperty = GetProperty(TX_LITERAL_DATA); + spProperty->SetValue(spData); +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Bounds__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Callbacks.hpp b/Tobii EyeX/include/eyex-cpp/Callbacks.hpp new file mode 100755 index 0000000..84bd702 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Callbacks.hpp @@ -0,0 +1,26 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Callbacks.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_CALLBACKS__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_CALLBACKS__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +typedef std::function ConnectionStateChangedHandler; +typedef std::function&)> AsyncDataHandler; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_CALLBACKS__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Command.hpp b/Tobii EyeX/include/eyex-cpp/Command.hpp new file mode 100755 index 0000000..ef1f189 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Command.hpp @@ -0,0 +1,38 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Command.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Command__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Command__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Command : + public InteractionObject +{ +public: + Command(const std::shared_ptr& spContext, TX_HANDLE hCommand); + + TX_COMMANDTYPE GetType() const; + void ExecuteAsync(AsyncDataHandler fnHandler); + +public: + std::shared_ptr GetData() const; + void SetData(const std::shared_ptr& spData); +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Command__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Command.inl b/Tobii EyeX/include/eyex-cpp/Command.inl new file mode 100755 index 0000000..953687f --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Command.inl @@ -0,0 +1,70 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Command.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Command__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Command__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline Command::Command(const std::shared_ptr& spContext, TX_HANDLE hCommand) +: InteractionObject(spContext, hCommand) +{} + +/*********************************************************************************************************************/ + +inline TX_COMMANDTYPE Command::GetType() const +{ + TX_COMMANDTYPE commandType; + TX_VALIDATE(txGetCommandType(_hObject, &commandType)); + return commandType; +} + +/*********************************************************************************************************************/ + +inline void Command::ExecuteAsync(AsyncDataHandler fnHandler) +{ + auto spThis = shared_from_this(); + auto fnProxy = [&, spThis, fnHandler](TX_CONSTHANDLE hAsyncData) + { + GetContext()->InvokeAsyncDataHandler(hAsyncData, fnHandler); + }; + + TX_VALIDATE(Tx::ExecuteCommandAsync(_hObject, fnProxy)); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Command::GetData() const +{ + auto spProperty = GetProperty(TX_LITERAL_DATA); + + std::shared_ptr spData; + if(spProperty->TryGetValue(&spData)) + return spData; + + return nullptr; +} + +/*********************************************************************************************************************/ + +inline void Command::SetData(const std::shared_ptr& spData) +{ + auto spProperty = GetProperty(TX_LITERAL_DATA); + spProperty->SetValue(spData); +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Command__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Context.hpp b/Tobii EyeX/include/eyex-cpp/Context.hpp new file mode 100755 index 0000000..c6cefa0 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Context.hpp @@ -0,0 +1,91 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Context.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Context__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Context__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Context : + public std::enable_shared_from_this +{ + Context(bool trackObjects); + +public: + static std::shared_ptr Create(bool trackObjects); + virtual ~Context(); + + TX_CONTEXTHANDLE GetHandle() const; + void SetName(const std::string& name); + std::string GetName() const; + + TX_TICKET RegisterConnectionStateChangedHandler(ConnectionStateChangedHandler fnConnectionStateChangedHandler); + void UnregisterConnectionStateChangedHandler(TX_TICKET ticket); + + void EnableConnection(); + void DisableConnection(); + void Shutdown(); + + + TX_TICKET RegisterMessageHandler(TX_MESSAGETYPE messageType, std::shared_ptr spOptions, AsyncDataHandler fnAsyncDataHandler); + void UnregisterMessageHandler(TX_TICKET ticket); + + void RegisterStateObserver(const std::string& statePath); + void UnregisterStateObserver(const std::string& statePath); + void GetStateAsync(const std::string& statePath, AsyncDataHandler fnCompletion) const; + std::shared_ptr GetState(const std::string& statePath) const; + + TX_TICKET RegisterStateChangedHandler(const std::string& statePath, AsyncDataHandler fnHandler); + void UnregisterStateChangedHandler(TX_TICKET ticket); + + template + void SetStateAsync(const std::string& statePath, const TValue& value, AsyncDataHandler fnCompletion = nullptr); + + std::vector> GetTrackedObjects() const; + + std::shared_ptr CreateObject(TX_HANDLE hObject) const; + std::shared_ptr CreateObject(Tx::Utils::ScopedHandle& hObject) const; + std::shared_ptr CreateProperty(TX_PROPERTYHANDLE hProperty) const; + + std::shared_ptr CreateBag(TX_PROPERTYBAGTYPE bagType = TX_PROPERTYBAGTYPE_OBJECT) const; + std::shared_ptr CreateStateBag(const std::string& statePath) const; + std::shared_ptr CreateSnapshot() const; + std::shared_ptr CreateGlobalInteractorSnapshot(TX_CONSTSTRING globalInteractorId, std::shared_ptr* pspInteractor) const; + std::shared_ptr CreateCommand(TX_COMMANDTYPE commandType) const; + std::shared_ptr CreateActionCommand(TX_ACTIONTYPE actionType) const; + + void DisableBuiltinKeys(const std::string& windowId, AsyncDataHandler fnCompletion = nullptr) const; + void EnableBuiltinKeys(const std::string& windowId, AsyncDataHandler fnCompletion = nullptr) const; + + void LaunchConfigurationTool(TX_CONFIGURATIONTOOL configurationTool, AsyncDataHandler fnCompletion = nullptr) const; + + template + std::shared_ptr CreateObject(TX_HANDLE hObject) const; + + template + std::shared_ptr CreateObject(Tx::Utils::ScopedHandle& hObject) const; + + void WriteLogMessage(TX_LOGLEVEL level, const std::string& scope, const std::string& message); + void PerformScheduledJobs(); + + void InvokeAsyncDataHandler(TX_CONSTHANDLE hAsyncData, AsyncDataHandler fnHandler) const; + +private: + TX_CONTEXTHANDLE _hContext; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Context__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Context.inl b/Tobii EyeX/include/eyex-cpp/Context.inl new file mode 100755 index 0000000..1e9089a --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Context.inl @@ -0,0 +1,427 @@ +/********************************************************************************************************************* +* Copyright 2013-2014 Tobii Technology AB. All rights reserved. +* Context.inl +*********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Context__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Context__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::Create(bool trackObjects) +{ + return std::shared_ptr(new Context(trackObjects)); +} + +/*********************************************************************************************************************/ + +inline Context::Context(bool trackObjects) + : _hContext(TX_EMPTY_HANDLE) +{ + TX_VALIDATE(txCreateContext(&_hContext, trackObjects ? TX_TRUE : TX_FALSE)); +} + +/*********************************************************************************************************************/ + +inline void Context::Shutdown() +{ + txShutdownContext(_hContext, 1000, TX_TRUE); +} + +/*********************************************************************************************************************/ + +inline Context::~Context() +{ + txReleaseContext(&_hContext); +} + +/*********************************************************************************************************************/ + +inline TX_CONTEXTHANDLE Context::GetHandle() const +{ + return _hContext; +} + +/*********************************************************************************************************************/ + +inline void Context::SetName(const std::string& name) +{ + TX_VALIDATE(txSetContextName(_hContext, name.c_str())); +} + +/*********************************************************************************************************************/ + +inline std::string Context::GetName() const +{ + std::string name; + TX_VALIDATE(Tx::Utils::GetString(&name, txGetContextName, _hContext)); + return name; +} + +/*********************************************************************************************************************/ + +inline TX_TICKET Context::RegisterConnectionStateChangedHandler(ConnectionStateChangedHandler fnConnectionStateChangedHandler) +{ + TX_TICKET ticket; + TX_VALIDATE(Tx::RegisterConnectionStateChangedHandler(_hContext, &ticket, fnConnectionStateChangedHandler)); + return ticket; +} + +/*********************************************************************************************************************/ + +inline void Context::UnregisterConnectionStateChangedHandler(TX_TICKET ticket) +{ + TX_VALIDATE(txUnregisterConnectionStateChangedHandler(_hContext, ticket)); +} + +/*********************************************************************************************************************/ + +inline void Context::EnableConnection() +{ + TX_VALIDATE(txEnableConnection(_hContext)); +} + +/*********************************************************************************************************************/ + +inline void Context::DisableConnection() +{ + TX_VALIDATE(txDisableConnection(_hContext)); +} + +/*********************************************************************************************************************/ + +inline TX_TICKET Context::RegisterMessageHandler(TX_MESSAGETYPE messageType, std::shared_ptr spOptions, AsyncDataHandler fnMessageHandler) +{ + auto fnProxy = [&, fnMessageHandler](TX_CONSTHANDLE hAsyncData) + { + InvokeAsyncDataHandler(hAsyncData, fnMessageHandler); + }; + + auto hOptions = spOptions ? spOptions->GetHandle() : nullptr; + + TX_TICKET ticket = 0; + Tx::RegisterMessageHandler(_hContext, &ticket, messageType, hOptions, fnProxy); + return ticket; +} + +/*********************************************************************************************************************/ + +inline void Context::UnregisterMessageHandler(TX_TICKET ticket) +{ + TX_VALIDATE(txUnregisterMessageHandler(_hContext, ticket)); +} + +/*********************************************************************************************************************/ + +inline void Context::RegisterStateObserver(const std::string& statePath) +{ + TX_VALIDATE(txRegisterStateObserver(_hContext, statePath.c_str())); +} + +/*********************************************************************************************************************/ + +inline void Context::UnregisterStateObserver(const std::string& statePath) +{ + TX_VALIDATE(txUnregisterStateObserver(_hContext, statePath.c_str())); +} + +/*********************************************************************************************************************/ + +inline void Context::GetStateAsync(const std::string& statePath, AsyncDataHandler fnCompletion) const +{ + auto callback = [&, fnCompletion](TX_CONSTHANDLE hAsyncData) + { + InvokeAsyncDataHandler(hAsyncData, fnCompletion); + }; + + TX_VALIDATE(Tx::GetStateAsync(_hContext, statePath.c_str(), callback)); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::GetState(const std::string& statePath) const +{ + Tx::Utils::ScopedHandle hStateBag; + TX_VALIDATE(txGetState(_hContext, statePath.c_str(), &hStateBag)); + + std::shared_ptr spStateBag; + if(hStateBag) + spStateBag = CreateObject(hStateBag); + + return spStateBag; +} + +/*********************************************************************************************************************/ + +inline TX_TICKET Context::RegisterStateChangedHandler(const std::string& statePath, AsyncDataHandler fnHandler) +{ + auto callback = [&, fnHandler](TX_CONSTHANDLE hAsyncData) + { + InvokeAsyncDataHandler(hAsyncData, fnHandler); + }; + + TX_TICKET ticket; + TX_VALIDATE(Tx::RegisterStateChangedHandler(_hContext, &ticket, statePath.c_str(), callback)); + + return ticket; +} + +/*********************************************************************************************************************/ + +inline void Context::UnregisterStateChangedHandler(TX_TICKET ticket) +{ + TX_VALIDATE(txUnregisterStateChangedHandler(_hContext, ticket)); +} + +/*********************************************************************************************************************/ + +template +inline void Context::SetStateAsync(const std::string& statePath, const TValue& value, AsyncDataHandler fnCompletion) +{ + auto stateBag = CreateStateBag(statePath); + stateBag->SetStateValue(statePath, value); + stateBag->SetAsync(fnCompletion); +} + +/*********************************************************************************************************************/ + +inline std::vector> Context::GetTrackedObjects() const +{ + std::vector objectHandles; + TX_VALIDATE(Tx::Utils::GetBufferData(objectHandles, txGetTrackedObjects, _hContext)); + + std::vector> objects; + + for(auto& hObject : objectHandles) + { + auto spObject = CreateObject(hObject); + objects.push_back(spObject); + } + + return objects; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::CreateObject(TX_HANDLE hObject) const +{ + TX_INTERACTIONOBJECTTYPE objectType; + TX_VALIDATE(txGetObjectType(hObject, &objectType)); + + switch(objectType) + { + case TX_INTERACTIONOBJECTTYPE_BEHAVIOR: + return CreateObject(hObject); + + case TX_INTERACTIONOBJECTTYPE_BOUNDS: + return CreateObject(hObject); + + case TX_INTERACTIONOBJECTTYPE_COMMAND: + return CreateObject(hObject); + + case TX_INTERACTIONOBJECTTYPE_QUERY: + return CreateObject(hObject); + + case TX_INTERACTIONOBJECTTYPE_EVENT: + return CreateObject(hObject); + + case TX_INTERACTIONOBJECTTYPE_INTERACTOR: + return CreateObject(hObject); + + case TX_INTERACTIONOBJECTTYPE_SNAPSHOT: + return CreateObject(hObject); + + case TX_INTERACTIONOBJECTTYPE_PROPERTYBAG: + return CreateObject(hObject); + + case TX_INTERACTIONOBJECTTYPE_STATEBAG: + return CreateObject(hObject); + + case TX_INTERACTIONOBJECTTYPE_NOTIFICATION: + return CreateObject(hObject); + } + + throw APIException(TX_RESULT_UNKNOWN, "Unknown interaction object type"); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::CreateObject(Tx::Utils::ScopedHandle& hObject) const +{ + auto spObject = CreateObject((TX_HANDLE)hObject); + + if(spObject) + hObject.Detach(); + + return spObject; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::CreateProperty(TX_PROPERTYHANDLE hProperty) const +{ + auto spProperty = std::make_shared(shared_from_this(), hProperty); + return spProperty; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::CreateBag(TX_PROPERTYBAGTYPE bagType) const +{ + Tx::Utils::ScopedHandle hBag; + TX_VALIDATE(txCreatePropertyBag(_hContext, &hBag, bagType)); + auto spBag = CreateObject(hBag); + return spBag; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::CreateStateBag(const std::string& statePath) const +{ + Tx::Utils::ScopedHandle hStateBag; + TX_VALIDATE(txCreateStateBag(_hContext, &hStateBag, statePath.c_str())); + auto spStateBag = CreateObject(hStateBag); + return spStateBag; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::CreateSnapshot() const +{ + Tx::Utils::ScopedHandle hSnapshot; + TX_VALIDATE(txCreateSnapshot(_hContext, &hSnapshot)); + auto spSnapshot = CreateObject(hSnapshot); + return spSnapshot; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::CreateGlobalInteractorSnapshot(TX_CONSTSTRING globalInteractorId, std::shared_ptr* pspInteractor) const +{ + Tx::Utils::ScopedHandle hSnapshot, hInteractor; + TX_VALIDATE(txCreateGlobalInteractorSnapshot(_hContext, globalInteractorId, &hSnapshot, &hInteractor)); + *pspInteractor = CreateObject(hInteractor); + auto spSnapshot = CreateObject(hSnapshot); + return spSnapshot; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::CreateCommand(TX_COMMANDTYPE commandType) const +{ + Tx::Utils::ScopedHandle hCommand; + TX_VALIDATE(txCreateCommand(_hContext, &hCommand, commandType)); + auto spCommand = CreateObject(hCommand); + return spCommand; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Context::CreateActionCommand(TX_ACTIONTYPE actionType) const +{ + Tx::Utils::ScopedHandle hCommand; + TX_VALIDATE(txCreateActionCommand(_hContext, &hCommand, actionType)); + auto spCommand = CreateObject(hCommand); + return spCommand; +} + +/*********************************************************************************************************************/ + +inline void Context::DisableBuiltinKeys(const std::string& windowId, AsyncDataHandler fnCompletion) const +{ + auto callback = [&, fnCompletion](TX_CONSTHANDLE hAsyncData) + { + InvokeAsyncDataHandler(hAsyncData, fnCompletion); + }; + + TX_VALIDATE(Tx::DisableBuiltinKeys(_hContext, windowId.c_str(), callback)); +} + +/*********************************************************************************************************************/ + +inline void Context::EnableBuiltinKeys(const std::string& windowId, AsyncDataHandler fnCompletion) const +{ + auto callback = [&, fnCompletion](TX_CONSTHANDLE hAsyncData) + { + InvokeAsyncDataHandler(hAsyncData, fnCompletion); + }; + + TX_VALIDATE(Tx::EnableBuiltinKeys(_hContext, windowId.c_str(), callback)); +} + +/*********************************************************************************************************************/ + +inline void Context::LaunchConfigurationTool(TX_CONFIGURATIONTOOL configurationTool, AsyncDataHandler fnCompletion) const +{ + auto callback = [&, fnCompletion](TX_CONSTHANDLE hAsyncData) + { + InvokeAsyncDataHandler(hAsyncData, fnCompletion); + }; + + TX_VALIDATE(Tx::LaunchConfigurationTool(_hContext, configurationTool, callback)); +} + +/*********************************************************************************************************************/ + +template +inline std::shared_ptr Context::CreateObject(TX_HANDLE hObject) const +{ + return std::make_shared(shared_from_this(), hObject); +} + +/*********************************************************************************************************************/ + +template +inline std::shared_ptr Context::CreateObject(Tx::Utils::ScopedHandle& hObject) const +{ + auto spObject = CreateObject((TX_HANDLE)hObject); + + if(spObject) + hObject.Detach(); + + return spObject; +} + +/*********************************************************************************************************************/ + +inline void Context::WriteLogMessage(TX_LOGLEVEL level, const std::string& scope, const std::string& message) +{ + TX_VALIDATE(txWriteLogMessage(level, scope.c_str(), message.c_str())); +} + +/*********************************************************************************************************************/ + +inline void Context::PerformScheduledJobs() +{ + TX_VALIDATE(txPerformScheduledJobs(_hContext)); +} + +/*********************************************************************************************************************/ + +inline void Context::InvokeAsyncDataHandler(TX_CONSTHANDLE hAsyncData, AsyncDataHandler fnHandler) const +{ + if(!fnHandler) + return; + + try + { + auto upAsyncData = std::unique_ptr(new AsyncData(shared_from_this(), hAsyncData)); + fnHandler(upAsyncData); + } + catch(...) + { } +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Context__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Environment.hpp b/Tobii EyeX/include/eyex-cpp/Environment.hpp new file mode 100755 index 0000000..5a4a8c8 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Environment.hpp @@ -0,0 +1,45 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Environment.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_ENVIRONMENT__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_ENVIRONMENT__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Environment +{ + Environment( + TX_EYEXCOMPONENTOVERRIDEFLAGS flags, + TX_LOGGINGMODEL* pLoggingModel, + TX_THREADINGMODEL* pThreadingModel, + TX_SCHEDULINGMODEL* pSchedulingModel, + void* pMemoryModel); +public: + virtual ~Environment(); + + static std::shared_ptr Initialize( + TX_EYEXCOMPONENTOVERRIDEFLAGS flags, + TX_LOGGINGMODEL* pLoggingModel, + TX_THREADINGMODEL* pThreadingModel, + TX_SCHEDULINGMODEL* pSchedulingModel, + void* pMemoryModel); + + TX_EYEXAVAILABILITY GetEyeXAvailability(); + static bool IsInitialized(); +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_ENVIRONMENT__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Environment.inl b/Tobii EyeX/include/eyex-cpp/Environment.inl new file mode 100755 index 0000000..fa83b1f --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Environment.inl @@ -0,0 +1,70 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Environment.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_ENVIRONMENT__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_ENVIRONMENT__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline Environment::Environment( + TX_EYEXCOMPONENTOVERRIDEFLAGS flags, + TX_LOGGINGMODEL* pLoggingModel, + TX_THREADINGMODEL* pThreadingModel, + TX_SCHEDULINGMODEL* pSchedulingModel, + void* pMemoryModel) +{ + TX_VALIDATE(txInitializeEyeX(flags, pLoggingModel, pThreadingModel, pSchedulingModel, pMemoryModel)); +} + +/*********************************************************************************************************************/ + +inline Environment::~Environment() +{ + TX_VALIDATE(txUninitializeEyeX()); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Environment::Initialize( + TX_EYEXCOMPONENTOVERRIDEFLAGS flags, + TX_LOGGINGMODEL* pLoggingModel, + TX_THREADINGMODEL* pThreadingModel, + TX_SCHEDULINGMODEL* pSchedulingModel, + void* pMemoryModel) +{ + return std::shared_ptr(new Environment(flags, pLoggingModel, pThreadingModel, pSchedulingModel, pMemoryModel)); +} + +/*********************************************************************************************************************/ + +inline TX_EYEXAVAILABILITY Environment::GetEyeXAvailability() +{ + TX_EYEXAVAILABILITY availability; + TX_VALIDATE(txGetEyeXAvailability(&availability)); + return availability; +} + +/*********************************************************************************************************************/ + +inline bool Environment::IsInitialized() +{ + TX_BOOL res; + txIsEyeXInitialized(&res); + return res != TX_FALSE; +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_ENVIRONMENT__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/EyeX.hpp b/Tobii EyeX/include/eyex-cpp/EyeX.hpp new file mode 100755 index 0000000..b0c8123 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/EyeX.hpp @@ -0,0 +1,105 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeX.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_TX__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_TX__HPP__ + +/*********************************************************************************************************************/ + +#define TX_NAMESPACE_BEGIN namespace EyeX { +#define TX_NAMESPACE_END } + +/*********************************************************************************************************************/ + +#include +#include +#include +#include +#include +#include +#include +#include + +/*********************************************************************************************************************/ + +#define TOBII_TX_DETAIL + +#include "eyex/EyeX.h" + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +class Environment; +class InteractionObject; +class Property; +class PropertyBag; +class Bounds; +class Behavior; +class Interactor; +class Snapshot; +class SnapshotResult; +class Command; +class CommandResult; +class Query; +class InteractionEvent; +class Notification; +class AsyncData; +class StateBag; +class Mask; + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#include "APIException.hpp" +#include "Callbacks.hpp" +#include "Environment.hpp" +#include "PropertyValueResolver.hpp" +#include "Context.hpp" +#include "HandleWrapper.hpp" +#include "InteractionObject.hpp" +#include "Behavior.hpp" +#include "Bounds.hpp" +#include "Command.hpp" +#include "AsyncData.hpp" +#include "InteractionEvent.hpp" +#include "Query.hpp" +#include "Snapshot.hpp" +#include "Interactor.hpp" +#include "Property.hpp" +#include "PropertyBag.hpp" +#include "Notification.hpp" +#include "StateBag.hpp" +#include "Mask.hpp" +#include "InteractionAgentBase.hpp" + +/*********************************************************************************************************************/ + +#include "PropertyValueResolver.inl" +#include "Environment.inl" +#include "Context.inl" +#include "HandleWrapper.inl" +#include "InteractionObject.inl" +#include "Behavior.inl" +#include "Bounds.inl" +#include "Command.inl" +#include "AsyncData.inl" +#include "InteractionEvent.inl" +#include "Query.inl" +#include "Snapshot.inl" +#include "Interactor.inl" +#include "Property.inl" +#include "PropertyBag.inl" +#include "Notification.inl" +#include "StateBag.inl" +#include "Mask.inl" +#include "InteractionAgentBase.inl" + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_TX__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/HandleWrapper.hpp b/Tobii EyeX/include/eyex-cpp/HandleWrapper.hpp new file mode 100755 index 0000000..d32b83c --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/HandleWrapper.hpp @@ -0,0 +1,44 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * HandleWrapper.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_HANDLEWRAPPER__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_HANDLEWRAPPER__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +template +class HandleWrapper : + public std::enable_shared_from_this> +{ +public: + HandleWrapper(const std::shared_ptr& spContext, THandle hObject); + virtual ~HandleWrapper(); + + std::shared_ptr GetContext() const; + THandle GetHandle() const; + +protected: + template + inline static std::string GetString(TX_RESULT (*pFn)(THandle1, TX_STRING, TX_SIZE*), THandle2 handle, TX_SIZE estimatedLength = 0); + +protected: + std::shared_ptr _spContext; + THandle _hObject; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_HANDLEWRAPPER__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/HandleWrapper.inl b/Tobii EyeX/include/eyex-cpp/HandleWrapper.inl new file mode 100755 index 0000000..eae842e --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/HandleWrapper.inl @@ -0,0 +1,61 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * InteractionObject.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_HANDLEWRAPPER__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_HANDLEWRAPPER__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +template +inline HandleWrapper::HandleWrapper(const std::shared_ptr& spContext, THandle hObject) +: _spContext(spContext), _hObject(hObject) +{} + +/*********************************************************************************************************************/ + +template +inline HandleWrapper::~HandleWrapper() +{ } + +/*********************************************************************************************************************/ + +template +inline std::shared_ptr HandleWrapper::GetContext() const +{ + return _spContext; +} + +/*********************************************************************************************************************/ + +template +inline THandle HandleWrapper::GetHandle() const +{ + return _hObject; +} + +/*********************************************************************************************************************/ + +template +template +inline static std::string HandleWrapper::GetString(TX_RESULT (*pFn)(THandle1, TX_STRING, TX_SIZE*), THandle2 handle, TX_SIZE estimatedLength) +{ + std::string str; + TX_VALIDATE(Tx::Utils::GetString(&str, pFn, handle, estimatedLength)); + return str; +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_HANDLEWRAPPER__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/InteractionAgentBase.hpp b/Tobii EyeX/include/eyex-cpp/InteractionAgentBase.hpp new file mode 100755 index 0000000..3ca22d4 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/InteractionAgentBase.hpp @@ -0,0 +1,79 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * InteractionAgentBase.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONAGENTBASE__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONAGENTBASE__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class InteractionAgentBase +{ +public: + void Initialize(); + void Uninitialize(); + + std::shared_ptr GetContext() const; + +protected: + InteractionAgentBase(bool trackObjects = true); + + virtual void OnInitialize() {} + virtual void OnUninitialize() {} + virtual void OnRegisterQueryHandlers(); + + virtual void OnConnectionStateChanged(TX_CONNECTIONSTATE state) {} + virtual void OnNotification(const std::shared_ptr& spNotification) {} + virtual void OnQuery(const std::shared_ptr& spQuery) {} + virtual void OnEvent(const std::shared_ptr& spEvent) {} + + virtual std::shared_ptr InitializeEyeX(); + virtual TX_LOGGINGMODEL* GetLoggingModel(); + virtual TX_THREADINGMODEL* GetThreadingModel() { return nullptr; } + virtual TX_SCHEDULINGMODEL* GetSchedulingModel() { return nullptr; } + + void RegisterQueryHandler(const std::string& processId); + + bool IsRunning() const; + +private: + bool _isRunning; + + std::shared_ptr _spContext; + TX_TICKET _connectionStateChangedHandlerTicket; + std::vector _messageHandlerTickets; + std::shared_ptr _spSystem; + bool _trackObjects; + + TX_LOGGINGMODEL _defaultLoggingModel; +}; + +/*********************************************************************************************************************/ + +class AutoRespondingInteractionAgentBase : + public InteractionAgentBase +{ +public: + AutoRespondingInteractionAgentBase(bool trackObjects = true); + +protected: + void OnQuery(const std::shared_ptr& spQuery) override; + + virtual bool PrepareSnapshot(const std::shared_ptr& spSnapshot) { return false; } + virtual void OnSnapshotResult(const std::unique_ptr& upAsyncData) {} +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONAGENTBASE__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/InteractionAgentBase.inl b/Tobii EyeX/include/eyex-cpp/InteractionAgentBase.inl new file mode 100755 index 0000000..c949822 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/InteractionAgentBase.inl @@ -0,0 +1,183 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * InteractionAgentBase.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONAGENTBASE__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONAGENTBASE__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline InteractionAgentBase::InteractionAgentBase(bool trackObjects) : +_trackObjects(trackObjects) +{ + memset(&_defaultLoggingModel, 0, sizeof(_defaultLoggingModel)); + _defaultLoggingModel.Targets = TX_LOGTARGET_CONSOLE; + +#if _DEBUG + _defaultLoggingModel.Targets = (TX_LOGTARGET)(_defaultLoggingModel.Targets | TX_LOGTARGET_TRACE); +#endif +} + +/*********************************************************************************************************************/ + +inline void InteractionAgentBase::Initialize() +{ + _isRunning = true; + _spSystem = InitializeEyeX(); + _spContext = Context::Create(_trackObjects); + + _connectionStateChangedHandlerTicket = _spContext->RegisterConnectionStateChangedHandler([this] (TX_CONNECTIONSTATE state) { + OnConnectionStateChanged(state); + }); + + auto eventHandlerTicket = _spContext->RegisterMessageHandler(TX_MESSAGETYPE_EVENT, nullptr, [this] (const std::unique_ptr& upAsyncData) { + auto spEvent = upAsyncData->GetDataAs(); + OnEvent(spEvent); + }); + + auto notificationHandlerTicket = _spContext->RegisterMessageHandler(TX_MESSAGETYPE_NOTIFICATION, nullptr, [this] (const std::unique_ptr& upAsyncData) { + auto spNotification = upAsyncData->GetDataAs(); + OnNotification(spNotification); + }); + + _messageHandlerTickets.push_back(eventHandlerTicket); + _messageHandlerTickets.push_back(notificationHandlerTicket); + + OnRegisterQueryHandlers(); + OnInitialize(); + + _spContext->EnableConnection(); +} + +/*********************************************************************************************************************/ + +inline void InteractionAgentBase::Uninitialize() +{ + _isRunning = false; + + OnUninitialize(); + _spContext->DisableConnection(); + + for(auto messageHandlerTicket : _messageHandlerTickets) + _spContext->UnregisterMessageHandler(messageHandlerTicket); + + _spContext->Shutdown(); + _spContext->UnregisterConnectionStateChangedHandler(_connectionStateChangedHandlerTicket); + + _spContext.reset(); + _spSystem.reset(); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr InteractionAgentBase::GetContext() const +{ + return _spContext; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr InteractionAgentBase::InitializeEyeX() +{ + auto pLoggingModel = GetLoggingModel(); + auto pThreadingModel = GetThreadingModel(); + auto pSchedulingModel = GetSchedulingModel(); + + auto overrideFlags = TX_EYEXCOMPONENTOVERRIDEFLAG_NONE; + + if(pLoggingModel) + overrideFlags = (TX_EYEXCOMPONENTOVERRIDEFLAGS)(overrideFlags | TX_EYEXCOMPONENTOVERRIDEFLAG_LOGGINGMODEL); + + if(pThreadingModel) + overrideFlags = (TX_EYEXCOMPONENTOVERRIDEFLAGS)(overrideFlags | TX_EYEXCOMPONENTOVERRIDEFLAG_INTERNAL_THREADINGMODEL); + + if(pSchedulingModel) + overrideFlags = (TX_EYEXCOMPONENTOVERRIDEFLAGS)(overrideFlags | TX_EYEXCOMPONENTOVERRIDEFLAG_INTERNAL_SCHEDULINGMODEL); + + return Environment::Initialize(overrideFlags, pLoggingModel, pThreadingModel, pSchedulingModel, nullptr); +} + +/*********************************************************************************************************************/ + +inline void InteractionAgentBase::OnRegisterQueryHandlers() +{ + auto currentProcessId = GetCurrentProcessId(); + auto currentProcessIdStr = std::to_string(currentProcessId); + RegisterQueryHandler(currentProcessIdStr); +} + +/*********************************************************************************************************************/ + +inline void InteractionAgentBase::RegisterQueryHandler(const std::string& processId) +{ + auto spOptions = _spContext->CreateBag(); + auto spProcessIdProeprty = spOptions->CreateProperty(TX_LITERAL_TARGETPROCESSID); + spProcessIdProeprty->SetValue(processId); + + auto fnQueryHandler = [this](const std::unique_ptr& upAsyncData) + { + auto spQuery = upAsyncData->GetDataAs(); + OnQuery(spQuery); + }; + + auto ticket = _spContext->RegisterMessageHandler(TX_MESSAGETYPE_QUERY, spOptions, fnQueryHandler); + _messageHandlerTickets.push_back(ticket); +} + +/*********************************************************************************************************************/ + +inline TX_LOGGINGMODEL* InteractionAgentBase::GetLoggingModel() +{ + return &_defaultLoggingModel; +} + +/*********************************************************************************************************************/ + +inline bool InteractionAgentBase::IsRunning() const +{ + return _isRunning; +} + +/*********************************************************************************************************************/ + +inline AutoRespondingInteractionAgentBase::AutoRespondingInteractionAgentBase(bool trackObjects) + : InteractionAgentBase(trackObjects) +{ } + +/*********************************************************************************************************************/ + +inline void AutoRespondingInteractionAgentBase::OnQuery(const std::shared_ptr& spQuery) +{ + auto spSnapshot = Snapshot::CreateSnapshotForQuery(spQuery); + + try + { + if(!PrepareSnapshot(spSnapshot)) + return; + } + catch(...) + { + GetContext()->WriteLogMessage(TX_LOGLEVEL_ERROR, "AutoRespondingInteractionAgentBase", "Custom snapshot preparation throw an exception"); + return; + } + + spSnapshot->CommitAsync([this](const std::unique_ptr& upAsyncData) + { + OnSnapshotResult(upAsyncData); + }); +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONAGENTBASE__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/InteractionContext.cpp b/Tobii EyeX/include/eyex-cpp/InteractionContext.cpp new file mode 100755 index 0000000..ac08a78 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/InteractionContext.cpp @@ -0,0 +1,28 @@ +//--------------------------------------------------------------------------------------------------------------------- +// InteractionContext.cpp +//--------------------------------------------------------------------------------------------------------------------- + +#include "Precompiled.hpp" +#include "InteractionContext.hpp" +#include "InteractionObject.hpp" +#include "InteractionCommand.hpp" +#include "InteractionBehavior.hpp" +#include "InteractionBounds.hpp" +#include "Interactor.hpp" +#include "InteractionQuery.hpp" +#include "InteractionEvent.hpp" +#include "InteractionSnapshot.hpp" +#include "Property.hpp" +#include "PropertyBag.hpp" + +//--------------------------------------------------------------------------------------------------------------------- + +TOBIIGAZE_NAMESPACE_BEGIN + +//--------------------------------------------------------------------------------------------------------------------- + +//--------------------------------------------------------------------------------------------------------------------- + +TOBIIGAZE_NAMESPACE_END + +//--------------------------------------------------------------------------------------------------------------------- diff --git a/Tobii EyeX/include/eyex-cpp/InteractionEvent.hpp b/Tobii EyeX/include/eyex-cpp/InteractionEvent.hpp new file mode 100755 index 0000000..2e6839f --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/InteractionEvent.hpp @@ -0,0 +1,35 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * InteractionEvent.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONEVENT__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONEVENT__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class InteractionEvent : + public InteractionObject +{ +public: + InteractionEvent(const std::shared_ptr& spContext, TX_HANDLE hEvent); + + std::string GetInteractorId() const; + std::vector> GetBehaviors() const; + bool TryGetBehavior(std::shared_ptr* pspBehavior, TX_BEHAVIORTYPE behaviorType) const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONEVENT__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/InteractionEvent.inl b/Tobii EyeX/include/eyex-cpp/InteractionEvent.inl new file mode 100755 index 0000000..b650bef --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/InteractionEvent.inl @@ -0,0 +1,63 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * InteractionEvent.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONEVENT__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONEVENT__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline InteractionEvent::InteractionEvent(const std::shared_ptr& spContext, TX_HANDLE hEvent) +: InteractionObject(spContext, hEvent) +{} + +/*********************************************************************************************************************/ + +inline std::string InteractionEvent::GetInteractorId() const +{ + return GetString(txGetEventInteractorId, _hObject); +} + +/*********************************************************************************************************************/ + +inline std::vector> InteractionEvent::GetBehaviors() const +{ + std::vector behaviorHandles; + TX_VALIDATE(Tx::Utils::GetBufferData(behaviorHandles, txGetEventBehaviors, _hObject)); + + std::vector> behaviors; + for(auto& hBehavior : behaviorHandles) + { + auto spBehavior = _spContext->CreateObject(hBehavior); + behaviors.push_back(spBehavior); + } + + return behaviors; +} + +/*********************************************************************************************************************/ + +inline bool InteractionEvent::TryGetBehavior(std::shared_ptr* pspBehavior, TX_BEHAVIORTYPE behaviorType) const +{ + Tx::Utils::ScopedHandle hBehavior; + if(!TX_VALIDATE(txGetEventBehavior(_hObject, &hBehavior, behaviorType), TX_RESULT_NOTFOUND)) + return false; + + *pspBehavior = _spContext->CreateObject(hBehavior); + return true; +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONEVENT__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/InteractionObject.hpp b/Tobii EyeX/include/eyex-cpp/InteractionObject.hpp new file mode 100755 index 0000000..75d4171 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/InteractionObject.hpp @@ -0,0 +1,63 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * InteractionObject.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONOBJECT__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONOBJECT__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +template +class InteractionObjectBase : + public HandleWrapper +{ +public: + InteractionObjectBase(const std::shared_ptr& spContext, THandle hObject); + + TX_INTERACTIONOBJECTTYPE GetObjectType() const; + + bool TryGetProperty(std::shared_ptr* pspProperty, const std::string& propertyName) const; + std::shared_ptr GetProperty(const std::string& propertyName) const; + std::vector> GetProperties() const; + void CopyPropertiesTo(const std::shared_ptr& spObject) const; + std::string FormatAsText() const; + +public: + template + typename PropertyValueResolver::ValueType GetPropertyValue(const std::string& propertyName) const; + + template + bool TryGetPropertyValue(TValue* pValue, const std::string& propertyName) const; +}; + +/*********************************************************************************************************************/ + +class InteractionObject : + public InteractionObjectBase +{ +public: + InteractionObject(const std::shared_ptr& spContext, TX_HANDLE hObject); + virtual ~InteractionObject(); + + std::shared_ptr CreateProperty(const std::string& propertyName); + +public: + template + void SetPropertyValue(const std::string& propertyName, const TValue& value); +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONOBJECT__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/InteractionObject.inl b/Tobii EyeX/include/eyex-cpp/InteractionObject.inl new file mode 100755 index 0000000..5722ce6 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/InteractionObject.inl @@ -0,0 +1,162 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * InteractionObject.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONOBJECT__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONOBJECT__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +template +inline InteractionObjectBase::InteractionObjectBase(const std::shared_ptr& spContext, THandle hObject) +: HandleWrapper(spContext, hObject) +{ } + +/*********************************************************************************************************************/ + +template +inline TX_INTERACTIONOBJECTTYPE InteractionObjectBase::GetObjectType() const +{ + TX_INTERACTIONOBJECTTYPE objectType; + TX_VALIDATE(txGetObjectType(_hObject, &objectType)); + return objectType; +} + +/*********************************************************************************************************************/ + +template +inline bool InteractionObjectBase::TryGetProperty(std::shared_ptr* pspProperty, const std::string& propertyName) const +{ + TX_PROPERTYHANDLE hProperty; + auto result = txGetProperty(_hObject, &hProperty, propertyName.c_str()); + if(result == TX_RESULT_NOTFOUND) + return false; + + *pspProperty = _spContext->CreateProperty(hProperty); + return true; +} + +/*********************************************************************************************************************/ + +template +inline std::shared_ptr InteractionObjectBase::GetProperty(const std::string& propertyName) const +{ + std::shared_ptr spProperty; + if(TryGetProperty(&spProperty, propertyName)) + return spProperty; + + throw APIException(TX_RESULT_NOTFOUND, "Property not found"); +} + +/*********************************************************************************************************************/ + +template +inline std::vector> InteractionObjectBase::GetProperties() const +{ + std::vector propertyHandles; + TX_VALIDATE(Tx::Utils::GetBufferData(propertyHandles, txGetProperties, _hObject)); + + std::vector> properties; + for(auto& hProperty : propertyHandles) + { + auto spProperty = _spContext->CreateProperty(hProperty); + properties.push_back(spProperty); + } + + return properties; +} + +/*********************************************************************************************************************/ + +template +inline void InteractionObjectBase::CopyPropertiesTo(const std::shared_ptr& spObject) const +{ + TX_VALIDATE(txCopyProperties(_hObject, spObject->GetHandle())); +} + +/*********************************************************************************************************************/ + +template +inline std::string InteractionObjectBase::FormatAsText() const +{ + return GetString(txFormatObjectAsText, _hObject, 512); +} + +/*********************************************************************************************************************/ + +template +template +inline typename PropertyValueResolver::ValueType InteractionObjectBase::GetPropertyValue(const std::string& propertyName) const +{ + auto spProperty = GetProperty(propertyName); + return spProperty->GetValue(); +} + +/*********************************************************************************************************************/ + +template +template +inline bool InteractionObjectBase::TryGetPropertyValue(TValue* pValue, const std::string& propertyName) const +{ + std::shared_ptr spProperty; + if(!TryGetProperty(&spProperty, propertyName)) + return false; + + if(!spProperty->TryGetValue(pValue)) + return false; + + return true; +} + +/*********************************************************************************************************************/ + + +/*********************************************************************************************************************/ + +inline InteractionObject::InteractionObject(const std::shared_ptr& spContext, TX_HANDLE hObject) +: InteractionObjectBase(spContext, hObject) +{ } + +/*********************************************************************************************************************/ + +inline InteractionObject::~InteractionObject() +{ + txReleaseObject(&_hObject); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr InteractionObject::CreateProperty(const std::string& propertyName) +{ + TX_PROPERTYHANDLE hProperty; + TX_VALIDATE(txCreateProperty(_hObject, &hProperty, propertyName.c_str())); + auto spProperty = _spContext->CreateProperty(hProperty); + return spProperty; +} + +/*********************************************************************************************************************/ + +template +inline void InteractionObject::SetPropertyValue(const std::string& propertyName, const TValue& value) +{ + std::shared_ptr spProperty; + if(!TryGetProperty(&spProperty, propertyName)) + spProperty = CreateProperty(propertyName); + + spProperty->SetValue(value); +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTIONOBJECT__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Interactor.hpp b/Tobii EyeX/include/eyex-cpp/Interactor.hpp new file mode 100755 index 0000000..046adb0 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Interactor.hpp @@ -0,0 +1,67 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Interactor.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTOR__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_INTERACTOR__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Interactor : + public InteractionObject +{ +public: + Interactor(const std::shared_ptr& spContext, TX_HANDLE hInteractor); + + std::string GetId() const; + std::string GetParentId() const; + std::string GetWindowId() const; + + bool GetEnabled() const; + void SetEnabled(bool enabled); + + bool GetDeleted() const; + void SetDeleted(bool deleted); + + double GetZ() const; + void SetZ(double z); + + void CreateGazePointDataBehavior(const TX_GAZEPOINTDATAPARAMS& params); + void CreateActivatableBehavior(const TX_ACTIVATABLEPARAMS& params); + void CreatePannableBehavior(const TX_PANNABLEPARAMS& params); + void CreateGazeAwareBehavior(const TX_GAZEAWAREPARAMS& params); + void CreateFixationDataBehaviorParams(const TX_FIXATIONDATAPARAMS& params); + + std::shared_ptr GetBounds() const; + std::vector> GetBehaviors() const; + std::shared_ptr CreateBounds(TX_BOUNDSTYPE boundsType); + void DeleteBounds(); + + std::shared_ptr CreateBehavior(TX_BEHAVIORTYPE behaviorType); + void DeleteBehavior(TX_BEHAVIORTYPE behaviorType); + bool TryGetBehavior(std::shared_ptr *pspBehavior, TX_BEHAVIORTYPE behaviorType) const; + + std::shared_ptr CreateMask(TX_MASKTYPE maskType, int columnCount, int rowCount, const TX_BYTE* pData); + void RemoveMask(); + std::shared_ptr GetMask() const; + + void SetMaskBounds(const TX_RECT& bounds); + void ClearMaskBounds(); + bool TryGetMaskBounds(TX_RECT* pBounds) const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTOR__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Interactor.inl b/Tobii EyeX/include/eyex-cpp/Interactor.inl new file mode 100755 index 0000000..5246609 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Interactor.inl @@ -0,0 +1,257 @@ +/********************************************************************************************************************* +* Copyright 2013-2014 Tobii Technology AB. All rights reserved. +* Interactor.inl +*********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTOR__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_INTERACTOR__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline Interactor::Interactor(const std::shared_ptr& spContext, TX_HANDLE hInteractor) +: InteractionObject(spContext, hInteractor) +{} + +/*********************************************************************************************************************/ + +inline bool Interactor::GetEnabled() const +{ + int isEnabled; + TX_VALIDATE(txGetInteractorEnabled(_hObject, &isEnabled)); + return isEnabled != 0; +} + +/*********************************************************************************************************************/ + +inline void Interactor::SetEnabled(bool enabled) +{ + TX_VALIDATE(txSetInteractorEnabled(_hObject, enabled ? 1 : 0)); +} + +/*********************************************************************************************************************/ + +inline bool Interactor::GetDeleted() const +{ + int isDeleted; + TX_VALIDATE(txGetInteractorDeleted(_hObject, &isDeleted)); + return isDeleted != 0; +} + +/*********************************************************************************************************************/ + +inline void Interactor::SetDeleted(bool deleted) +{ + TX_VALIDATE(txSetInteractorDeleted(_hObject, deleted ? 1 : 0)); +} + +/*********************************************************************************************************************/ + +inline std::string Interactor::GetId() const +{ + return GetString(txGetInteractorId, _hObject); +} + +/*********************************************************************************************************************/ + +inline std::string Interactor::GetParentId() const +{ + return GetString(txGetInteractorParentId, _hObject); +} + +/*********************************************************************************************************************/ + +inline std::string Interactor::GetWindowId() const +{ + return GetString(txGetInteractorWindowId, _hObject); +} + +/*********************************************************************************************************************/ + +inline double Interactor::GetZ() const +{ + double z; + TX_VALIDATE(txGetInteractorZ(_hObject, &z)); + return z; +} + +/*********************************************************************************************************************/ + +inline void Interactor::SetZ(double z) +{ + TX_VALIDATE(txSetInteractorZ(_hObject, z)); +} + +/*********************************************************************************************************************/ + +inline void Interactor::CreateGazePointDataBehavior(const TX_GAZEPOINTDATAPARAMS& params) +{ + + TX_VALIDATE(txCreateGazePointDataBehavior(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline void Interactor::CreateActivatableBehavior(const TX_ACTIVATABLEPARAMS& params) +{ + TX_VALIDATE(txCreateActivatableBehavior(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline void Interactor::CreatePannableBehavior(const TX_PANNABLEPARAMS& params) +{ + TX_VALIDATE(txCreatePannableBehavior(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline void Interactor::CreateGazeAwareBehavior(const TX_GAZEAWAREPARAMS& params) +{ + TX_VALIDATE(txCreateGazeAwareBehavior(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline void Interactor::CreateFixationDataBehaviorParams(const TX_FIXATIONDATAPARAMS& params) +{ + TX_VALIDATE(txCreateFixationDataBehavior(_hObject, ¶ms)); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Interactor::GetBounds() const +{ + TX_HANDLE hBounds; + if (!TX_VALIDATE(txGetInteractorBounds(_hObject, &hBounds), TX_RESULT_NOTFOUND)) + return nullptr; + + return _spContext->CreateObject(hBounds); +} + +/*********************************************************************************************************************/ + +inline std::vector> Interactor::GetBehaviors() const +{ + std::vector behaviorHandles; + TX_VALIDATE(Tx::Utils::GetBufferData(behaviorHandles, txGetInteractorBehaviors, _hObject)); + + std::vector> behaviors; + for(auto& hBehavior : behaviorHandles) + { + auto spBehavior = _spContext->CreateObject(hBehavior); + behaviors.push_back(spBehavior); + } + + return behaviors; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Interactor::CreateBounds(TX_BOUNDSTYPE boundsType) +{ + Tx::Utils::ScopedHandle hBounds; + TX_VALIDATE(txCreateInteractorBounds(_hObject, &hBounds, boundsType)); + auto spBounds = _spContext->CreateObject(hBounds); + return spBounds; +} + +/*********************************************************************************************************************/ + +inline void Interactor::DeleteBounds() +{ + TX_VALIDATE(txDeleteInteractorBounds(_hObject)); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Interactor::CreateBehavior(TX_BEHAVIORTYPE behaviorType) +{ + Tx::Utils::ScopedHandle hBehavior; + TX_VALIDATE(txCreateInteractorBehavior(_hObject, &hBehavior, behaviorType)); + auto spBehavior = _spContext->CreateObject(hBehavior); + return spBehavior; +} + +/*********************************************************************************************************************/ + +inline void Interactor::DeleteBehavior(TX_BEHAVIORTYPE behaviorType) +{ + TX_VALIDATE(txRemoveInteractorBehavior(_hObject, behaviorType)); +} + +/*********************************************************************************************************************/ + +inline bool Interactor::TryGetBehavior(std::shared_ptr *pspBehavior, TX_BEHAVIORTYPE behaviorType) const +{ + Tx::Utils::ScopedHandle hBehavior; + if (!TX_VALIDATE(txGetInteractorBehavior(_hObject, &hBehavior, behaviorType), TX_RESULT_NOTFOUND)) + return false; + + *pspBehavior = _spContext->CreateObject(hBehavior); + return true; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Interactor::CreateMask(TX_MASKTYPE maskType, int columnCount, int rowCount, const TX_BYTE* pData) +{ + Tx::Utils::ScopedHandle hMask; + TX_VALIDATE(txCreateMask(_hObject, &hMask, maskType, columnCount, rowCount, pData)); + auto spMask = _spContext->CreateObject(hMask); + return spMask; +} + +/*********************************************************************************************************************/ + +inline void Interactor::RemoveMask() +{ + TX_VALIDATE(txRemoveMask(_hObject)); +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Interactor::GetMask() const +{ + Tx::Utils::ScopedHandle hMask; + TX_VALIDATE(txGetMask(_hObject, &hMask)); + auto spMask = _spContext->CreateObject(hMask); + return spMask; +} + +/*********************************************************************************************************************/ + +inline void Interactor::SetMaskBounds(const TX_RECT& bounds) +{ + TX_VALIDATE(txSetMaskBounds(_hObject, &bounds)); +} + +/*********************************************************************************************************************/ + +inline void Interactor::ClearMaskBounds() +{ + TX_VALIDATE(txClearMaskBounds(_hObject)); +} + +/*********************************************************************************************************************/ + +inline bool Interactor::TryGetMaskBounds(TX_RECT* pBounds) const +{ + if(!TX_VALIDATE(txGetMaskBounds(_hObject, pBounds), TX_RESULT_NOTFOUND)) + return false; + + return true; +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + + /*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_INTERACTOR__INL__) + + /*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Mask.hpp b/Tobii EyeX/include/eyex-cpp/Mask.hpp new file mode 100755 index 0000000..a2b9458 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Mask.hpp @@ -0,0 +1,34 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Mask.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_MASK__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_MASK__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Mask : + public InteractionObject +{ +public: + Mask(const std::shared_ptr& spContext, TX_HANDLE hMask); + int GetColumnCount() const; + int GetRowCount() const; + void GetData(std::vector& data) const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_MASK__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Mask.inl b/Tobii EyeX/include/eyex-cpp/Mask.inl new file mode 100755 index 0000000..3e7ed2d --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Mask.inl @@ -0,0 +1,58 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Mask.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_MASK__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_MASK__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline Mask::Mask(const std::shared_ptr& spContext, TX_HANDLE hMask) +: InteractionObject(spContext, hMask) +{ } + +/*********************************************************************************************************************/ + +inline int Mask::GetColumnCount() const +{ + int columnCount, rowCount; + TX_VALIDATE(txGetMaskData(_hObject, &columnCount, &rowCount, nullptr, nullptr)); + return columnCount; +} + +/*********************************************************************************************************************/ + +inline int Mask::GetRowCount() const +{ + int columnCount, rowCount; + TX_VALIDATE(txGetMaskData(_hObject, &columnCount, &rowCount, nullptr, nullptr)); + return rowCount; +} + +/*********************************************************************************************************************/ + +inline void Mask::GetData(std::vector& data) const +{ + int columnCount, rowCount, dataSize = 0; + if(TX_VALIDATE(txGetMaskData(_hObject, &columnCount, &rowCount, nullptr, &dataSize))) + return; + + data.resize(dataSize); + TX_VALIDATE(txGetMaskData(_hObject, &columnCount, &rowCount, &data[0], &dataSize)); +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_MASK__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Notification.hpp b/Tobii EyeX/include/eyex-cpp/Notification.hpp new file mode 100755 index 0000000..6d342da --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Notification.hpp @@ -0,0 +1,34 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Notification.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Notification__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Notification__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Notification : + public InteractionObject +{ +public: + Notification(const std::shared_ptr& spContext, TX_HANDLE hNotification); + + TX_NOTIFICATIONTYPE GetNotificationType() const; + std::shared_ptr GetData() const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Notification__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Notification.inl b/Tobii EyeX/include/eyex-cpp/Notification.inl new file mode 100755 index 0000000..180fcd2 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Notification.inl @@ -0,0 +1,49 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Notification.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Notification__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Notification__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline Notification::Notification(const std::shared_ptr& spContext, TX_HANDLE hNotification) +: InteractionObject(spContext, hNotification) +{ } + +/*********************************************************************************************************************/ + +inline TX_NOTIFICATIONTYPE Notification::GetNotificationType() const +{ + TX_NOTIFICATIONTYPE notificationType; + TX_VALIDATE(txGetNotificationType(_hObject, ¬ificationType)); + return notificationType; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Notification::GetData() const +{ + Tx::Utils::ScopedHandle hData; + if(!TX_VALIDATE(txGetNotificationData(_hObject, &hData), TX_RESULT_NOTFOUND)) + return nullptr; + + auto spData = _spContext->CreateObject(hData); + return spData; +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Notification__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Property.cpp b/Tobii EyeX/include/eyex-cpp/Property.cpp new file mode 100755 index 0000000..b5da8af --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Property.cpp @@ -0,0 +1,19 @@ +//--------------------------------------------------------------------------------------------------------------------- +// Property.cpp +//--------------------------------------------------------------------------------------------------------------------- + +#include "Precompiled.hpp" +#include "Property.hpp" +#include "InteractionContext.hpp" + +//--------------------------------------------------------------------------------------------------------------------- + +TOBIIGAZE_NAMESPACE_BEGIN + +//--------------------------------------------------------------------------------------------------------------------- + +//--------------------------------------------------------------------------------------------------------------------- + +TOBIIGAZE_NAMESPACE_END + +//--------------------------------------------------------------------------------------------------------------------- diff --git a/Tobii EyeX/include/eyex-cpp/Property.hpp b/Tobii EyeX/include/eyex-cpp/Property.hpp new file mode 100755 index 0000000..2ff87c0 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Property.hpp @@ -0,0 +1,46 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Property.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Property : + public HandleWrapper +{ +public: + Property(const std::shared_ptr& spContext, TX_PROPERTYHANDLE hProperty); + + TX_PROPERTYVALUETYPE GetValueType() const; + std::string GetName() const; + TX_PROPERTYFLAGS GetFlags() const; + + void Clear(); + + template + bool TryGetValue(TValue* pValue) const; + + template + typename PropertyValueResolver::ValueType GetValue() const; + + template + void SetValue(const TValue& value); +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Property.inl b/Tobii EyeX/include/eyex-cpp/Property.inl new file mode 100755 index 0000000..9469af4 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Property.inl @@ -0,0 +1,90 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Property.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +template +bool Property::TryGetValue(TValue* pValue) const +{ + if(PropertyValueResolver().GetValue(this, pValue) == TX_RESULT_OK) + return true; + + return false; +} + +/*********************************************************************************************************************/ + +template +typename PropertyValueResolver::ValueType Property::GetValue() const +{ + TValue value; + if(TryGetValue(&value)) + return value; + + throw APIException(TX_RESULT_INVALIDPROPERTYTYPE, "Invalid property type"); +} + +/*********************************************************************************************************************/ + +template +void Property::SetValue(const TValue& value) +{ + TX_VALIDATE(PropertyValueResolver().SetValue(this, value)); +} + +/*********************************************************************************************************************/ + +inline Property::Property(const std::shared_ptr& spContext, TX_PROPERTYHANDLE hProperty) +: HandleWrapper(spContext, hProperty) +{} + +/*********************************************************************************************************************/ + +inline TX_PROPERTYVALUETYPE Property::GetValueType() const +{ + TX_PROPERTYVALUETYPE valueType; + TX_VALIDATE(txGetPropertyValueType(_hObject, &valueType)); + return valueType; +} + +/*********************************************************************************************************************/ + +inline std::string Property::GetName() const +{ + return GetString(txGetPropertyName, _hObject); +} + +/*********************************************************************************************************************/ + +inline TX_PROPERTYFLAGS Property::GetFlags() const +{ + TX_PROPERTYFLAGS flags; + TX_VALIDATE(txGetPropertyFlags(_hObject, &flags)); + return flags; +} + +/*********************************************************************************************************************/ + +inline void Property::Clear() +{ + TX_VALIDATE(txClearPropertyValue(_hObject)); +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTY__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/PropertyBag.hpp b/Tobii EyeX/include/eyex-cpp/PropertyBag.hpp new file mode 100755 index 0000000..045c939 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/PropertyBag.hpp @@ -0,0 +1,32 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * PropertyBag.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYBAG__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYBAG__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class PropertyBag : + public InteractionObject +{ +public: + PropertyBag(const std::shared_ptr& spContext, TX_HANDLE hBag); + + TX_PROPERTYBAGTYPE GetType() const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYBAG__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/PropertyBag.inl b/Tobii EyeX/include/eyex-cpp/PropertyBag.inl new file mode 100755 index 0000000..7b508f2 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/PropertyBag.inl @@ -0,0 +1,36 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * PropertyBag.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYBAG__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYBAG__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline PropertyBag::PropertyBag(const std::shared_ptr& spContext, TX_HANDLE hBag) +: InteractionObject(spContext, hBag) +{} + +/*********************************************************************************************************************/ + +inline TX_PROPERTYBAGTYPE PropertyBag::GetType() const +{ + TX_PROPERTYBAGTYPE bagType; + TX_VALIDATE(txGetPropertyBagType(_hObject, &bagType)); + return bagType; +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYBAG__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/PropertyValueResolver.hpp b/Tobii EyeX/include/eyex-cpp/PropertyValueResolver.hpp new file mode 100755 index 0000000..87018a7 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/PropertyValueResolver.hpp @@ -0,0 +1,34 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * PropertyValueResolver.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYVALUERESOLVER__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYVALUERESOLVER__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +template +struct PropertyValueResolverBase +{ + typedef TValue ValueType; +}; + +/*********************************************************************************************************************/ + +template +struct PropertyValueResolver; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYVALUERESOLVER__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/PropertyValueResolver.inl b/Tobii EyeX/include/eyex-cpp/PropertyValueResolver.inl new file mode 100755 index 0000000..0bd2a28 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/PropertyValueResolver.inl @@ -0,0 +1,266 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * PropertyValueResolver.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYVALUERESOLVER__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYVALUERESOLVER__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +template +struct PropertyValueResolver : + public PropertyValueResolverBase +{ + TX_RESULT GetValue(const Property* pProperty, TValue* pValue) const + { + return txGetPropertyValueAsInteger(pProperty->GetHandle(), (int*)pValue); + } + + TX_RESULT SetValue(Property* pProperty, TValue value) const + { + return txSetPropertyValueAsInteger(pProperty->GetHandle(), (int)value); + } +}; + +/*********************************************************************************************************************/ + +template <> +struct PropertyValueResolver : + public PropertyValueResolverBase +{ + TX_RESULT GetValue(const Property* pProperty, bool* pValue) const + { + int intValue; + auto result = txGetPropertyValueAsInteger(pProperty->GetHandle(), &intValue); + if(result != TX_RESULT_OK) + return result; + + *pValue = intValue != 0; + return TX_RESULT_OK; + } + + TX_RESULT SetValue(Property* pProperty, bool value) const + { + auto intValue = value ? 1 : 0; + return txSetPropertyValueAsInteger(pProperty->GetHandle(), intValue); + } +}; + +/*********************************************************************************************************************/ + +template <> +struct PropertyValueResolver : + public PropertyValueResolverBase +{ + TX_RESULT GetValue(const Property* pProperty, double* pValue) const + { + return txGetPropertyValueAsReal(pProperty->GetHandle(), pValue); + } + + TX_RESULT SetValue(Property* pProperty, double value) const + { + return txSetPropertyValueAsReal(pProperty->GetHandle(), value); + } +}; + +/*********************************************************************************************************************/ + +template <> +struct PropertyValueResolver : + public PropertyValueResolverBase +{ + TX_RESULT GetValue(const Property* pProperty, float* pValue) const + { + double doubleValue; + auto result = txGetPropertyValueAsReal(pProperty->GetHandle(), &doubleValue); + if(result != TX_RESULT_OK) + return result; + + *pValue = (float)doubleValue; + return TX_RESULT_OK; + } + + TX_RESULT SetValue(Property* pProperty, float value) const + { + return txSetPropertyValueAsReal(pProperty->GetHandle(), value); + } +}; + +/*********************************************************************************************************************/ + +template <> +struct PropertyValueResolver : + public PropertyValueResolverBase +{ + TX_RESULT GetValue(const Property* pProperty, std::string* pValue) const + { + return Tx::Utils::GetString(pValue, txGetPropertyValueAsString, pProperty->GetHandle()); + } + + TX_RESULT SetValue(Property* pProperty, const std::string& value) const + { + return txSetPropertyValueAsString(pProperty->GetHandle(), value.c_str()); + } +}; + +/*********************************************************************************************************************/ + +template +struct PropertyValueResolver> : + public PropertyValueResolverBase> +{ + TX_RESULT GetValue(const Property* pProperty, std::shared_ptr* pspValue) const + { + Tx::Utils::ScopedHandle hObject; + auto result = txGetPropertyValueAsObject(pProperty->GetHandle(), &hObject); + if(result != TX_RESULT_OK) + return result; + + // CreateObject will detach scoped handle. + *pspValue = pProperty->GetContext()->CreateObject(hObject); + return TX_RESULT_OK; + } + + TX_RESULT SetValue(Property* pProperty, const std::shared_ptr& spValue) const + { + return txSetPropertyValueAsObject(pProperty->GetHandle(), spValue->GetHandle()); + } +}; + +/*********************************************************************************************************************/ + +template +struct CompositePropertyValueResolver : + public PropertyValueResolverBase +{ + TX_RESULT GetValue(const Property* pProperty, TValue* pValue) const + { + std::shared_ptr spObject; + if(!pProperty->TryGetValue(&spObject)) + return TX_RESULT_NOTFOUND; + + try + { + return GetContent(spObject, pValue); + } + catch(...) + { + return TX_RESULT_NOTFOUND; + } + + return TX_RESULT_OK; + } + + TX_RESULT SetValue(Property* pProperty, const TX_RECT& value) const + { + try + { + auto spObject = pProperty->GetContext()->CreateBag(); + auto result = SetContent(spObject, value); + if(result != TX_RESULT_OK) + return result; + + pProperty->SetValue(spObject); + } + catch(...) + { + return TX_RESULT_NOTFOUND; + } + + return TX_RESULT_OK; + } + + virtual TX_RESULT GetContent(const std::shared_ptr& spObject, TValue* pValue) const = 0; + virtual TX_RESULT SetContent(const std::shared_ptr& spObject, const TValue& Value) const = 0; +}; + +/*********************************************************************************************************************/ + +template <> +struct PropertyValueResolver : + public CompositePropertyValueResolver +{ + TX_RESULT GetContent(const std::shared_ptr& spObject, ValueType* pValue) const + { + if(spObject->TryGetPropertyValue(&pValue->X, TX_LITERAL_X) && + spObject->TryGetPropertyValue(&pValue->Y, TX_LITERAL_Y) && + spObject->TryGetPropertyValue(&pValue->Width, TX_LITERAL_WIDTH) && + spObject->TryGetPropertyValue(&pValue->Height, TX_LITERAL_HEIGHT)) + return TX_RESULT_OK; + + return TX_RESULT_NOTFOUND; + } + + TX_RESULT SetContent(const std::shared_ptr& spObject, const ValueType& value) const + { + spObject->SetPropertyValue(TX_LITERAL_X, value.X); + spObject->SetPropertyValue(TX_LITERAL_Y, value.Y); + spObject->SetPropertyValue(TX_LITERAL_WIDTH, value.Width); + spObject->SetPropertyValue(TX_LITERAL_HEIGHT, value.Height); + + return TX_RESULT_OK; + } +}; + +/*********************************************************************************************************************/ + +template <> +struct PropertyValueResolver : + public CompositePropertyValueResolver +{ + TX_RESULT GetContent(const std::shared_ptr& spObject, ValueType* pValue) const + { + if(spObject->TryGetPropertyValue(&pValue->X, TX_LITERAL_X) && + spObject->TryGetPropertyValue(&pValue->Y, TX_LITERAL_Y)) + return TX_RESULT_OK; + + return TX_RESULT_NOTFOUND; + } + + TX_RESULT SetContent(const std::shared_ptr& spObject, const ValueType& value) const + { + spObject->SetPropertyValue(TX_LITERAL_X, value.X); + spObject->SetPropertyValue(TX_LITERAL_Y, value.Y); + + return TX_RESULT_OK; + } +}; + +/*********************************************************************************************************************/ + +template <> +struct PropertyValueResolver : + public CompositePropertyValueResolver +{ + TX_RESULT GetContent(const std::shared_ptr& spObject, ValueType* pValue) const + { + if(spObject->TryGetPropertyValue(&pValue->Width, TX_LITERAL_WIDTH) && + spObject->TryGetPropertyValue(&pValue->Height, TX_LITERAL_HEIGHT)) + return TX_RESULT_OK; + + return TX_RESULT_NOTFOUND; + } + + TX_RESULT SetContent(const std::shared_ptr& spObject, const ValueType& value) const + { + spObject->SetPropertyValue(TX_LITERAL_WIDTH, value.Width); + spObject->SetPropertyValue(TX_LITERAL_HEIGHT, value.Height); + + return TX_RESULT_OK; + } +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_PROPERTYVALUERESOLVER__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Query.hpp b/Tobii EyeX/include/eyex-cpp/Query.hpp new file mode 100755 index 0000000..6420fd2 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Query.hpp @@ -0,0 +1,34 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Query.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Query__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Query__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Query : + public InteractionObject +{ +public: + Query(const std::shared_ptr& spContext, TX_HANDLE hQuery); + + std::shared_ptr GetBounds() const; + std::vector GetWindowIds() const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Query__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Query.inl b/Tobii EyeX/include/eyex-cpp/Query.inl new file mode 100755 index 0000000..9b6c2e7 --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Query.inl @@ -0,0 +1,58 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Query.inl + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Query__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Query__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline Query::Query(const std::shared_ptr& spContext, TX_HANDLE hQuery) +: InteractionObject(spContext, hQuery) +{} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Query::GetBounds() const +{ + Tx::Utils::ScopedHandle hBounds; + TX_VALIDATE(txGetQueryBounds(_hObject, &hBounds)); + auto spBounds = _spContext->CreateObject(hBounds); + return spBounds; +} + +/*********************************************************************************************************************/ + +inline std::vector Query::GetWindowIds() const +{ + TX_SIZE windowIdCount; + TX_VALIDATE(txGetQueryWindowIdCount(_hObject, &windowIdCount)); + + std::vector windowIds; + for (int i = 0; i < windowIdCount; i++) + { + std::string windowId; + TX_VALIDATE(Tx::Utils::GetString(&windowId, [i, this](TX_CHAR* pBuf, TX_SIZE* pSize) + { + return txGetQueryWindowId(_hObject, i, pBuf, pSize); + })); + + windowIds.push_back(windowId); + } + return windowIds; +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Query__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Snapshot.hpp b/Tobii EyeX/include/eyex-cpp/Snapshot.hpp new file mode 100755 index 0000000..1b1befb --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Snapshot.hpp @@ -0,0 +1,53 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * Snapshot.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Snapshot__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Snapshot__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class Snapshot : + public InteractionObject +{ +public: + Snapshot(const std::shared_ptr& spContext, TX_HANDLE hSnapshot); + static std::shared_ptr CreateSnapshotForQuery(const std::shared_ptr& spQuery); + static std::shared_ptr CreateSnapshotWithQueryBounds(const std::shared_ptr& spQuery); + + + std::shared_ptr GetBounds() const; + std::shared_ptr CreateBounds(TX_BOUNDSTYPE boundsType); + void SetBoundsFromQuery(); + void DeleteBounds(); + + std::vector> GetInteractors() const; + + std::shared_ptr CreateInteractor( + const std::string& interactorId, + const std::string& parentId, + const std::string& windowId); + + void RemoveInteractor(const std::string& interactorId); + + std::vector GetWindowIds(); + void AddWindowId(const std::string& windowId); + + void CommitAsync(AsyncDataHandler fnHandler) const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Snapshot__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/Snapshot.inl b/Tobii EyeX/include/eyex-cpp/Snapshot.inl new file mode 100755 index 0000000..553d00e --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/Snapshot.inl @@ -0,0 +1,159 @@ +/********************************************************************************************************************* +* Copyright 2013-2014 Tobii Technology AB. All rights reserved. +* Snapshot.inl +*********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Snapshot__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_Snapshot__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + + inline Snapshot::Snapshot(const std::shared_ptr& spContext, TX_HANDLE hSnapshot) + : InteractionObject(spContext, hSnapshot) +{} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Snapshot::CreateSnapshotForQuery(const std::shared_ptr& spQuery) +{ + Tx::Utils::ScopedHandle hSnapshot; + TX_VALIDATE(txCreateSnapshotForQuery(spQuery->GetHandle(), &hSnapshot)); + + auto spContext = spQuery->GetContext(); + auto spSnapshot = spContext->CreateObject(hSnapshot); + return spSnapshot; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Snapshot::CreateSnapshotWithQueryBounds(const std::shared_ptr& spQuery) +{ + Tx::Utils::ScopedHandle hSnapshot; + TX_VALIDATE(txCreateSnapshotWithQueryBounds(spQuery->GetHandle(), &hSnapshot)); + + auto spContext = spQuery->GetContext(); + auto spSnapshot = spContext->CreateObject(hSnapshot); + return spSnapshot; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Snapshot::GetBounds() const +{ + Tx::Utils::ScopedHandle hBounds; + if (!TX_VALIDATE(txGetSnapshotBounds(_hObject, &hBounds), TX_RESULT_NOTFOUND)) + return nullptr; + + auto spBounds = _spContext->CreateObject(hBounds); + return spBounds; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Snapshot::CreateBounds(TX_BOUNDSTYPE boundsType) +{ + Tx::Utils::ScopedHandle hBounds; + TX_VALIDATE(txCreateSnapshotBounds(_hObject, &hBounds, boundsType)); + auto spBounds = _spContext->CreateObject(hBounds); + return spBounds; +} + +/*********************************************************************************************************************/ + +inline void Snapshot::DeleteBounds() +{ + TX_VALIDATE(txDeleteSnapshotBounds(_hObject)); +} + +/*********************************************************************************************************************/ + +inline std::vector> Snapshot::GetInteractors() const +{ + std::vector interactorHandles; + TX_VALIDATE(Tx::Utils::GetBufferData(interactorHandles, txGetInteractors, _hObject)); + + std::vector> interactors; + for(auto& hInteractor : interactorHandles) + { + auto spInteractor = _spContext->CreateObject(hInteractor); + interactors.push_back(spInteractor); + } + + return interactors; +} + +/*********************************************************************************************************************/ + +inline std::shared_ptr Snapshot::CreateInteractor( + const std::string& interactorId, + const std::string& parentId, + const std::string& windowId) +{ + Tx::Utils::ScopedHandle hInteractor; + TX_VALIDATE(txCreateInteractor(_hObject, &hInteractor, interactorId.c_str(), parentId.c_str(), windowId.c_str())); + auto spInteractor = _spContext->CreateObject(hInteractor); + return spInteractor; +} + +/*********************************************************************************************************************/ + +inline void Snapshot::RemoveInteractor(const std::string& interactorId) +{ + TX_VALIDATE(txRemoveInteractor(_hObject, interactorId.c_str())); +} + +/*********************************************************************************************************************/ + +inline std::vector Snapshot::GetWindowIds() +{ + int windowIdCount = 0; + TX_VALIDATE(txGetSnapshotWindowIdCount(_hObject, &windowIdCount)); + + std::vector windowIds; + for (int i = 0; i < windowIdCount; i++) + { + std::string windowId; + TX_VALIDATE(Tx::Utils::GetString(&windowId, [i, this](TX_CHAR* pBuf, TX_SIZE* pSize) + { + return txGetSnapshotWindowId(_hObject, i, pBuf, pSize); + })); + + windowIds.push_back(windowId); + } + + return windowIds; +} + +/*********************************************************************************************************************/ + +inline void Snapshot::AddWindowId(const std::string& windowId) +{ + TX_VALIDATE(txAddSnapshotWindowId(_hObject, windowId.c_str())); +} + +/*********************************************************************************************************************/ + +inline void Snapshot::CommitAsync(AsyncDataHandler fnHandler) const +{ + auto spThis = shared_from_this(); + auto fnProxy = [&, spThis, fnHandler](TX_CONSTHANDLE hAsyncData) + { + GetContext()->InvokeAsyncDataHandler(hAsyncData, fnHandler); + }; + + TX_VALIDATE(Tx::CommitSnapshotAsync(_hObject, fnProxy)); +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_Snapshot__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/StateBag.hpp b/Tobii EyeX/include/eyex-cpp/StateBag.hpp new file mode 100755 index 0000000..3b663ba --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/StateBag.hpp @@ -0,0 +1,44 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * StateBag.hpp + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_STATEBAG__HPP__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_STATEBAG__HPP__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +class StateBag : + public InteractionObject +{ +public: + StateBag(const std::shared_ptr& spContext, TX_HANDLE hBag); + + std::string GetStatePath() const; + + template + bool TryGetStateValue(TValue* pValue, const std::string& valuePath) const; + + template + void SetStateValue(const std::string& valuePath, const TValue& value); + + void SetAsync(AsyncDataHandler fnCompletion = nullptr); + +private: + bool TryGetPropertyForStateValue(std::shared_ptr* pspProperty, const std::string& valuePath, bool createIfNotExists) const; +}; + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_STATEBAG__HPP__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex-cpp/StateBag.inl b/Tobii EyeX/include/eyex-cpp/StateBag.inl new file mode 100755 index 0000000..83e054a --- /dev/null +++ b/Tobii EyeX/include/eyex-cpp/StateBag.inl @@ -0,0 +1,82 @@ +/********************************************************************************************************************* +* Copyright 2013-2014 Tobii Technology AB. All rights reserved. +* StateBag.inl +*********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_CPPBINDINGS_STATEBAG__INL__) +#define __TOBII_TX_CLIENT_CPPBINDINGS_STATEBAG__INL__ + +/*********************************************************************************************************************/ + +TX_NAMESPACE_BEGIN + +/*********************************************************************************************************************/ + +inline StateBag::StateBag(const std::shared_ptr& spContext, TX_HANDLE hBag) + : InteractionObject(spContext, hBag) +{} + +/*********************************************************************************************************************/ + +inline std::string StateBag::GetStatePath() const +{ + return GetString(txGetStateBagPath, _hObject); +} + +/*********************************************************************************************************************/ + +template +inline bool StateBag::TryGetStateValue(TValue* pValue, const std::string& valuePath) const +{ + std::shared_ptr spProperty; + if(!TryGetPropertyForStateValue(&spProperty, valuePath, false)) + return false; + + return spProperty->TryGetValue(pValue); +} + +/*********************************************************************************************************************/ + +template +inline void StateBag::SetStateValue(const std::string& valuePath, const TValue& value) +{ + std::shared_ptr spProperty; + TryGetPropertyForStateValue(&spProperty, valuePath, true); + spProperty->SetValue(value); +} + +/*********************************************************************************************************************/ + +inline void StateBag::SetAsync(AsyncDataHandler fnCompletion) +{ + auto spThis = shared_from_this(); + + auto callback = [&, spThis, fnCompletion](TX_CONSTHANDLE hAsyncData) + { + GetContext()->InvokeAsyncDataHandler(hAsyncData, fnCompletion); + }; + + TX_VALIDATE(Tx::SetStateAsync(GetHandle(), callback)); +} + +/*********************************************************************************************************************/ + +inline bool StateBag::TryGetPropertyForStateValue(std::shared_ptr* pspProperty, const std::string& valuePath, bool createIfNotExists) const +{ + TX_PROPERTYHANDLE hProperty; + if (!TX_VALIDATE(txGetPropertyForStateValue(_hObject, &hProperty, valuePath.c_str(), createIfNotExists ? TX_TRUE : TX_FALSE), TX_RESULT_NOTFOUND)) + return false; + + *pspProperty = _spContext->CreateProperty(hProperty); + return true; +} + +/*********************************************************************************************************************/ + +TX_NAMESPACE_END + +/*********************************************************************************************************************/ + +#endif // !defined(__TOBII_TX_CLIENT_CPPBINDINGS_STATEBAG__INL__) + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeX.h b/Tobii EyeX/include/eyex/EyeX.h new file mode 100755 index 0000000..d76dc26 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeX.h @@ -0,0 +1,46 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeX.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX__H__) +#define __TOBII_TX__H__ + +/*********************************************************************************************************************/ + +#ifdef __cplusplus +#define TX_NAMESPACE_BEGIN namespace EyeX { +#define TX_NAMESPACE_END } +#define TX_USING_NAMESPACE_TX using namespace EyeX; +#endif // __cplusplus + +/*********************************************************************************************************************/ + +#include "EyeXMacros.h" +#include "EyeXLiterals.h" +#include "EyeXConstants.h" +#include "EyeXSharedLiterals.h" +#include "EyeXFrameworkTypes.h" +#include "EyeXClientTypes.h" +#include "EyeXEnv.h" +#include "EyeXContext.h" +#include "EyeXObject.h" +#include "EyeXAsyncData.h" +#include "EyeXUtils.h" +#include "EyeXSnapshot.h" +#include "EyeXBounds.h" +#include "EyeXInteractor.h" +#include "EyeXCommand.h" +#include "EyeXActions.h" +#include "EyeXBehavior.h" +#include "EyeXStates.h" +#include "EyeXNotification.h" +#include "EyeXQuery.h" +#include "EyeXEvent.h" +#include "EyeXProperty.h" + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXActions.h b/Tobii EyeX/include/eyex/EyeXActions.h new file mode 100755 index 0000000..4e95b12 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXActions.h @@ -0,0 +1,344 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXAction.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_ACTION_API__H__) +#define __TOBII_TX_ACTION_API__H__ + +/*********************************************************************************************************************/ + +/** + txCreateActionCommand + + Creates an Action command. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to create the command. + Must not be TX_EMPTY_HANDLE. + + @param phCommand [out]: + A pointer to a TX_HANDLE which will be set to the newly created command. + This handle must be released using txReleaseObject to avoid leaks. + Must not be TX_EMPTY_HANDLE. + + @param action [in]: + The type of action. + + @return + TX_RESULT_OK: The command was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateActionCommand( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phCommand, + TX_ACTIONTYPE actionType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateActionCommandHook)( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phCommand, + TX_ACTIONTYPE actionType + ); + + +/*********************************************************************************************************************/ + +/** + txDisableBuiltinKeysAsync + + Disables EyeX builtin keys for a top-level window. When the gaze is over the + specified window, all interaction must be done through action commands. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to disable keys. + Must not be TX_EMPTY_HANDLE. + + @param windowId [in]: + The window id for which to disable keys (window id corresponds to the windows handle on Windows). + + @param completionHandler [in]: + The TX_ASYNCDATACALLBACK that will handle the request result. + Can be NULL. + + The data provided by the TX_ASYNCDATACALLBACK will contain a result code which can be retrieved using + + TX_RESULT_OK: + The request was succesfully executed on the client. + + TX_RESULT_CANCELLED: + The asynchronous operation was cancelled. + + That handle to the async data must NOT be released. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The request was successfully sent. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txDisableBuiltinKeys( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING windowId, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *DisableBuiltinKeysHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING windowId, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ + +/** + txEnableBuiltinKeysAsync + + Enables EyeX builtin keys for a top-level window where the keys was previously disabled. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to enable keys. + Must not be TX_EMPTY_HANDLE. + + @param windowId [in]: + The window id for which to re-enable keys (window id corresponds to the windows handle on Windows). + + @param completionHandler [in]: + The TX_ASYNCDATACALLBACK that will handle the request result. + Can be NULL. + + The data provided by the TX_ASYNCDATACALLBACK will contain a result code which can be retrieved using + txGetAsyncDataResult(). The result code will be one of the following: + + TX_RESULT_OK: + The request was succesfully executed on the client. + + TX_RESULT_CANCELLED: + The asynchronous operation was cancelled. + + That handle to the async data must NOT be released. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The command was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txEnableBuiltinKeys( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING windowId, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *EnableBuiltinKeysHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING windowId, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ + +/** + txLaunchConfigurationTool + + \since Version 1.1.0 + + Launch a configuration tool. The supported tools are: + - EyeX Settings + - Test eye tracking + - Recalibrate current user profile + - Create new user profile + - Guest calibration + - Diagnostics + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context. + Must not be TX_EMPTY_HANDLE. + + @param configurationTool[in]: + A TX_CONFIGURATIONTOOL that determines which tool to launch. + + @param completionHandler [in]: + The TX_ASYNCDATACALLBACK that will handle the request result. + Can be NULL. + + The data provided by the TX_ASYNCDATACALLBACK will contain a result code which can be retrieved using + txGetAsyncDataResult(). The result code will be one of the following: + + TX_RESULT_OK: + The tool was successfully launched. + + TX_RESULT_INVALIDEYETRACKERSTATE: + The tool can not be launched in the current eye tracker state. + This could be that another configuration tool is active or that + the eye tracker is in an invalid state to start the configuration tool, + see TX_CONFIGURATIONTOOL for details. + + TX_RESULT_NOTFOUND: + The tool was not found or failed to launch. + + TX_RESULT_CANCELLED: + The client is not connected. + + The handle to the async data must NOT be released. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The command was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txLaunchConfigurationTool( + TX_CONTEXTHANDLE hContext, + TX_CONFIGURATIONTOOL configurationTool, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *LaunchConfigurationToolHook)( + TX_CONTEXTHANDLE hContext, + TX_CONFIGURATIONTOOL configurationTool, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); + + + +/*********************************************************************************************************************/ + +/** + Set the current calibration profile. + + \since Version 1.3.0 + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context. + Must not be TX_EMPTY_HANDLE. + + @param profileName[in]: + The name of the profile to activate. Must be one of the available profiles, see state TX_STATEPATH_EYETRACKINGPROFILES. + + @param completionHandler [in]: + The TX_ASYNCDATACALLBACK that will handle the request result. + Can be NULL. + + The data provided by the TX_ASYNCDATACALLBACK will contain a result code which can be retrieved using + txGetAsyncDataResult(). The result code will be one of the following: + + TX_RESULT_OK: + The profile was successfully set. + + TX_RESULT_NOTFOUND: + The profile was not found among the available profiles. + + The handle to the async data must NOT be released. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The command was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetCurrentProfile( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING profileName, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetCurrentProfileHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING profileName, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam); + + + +/*********************************************************************************************************************/ + +/** + Delete a calibration profile. + + \since Version 1.3.0 + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context. + Must not be TX_EMPTY_HANDLE. + + @param profileName[in]: + The name of the profile to delete. Must be one of the available profiles, see state TX_STATEPATH_EYETRACKINGPROFILES. + + @param completionHandler [in]: + The TX_ASYNCDATACALLBACK that will handle the request result. + Can be NULL. + + The data provided by the TX_ASYNCDATACALLBACK will contain a result code which can be retrieved using + txGetAsyncDataResult(). The result code will be one of the following: + + TX_RESULT_OK: + The profile was successfully set. + + TX_RESULT_NOTFOUND: + The profile was not found among the available profiles. + + The handle to the async data must NOT be released. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The command was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txDeleteProfile( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING profileName, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *DeleteProfileHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING profileName, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_ACTION_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXAsyncData.h b/Tobii EyeX/include/eyex/EyeXAsyncData.h new file mode 100755 index 0000000..6395985 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXAsyncData.h @@ -0,0 +1,86 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXAsyncData.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_ASYNCDATA_API__H__) +#define __TOBII_TX_ASYNCDATA_API__H__ + +/*********************************************************************************************************************/ + +/** + txGetAsyncDataResultCode + + Gets the result code contained by an async data. + Not all async data objects have a result code. See the specific asynchronous call for + details. + + @param hAsyncData [in]: + A TX_CONSTHANDLE to the async data object. + Must not be TX_EMPTY_HANDLE. + + @param pResult [out]: + A pointer to a TX_RESULT which will be set to the result code. + Must not be NULL. + + @return + TX_RESULT_OK: The result code of the async data was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The async data does not have a result code. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetAsyncDataResultCode( + TX_CONSTHANDLE hAsyncData, + TX_RESULT* pResult + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetAsyncDataResultCodeHook)( + TX_CONSTHANDLE hAsyncData, + TX_RESULT* pResult + ); + + +/*********************************************************************************************************************/ + +/** + txGetAsyncDataContent + + Gets the content of an asynchronous data object. + The content may be any interaction object or nothing depending on the operation. + + @param hCommand [in]: + A TX_CONSTHANDLE to the async data object. + Must not be TX_EMPTY_HANDLE. + + @param phObject [out]: + A pointer to a TX_HANDLE will be set to the content of the async data. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The content of the async data was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The async data does not have any content. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetAsyncDataContent( + TX_CONSTHANDLE hAsyncData, + TX_HANDLE* phObject + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetAsyncDataContentHook)( + TX_CONSTHANDLE hAsyncData, + TX_HANDLE* phObject + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_ASYNCDATA_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXBehavior.h b/Tobii EyeX/include/eyex/EyeXBehavior.h new file mode 100755 index 0000000..9bee288 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXBehavior.h @@ -0,0 +1,764 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXBehavior.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_BEHAVIOR_API__H__) +#define __TOBII_TX_BEHAVIOR_API__H__ + +/*********************************************************************************************************************/ + +/** + txGetBehaviorType + + Gets the TX_BEHAVIORTYPE of an interaction behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior. + Must not be TX_EMPTY_HANDLE. + + @param pBehaviorType [out]: + A pointer to a TX_BEHAVIORTYPE which will be set to the type of the behavior + Must not be NULL. + + @return + TX_RESULT_OK: The type of the behavior was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetBehaviorType( + TX_CONSTHANDLE hBehavior, + TX_BEHAVIORTYPE* pBehaviorType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetBehaviorTypeHook)( + TX_CONSTHANDLE hBehavior, + TX_BEHAVIORTYPE* pBehaviorType + ); + + +/*********************************************************************************************************************/ + +/** + txSetActivatableBehaviorParams + + Sets TX_ACTIVATABLEPARAMS for an activatable Behavior. + + @param hBehavior [in]: + A TX_HANDLE to the behavior on which to set the parameters. + Must not be TX_EMPTY_HANDLE. + + @param pParams [in]: + A pointer to a TX_ACTIVATABLEPARAMS which specifies the behaviors parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The option was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetActivatableBehaviorParams( + TX_HANDLE hBehavior, + const TX_ACTIVATABLEPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetActivatableBehaviorParamsHook)( + TX_HANDLE hBehavior, + const TX_ACTIVATABLEPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetActivatableBehaviorParams + + Gets the TX_ACTIVATABLEPARAMS for an activatable behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the parameters should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pParams [out]: + A pointer to a TX_ACTIVATABLEPARAMS which will be set to the behaviors parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_ACTIVATABLE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetActivatableBehaviorParams( + TX_CONSTHANDLE hBehavior, + TX_ACTIVATABLEPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetActivatableBehaviorParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_ACTIVATABLEPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetActivatableEventType + + Gets the TX_ACTIVABLEEVENTTYPE for an activatable behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the event type will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventType [out]: + A pointer to a TX_ACTIVATABLEEVENTTYPE which will be set to the event type. + Must not be NULL. + + @return + TX_RESULT_OK: The event type was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_ACTIVATABLE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetActivatableEventType( + TX_CONSTHANDLE hBehavior, + TX_ACTIVATABLEEVENTTYPE* pEventType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetActivatableEventTypeHook)( + TX_CONSTHANDLE hBehavior, + TX_ACTIVATABLEEVENTTYPE* pEventType + ); + + +/*********************************************************************************************************************/ + +/** + txGetActivationFocusChangedEventParams + + Gets the TX_ACTIVATIONFOCUSCHANGEDEVENTPARAMS for an activatable behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the event parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventParams [out]: + A pointer to a TX_ACTIVATIONFOCUSCHANGEDEVENTPARAMS which will be set to the behaviors event parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_ACTIVATABLE. + TX_RESULT_NOTFOUND: The options could not be found due to invalid event type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetActivationFocusChangedEventParams( + TX_CONSTHANDLE hBehavior, + TX_ACTIVATIONFOCUSCHANGEDEVENTPARAMS* pEventParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetActivationFocusChangedEventParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_ACTIVATIONFOCUSCHANGEDEVENTPARAMS* pEventParams + ); + + +/*********************************************************************************************************************/ + +/** + txSetPannableBehaviorParams + + Sets the TX_PANNABLEPARAMS for a pannable behavior. + + @param hBehavior [in]: + A TX_HANDLE to the behavior on which to set the parameters. + Must not be TX_EMPTY_HANDLE. + + @param pParams [in]: + A pointer to a TX_PANNABLEPARAMS which specifies the parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_PANNABLE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetPannableBehaviorParams( + TX_HANDLE hBehavior, + const TX_PANNABLEPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetPannableBehaviorParamsHook)( + TX_HANDLE hBehavior, + const TX_PANNABLEPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetPannableBehaviorParams + + Gets the TX_PANNABLEPARAMS for a pannable behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pParams [out]: + A pointer to a TX_PANNABLEPARAMS which will be set to the parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_PANNABLE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPannableBehaviorParams( + TX_CONSTHANDLE hBehavior, + TX_PANNABLEPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPannableBehaviorParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_PANNABLEPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetPannableEventType + + Gets the TX_PANNABLEEVENTTYPE for a pannable behavior event. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the event type will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventType [out]: + A pointer to a TX_PANNABLEEVENTTYPE which will be set to the event type. + Must not be NULL. + + @return + TX_RESULT_OK: The event type was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_PANNABLE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPannableEventType( + TX_CONSTHANDLE hBehavior, + TX_PANNABLEEVENTTYPE* pEventType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPannableEventTypeHook)( + TX_CONSTHANDLE hBehavior, + TX_PANNABLEEVENTTYPE* pEventType + ); + + + +/*********************************************************************************************************************/ + +/** + txGetPannablePanEventParams + + Gets the TX_PANNABLEPANEVENTPARAMS for a pannable behavior pan event. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventParams [out]: + A pointer to a TX_PANNABLEPANEVENTPARAMS which will be set to the parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The event parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_PANNABLE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPannablePanEventParams( + TX_CONSTHANDLE hBehavior, + TX_PANNABLEPANEVENTPARAMS* pEventParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPannablePanEventParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_PANNABLEPANEVENTPARAMS* pEventParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetPannableStepEventParams + + Gets the TX_PANNABLESTEPEVENTPARAMS for a pannable behavior step event. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventParams [out]: + A pointer to a TX_PANNABLESTEPEVENTPARAMS which will be set to the parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The event parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_PANNABLE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPannableStepEventParams( + TX_CONSTHANDLE hBehavior, + TX_PANNABLESTEPEVENTPARAMS* pEventParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPannableStepEventParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_PANNABLESTEPEVENTPARAMS* pEventParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetPannableHandsFreeEventParams + + Gets the TX_PANNABLEHANDSFREEEVENTPARAMS for a pannable behavior hands free event. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventParams [out]: + A pointer to a TX_PANNABLEHANDSFREEEVENTPARAMS which will be set to the parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The event parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_PANNABLE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPannableHandsFreeEventParams( + TX_CONSTHANDLE hBehavior, + TX_PANNABLEHANDSFREEEVENTPARAMS* pEventParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPannableHandsFreeEventParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_PANNABLEHANDSFREEEVENTPARAMS* pEventParams + ); + + +/*********************************************************************************************************************/ + +/** + txSetGazePointDataBehaviorParams + + Sets TX_GAZEPOINTDATAPARAMS for a gaze point data behavior. + + @param hBehavior [in]: + A TX_HANDLE to the behavior on which to set the parameters. + Must not be TX_EMPTY_HANDLE. + + @param pParams [in]: + A pointer to a TX_GAZEPOINTDATAPARAMS which specifies the behavior parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_GAZEPOINTDATA. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetGazePointDataBehaviorParams( + TX_HANDLE hBehavior, + const TX_GAZEPOINTDATAPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetGazePointDataBehaviorParamsHook)( + TX_HANDLE hBehavior, + const TX_GAZEPOINTDATAPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetGazePointDataBehaviorParams + + Gets the TX_GAZEPOINTDATAPARAMS for gaze point data behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the parameter will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pParams [out]: + A pointer to a TX_GAZEPOINTDATAPARAMS which will be set to the behavior parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_GAZEPOINTDATA. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetGazePointDataBehaviorParams( + TX_CONSTHANDLE hBehavior, + TX_GAZEPOINTDATAPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetGazePointDataBehaviorParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_GAZEPOINTDATAPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetGazePointDataEventParams + + Gets the TX_GAZEPOINTDATAEVENTPARAMS for a gaze point behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the event parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventParams [out]: + A pointer to a TX_GAZEPOINTDATAEVENTPARAMS which will be set to the behavior event parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The event parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior is not of type TX_BEHAVIORTYPE_GAZEPOINTDATA. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetGazePointDataEventParams( + TX_CONSTHANDLE hBehavior, + TX_GAZEPOINTDATAEVENTPARAMS* pEventParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetGazePointDataEventParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_GAZEPOINTDATAEVENTPARAMS* pEventParams + ); + + +/*********************************************************************************************************************/ + +/** + txSetGazeAwareBehaviorParams + + Sets TX_GAZEAWAREPARAMS for a gaze aware behavior. + + @param hBehavior [in]: + A TX_HANDLE to the behavior on which to set the parameters. + Must not be TX_EMPTY_HANDLE. + + @param pParams [in]: + A pointer to a TX_GAZEAWAREPARAMS which specifies the behavior parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_GAZEAWARE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetGazeAwareBehaviorParams( + TX_HANDLE hBehavior, + const TX_GAZEAWAREPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetGazeAwareBehaviorParamsHook)( + TX_HANDLE hBehavior, + const TX_GAZEAWAREPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetGazeAwareBehaviorParams + + Gets the TX_GAZEAWAREPARAMS for gaze point data behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the parameter will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pParams [out]: + A pointer to a TX_GAZEAWAREPARAMS which will be set to the behavior parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_GAZEAWARE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetGazeAwareBehaviorParams( + TX_CONSTHANDLE hBehavior, + TX_GAZEAWAREPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetGazeAwareBehaviorParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_GAZEAWAREPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetGazeAwareBehaviorEventParams + + Gets the TX_GAZEAWAREEVENTPARAMS for a gaze-aware behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the event parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventParams [out]: + A pointer to a TX_GAZEAWAREEVENTPARAMS which will be set to the behavior event parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior was not of type TX_BEHAVIORTYPE_GAZEAWARE. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetGazeAwareBehaviorEventParams( + TX_CONSTHANDLE hBehavior, + TX_GAZEAWAREEVENTPARAMS* pEventParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetGazeAwareBehaviorEventParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_GAZEAWAREEVENTPARAMS* pEventParams + ); + + +/*********************************************************************************************************************/ + +/** + txSetFixationDataBehaviorParams + + Gets the TX_FIXATIONDATAPARAMS for a fixation behavior. + + @param hBehavior [in]: + A TX_HANDLE to the behavior on which the parameters will be set. + Must not be TX_EMPTY_HANDLE. + + @param pParams [in]: + A pointer to a TX_FIXATIONDATAPARAMS which will be set to the behavior parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior is not of type TX_Behavior_FIXATIONDATA. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetFixationDataBehaviorParams( + TX_HANDLE hBehavior, + const TX_FIXATIONDATAPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetFixationDataBehaviorParamsHook)( + TX_HANDLE hBehavior, + const TX_FIXATIONDATAPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetFixationDataBehaviorParams + + Gets the TX_FIXATIONDATAPARAMS for a fixation behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pParams [out]: + A pointer to a TX_FIXATIONDATAPARAMS which will be set to the behavior parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior is not of type TX_Behavior_FIXATIONDATA. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetFixationDataBehaviorParams( + TX_CONSTHANDLE hBehavior, + TX_FIXATIONDATAPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetFixationDataBehaviorParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_FIXATIONDATAPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetFixationDataEventParams + + Gets the TX_FIXATIONDATAEVENTPARAMS for a fixation behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the event parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventParams [out]: + A pointer to a TX_FIXATIONDATAEVENTPARAMS which will be set to the behavior event parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The event parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior is not of type TX_BEHAVIORTYPE_FIXATIONDATA. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetFixationDataEventParams( + TX_CONSTHANDLE hBehavior, + TX_FIXATIONDATAEVENTPARAMS* pEventParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetFixationDataEventParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_FIXATIONDATAEVENTPARAMS* pEventParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetEyePositionDataEventParams + + Gets the TX_EYEPOSITIONDATAEVENTPARAMS for an eye position behavior. + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the event parameters will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pEventParams [out]: + A pointer to a TX_EYEPOSITIONDATAEVENTPARAMS which will be set to the behavior event parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The event parameters was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBEHAVIORTYPE: The behavior is not of type TX_BEHAVIORTYPE_EYEPOSITIONDATA. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetEyePositionDataEventParams( + TX_CONSTHANDLE hBehavior, + TX_EYEPOSITIONDATAEVENTPARAMS* pEventParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetEyePositionDataEventParamsHook)( + TX_CONSTHANDLE hBehavior, + TX_EYEPOSITIONDATAEVENTPARAMS* pEventParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetBehaviorEventTimestamp + + Gets the timestamp of when the behavior was created, in milliseconds. + Not to be confused with data timestamps, which deals with when + the data was captured by the tracker (e.g. TX_GAZEPOINTDATAEVENTPARAMS - Timestamp) + + @param hBehavior [in]: + A TX_CONSTHANDLE to the behavior from which the timestamp will be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pTimestamp [out]: + A pointer to a TX_REAL which will be set to the behavior event Timestamp. + Must not be NULL. + + @return + TX_RESULT_OK: The timestamp was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The timestamp cannot be found for the supplied behavior. + */ + TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetBehaviorEventTimestamp( + TX_CONSTHANDLE hBehavior, + TX_REAL* pTimestamp + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetBehaviorEventTimestampHook)( + TX_CONSTHANDLE hBehavior, + TX_REAL* pTimestamp + ); + + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_BEHAVIOR_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXBounds.h b/Tobii EyeX/include/eyex/EyeXBounds.h new file mode 100755 index 0000000..1c0a4eb --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXBounds.h @@ -0,0 +1,292 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXBounds.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_BOUNDS_API__H__) +#define __TOBII_TX_BOUNDS_API__H__ + +/*********************************************************************************************************************/ + +/** + txGetBoundsType + + Gets the TX_BOUNDSTYPE of an interaction bounds object. + + @param hBounds [in]: + A TX_CONSTHANDLE to the bounds. + Must not be TX_EMPTY_HANDLE. + + @param pBoundsType [out]: + A pointer to a TX_BOUNDSTYPE which will be set to the type of the bounds. + Must not be NULL. + + @return + TX_RESULT_OK: The type of the bounds was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetBoundsType( + TX_CONSTHANDLE hBounds, + TX_BOUNDSTYPE* pBoundsType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetBoundsTypeHook)( + TX_CONSTHANDLE hBounds, + TX_BOUNDSTYPE* pBoundsType + ); + + +/*********************************************************************************************************************/ + +/** + txSetRectangularBoundsData + + Sets rectangular bounds data for a bounds object. + + @param hBounds [in]: + A TX_HANDLE to the bounds on which to set the rectangle. + Must not be TX_EMPTY_HANDLE. + + @param x [in]: + Position of left edge of the rectangle. + + @param y [in]: + Position of top edge of the rectangle. + + @param width [in]: + Width of the rectangle. Must not be negative. + + @param height [in]: + Height of the rectangle. Must not be negative. + + @return + TX_RESULT_OK: The rectangular data was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBOUNDSTYPE: The bounds type was invalid, must be TX_BOUNDSTYPE_RECTANGULAR. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetRectangularBoundsData( + TX_HANDLE hBounds, + TX_REAL x, + TX_REAL y, + TX_REAL width, + TX_REAL height + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetRectangularBoundsDataHook)( + TX_HANDLE hBounds, + TX_REAL x, + TX_REAL y, + TX_REAL width, + TX_REAL height + ); + + +/*********************************************************************************************************************/ + +/** + txSetRectangularBoundsDataRect + + Sets rectangular bounds data for a bounds object. + + @param hBounds [in]: + A TX_HANDLE to the bounds object on which to set the rectangle. + Must not be TX_EMPTY_HANDLE. + + @param pRect [in]: + A pointer to a TX_RECT which holds the rectangular data. + Must not be NULL. + + @return + TX_RESULT_OK: The rectangular data was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBOUNDSTYPE: The bounds type was invalid, must be TX_BOUNDSTYPE_RECTANGULAR. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetRectangularBoundsDataRect( + TX_HANDLE hBounds, + const TX_RECT* pRect + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetRectangularBoundsDataRectHook)( + TX_HANDLE hBounds, + const TX_RECT* pRect + ); + + +/*********************************************************************************************************************/ + +/** + txGetRectangularBoundsData + + Gets rectangular bounds data from a bounds object. + + @param hBounds [in]: + A TX_CONSTHANDLE to the bounds object from which to get the rectangular data. + Must not be TX_EMPTY_HANDLE. + + @param pX [out]: + A pointer to a TX_REAL which will be set to the position of the left edge of the rectangle. + Must not be NULL. + + @param pY [out]: + A pointer to a TX_REAL which will be set to the position of the top edge of the rectangle. + Must not be NULL. + + @param pWidth [out]: + A pointer to a TX_REAL which will be set to the width of the rectangle. + Must not be NULL. + + @param height [out]: + A pointer to a TX_REAL which will be set to the height of the rectangle. + Must not be NULL. + + @return + TX_RESULT_OK: The rectangular data was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBOUNDSTYPE: The bounds type is invalid, must be TX_BOUNDSTYPE_RECTANGULAR. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetRectangularBoundsData( + TX_CONSTHANDLE hBounds, + TX_REAL* pX, + TX_REAL* pY, + TX_REAL* pWidth, + TX_REAL* pHeight + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetRectangularBoundsDataHook)( + TX_CONSTHANDLE hBounds, + TX_REAL* pX, + TX_REAL* pY, + TX_REAL* pWidth, + TX_REAL* pHeight + ); + + +/*********************************************************************************************************************/ + +/** + txGetRectangularBoundsDataRect + + Gets rectangular bounds data from a bounds object. + + @param hBounds [in]: + A TX_CONSTHANDLE to the Bounds on which to get the rectangle data. + Must not be TX_EMPTY_HANDLE. + + @param pRect [out]: + A pointer to a TX_RECT which will hold the rectangle data. + Must not be NULL. + + @return + TX_RESULT_OK: The rectangular data was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBOUNDSTYPE: The bounds type is invalid, must be TX_BOUNDSTYPE_RECTANGULAR. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetRectangularBoundsDataRect( + TX_CONSTHANDLE hBounds, + TX_RECT* pRect + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetRectangularBoundsDataRectHook)( + TX_CONSTHANDLE hBounds, + TX_RECT* pRect + ); + + +/*********************************************************************************************************************/ + +/** + txBoundsIntersect + + Checks if a bound intersects with a rectangle. + + @param hBounds [in]: + The bounds to check intersection with. + + @param x2 [in]: + The upper left x coordinate of the rectangle + + @param y2 [in]: + The upper left y coordinate of the rectangle + + @param width2 [in]: + The width of the rectangle + + @param height2 [in]: + The height of the rectangle + + @param pIntersects [out] + The intersection test result. Will be non-zero if rectangles intersects. + Must not be NULL. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txBoundsIntersect( + TX_CONSTHANDLE hBounds, + TX_REAL x2, + TX_REAL y2, + TX_REAL width2, + TX_REAL height2, + TX_BOOL* pIntersects + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *BoundsIntersectHook)( + TX_CONSTHANDLE hBounds, + TX_REAL x2, + TX_REAL y2, + TX_REAL width2, + TX_REAL height2, + TX_BOOL* pIntersects + ); + + +/*********************************************************************************************************************/ + +/** + txBoundsIntersectRect + + Checks if a bound intersects with a rectangle. + + @param hBounds [in]: + The bounds to check intersection with. + + @param pRect2 [in]: + The rectangle to check intersection with. + + @param pIntersects [out] + The intersection test result. Will be non-zero if rectangles intersects. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txBoundsIntersectRect( + TX_CONSTHANDLE hBounds, + const TX_RECT* pRect2, + TX_BOOL* pIntersects + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *BoundsIntersectRectHook)( + TX_CONSTHANDLE hBounds, + const TX_RECT* pRect2, + TX_BOOL* pIntersects + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_BOUNDS_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXClientTypes.h b/Tobii EyeX/include/eyex/EyeXClientTypes.h new file mode 100755 index 0000000..aa4e43c --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXClientTypes.h @@ -0,0 +1,954 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXClientTypes.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CLIENT_TYPES__H__) +#define __TOBII_TX_CLIENT_TYPES__H__ + +/********************************************************************************************************************* + * Common types + *********************************************************************************************************************/ + +typedef void* TX_USERPARAM; +typedef struct txInteractionObject* TX_HANDLE; +typedef const struct txInteractionObject* TX_CONSTHANDLE; +typedef struct txProperty* TX_PROPERTYHANDLE; +typedef const struct txProperty* TX_CONSTPROPERTYHANDLE; +typedef struct txContext* TX_CONTEXTHANDLE; +typedef const struct txContext* TX_CONSTCONTEXTHANDLE; +typedef int TX_TICKET; +typedef int TX_BOOL; +typedef unsigned char TX_BYTE; +typedef int TX_SIZE; +typedef int TX_INTEGER; +typedef double TX_REAL; +typedef char TX_CHAR; +typedef char* TX_STRING; +typedef const char* TX_CONSTSTRING; +typedef void* TX_RAWPTR; +typedef int TX_THREADID; + +/*********************************************************************************************************************/ + +#include "EyeXInternalTypes.h" + +/*********************************************************************************************************************/ + +#define TX_EMPTY_HANDLE 0 +#define TX_INVALID_TICKET 0 + +#define TX_TRUE 1 +#define TX_FALSE 0 + +#define TX_CLEANUPTIMEOUT_DEFAULT 500 +#define TX_CLEANUPTIMEOUT_FORCEIMMEDIATE -1 + +/*********************************************************************************************************************/ + +/** + TX_EYEXCOMPONENTOVERRIDEFLAGS + + Enumeration for all client environment component override flags. + When calling txInitializeEyeX these flags must be combined to specify which components should be overridden. + + @field TX_EYEXCOMPONENTOVERRIDEFLAG_NONE: + No client environment component should be overridden. + + @field TX_EYEXCOMPONENTOVERRIDEFLAG_LOGGINGMODEL: + The logging model should be overridden. + The logging model can be overridden by just specifying some of the standard log targets (see TX_LOGTARGET) or by + a custom user implemented log writer. + + @field TX_EYEXCOMPONENTOVERRIDEFLAG_INTERNAL_MEMORYMODEL: + The memory model should be overridden. For internal use only. + + @field TX_EYEXCOMPONENTOVERRIDEFLAG_INTERNAL_THREADINGMODEL: + The threading model should be overridden. For internal use only. + + @field TX_EYEXCOMPONENTOVERRIDEFLAG_INTERNAL_SCHEDULINGMODEL: + The scheduling model should be overridden. For internal use only. + */ +typedef enum { + TX_EYEXCOMPONENTOVERRIDEFLAG_NONE = TX_FLAGS_NONE_VALUE, + TX_EYEXCOMPONENTOVERRIDEFLAG_LOGGINGMODEL = 1 << 0, + TX_EYEXCOMPONENTOVERRIDEFLAG_INTERNAL_MEMORYMODEL = 1 << 1, + TX_EYEXCOMPONENTOVERRIDEFLAG_INTERNAL_THREADINGMODEL = 1 << 2, + TX_EYEXCOMPONENTOVERRIDEFLAG_INTERNAL_SCHEDULINGMODEL = 1 << 3 +} TX_EYEXCOMPONENTOVERRIDEFLAGS; + +/*********************************************************************************************************************/ + +/** + TX_CONNECTIONSTATE + + Enumeration for all connection states. + These values are used to notify the application of the current connection state. + To receive these notifications the client needs to subscribe using txRegisterConnectionStateChangedHandler and then + call txEnableConnection. + + @field TX_CONNECTIONSTATE_CONNECTED: + The client is now connected to the server. + + @field TX_CONNECTIONSTATE_DISCONNECTED: + The client is now disconnected from the server. Unless this is due to txDisableConnection being called the client + will shortly attempt to connect again. + + @field TX_CONNECTIONSTATE_TRYINGTOCONNECT: + The client is now trying to connect to the server. This is the first state being sent to the application after + txEnableConnection has been called. + + @field TX_CONNECTIONSTATE_SERVERVERSIONTOOLOW: + the server version is too low. The client is not connected and will not try to reconnect. + + @field TX_CONNECTIONSTATE_SERVERVERSIONTOOHIGH: + the server version is too high. The client is not connected and will not try to reconnect. + */ +typedef enum { + TX_CONNECTIONSTATE_CONNECTED = TX_ENUM_STARTVALUE, + TX_CONNECTIONSTATE_DISCONNECTED, + TX_CONNECTIONSTATE_TRYINGTOCONNECT, + TX_CONNECTIONSTATE_SERVERVERSIONTOOLOW, + TX_CONNECTIONSTATE_SERVERVERSIONTOOHIGH +} TX_CONNECTIONSTATE; + +/*********************************************************************************************************************/ + +/** + TX_LOGTARGET + + Enumeration for all log targets. + When overriding the logging model these flags specify which log targets to use. The flags can be combined. + + @field TX_LOGTARGET_NONE: + No logging should occur at all. + + @field TX_LOGTARGET_CONSOLE: + The log message should be written to the console. + + @field TX_LOGTARGET_TRACE: + The log messages should be traced. (output window i Visual Studio) + + @field TX_LOGTARGET_CUSTOM: + The specified TX_LOGCALLBACK should be invoked for custom logging. + */ +typedef enum { + TX_LOGTARGET_NONE = TX_FLAGS_NONE_VALUE, + TX_LOGTARGET_CONSOLE = 1 << 0, + TX_LOGTARGET_TRACE = 1 << 1, + TX_LOGTARGET_CUSTOM = 1 << 2 +} TX_LOGTARGET; + +/*********************************************************************************************************************/ + +/** + TX_LOGLEVEL + + Enumeration for all log levels. + The log levels are used to indicate the severity of the message. + + @field TX_LOGLEVEL_DEBUG: + The message is just a debug print out typically used during development. + + @field TX_LOGLEVEL_INFO: + The message is plain info and does not indciate that something is wrong. + + @field TX_LOGLEVEL_WARNING: + The message is a warning that indicates that something is not the way it should, not yet critical. + + @field TX_LOGLEVEL_ERROR: + The message indicates that there is some kind of error. + */ +typedef enum { + TX_LOGLEVEL_DEBUG = TX_ENUM_STARTVALUE, + TX_LOGLEVEL_INFO, + TX_LOGLEVEL_WARNING, + TX_LOGLEVEL_ERROR +} TX_LOGLEVEL; + +/*********************************************************************************************************************/ + +/** + TX_SCHEDULINGMODE + + Enumeration for all schedulng modes. + When overriding the scheduling model the mode specifies which of the available scheduling modes to use. + + @field TX_SCHEDULINGMODE_DIRECT: + All jobs are performed immediately on the thread that calls them. + + @field TX_SCHEDULINGMODE_USERFRAME: + All jobs are performed when the txPerformScheduledJobs are called. + + @field TX_SCHEDULINGMODE_CUSTOM: + Whenever a job is to be performed a callback function is invoked giving the client application full control. + */ +typedef enum { + TX_SCHEDULINGMODE_DIRECT = TX_ENUM_STARTVALUE, + TX_SCHEDULINGMODE_USERFRAME, + TX_SCHEDULINGMODE_CUSTOM +} TX_SCHEDULINGMODE; + +/*********************************************************************************************************************/ + +/** + TX_PROPERTYVALUETYPE + + Enumeration for all property value types. + + @field TX_PROPERTYVALUETYPE_EMPTY: + The property does not have a value. + + @field TX_PROPERTYVALUETYPE_OBJECT: + The property currently holds an interaction object. + + @field TX_PROPERTYVALUETYPE_INTEGER: + The property currently holds an integer. + + @field TX_PROPERTYVALUETYPE_REAL: + The property currently holds a real. + + @field TX_PROPERTYVALUETYPE_STRING: + The property currently holds a string. + + @field TX_PROPERTYVALUETYPE_BLOB: + The property currently holds a blob. + */ +typedef enum { + TX_PROPERTYVALUETYPE_EMPTY = TX_ENUM_STARTVALUE, + TX_PROPERTYVALUETYPE_OBJECT, + TX_PROPERTYVALUETYPE_INTEGER, + TX_PROPERTYVALUETYPE_REAL, + TX_PROPERTYVALUETYPE_STRING, + TX_PROPERTYVALUETYPE_BLOB +} TX_PROPERTYVALUETYPE; + +/*********************************************************************************************************************/ + +/** + TX_PROPERTYBAGTYPE + + Enumeration for the all Property Bag types. + + @field TX_PROPERTYBAGTYPE_OBJECT: + The property is a normal object with named properties. + + @field TX_PROPERTYBAGTYPE_ARRAY: + The property bag is an array with sequentially named properties appearing in the order they where inserted. + */ +typedef enum { + TX_PROPERTYBAGTYPE_OBJECT = TX_ENUM_STARTVALUE, + TX_PROPERTYBAGTYPE_ARRAY +} TX_PROPERTYBAGTYPE; + +/*********************************************************************************************************************/ + +/** + TX_EYEXAVAILABILITY + + Enumeration for the availability status of the EyeX Engine. + + @field TX_EYEXAVAILABILITY_NOTAVAILABLE: + EyeX Engine is not installed on the system or otherwise not available. + + @field TX_EYEXAVAILABILITY_NOTRUNNING: + EyeX Engine is not running. + + @field TX_EYEXAVAILABILITY_RUNNING: + EyeX Engine is running. + */ +typedef enum { + TX_EYEXAVAILABILITY_NOTAVAILABLE = TX_ENUM_STARTVALUE, + TX_EYEXAVAILABILITY_NOTRUNNING, + TX_EYEXAVAILABILITY_RUNNING +} TX_EYEXAVAILABILITY; + + +/********************************************************************************************************************* + * Callbacks + *********************************************************************************************************************/ + +/** + Callback for when the connection state is changed. + See txRegisterConnectionStateChangedHandler + + @param state [in]: + Specifies the current state of the connection. + + @param userParam [in]: + The user parameter provided to the txRegisterConnectionStateChangedHandler function. + + @return + void + */ +typedef void (TX_CALLCONVENTION *TX_CONNECTIONSTATECHANGEDCALLBACK)( + TX_CONNECTIONSTATE state, + TX_USERPARAM userParam + ); + +#if defined(__cplusplus) +#ifndef TOBII_TX_INTEROP +#include + + namespace Tx { + typedef std::function ConnectionStateChangedCallback; + } + +#endif +#endif + +/*********************************************************************************************************************/ + +/** + Callback for an asynchronous operations. + + @param hAsyncData [in]: + A TX_CONSTHANDLE to the async data. + + @param userParam [in]: + The user parameter provided to the asynchronous operation. + + @return + void + */ +typedef void (TX_CALLCONVENTION *TX_ASYNCDATACALLBACK)( + TX_CALLBACK_PARAM(TX_CONSTHANDLE) hAsyncData, + TX_USERPARAM userParam + ); + +#if defined(__cplusplus) +#ifndef TOBII_TX_INTEROP +#include + + namespace Tx { + typedef std::function AsyncDataCallback; + } + +#endif +#endif + +/*********************************************************************************************************************/ + +/** + Function run by a thread. + See txInitializeEyeX, TX_THREADINGMODEL + + @param threadWorkerParam [in]: + The user parameter provided to the CreateThreadCallback. + + @return + void + */ +typedef void (TX_CALLCONVENTION *TX_THREADWORKERFUNCTION)( + TX_USERPARAM threadWorkerParam + ); + +/*********************************************************************************************************************/ + +/** + Callback used to create a thread. + See txInitializeEyeX, TX_THREADINGMODEL + + @param worker [in]: + Worker function that will be run by the thread. + + @param threadWorkerParam [in]: + A user parameter passed to worker function. + + @param userParam [in]: + The user parameter provided by the TX_THREADINGMODEL structure. + + @return + TX_THREADID, the id of the created thread. + */ +typedef TX_THREADID (TX_CALLCONVENTION *TX_CREATETHREADCALLBACK)( + TX_THREADWORKERFUNCTION worker, + TX_USERPARAM threadWorkerParam, + TX_USERPARAM userParam + ); + +/*********************************************************************************************************************/ + +/** + Callback used to get the current thread id. + See txInitializeEyeX, TX_THREADINGMODEL + + @param userParam [in]: + The user parameter provided by the TX_THREADINGMODEL structure. + + @return + TX_THREADID, the id of the current thread + */ +typedef TX_THREADID (TX_CALLCONVENTION *TX_GETCURRENTTHREADIDCALLBACK)( + TX_USERPARAM userParam + ); + +/*********************************************************************************************************************/ + +/** + Callback used to join a thread. + See txInitializeEyeX, TX_THREADINGMODEL + + @param threadId [in]: + The id of the thread to join. + + @param userParam [in]: + The user parameter provided by the TX_THREADINGMODEL structure. + + @return + TX_TRUE if the thread was successfully joined. TX_FALSE on non existing thread. + */ +typedef TX_BOOL (TX_CALLCONVENTION *TX_JOINTHREADCALLBACK)( + TX_THREADID threadId, + TX_USERPARAM userParam + ); + +/*********************************************************************************************************************/ + +/** + Callback used to delete a thread. + See txInitializeEyeX, TX_THREADINGMODEL + + @param threadId [in]: + The id of the thread to be deleted. + + @param userParam [in]: + The user parameter provided by the TX_THREADINGMODEL structure. + + @return + TX_TRUE if the thread was successfully deleted, otherwise TX_FALSE. + */ +typedef TX_BOOL (TX_CALLCONVENTION *TX_DELETETHREADCALLBACK)( + TX_THREADID threadId, + TX_USERPARAM userParam + ); + +/*********************************************************************************************************************/ + +/** + Callback used to release a threading model or a logging model. + See SetThreadingModel, SetLoggingModel + + @param userParam [in]: + Normally used for capture outside the scope of the callback. + */ +typedef void (TX_CALLCONVENTION *TX_DELETEMODELCALLBACK)( + TX_USERPARAM userParam + ); + +/*********************************************************************************************************************/ + +/** + Allocator function, used to override allocation of memory + See SetCustomAllocator + + @param length [in]: + Size in bytes of the requested memory block + + @return + void + */ +typedef void (TX_CALLCONVENTION *TX_ALLOCATORFUNCTION)( + TX_INTEGER length + ); + +/*********************************************************************************************************************/ + +/** + Callback for logging. + If a custom logging model is set, see TX_LOGGINGMODEL, this callback will be invoked when a log message is + written by the API. + + @param level [in]: + The level of log message, see TX_LOGLEVEL for levels. + + @param scope [in]: + A string token representing from which part the log message was originated. + + @param message [in]: + The message to be logged. + + @param userParam [in]: + The user parameter provided by the TX_LOGGINGMODEL structure. + + @return + void + */ +typedef void (TX_CALLCONVENTION *TX_LOGCALLBACK)( + TX_LOGLEVEL level, + TX_CONSTSTRING scope, + TX_CONSTSTRING message, + TX_USERPARAM userParam + ); + +/*********************************************************************************************************************/ + +/** + Function provided by the API when a job is scheduled. + See TX_SCHEDULEJOBCALLBACK. + + @param jobParam [in]: + The user parameter provided by the API when a job is scheduled. + + @return + void + */ +typedef void (TX_CALLCONVENTION *TX_PERFORMJOBFUNCTION)( + TX_USERPARAM jobParam + ); + +/*********************************************************************************************************************/ + +/** + Callback for scheduling a job. + If a custom scheduling model is set, see TX_SCHEDULINGMODEL, this callback will be invoked when a job is to be + scheduled. + + @param performJob [in]: + The function to invoke when the job is to be performed. + + @param jobParam [in]: + A parameter used to provide a context to the job. + + @param userParam [in]: + The user parameter provided to the TX_SCHEDULINGMODEL. + + @return + void + */ +typedef void (TX_CALLCONVENTION *TX_SCHEDULEJOBCALLBACK)( + TX_PERFORMJOBFUNCTION performJob, + TX_USERPARAM jobParam, + TX_USERPARAM userParam + ); + +/********************************************************************************************************************* + * Structs + *********************************************************************************************************************/ + +/** + Struct for a rectangle. + + @field X: + The X coordinate for the upper left corner of the rectangle. + + @field Y: + The Y coordinate for the upper left corner of the rectangle. + + @field Width: + The width of the rectangle. + + @field Height: + The height of the rectangle. + */ +typedef struct { + TX_REAL X; + TX_REAL Y; + TX_REAL Width; + TX_REAL Height; +} TX_RECT; + +/*********************************************************************************************************************/ + +/** + Struct for 2D vector. + + @field X: + The X coordinate of the vector. + + @field Y: + The Y coordinate of the vector. + */ +typedef struct { + TX_REAL X; + TX_REAL Y; +} TX_VECTOR2; + + /*********************************************************************************************************************/ + +/** + Struct for 2D size. + + @field Width: + The width of the size. + + @field Height: + The height of the size. + */ +typedef struct { + TX_REAL Width; + TX_REAL Height; +} TX_SIZE2; + +/*********************************************************************************************************************/ + +/** + Struct for pannable behavior parameters. + + @field IsHandsFreeEnabled: + Set to TX_FALSE - hands free panning is not yet implemented. + + @field Profile: + The panning profile. See TX_PANNINGPROFILE. + + @field PeakVelocity: + Currently not used. + + @field PanDirectionsAvailable: + Flags specifying which pan directions are currently possible. See TX_PANDIRECTION. + Correct pan direction flags are needed for panning to work properly. + */ +typedef struct { + TX_BOOL IsHandsFreeEnabled; + TX_PANNINGPROFILE Profile; + TX_REAL PeakVelocity; + TX_PANDIRECTION PanDirectionsAvailable; +} TX_PANNABLEPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for pannable pan event parameters. + + @field PanVelocityX: + The X velocity for the pan. In pixels per second. + + @field PanVelocityY: + The Y velocity for the pan. In pixels per second. + */ +typedef struct { + TX_REAL PanVelocityX; + TX_REAL PanVelocityY; +} TX_PANNABLEPANEVENTPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for pannable step event parameters. + + @field PanStepX: + The step length on the X axis in pixels. + + @field PanStepY: + The step length on the Y axis in pixels. + + @field PanStepDuration: + The amount of time in seconds during which the step should be performed. + */ +typedef struct { + TX_REAL PanStepX; + TX_REAL PanStepY; + TX_REAL PanStepDuration; +} TX_PANNABLESTEPEVENTPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for pannable hands free event parameters. + + @field HandsFreeEnabled: + Specifies if hands free panning is enabled or not. + */ +typedef struct { + TX_BOOL HandsFreeEnabled; +} TX_PANNABLEHANDSFREEEVENTPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for activatable behavior parameters. + + @field EnableTentativeFocus: + Specifies if tentative focus should be enabled. + @field EnableSmallItemActivation: + Specifies if small item detection should be enabled. + For internal use only. + */ +typedef struct { + TX_BOOL EnableTentativeFocus; + TX_BOOL EnableSmallItemDetection; +} TX_ACTIVATABLEPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for gaze aware parameters. + + @field GazeAwareMode: + Specifies the gaze aware mode. See TX_GAZEAWAREMODE. + + @field DelayTime: + Specifies the amount of time in milliseconds that the user has to look at an interactor before a gaze aware event + is sent. This value only has an effect if the mode is set to TX_GAZEAWAREMODE_DELAYED. + */ +typedef struct { + TX_GAZEAWAREMODE GazeAwareMode; + TX_REAL DelayTime; +} TX_GAZEAWAREPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for gaze aware event parameters. + + @field HasGaze: + Specifies if the interactor currently has gaze on it. + */ +typedef struct { + TX_BOOL HasGaze; +} TX_GAZEAWAREEVENTPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for activation focus changed Params. + + @field HasTentativeActivationFocus: + Specifies if the interactor currently has tentative activation focus. + + @field HasActivationFocus: + Specifies if the interactor currently has activation focus. + */ +typedef struct { + TX_BOOL HasTentativeActivationFocus; + TX_BOOL HasActivationFocus; +} TX_ACTIVATIONFOCUSCHANGEDEVENTPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for gaze point data behavior parameters. + + @field GazePointDataMode: + Specifies the gaze point data mode. See TX_GAZEPOINTDATAMODE. + */ +typedef struct { + TX_GAZEPOINTDATAMODE GazePointDataMode; +} TX_GAZEPOINTDATAPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for fixation behavior parameters. + + @field FixationDataMode: + Specifies the fixation data mode. See TX_FIXATIONDATAMODE. + */ +typedef struct { + TX_FIXATIONDATAMODE FixationDataMode; +} TX_FIXATIONDATAPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for fixation behavior event parameters. + + @field FixationDataMode: + The fixation data mode. See TX_FIXATIONDATAMODE. + + @field EventType: + The type of fixation event. See TX_FIXATIONDATAEVENTTYPE. + + @field Timestamp: + For TX_FIXATIONDATAEVENTTYPE_BEGIN, this is the time when the fixation started, in milliseconds. + For TX_FIXATIONDATAEVENTTYPE_END, this is the time when the fixation ended, in milliseconds. + For TX_FIXATIONDATAEVENTTYPE_DATA, the timestamp for the filtered gaze point provided within + the current fixation, when the filter was applied, in milliseconds. + + @field X: + The current X coordinate of the fixation in pixels. For begin and end events will reflect where the fixation + began or ended. + + @field Y: + The current Y coordinate of the fixation in pixels. For begin and end events will reflect where the fixation + began or ended. + */ +typedef struct { + TX_FIXATIONDATAMODE FixationDataMode; + TX_FIXATIONDATAEVENTTYPE EventType; + TX_REAL Timestamp; + TX_REAL X; + TX_REAL Y; +} TX_FIXATIONDATAEVENTPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for gaze point data behavior event parameters. + + @field GazePointDataMode: + The gaze point data mode. See TX_GAZEPOINTDATAMODE. + + @field Timestamp: + For TX_GAZEPOINTDATAMODE_LIGHTLYFILTERED this is the point in time when the filter was applied, in milliseconds. + For TX_GAZEPOINTDATAMODE_UNFILTERED this is the point in time time when gazepoint was captured, in milliseconds. + + @field X: + The X coordinate of the gaze point in pixels. + + @field Y: + The Y coordinate of the gaze point in pixels. + */ +typedef struct { + TX_GAZEPOINTDATAMODE GazePointDataMode; + TX_REAL Timestamp; + TX_REAL X; + TX_REAL Y; +} TX_GAZEPOINTDATAEVENTPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for eye position data behavior event parameters. + + The components of the eye vectors are the relative position of the eyes from the center of the screen in + millimeters on each axis. + + @field Timestamp: + The point in time when the eye position was captured, in milliseconds. + + @field HasLeftEyePosition: + Specifies if the data for the left eye is valid. + + @field HasRightEyePosition: + Specifies if the data for the right eye is valid. + + @field LeftEyeX: + The X coordinate of the left eye in millimeters. + + @field LeftEyeY: + The Y coordinate of the left eye in millimeters. + + @field LeftEyeZ: + The Z coordinate of the left eye in millimeters. + + @field LeftEyeXNormalized: + The X coordinate of the left eye normalized in the track box. + + @field LeftEyeYNormalized: + The Y coordinate of the left eye normalized in the track box. + + @field LeftEyeZNormalized: + The Z coordinate of the left eye normalized in the track box. + + @field RightEyeX: + The X coordinate of the right eye in millimeters. + + @field RightEyeY: + The Y coordinate of the right eye in millimeters. + + @field RightEyeZ: + The Z coordinate of the right eye in millimeters. + + @field RightEyeXNormalized: + The X coordinate of the right eye normalized in the track box. + + @field RightEyeYNormalized: + The Y coordinate of the right eye normalized in the track box. + + @field RightEyeZNormalized: + The Z coordinate of the right eye normalized in the track box. + */ +typedef struct { + TX_REAL Timestamp; + TX_BOOL HasLeftEyePosition; + TX_BOOL HasRightEyePosition; + TX_REAL LeftEyeX; + TX_REAL LeftEyeY; + TX_REAL LeftEyeZ; + TX_REAL LeftEyeXNormalized; + TX_REAL LeftEyeYNormalized; + TX_REAL LeftEyeZNormalized; + TX_REAL RightEyeX; + TX_REAL RightEyeY; + TX_REAL RightEyeZ; + TX_REAL RightEyeXNormalized; + TX_REAL RightEyeYNormalized; + TX_REAL RightEyeZNormalized; +} TX_EYEPOSITIONDATAEVENTPARAMS; + +/*********************************************************************************************************************/ + +/** + Struct for the threading model. + + @field CreateThread: + Callback function used to create a thread. See TX_CREATETHREADCALLBACK. + + @field GetCurrentThreadId: + Callback function used to get the id of the current (calling) thread. See TX_GETCURRENTTHREADIDCALLBACK. + + @field JoinThread: + Callback function used to join a thread. See TX_JOINTHREADCALLBACK. + + @field DeleteThread: + Callback function used to delete a thread. See TX_DELETETHREADCALLBACK. + + @field DeleteModel: + Callback function used to release the threading model. + + @field UserParam: + User parameter which will be passed to the functions. + */ +typedef struct { + TX_CREATETHREADCALLBACK CreateThread; + TX_GETCURRENTTHREADIDCALLBACK GetCurrentThreadId; + TX_JOINTHREADCALLBACK JoinThread; + TX_DELETETHREADCALLBACK DeleteThread; + TX_DELETEMODELCALLBACK DeleteModel; + TX_USERPARAM UserParam; +} TX_THREADINGMODEL; + +/*********************************************************************************************************************/ + +/** + Struct for the logging model. + + @field Targets: + Specifies which log targets to use. See TX_LOGTARGET. + + @field Log: + Callback function used to write a custom log message. See TX_LOGCALLBACK. + + @field DeleteModel: + Callback function used to release the logging model. + + @field UserParam: + User parameter which will be passed to the custom log function. + */ +typedef struct { + TX_LOGTARGET Targets; + TX_LOGCALLBACK Log; + TX_DELETEMODELCALLBACK DeleteModel; + TX_USERPARAM UserParam; +} TX_LOGGINGMODEL; + +/*********************************************************************************************************************/ + +/** + Struct for the scheduling model. + + @field Mode: + Specifies which scheduling mode to use. See TX_SCHEDULINGMODE. + + @field Schedule: + Callback function schedule a work item. See TX_SCHEDULEJOBCALLBACK. + + @field DeleteModel: + Callback function used to release the logging model. + + @field UserParam: + User parameter which will be passed to the custom schedule function. + */ +typedef struct { + TX_SCHEDULINGMODE Mode; + TX_SCHEDULEJOBCALLBACK ScheduleJob; + TX_DELETEMODELCALLBACK DeleteModel; + TX_USERPARAM UserParam; +} TX_SCHEDULINGMODEL; + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_CLIENT_TYPES__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXCommand.h b/Tobii EyeX/include/eyex/EyeXCommand.h new file mode 100755 index 0000000..0e0002e --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXCommand.h @@ -0,0 +1,211 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXCommand.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_COMMAND_API__H__) +#define __TOBII_TX_COMMAND_API__H__ + +/*********************************************************************************************************************/ + +/** + txCreateCommand. For internal use only. + + Creates a command. Internal: In first hand, prefer a higher abstraction before + sending raw commands to the engine. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to create the command. + Must not be TX_EMPTY_HANDLE. + + @param phCommand [out]: + A pointer to a TX_HANDLE which will be set to the newly created command. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param commandType [in] + The type of the command. + + @return + TX_RESULT_OK: The command was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDCONTEXT: The handle to the context was invalid. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateCommand( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phCommand, + TX_COMMANDTYPE commandType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateCommandHook)( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phCommand, + TX_COMMANDTYPE commandType + ); + + +/*********************************************************************************************************************/ + +/** + txGetCommandType. For internal use only. + + Gets the TX_COMMANDTYPE of a command. + + @param hCommand [in]: + A TX_CONSTHANDLE to the command. + Must not be TX_EMPTY_HANDLE. + + @param pCommandType [out]: + A pointer to a TX_COMMANDTYPE which will be set to the type of the command. + Must not be NULL. + + @return + TX_RESULT_OK: The type of the command was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetCommandType( + TX_CONSTHANDLE hCommand, + TX_COMMANDTYPE* pCommandType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetCommandTypeHook)( + TX_CONSTHANDLE hCommand, + TX_COMMANDTYPE* pCommandType + ); + + +/*********************************************************************************************************************/ + +/** + txSetCommandData. For internal use only. + + Sets the data of a command. + If the command already has some object set as data it will be replaced and released. + + @param hCommand [in]: + A TX_HANDLE to the command. + Must not be TX_EMPTY_HANDLE. + + @param hObject [in]: + A TX_HANDLE to the object that should represent the data of the command. + Must not be NULL. + + @return + TX_RESULT_OK: The data of the command was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetCommandData( + TX_HANDLE hCommand, + TX_HANDLE hObject + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetCommandDataHook)( + TX_HANDLE hCommand, + TX_HANDLE hObject + ); + + +/*********************************************************************************************************************/ + +/** + txGetCommandData. For internal use only. + + Gets the data of a command. + + @param hCommand [in]: + A TX_CONSTHANDLE to the command. + Must not be TX_EMPTY_HANDLE. + + @param phObject [out]: + A pointer to a TX_HANDLE to which the handle of the object used as data will be copied. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The data of the command was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The command does not have any data. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetCommandData( + TX_CONSTHANDLE hCommand, + TX_HANDLE* phObject + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetCommandDataHook)( + TX_CONSTHANDLE hCommand, + TX_HANDLE* phObject + ); + + +/*********************************************************************************************************************/ + +/** + txExecuteCommandAsync. For internal use only. + + Executes a command asynchronously. + + @param hCommand [in]: + A TX_HANDLE to the command. + Must not be TX_EMPTY_HANDLE. + + @param completionHandler [in]: + The TX_ASYNCDATACALLBACK that will handle the command result. + Can be NULL. + + The data provided by the TX_ASYNCDATACALLBACK will contain a result code which can be retrieved using + txGetAsyncDataResult(). The result code will be one of the follwing: + + TX_RESULT_OK: + The command was succesfully executed on the client. + + TX_RESULT_INVALIDCOMMAND: + The command was rejected by the client. + + TX_RESULT_CANCELLED: + The asynchronous operation was cancelled. + + That handle to the async data must NOT be released. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The command was successfully executed. The actual result of the command will be provided to the callback. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txExecuteCommandAsync( + TX_HANDLE hCommand, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *ExecuteCommandAsyncHook)( + TX_HANDLE hCommand, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_COMMAND_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXConstants.h b/Tobii EyeX/include/eyex/EyeXConstants.h new file mode 100755 index 0000000..59ce248 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXConstants.h @@ -0,0 +1,33 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXConstants.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CONSTANTS__H__) +#define __TOBII_TX_CONSTANTS__H__ + +/*********************************************************************************************************************/ + +/** + * Constants for mask weights. + * + * @field TX_MASKWEIGHT_NONE: + * Use this mask weight to indicate that a region of an interactor has no weight (not interactable). + * + * @field TX_MASKWEIGHT_DEFAULT: + * Use this mask weight to indicate that a region of an interactor has a default weight. + + * @field TX_MASKWEIGHT_HIGH: + * Use this mask weight to indicate that a region of an interactor has a high weight (more likely to be interacted with). + */ + + static const unsigned char None = 0; + static const unsigned char Default = 1; + static const unsigned char High = 255; + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_CONSTANTS__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXContext.h b/Tobii EyeX/include/eyex/EyeXContext.h new file mode 100755 index 0000000..1033e14 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXContext.h @@ -0,0 +1,773 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXContext.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_CONTEXT_API__H__) +#define __TOBII_TX_CONTEXT_API__H__ + +/*********************************************************************************************************************/ + +/** + txCreateContext + + Creates a new context. + A context represents an environment in which the interaction objects live and a single connection to the client. + Interaction objects may not be shared between contexts. + A context must be cleaned up using txReleaseContext to avoid leaks. + + @param phContext [out]: + A pointer to a TX_CONTEXTHANDLE which will be set to the context. + Must not be NULL. + + @param trackObjects [in]: + Specifies if objects owned by this context should be tracked. + Specifying TX_TRUE will give more information on leaking objects when shutting down but comes with + a performance hit and is not recommended for production builds. + + @return + TX_RESULT_OK: The context was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateContext( + TX_CONTEXTHANDLE* phContext, + TX_BOOL trackObjects + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateContextHook)( + TX_CONTEXTHANDLE* phContext, + TX_BOOL trackObjects + ); + + +/*********************************************************************************************************************/ + +/** + txReleaseContext + + Releases an existing context. + If not all objects has been released prior to this call then TX_RESULT_OBJECTLEAKAGE will be returned and the context + will not be released. The leaking objects may be retreived using txGetTrackedObjects. + + @param phContext [in,out]: + A pointer to a TX_CONTEXTHANDLE pointing to the context. + If the context is successfully released the value of this pointer will be set to NULL. + Must not be NULL. + + @return + TX_RESULT_OK: The context was successfully released. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txReleaseContext( + TX_CONTEXTHANDLE* phContext + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *ReleaseContextHook)( + TX_CONTEXTHANDLE* phContext + ); + + +/*********************************************************************************************************************/ + +/** + txShutdownContext + + Shuts down a context. + This call will block until the context has been properly shut down or until the specified timeout has passed. + If any interaction objects are still alive when a context is being shut down this call will block for the specified + timeout waiting for other threads to release the objects. If any objects are still not released after this amount + of time then TX_RESULT_OBJECTLEAKAGE will be returned. The leaking objects may be retreived using txGetTrackedObjects. + + @param hContext [in]: + A TX_CONTEXTHANDLE pointing to the context. + Must not be NULL. + + @param cleanupTimeout [in]: + The amount of time in millseconds to wait for objects to be released. + Use the constant TX_CLEANUPTIMEOUT_DEFAULT for a default timeout of 500 ms. + Use the special value TX_CLEANUPTIMEOUT_FORCEIMMEDIATE to shut down the context immediately, without checking for + leaking objects. + + @param logLeakingObjectsInfo [in]: + Specifies if information about the leaking objects should be logged. To get full details on leaking objects the + context must be set up to track objects when created. + + @return + TX_RESULT_OK: The context was successfully shut down. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_OBJECTLEAKAGE: All interaction objects have not been released properly. The context was not deleted. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txShutdownContext( + TX_CONTEXTHANDLE hContext, + TX_INTEGER cleanupTimeout, + TX_BOOL logLeakingObjectsInfo + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *ShutdownContextHook)( + TX_CONTEXTHANDLE hContext, + TX_INTEGER cleanupTimeout, + TX_BOOL logLeakingObjectsInfo + ); + + +/*********************************************************************************************************************/ + +/** + txSetContextName + + Sets the name of a context. This name will only be used when logging messages. This method is typically in debugging scenarios + with multiple contexts. + + @param hContext [in]: + A TX_CONTEXTHANDLE for the context on which to set the name. + Must not be NULL. + + @param name [in]: + The name of the context. + + @return + TX_RESULT_OK: The name of the context was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ + +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetContextName( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING name + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetContextNameHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING name + ); + + +/*********************************************************************************************************************/ + +/** + txSetContextParams + + Sets custom params which gives the context different behaviors. For internal use only. + + @param hContext [in]: + A TX_CONTEXTHANDLE for the context on which to set the parameters. + Must not be NULL. + + @param hParams [in]: + A TX_CONSTHANDLE to an object containing the params. + + @return + TX_RESULT_OK: The params was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ + +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetContextParams( + TX_CONTEXTHANDLE hContext, + TX_CONSTHANDLE hParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetContextParamsHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTHANDLE hParams + ); + + +/*********************************************************************************************************************/ + +/** + txGetContextName + + Gets the name of a context. + + @param hContext [in]: + A TX_CONTEXTHANDLE pointing to the context. + Must not be NULL. + + @param pName [out]: + A TX_STRING to which the context name will be copied. + Must be at least the size of the context name. + Can be NULL to only get the size of the context name. + + @param pNameSize [in,out]: + A pointer to a TX_SIZE which will be set the size of the context name. + Must not be NULL. + The value must be 0 if pNameSize is NULL. + + @return + TX_RESULT_OK: The context name or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pName is invalid (*pNameSize will be set to the required size). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetContextName( + TX_CONTEXTHANDLE hContext, + TX_STRING pName, + TX_SIZE* pNameSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetContextNameHook)( + TX_CONTEXTHANDLE hContext, + TX_STRING pName, + TX_SIZE* pNameSize + ); + + +/*********************************************************************************************************************/ + +/** + txGetTrackedObjects + + Gets all the objects that currently tracked by a context. This requires the context to be set up to track objects. + + @param hContext [in]: + A TX_CONSTCONTEXTHANDLE to the context from which to get the tracked objects. + Must not be TX_EMPTY_HANDLE. + + @param phObjects [in]: + A pointer to an array of TX_HANDLEs to which the property handles will be copied. + These handles must be released using txReleaseObject to avoid leaks. + Can be NULL to only retreive the size. + + @param pObjectsSize [in,out]: + A pointer to a TX_SIZE which will be set to the number of objects. + Must not be NULL. + The value must be 0 if phObjects is NULL. + + @return + TX_RESULT_OK: The objects or required sie of the buffer were successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of the buffer was to small. (*pObjectSize will be set to the required size.) + TX_RESULT_OBJECTTRACKINGNOTENABLED: The specified context has not been set up to track objects. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetTrackedObjects( + TX_CONSTCONTEXTHANDLE hContext, + TX_HANDLE* phObjects, + TX_SIZE* pObjectsSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetTrackedObjectsHook)( + TX_CONSTCONTEXTHANDLE hContext, + TX_HANDLE* phObjects, + TX_SIZE* pObjectsSize + ); + + +/*********************************************************************************************************************/ + +/** + txEnableConnection + + Enables the connection to the client. + This method must be called to start the communication between the client and server. + Once the connection has been enabled the client will attempt to always keep it alive. If the connection + to the client for some reason goes down, the client will immediately attemt to reconnect. + See txRegisterConnectionStateChangedHandler to get notified of the current connection state. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context which should get its connection enabled. + Must not be TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The connection was successfully enabled (does not mean that a connection to the client has been established). + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txEnableConnection( + TX_CONTEXTHANDLE hContext + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *EnableConnectionHook)( + TX_CONTEXTHANDLE hContext + ); + + +/*********************************************************************************************************************/ + +/** + txDisableConnection + + Disables the connection to the client. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context which should get its connection disabled. + Must not be TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The connection was successfully disabled. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txDisableConnection( + TX_CONTEXTHANDLE hContext + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *DisableConnectionHook)( + TX_CONTEXTHANDLE hContext + ); + + +/*********************************************************************************************************************/ + +/** + txGetConnectionState + + Gets the current connection state of the context. + + @param hContext [in]: + A TX_CONSTCONTEXTHANDLE to the context from which to retrieve the connection state. + Must not be TX_EMPTY_HANDLE. + + @param pConnectionState [out]: + A pointer to a TX_CONNECTIONSTATE which will get the current connection state. + Must not be NULL. + + @return + TX_RESULT_OK: The current connection state was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetConnectionState( + TX_CONSTCONTEXTHANDLE hContext, + TX_CONNECTIONSTATE* pConnectionState + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetConnectionStateHook)( + TX_CONSTCONTEXTHANDLE hContext, + TX_CONNECTIONSTATE* pConnectionState + ); + + +/*********************************************************************************************************************/ + +/** + txRegisterConnectionStateChangedHandler + + Registers a callback which will be invoked when the connection state changes. Use txEnableConnection + to initiate a connection to the engine. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to register the callback. + Must not be TX_EMPTY_HANDLE. + + @param pTicket [out]: + A pointer to a TX_TICKET which will represent this registration. + This ticket should be used for unregistration. + Must not be NULL. + + @param handler [in]: + A TX_CONNECTIONSTATECHANGEDCALLBACK which will be called when the connection state changes. + Must not be NULL. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the callback. + Can be NULL and will in this case be ignored. + + @return + TX_RESULT_OK: The callback was successfully registered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRegisterConnectionStateChangedHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_CONNECTIONSTATECHANGEDCALLBACK handler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RegisterConnectionStateChangedHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_CONNECTIONSTATECHANGEDCALLBACK handler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ + +#if defined(__cplusplus) +#ifndef TOBII_TX_INTEROP +#include + + TX_API_FUNCTION_CPP(RegisterConnectionStateChangedHandler,( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + const Tx::ConnectionStateChangedCallback& handler)); +#endif +#endif + +/*********************************************************************************************************************/ + +/** + txUnregisterConnectionStateChangedHandler + + Unregisters a callback previously registered for connection state changes. + This function may not be called on a callback thread. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to unregister the callback. + Must not be TX_EMPTY_HANDLE. + + @param ticket [in]: + A TX_TICKET which represents the registration. + Must not be TX_INVALID_TICKET. + + @return + TX_RESULT_OK: The callback was successfully unregistered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: A registration for the specified ticket could not be found. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txUnregisterConnectionStateChangedHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *UnregisterConnectionStateChangedHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket + ); + + +/*********************************************************************************************************************/ + +/** + txRegisterMessageHandler + + Registers a callback to be invoked when a message of a specific type arrives. + This function may not be called on a callback thread. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to register the callback. + Must not be TX_EMPTY_HANDLE. + + @param pTicket [out]: + A pointer to a TX_TICKET which will represent this registration. + This ticket should be used for unregistration. + Must not be NULL. + + @param messsageType [in]: + The TX_MESSAGETYPE for which to register the callback. + + @param hOptions [in]: + A TX_HANDLE to an interaction object containing the options for this registration. + The following options should be provided for the following message types: + + TX_MESSAGETYPE_QUERY: + - TX_LITERAL_PROCESSID: The id of the process for which to get queries. + + @param handler [in]: + A TX_ASYNCDATACALLBACK which will be called when a message of the specified type arrives. + When this callback is invoked it is passed a parameter hAsyncData which contains the message as its content. + The content of the async data can be retrieved using txGetAsyncDataContent. + That handle to the async data must NOT be released as it is automatically released by the API when the callback returns. + Must not be NULL. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the callback. + Can be NULL and will in this case be ignored. + + @return + TX_RESULT_OK: The callback was successfully registered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRegisterMessageHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_MESSAGETYPE messageType, + TX_HANDLE hOptions, + TX_ASYNCDATACALLBACK handler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RegisterMessageHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_MESSAGETYPE messageType, + TX_HANDLE hOptions, + TX_ASYNCDATACALLBACK handler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ + +/** + txUnregisterMessageHandler + + Unregisters a callback previously registered as a message handler. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to unregister the callback. + Must not be TX_EMPTY_HANDLE. + + @param ticket [in]: + A TX_TICKET which represents the registration. + Must not be TX_INVALID_TICKET + + @return + TX_RESULT_OK: The callback was successfully unregistered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: A registration for the specified ticket could not be found. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txUnregisterMessageHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *UnregisterMessageHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket + ); + + +/*********************************************************************************************************************/ + +/** + txRegisterQueryHandler + + Registers a query handler. + + This will setup a subscription to receive interactor queries from the engine. + + This is a specialization of txRegisterMessageHandler. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to register the callback. + Must not be TX_EMPTY_HANDLE. + + @param pTicket [out]: + A pointer to a TX_TICKET which will represent this registration. + This ticket should be used for unregistration. + Must not be NULL. + + @param handler [in]: + A TX_ASYNCDATACALLBACK which will be called when a query arrives. + When this callback is invoked it is passed a parameter hAsyncData which contains the query as its content. + The content of the async data can be retrieved using txGetAsyncDataContent(). + That handle to the async data must NOT be released as it is automatically released by the API when the callback returns. + Must not be NULL. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the callback. + + @return + TX_RESULT_OK: The Query Handler was successfully registered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRegisterQueryHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_ASYNCDATACALLBACK handler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RegisterQueryHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_ASYNCDATACALLBACK handler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ + +/** + txUnregisterQueryHandler + + Unregisters a previously registered query handler callback + This is a specialization of txUnregisterMessageHandler. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to unregister the callback. + Must not be TX_EMPTY_HANDLE. + + @param ticket [in]: + A TX_TICKET which represents the registration. + Must not be TX_INVALID_TICKET + + @return + TX_RESULT_OK: The callback was successfully unregistered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: A registration for the specified ticket could not be found. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txUnregisterQueryHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *UnregisterQueryHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket + ); + + +/*********************************************************************************************************************/ + +/** + txRegisterEventHandler + + Registers an event handler. This will setup a subscription to receive interaction events + from the engine. + + This is a specialization of txRegisterMessageHandler. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to register the callback. + Must not be TX_EMPTY_HANDLE. + + @param pTicket [out]: + A pointer to a TX_TICKET which will represent this registration. + This ticket should be used for unregistration. + Must not be NULL. + + @param handler [in]: + A TX_ASYNCDATACALLBACK which will be called when an event arrives. + When this callback is invoked it is passed a parameter hAsyncData which contains the event as its content. + The content of the async data can be retrieved using txGetAsyncDataContent(). + That handle to the async data must NOT be released as it is automatically released by the API when the callback returns. + Must not be NULL. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the callback. + + @return + TX_RESULT_OK: The event handler was successfully registered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRegisterEventHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_ASYNCDATACALLBACK handler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RegisterEventHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_ASYNCDATACALLBACK handler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ + +/** + txUnregisterEventHandler + + Unregisters a previously registered event handler callback + This is a specialization of txUnregisterMessageHandler. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to unregister the callback. + Must not be TX_EMPTY_HANDLE. + + @param ticket [in]: + A TX_TICKET which represents the registration. + Must not be TX_INVALID_TICKET + + @return + TX_RESULT_OK: The callback was successfully unregistered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: A registration for the specified ticket could not be found. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txUnregisterEventHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *UnregisterEventHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket + ); + + +/*********************************************************************************************************************/ + +/** + txPerformScheduledJobs + + Performs all jobs scheduled by the API on the thread that calls this function. + This call will block until all jobs have been performed. For internal use only. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context which jobs should be performed. + + @return + TX_RESULT_OK: The callback was successfully unregistered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDSCHEDULINGMODE: The scheduling mode must be set TX_SCHEDULINGMODE_USERFRAME for this call to be valid. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txPerformScheduledJobs( + TX_CONTEXTHANDLE hContext + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *PerformScheduledJobsHook)( + TX_CONTEXTHANDLE hContext + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_CONTEXT_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXEnv.h b/Tobii EyeX/include/eyex/EyeXEnv.h new file mode 100755 index 0000000..68d3256 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXEnv.h @@ -0,0 +1,236 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXEnv.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_ENV_API__H__) +#define __TOBII_TX_ENV_API__H__ + +/*********************************************************************************************************************/ + +/** + txInitializeEyeX + + Initializes the Tobii EyeX client environment. + This function must be called prior to any other in the API, except txGetEyeXAvailability and txEnableMonoCallbacks. + A client can choose to override the default memory model, threading model and logging model by supplying custom models + to this function. + + @param flags [in]: + Specifies which components to override. + + @param pLoggingModel [in]: + A pointer to a TX_LOGGINGMODEL which will override the default model. + This argument can be NULL to use the default logging model. + + @param pThreadingModel [in]: + A pointer to a TX_THREADINGMODEL which will override the default model. + This argument can be NULL to use the default threading model. Any + non-NULL value is for internal use only. + + @param pSchedulingModel [in]: + A pointer to a TX_SCHEDULINGMODEL which will override the default model. + This argument can be NULL to use the default scheduling model. Any + non-NULL value is for internal use only. + + @param pMemoryModel [in]: + Reserved for future use. + + @return + TX_RESULT_OK: The client environment was successfully initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_EYEXALREADYINITIALIZED: The EyeX client environment is already initialized. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txInitializeEyeX( + TX_EYEXCOMPONENTOVERRIDEFLAGS flags, + const TX_LOGGINGMODEL* pLoggingModel, + const TX_THREADINGMODEL* pThreadingModel, + const TX_SCHEDULINGMODEL* pSchedulingModel, + void* pMemoryModel + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *InitializeEyeXHook)( + TX_EYEXCOMPONENTOVERRIDEFLAGS flags, + const TX_LOGGINGMODEL* pLoggingModel, + const TX_THREADINGMODEL* pThreadingModel, + const TX_SCHEDULINGMODEL* pSchedulingModel, + void* pMemoryModel + ); + + +/*********************************************************************************************************************/ + +/** + txUninitializeEyeX + + Uninitializes the EyeX client environment. + If any context is still active this call will fail. + + @return + TX_RESULT_OK: The client environment was successfully uninitialized. + TX_RESULT_EYEXNOTINITIALIZED: The client environment is not initialized. + TX_RESULT_EYEXSTILLINUSE: The EyeX client environment is still in use. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txUninitializeEyeX(); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *UninitializeEyeXHook)(); + + +/*********************************************************************************************************************/ + +/** + txIsEyeXInitialized + + Checks if the EyeX client environment has been initialized. + + @param pInitialized [out]: + A pointer to a TX_BOOL which will be set to true if the environment is initialized and false otherwise. + Must not be NULL. + + @return + TX_RESULT_OK: The operation was successful. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txIsEyeXInitialized( + TX_BOOL* pInitialized + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *IsEyeXInitializedHook)( + TX_BOOL* pInitialized + ); + + +/*********************************************************************************************************************/ + +/** + txWriteLogMessage + + Writes a message using the internal logging model. + This method is typically not intended for end users but rather for the different language bindings to have a common + way of utilizing the logging model. + + @param level [in]: + The log level for this message. + + @param scope [in]: + The scope for this message. + + @param message [in]: + The log message it self. + + @return + TX_RESULT_OK: The message was successfully written to the log. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txWriteLogMessage( + TX_LOGLEVEL level, + TX_CONSTSTRING scope, + TX_CONSTSTRING message + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *WriteLogMessageHook)( + TX_LOGLEVEL level, + TX_CONSTSTRING scope, + TX_CONSTSTRING message + ); + + +/*********************************************************************************************************************/ +/** + txSetInvalidArgumentHandler + + Sets a hook that notifies when an invalid argument has been passed to any of the API function. + This function should typically only be used for testing purposes. + + @param handler [in]: + The callback to be invoked when an invalid argument is detected. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the callback. + Can be NULL and will in this case be ignored. + + @return + TX_RESULT_OK: The invalid argument handler was successful set. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetInvalidArgumentHandler( + TX_INVALIDARGUMENTCALLBACK handler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetInvalidArgumentHandlerHook)( + TX_INVALIDARGUMENTCALLBACK handler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ +/** + txEnableMonoCallbacks + + Prepares the EyeX client library for use with the Mono .NET runtime: before a callback function is invoked, the + thread on which the callback will be made is attached to a mono domain, and the thread is detached again when the + callback function returns. Mono requires that any threads calling managed code be attached for garbage collection + and soft debugging to work properly. + + This function must be called prior to any other in the API, and from a managed thread. The subsequent callback + invocations will be attached to the same mono domain as the caller thread. + + Note that Mono callbacks cannot be used in combination with a custom threading model. + + @param monoModuleName [in]: + The name of the Mono runtime module (dll). Typically "mono". + + @return + TX_RESULT_OK: The mono callbacks were successfully enabled. + TX_RESULT_INVALIDARGUMENT: The Mono module name could not be used to resolve the necessary Mono functions. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txEnableMonoCallbacks( + TX_CONSTSTRING monoModuleName + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *EnableMonoCallbacksHook)( + TX_CONSTSTRING monoModuleName + ); + + +/*********************************************************************************************************************/ +/** + txGetEyeXAvailability + + Gets the availability of the EyeX Engine. + + @param pEyeXAvailability [out]: + The availability of EyeX Engine. + + @return + TX_RESULT_OK: The status was fetched successfully. + TX_RESULT_INVALIDARGUMENT: An invalid argument was supplied. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetEyeXAvailability( + TX_EYEXAVAILABILITY* pEyeXAvailability + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetEyeXAvailabilityHook)( + TX_EYEXAVAILABILITY* pEyeXAvailability + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_ENV_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXEvent.h b/Tobii EyeX/include/eyex/EyeXEvent.h new file mode 100755 index 0000000..446fc4f --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXEvent.h @@ -0,0 +1,139 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXEvent.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_EVENT_API__H__) +#define __TOBII_TX_EVENT_API__H__ + +/*********************************************************************************************************************/ + +/** + txGetEventInteractorId + + Gets the id of the interactor for which the event should apply. + + @param hEvent [in]: + A TX_CONSTHANDLE to the event from which the interactor id should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pInteractorId [out]: + A TX_STRING to which the interactor id will be copied. + Must be at least the size of the interactor id. + Can be NULL to only get the size of the interactor. + + @param pInteractorIdSize [in,out]: + A pointer to a TX_SIZE which will be set to the size of the interactor id. + Must not be NULL. + The value must be 0 if pInteractorId is NULL. + + @return + TX_RESULT_OK: The interactor id or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pInteractorId is invalid (*pInteractorIdSize will be set to the required size). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetEventInteractorId( + TX_CONSTHANDLE hEvent, + TX_STRING pInteractorId, + TX_SIZE* pInteractorIdSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetEventInteractorIdHook)( + TX_CONSTHANDLE hEvent, + TX_STRING pInteractorId, + TX_SIZE* pInteractorIdSize + ); + + +/*********************************************************************************************************************/ + +/** + txGetEventBehavior + + Gets a behavior with a specified TX_BEHAVIORTYPE from an event. + If the event does not have a behavior of the specified type this call will fail. + + @param hEvent [in]: + A TX_CONSTHANDLE to the event from which the behavior should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param phBehavior [out]: + A pointer to a TX_HANDLE which will be set to the behavior. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param behaviorType [in]: + The TX_BEHAVIORTYPE which specifies what type of behavior to get. + + @return + TX_RESULT_OK: The behavior was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: This event does not have a behavior of the specified type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetEventBehavior( + TX_CONSTHANDLE hEvent, + TX_HANDLE* phBehavior, + TX_BEHAVIORTYPE behaviorType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetEventBehaviorHook)( + TX_CONSTHANDLE hEvent, + TX_HANDLE* phBehavior, + TX_BEHAVIORTYPE behaviorType + ); + + +/*********************************************************************************************************************/ + +/** + txGetEventBehaviors + + Gets the TX_HANDLEs to all the behaviors on an event. + + @param hEvent [in]: + A TX_CONSTHANDLE to the event from which to get the behaviors. + Must not be TX_EMPTY_HANDLE. + + @param phBehaviors [out]: + A pointer to an array of TX_HANDLEs to which the behavior handles will be copied. + These handles must be released using txReleaseObject to avoid leaks. + Can be NULL to only get the required size. + + @param pBehaviorsSize [in,out]: + A pointer to a TX_SIZE which will be set to the number of behaviors. + Must not be NULL. + The value must be 0 if phBehaviors is NULL. + + @return + TX_RESULT_OK: The handles or the required size of the buffer was retrieved successfully. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of the array is invalid. (*pBehaviorsSize will be set to the number of behaviors). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetEventBehaviors( + TX_CONSTHANDLE hEvent, + TX_HANDLE* phBehaviors, + TX_SIZE* pBehaviorsSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetEventBehaviorsHook)( + TX_CONSTHANDLE hEvent, + TX_HANDLE* phBehaviors, + TX_SIZE* pBehaviorsSize + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_EVENT_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXFrameworkTypes.h b/Tobii EyeX/include/eyex/EyeXFrameworkTypes.h new file mode 100755 index 0000000..614c070 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXFrameworkTypes.h @@ -0,0 +1,967 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXFrameworkTypes.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_FRAMEWORK_TYPES__H__) +#define __TOBII_TX_FRAMEWORK_TYPES__H__ + +/*********************************************************************************************************************/ + +#include "EyeXMacros.h" + +/*********************************************************************************************************************/ + +/** + TX_RESULT + + Enumeration for all result codes returned by the API functions. + + @field TX_RESULT_UNKNOWN: + Unknown error, typically returned if something unexpected occurs in the API. Is most likely a bug in the API. + + @field TX_RESULT_OK: + Everything went well. + + @field TX_RESULT_EYEXNOTINITIALIZED: + The EyeX client environment is not initalized. All API functions except txInitializeEyeX requires the EyeX client environment to be + initialized prior to being called. + + @field TX_RESULT_EYEXALREADYINITIALIZED: + The EyeX client environment has already been initialized. This is returned by txInitializeEyeX if called twice without being + uninitialized in between. + + @field TX_RESULT_EYEXSTILLINUSE: + The EyeX client environment is still in use. This is returned by txUninitializeEyeX if at least one context is still being used. + + @field TX_RESULT_INVALIDARGUMENT: + An invalid argument was passed to an API function. All arguments are checked before an API function actually + does something. There are many reasons why an argument can be considered invalid. + Check the log for more details if this code is returned. + + @field TX_RESULT_INVALIDHANDLE: + The handle for an interaction object is not valid. + + @field TX_RESULT_NOTFOUND: + Generic result code when something could not be found. + + @field TX_RESULT_INVALIDBUFFERSIZE: + Some buffer; string, array, etc had an invalid size. Typically, API functions that return this result code also + provides the required size. + + @field TX_RESULT_DUPLICATEPROPERTY: + An attempt has been made to create a property that does already exist. + + @field TX_RESULT_DUPLICATEBOUNDS: + An attempt has been made to create bounds that already exists. + + @field TX_RESULT_DUPLICATEBEHAVIOR: + An attempt has been made to create a behavior that already exists. + + @field TX_RESULT_DUPLICATEINTERACTOR: + An attempt has been made to create an interactor with the same id as another in the same snapshot. + + @field TX_RESULT_DUPLICATESTATEOBSERVER: + An attempt has been made to register the same state observer twice. + + @field TX_RESULT_DUPLICATEMASK: + An attempt has been made to create more than one mask on an interactor. + + @field TX_RESULT_INVALIDPROPERTYTYPE: + A type specific operation has been made on a property of a different type. For example a property containing a + TX_INTEGER has been requested for its value as a TX_STRING. + + @field TX_RESULT_INVALIDPROPERTYNAME: + The specified property name is invalid. + + @field TX_RESULT_PROPERTYNOTREMOVABLE: + An attempt has been made to remove a property that is not removable. Typically such properties are the ones + backing up data that is required on different interaction objects. + + @field TX_RESULT_NOTCONNECTED: + An attempt was made to perform an operation that requires a valid connection to the client. + + @field TX_RESULT_INVALIDOBJECTCAST: + A handle for a different type of interaction object than expected was provided. + + @field TX_RESULT_INVALIDTHREAD: + An attempt was made to perform an operation on a thread that is not allowed to perform such an operation. + For example a context can not be deleted on a callback from the API. + + @field TX_RESULT_INVALIDBOUNDSTYPE: + An attempt was made to perform an operation that does not apply to the current bounds type. + + @field TX_RESULT_INVALIDBEHAVIORTYPE: + An attempt was made to perform an operation that does not apply to the current behavior type. + + @field TX_RESULT_OBJECTLEAKAGE: + A leakage of an interaction object has been detected. May be returned by a + successful txReleaseContext call where some object were not released properly. + + @field TX_RESULT_OBJECTTRACKINGNOTENABLED: + An attempt to retrieve tracked object has been made without tracking of objects being enabled. + + @field TX_RESULT_INVALIDSNAPSHOT: + The snapshot committed to the client contained some invalid data. + + @field TX_RESULT_INVALIDCOMMAND: + The submitted command was malformed or not recognized by the client. + + @field TX_RESULT_CANCELLED: + An attempt has been made to perform an operation that is not supported during shutdown. + + @field TX_RESULT_INVALIDSCHEDULINGMODE: + The scheduling mode is invalid. + + @field TX_RESULT_MASKTOOLARGE: + The supplied mask is too large, width*height must be less than 65536 + + @field TX_RESULT_INVALIDEYETRACKERSTATE + \since Version 1.1.0 + The submitted command can not be executed in the current state of the eye tracker + */ +typedef enum { + TX_RESULT_UNKNOWN = TX_ENUM_STARTVALUE, + TX_RESULT_OK, + TX_RESULT_EYEXNOTINITIALIZED, + TX_RESULT_EYEXALREADYINITIALIZED, + TX_RESULT_EYEXSTILLINUSE, + TX_RESULT_INVALIDARGUMENT, + TX_RESULT_INVALIDHANDLE, + TX_RESULT_NOTFOUND, + TX_RESULT_INVALIDBUFFERSIZE, + TX_RESULT_DUPLICATEPROPERTY, + TX_RESULT_DUPLICATEBOUNDS, + TX_RESULT_DUPLICATEBEHAVIOR, + TX_RESULT_DUPLICATEINTERACTOR, + TX_RESULT_DUPLICATESTATEOBSERVER, + TX_RESULT_DUPLICATEMASK, + TX_RESULT_INVALIDPROPERTYTYPE, + TX_RESULT_INVALIDPROPERTYNAME, + TX_RESULT_PROPERTYNOTREMOVABLE, + TX_RESULT_NOTCONNECTED, + TX_RESULT_INVALIDOBJECTCAST, + TX_RESULT_INVALIDTHREAD, + TX_RESULT_INVALIDBOUNDSTYPE, + TX_RESULT_INVALIDBEHAVIORTYPE, + TX_RESULT_OBJECTLEAKAGE, + TX_RESULT_OBJECTTRACKINGNOTENABLED, + TX_RESULT_INVALIDSNAPSHOT, + TX_RESULT_INVALIDCOMMAND, + TX_RESULT_CANCELLED, + TX_RESULT_INVALIDSCHEDULINGMODE, + TX_RESULT_MASKTOOLARGE, + TX_RESULT_INVALIDEYETRACKERSTATE +} TX_RESULT; + +/********************************************************************************************************************* + * Interaction Object Types + *********************************************************************************************************************/ + +/** + Enumeration for all the types of interaction objects that can be exposed through the API. + + @field TX_INTERACTIONOBJECTTYPE_SNAPSHOT: + The object is a snapshot. + + @field TX_INTERACTIONOBJECTTYPE_INTERACTOR: + The object is an interactor. + + @field TX_INTERACTIONOBJECTTYPE_QUERY: + The object is a query. + + @field TX_INTERACTIONOBJECTTYPE_EVENT: + The object is an event. + + @field TX_INTERACTIONOBJECTTYPE_BEHAVIOR: + The object is a behavior. + + @field TX_INTERACTIONOBJECTTYPE_BOUNDS: + The object is a bounds structure. + + @field TX_INTERACTIONOBJECTTYPE_PROPERTYBAG: + The object is a property bag. + + @field TX_INTERACTIONOBJECTTYPE_PROPERTY: + The object is a property. + + @field TX_INTERACTIONOBJECTTYPE_COMMAND: + The object is a command. + + @field TX_INTERACTIONOBJECTTYPE_STATEBAG: + The object is a state bag. + + @field TX_INTERACTIONOBJECTTYPE_NOTIFICATION: + The object is a notification. + + @field TX_INTERACTIONOBJECTTYPE_MASK: + The object is a mask. + */ +typedef enum { + TX_INTERACTIONOBJECTTYPE_SNAPSHOT = TX_ENUM_STARTVALUE, + TX_INTERACTIONOBJECTTYPE_INTERACTOR, + TX_INTERACTIONOBJECTTYPE_QUERY, + TX_INTERACTIONOBJECTTYPE_EVENT, + TX_INTERACTIONOBJECTTYPE_BEHAVIOR, + TX_INTERACTIONOBJECTTYPE_BOUNDS, + TX_INTERACTIONOBJECTTYPE_PROPERTYBAG, + TX_INTERACTIONOBJECTTYPE_COMMAND, + TX_INTERACTIONOBJECTTYPE_STATEBAG, + TX_INTERACTIONOBJECTTYPE_NOTIFICATION, + TX_INTERACTIONOBJECTTYPE_MASK, + TX_INTERACTIONOBJECTTYPE_ASYNCDATA, + + /* for internal use only */ + TX_INTERACTIONOBJECTTYPE_INTERNAL_MESSAGE = TX_INTERNAL_ENUM_STARTVALUE, + TX_INTERACTIONOBJECTTYPE_INTERNAL_MESSAGEHEADER +} TX_INTERACTIONOBJECTTYPE; + +/*********************************************************************************************************************/ + +/** + TX_MESSAGETYPE + + Enumeration for all message types. + The messages type is metadata contained by all packets sent between the client and server. + Some messages should be handled by the application to do proper interaction, others are internal and should be + ignored. + + @field TX_MESSAGETYPE_QUERY: + Message contains a query. + + @field TX_MESSAGETYPE_EVENT: + Message contains an event. + + @field TX_MESSAGETYPE_NOTIFICATION: + Message contains a notification. This is an internal message type. + + @field TX_MESSAGETYPE_REQUEST: + Message contains a request. This is an internal message type. + + @field TX_MESSAGETYPE_RESPONSE: + Message contains a response. This is an internal message type. + + @field TX_MESSAGETYPE_CUSTOM: + Base value for custom message defined by other protocols. + */ +typedef enum { + TX_MESSAGETYPE_QUERY = TX_ENUM_STARTVALUE, + TX_MESSAGETYPE_EVENT, + TX_MESSAGETYPE_NOTIFICATION = TX_INTERNAL_ENUM_STARTVALUE, + TX_MESSAGETYPE_REQUEST, + TX_MESSAGETYPE_RESPONSE, + TX_MESSAGETYPE_CUSTOM +} TX_MESSAGETYPE; + +/*********************************************************************************************************************/ + +/** + TX_NOTIFICATIONTYPE + + Enumeration for all notification types. + The notification type is metadata contained by all notifications to specify what kind of notification it is. + + @field TX_NOTIFICATIONTYPE_STATECHANGED: + Notifies that some states have changed. + */ +typedef enum { + TX_NOTIFICATIONTYPE_STATECHANGED = TX_ENUM_STARTVALUE, + TX_NOTIFICATIONTYPE_DIAGNOSTICSDATA +} TX_NOTIFICATIONTYPE; + +/*********************************************************************************************************************/ + +/** + TX_BEHAVIORTYPE + + Enumeration for all behavior types. + The behavior type is metadata contained by all behaviors to specify what kind of behavior it is. + + @field TX_BEHAVIORTYPE_GAZEPOINTDATA: + Behavior used on interactors to receive gaze point data. + + @field TX_BEHAVIORTYPE_EYEPOSITIONDATA: + Behavior used on interactors to receive eye position data. + + @field TX_BEHAVIORTYPE_GAZEAWARE: + Behavior used on interactors to perform gaze-aware interaction. + + @field TX_BEHAVIORTYPE_ACTIVATABLE: + Behavior used on interactors to perform activation interaction. + + @field TX_BEHAVIORTYPE_PANNABLE: + Behavior used on interactors to perform panning interaction. + + @field TX_BEHAVIORTYPE_FIXATIONDATA: + Behavior used on interactors to receive fixation data. + */ +typedef enum { + TX_BEHAVIORTYPE_GAZEPOINTDATA = TX_ENUM_STARTVALUE, + TX_BEHAVIORTYPE_EYEPOSITIONDATA, + TX_BEHAVIORTYPE_GAZEAWARE, + TX_BEHAVIORTYPE_ACTIVATABLE, + TX_BEHAVIORTYPE_PANNABLE, + TX_BEHAVIORTYPE_FIXATIONDATA, + /* For Internal use */ + TX_INTERNAL_BEHAVIORTYPE_RAWGAZEDATA = TX_INTERNAL_ENUM_STARTVALUE, + TX_INTERNAL_BEHAVIORTYPE_ZOOMABLE, + TX_BEHAVIORTYPE_GAZEDATADIAGNOSTICS +} TX_BEHAVIORTYPE; + +/*********************************************************************************************************************/ + +/** + TX_BOUNDSTYPE + + Enumeration for all bounds types. + + @field TX_BOUNDSTYPE_NONE: + No bounds. + + @field TX_BOUNDSTYPE_RECTANGULAR: + Rectangular bounds. + */ +typedef enum { + TX_BOUNDSTYPE_NONE = TX_ENUM_STARTVALUE, + TX_BOUNDSTYPE_RECTANGULAR +} TX_BOUNDSTYPE; + +/*********************************************************************************************************************/ + +/** + TX_ACTIVATABLEEVENTTYPE + + Enumeration for all activation event types. + Activatable event type are metadata contained by all behaviors of type TX_BEHAVIORTYPE_ACTIVATABLE sent + from the client. This event type specifies what kind of activation event actually happened. + + @field TX_ACTIVATABLEEVENTTYPE_ACTIVATED: + The interactor has been activated. + + @field TX_ACTIVATABLEEVENTTYPE_ACTIVATIONFOCUSCHANGED: + The activation focus and/or tentative activation focus has changed. + */ +typedef enum { + TX_ACTIVATABLEEVENTTYPE_ACTIVATED = TX_ENUM_STARTVALUE, + TX_ACTIVATABLEEVENTTYPE_ACTIVATIONFOCUSCHANGED +} TX_ACTIVATABLEEVENTTYPE; + +/*********************************************************************************************************************/ + +/** + TX_FAILEDACTIONTYPE + + Enumeration for all action data types. + + @field TX_FAILEDACTIONTYPE_ACTIVATIONNOHIT + An activation action did not hit any valid interactor + @field TX_FAILEDACTIONTYPE_PANNOHIT + A pan action did not hit any valid interactor + @field TX_FAILEDACTIONTYPE_ZOOMNOHIT + A zoom action did not hit any valid interactor + @field TX_FAILEDACTIONTYPE_ACTIVATIONDURINGNOTRACKING + An activation action occured when there was no tracking + @field TX_FAILEDACTIONTYPE_PANDURINGNOTRACKING + A pan action occured when there was no tracking + @field TX_FAILEDACTIONTYPE_ZOOMDURINGNOTRACKING + A zoom action occured when there was no tracking + @field TX_FAILEDACTIONTYPE_ACTIVATIONSMALLITEMS + For internal use only. + An activation occured near multiple small interactors and was therefore undecided + */ +typedef enum { + TX_FAILEDACTIONTYPE_ACTIVATIONNOHIT = TX_ENUM_STARTVALUE, + TX_FAILEDACTIONTYPE_PANNOHIT, + TX_FAILEDACTIONTYPE_ZOOMNOHIT, + TX_FAILEDACTIONTYPE_ACTIVATIONDURINGNOTRACKING, + TX_FAILEDACTIONTYPE_PANDURINGNOTRACKING, + TX_FAILEDACTIONTYPE_ZOOMDURINGNOTRACKING, + TX_FAILEDACTIONTYPE_ACTIVATIONSMALLITEMS +} TX_FAILEDACTIONTYPE; + +/*********************************************************************************************************************/ + +/** + TX_FIXATIONDATAEVENTTYPE + + Enumeration for all fixation data event types. + Fixation event type is metadata contained by all behaviors of type TX_BEHAVIORTYPE_FIXATION sent + from the client. This event type specifies what kind of fixation event actually happened. + + @field TX_FIXATIONDATAEVENTTYPE_BEGIN: + The fixation has begun. The gaze point data provided is a combination of the gaze points used to detect the + fixation. The timestamp will reflect when the fixation actually began. + + @field TX_FIXATIONDATAEVENTTYPE_END: + The fixation has ended. The last valid gaze point is provided. The timestamp will reflect when the + fixation actually ended. + + @field TX_FIXATIONDATAEVENTTYPE_DATA: + The fixation is still occuring. A new, filtered gaze point within the fixation is provided. + */ +typedef enum { + TX_FIXATIONDATAEVENTTYPE_BEGIN = TX_ENUM_STARTVALUE, + TX_FIXATIONDATAEVENTTYPE_END, + TX_FIXATIONDATAEVENTTYPE_DATA +} TX_FIXATIONDATAEVENTTYPE; + +/*********************************************************************************************************************/ + +/** + TX_GAZEPOINTDATAMODE + + Enumeration for all gaze point data modes. + The gaze point data mode is metadata contained by all behaviors of type TX_BEHAVIORTYPE_GAZEPOINTDATA. + When put on an interactor it specifies what kind of filter to use by the engine when calculating the gaze points. + When put on an event it specifies what kind of filter that was used by the engine. + + @field TX_GAZEPOINTDATAMODE_UNFILTERED: + No filter will be applied to the gaze points. (note though that invalid gaze points are discarded) + + @field: TX_GAZEPOINTDATAMODE_LIGHTLYFILTERED: + A light filter was/will be applied to the gaze point data. It is not a simple smoothing filter, it aims to be + smooth but responsive. This should be you default choice for gaze point data. + */ +typedef enum { + TX_GAZEPOINTDATAMODE_UNFILTERED = TX_ENUM_STARTVALUE, + TX_GAZEPOINTDATAMODE_LIGHTLYFILTERED +} TX_GAZEPOINTDATAMODE; + + +/*********************************************************************************************************************/ + +/** + TX_GAZEAWAREMODE + + Enumeration for all gaze aware modes. + The gaze aware mode is metadata contained by all behaviors of type TX_BEHAVIORTYPE_GAZEAWARE. + When put on an interactor it specifies how the user must gaze on the interactor to make it gaze aware. + When put on an event it specifies what kind of mode that was used by the engine. + + @field: TX_GAZEAWAREMODE_NORMAL: + The interactor will get a gaze aware event when the engine considers the user to intentionally look at it. + + @field: TX_GAZEAWAREMODE_DELAYED: + The interactor will get a gaze aware event when the engine considers the user to have looked at it for a + specified amount of time. When using this mode TX_GAZEAWAREPARAMS needs have the field DelayTime set. + */ +typedef enum { + TX_GAZEAWAREMODE_NORMAL = TX_ENUM_STARTVALUE, + TX_GAZEAWAREMODE_DELAYED +} TX_GAZEAWAREMODE; + +/*********************************************************************************************************************/ + +/** + TX_FIXATIONDATAMODE + + Enumeration for all fixation data modes. + The fixation data mode is metadata contained by all behaviors of type TX_BEHAVIORTYPE_FIXATION. + When put on an interactor it specifies what kind of filter to use by the engine when finding fixations. + When put on an event it specifies what kind of filter that was used by the engine. + + @field TX_FIXATIONDATAMODE_SENSITIVE: + Very sensitive fixation filter, will result in many fixations, sometimes very close and in quick succession. + + @field TX_FIXATIONDATAMODE_SLOW: + Fairly sensitive to enter fixation but can be slow to exit, as it tries merge fixations close to each other. + Will result in fairly stable fixations but fixation end events may be coming rather late in certain circumstances. + */ +typedef enum { + TX_FIXATIONDATAMODE_SENSITIVE = TX_ENUM_STARTVALUE, + TX_FIXATIONDATAMODE_SLOW +} TX_FIXATIONDATAMODE; + +/*********************************************************************************************************************/ + +/** + TX_EYETRACKINGDEVICESTATUS + + Enumeration for all eye tracking device statuses. + + @field TX_EYETRACKINGDEVICESTATUS_INITIALIZING: + The eye tracking device is initializing. + + @field TX_EYETRACKINGDEVICESTATUS_NOTAVAILABLE: + There is no eye tracking device available. + + @field TX_EYETRACKINGDEVICESTATUS_INVALIDCONFIGURATION: + The eye tracking device has an invalid configuration. + + @field TX_EYETRACKINGDEVICESTATUS_DEVICENOTCONNECTED: + The eye tracking device is not connected. + + @field TX_EYETRACKINGDEVICESTATUS_TRACKING: + The eye tracking device is currently tracking. + + @field TX_EYETRACKINGDEVICESTATUS_TRACKINGPAUSED: + The eye tracking device is paused. + + @field TX_EYETRACKINGDEVICESTATUS_CONFIGURING: + The eye tracking device is being configured. + + @field TX_EYETRACKINGDEVICESTATUS_UNKNOWNERROR: + Unknown error. + + @field TX_EYETRACKINGDEVICESTATUS_CONNECTIONERROR: + The eye tracking device is connected to USB port but EyeX Engine can not connect to it. + + @field TX_EYETRACKINGDEVICESTATUS_TRACKINGUNAVAILABLE: + The eye tracking device is functioning as intended, but no gaze data is sent. + */ +typedef enum { + TX_EYETRACKINGDEVICESTATUS_INITIALIZING = TX_ENUM_STARTVALUE, + TX_EYETRACKINGDEVICESTATUS_NOTAVAILABLE, + TX_EYETRACKINGDEVICESTATUS_INVALIDCONFIGURATION, + TX_EYETRACKINGDEVICESTATUS_DEVICENOTCONNECTED, + TX_EYETRACKINGDEVICESTATUS_TRACKING, + TX_EYETRACKINGDEVICESTATUS_TRACKINGPAUSED, + TX_EYETRACKINGDEVICESTATUS_CONFIGURING, + TX_EYETRACKINGDEVICESTATUS_UNKNOWNERROR, + TX_EYETRACKINGDEVICESTATUS_CONNECTIONERROR, + TX_EYETRACKINGDEVICESTATUS_TRACKINGUNAVAILABLE +} TX_EYETRACKINGDEVICESTATUS; + +/*********************************************************************************************************************/ + +/** + Enumeration for all command types. For internal use only. + */ +typedef enum { + TX_COMMANDTYPE_EXECUTEACTION = TX_ENUM_STARTVALUE, + TX_COMMANDTYPE_SETSTATE, + TX_COMMANDTYPE_GETSTATE, + TX_COMMANDTYPE_REGISTERSTATEOBSERVER, + TX_COMMANDTYPE_UNREGISTERSTATEOBSERVER, + TX_COMMANDTYPE_COMMITSNAPSHOT, + TX_COMMANDTYPE_ENABLEBUILTINKEYS, + TX_COMMANDTYPE_DISABLEBUILTINKEYS, + TX_COMMANDTYPE_CLIENTCONNECTION, + TX_COMMANDTYPE_LAUNCHEYETRACKINGCONTROLPANEL, /** Deprecated */ + TX_COMMANDTYPE_REGISTERQUERYHANDLER, + TX_COMMANDTYPE_UNREGISTERQUERYHANDLER, + TX_COMMANDTYPE_DIAGNOSTICSREQUEST, + TX_COMMANDTYPE_LAUNCHCONFIGURATIONTOOL, + TX_COMMANDTYPE_SETCURRENTPROFILE, + TX_COMMANDTYPE_DELETEPROFILE, + TX_COMMANDTYPE_CLIENTPROCESSIDLIST + + +} TX_COMMANDTYPE; + +/*********************************************************************************************************************/ + +/** + Enumeration for all action types. + An action is a way to interact with the EyeX Engine in addition or instead of the default keybindings that normally + executes gaze actions. + + @field TX_ACTIONTYPE_ACTIVATE: + Activates an interactor. This corresponds to a click on the activation button + + @field TX_ACTIONTYPE_ACTIVATIONMODEON: + Turns on activation mode. This corresponds to pressing the activation button. + + @field TX_ACTIONTYPE_ACTIVATIONMODEOFF: + Turns off activation mode. This corresponds to releasing the activation button. + + @field TX_ACTIONTYPE_PANNINGBEGIN: + Begins a panning. This corresponds to pressing the panning button. + + @field TX_ACTIONTYPE_PANNINGEND: + Ends a panning. This corresponds to releasing the panning button. + + @field TX_ACTIONTYPE_PANNINGSTEP: + Performs a panning step action. This corresponds to a click on the panning button. + + @field TX_ACTIONTYPE_ZOOMIN: + Not yet supported. + + @field TX_ACTIONTYPE_ZOOMOUT: + Not yet supported. + + @field TX_ACTIONTYPE_PANNINGTOGGLEHANDSFREE: + Not yet supported. + */ +typedef enum { + TX_ACTIONTYPE_ACTIVATE = TX_ENUM_STARTVALUE, + TX_ACTIONTYPE_ACTIVATIONMODEON, + TX_ACTIONTYPE_ACTIVATIONMODEOFF, + TX_ACTIONTYPE_PANNINGBEGIN, + TX_ACTIONTYPE_PANNINGEND, + TX_ACTIONTYPE_PANNINGSTEP, + TX_ACTIONTYPE_ZOOMIN, + TX_ACTIONTYPE_ZOOMOUT, + TX_ACTIONTYPE_PANNINGTOGGLEHANDSFREE +} TX_ACTIONTYPE; + +/*********************************************************************************************************************/ + +/** + TX_PANNABLEEVENTTYPE + + Enumeration for all pannable event types. + Pannable event type are metadata contained by all behaviors of type TX_BEHAVIORTYPE_PANNABLE sent + from the client. This event type specifies what kind of pannable event actually happened. + + @field TX_PANNABLEEVENTTYPE_PAN: + The interactor has been panned. + + @field TX_PANNABLEEVENTTYPE_STEP: + The interactor has been stepped. + + @field TX_PANNABLEEVENTTYPE_HANDSFREE: + Not yet supported. + */ +typedef enum { + TX_PANNABLEEVENTTYPE_PAN = TX_ENUM_STARTVALUE, + TX_PANNABLEEVENTTYPE_STEP, + TX_PANNABLEEVENTTYPE_HANDSFREE +} TX_PANNABLEEVENTTYPE; + + +/*********************************************************************************************************************/ + +/** + TX_PANDIRECTION + + Enumeration flags for all pannable directions. + Governs available directions to pan for a pannable interactor. + The directions are bitwise combinable. + + @field TX_PANDIRECTION_NONE: + No pandirection available. + + @field TX_PANDIRECTION_LEFT: + Panning to the left available. + + @field TX_PANDIRECTION_RIGHT: + Panning to the right available. + + @field TX_PANDIRECTION_UP: + Panning up available. + + @field TX_PANDIRECTION_DOWN: + Panning down available. + + @field TX_PANDIRECTION_ALL: + All pan directions available. + */ +typedef enum { + TX_PANDIRECTION_NONE = TX_FLAGS_NONE_VALUE, + TX_PANDIRECTION_LEFT = 1, + TX_PANDIRECTION_RIGHT = 1 << 1, + TX_PANDIRECTION_UP = 1 << 2, + TX_PANDIRECTION_DOWN = 1 << 3, + TX_PANDIRECTION_ALL = (1 << 4)-1 +} TX_PANDIRECTION; + +/*********************************************************************************************************************/ + +/** + TX_PANNINGPROFILE + + Enumeration for all panning profiles. + + @field TX_PANNINGPROFILE_NONE: + No panning profile. + + @field TX_PANNINGPROFILE_READING: + Panning profile for reading, currently same as TX_PANNINGPROFILE_VERTICAL. Will be available in subsequent versions. + + @field TX_PANNINGPROFILE_HORIZONTAL: + Left and right only panning profile. + + @field TX_PANNINGPROFILE_VERTICAL: + Up and down only panning profile. + + @field TX_PANNINGPROFILE_VERTICALFIRSTTHENHORIZONTAL: + Up, down, left and right, with emphasis on vertical panning. + + @field TX_PANNINGPROFILE_RADIAL: + Panning in any direction. + + @field TX_PANNINGPROFILE_HORIZONTALFIRSTTHENVERTICAL: + Up, down, left and right, with emphasis on horizontal panning. + */ +typedef enum { + TX_PANNINGPROFILE_NONE = TX_ENUM_STARTVALUE, + TX_PANNINGPROFILE_READING, + TX_PANNINGPROFILE_HORIZONTAL, + TX_PANNINGPROFILE_VERTICAL, + TX_PANNINGPROFILE_VERTICALFIRSTTHENHORIZONTAL, + TX_PANNINGPROFILE_RADIAL, + TX_PANNINGPROFILE_HORIZONTALFIRSTTHENVERTICAL +} TX_PANNINGPROFILE; + +/*********************************************************************************************************************/ + +/** + TX_GAZETRACKING + + \since Version 1.4.0 + + Enumeration for conveying gaze tracking status. + + @field TX_GAZETRACKING_GAZETRACKED: + Gaze is currently being tracked. + + @field TX_GAZETRACKING_GAZENOTTRACKED: + Gaze is currently not being tracked. This state can be set when for example the user is gazing outside of the + tracked display, no user is present in front of the eye tracker, or that no connection is established with the + eye tracker etc. + */ + + typedef enum { + TX_GAZETRACKING_GAZETRACKED = TX_ENUM_STARTVALUE, + TX_GAZETRACKING_GAZENOTTRACKED +} TX_GAZETRACKING; + +/*********************************************************************************************************************/ + +/** + TX_USERPRESENCE + + Enumeration for conveying presence status. + + @field TX_USERPRESENCE_PRESENT: + A user is present in front of the eye tracker. + + @field TX_USERPRESENCE_NOTPRESENT: + A user is not present in front of the eye tracker. + + @field TX_USERPRESENCE_UNKNOWN: + It is unknown whether or not a user is present in front of the eye tracker. + This value will be returned if there is no observer registered for TX_STATEPATH_USERPRESENCE. + */ +typedef enum { + TX_USERPRESENCE_PRESENT = TX_ENUM_STARTVALUE, + TX_USERPRESENCE_NOTPRESENT, + TX_USERPRESENCE_UNKNOWN +} TX_USERPRESENCE; + +/*********************************************************************************************************************/ + +/** + TX_REQUESTTYPE + + Enumeration for all the types of requests that can be exposed through the API. + + @field TX_REQUESTTYPE_COMMAND: + The request handles a command. + + @field TX_REQUESTTYPE_CUSTOM: + Base value for custom requests defined by other protocols. + */ +typedef enum { + TX_REQUESTTYPE_COMMAND = TX_ENUM_STARTVALUE, + TX_REQUESTTYPE_CUSTOM = TX_INTERNAL_ENUM_STARTVALUE +} TX_REQUESTTYPE; + +/*********************************************************************************************************************/ + +/** + TX_MASKTYPE + + Enumeration for mask types. + + @field TX_MASKTYPE_DEFAULT: + Default mask type. + */ +typedef enum { + TX_MASKTYPE_DEFAULT = TX_ENUM_STARTVALUE +} TX_MASKTYPE; + +/*********************************************************************************************************************/ + +/** + TX_INTERACTIONMODES + + \since Version 1.1.0 + + Flags for describing engine interaction modes. These influence what behaviors are being + treated and what interaction behavior events are being generated. + + @field TX_INTERACTIONMODES_NONE: + Engine is not in any specific interacion mode, gaze aware behaviors and data stream + behaviors are being treated only. + + @field TX_INTERACTIONMODES_ACTIVATIONMODE: + Engine is in activation mode, meaning activatable interactors are prioritized and + activation events are being generated. + + @field TX_INTERACTIONMODES_PANNINGMODE: + Engine is in panning mode, meaning pannable interactors are being prioritzed, and + appropriate events being generated. + + */ +typedef enum { + TX_INTERACTIONMODES_NONE = TX_FLAGS_NONE_VALUE, + TX_INTERACTIONMODES_ACTIVATIONMODE = 1, + TX_INTERACTIONMODES_PANNINGMODE = 1 << 2 +} TX_INTERACTIONMODES; + +/*********************************************************************************************************************/ + + +typedef enum { + TX_CLIENTMODE_AGENT = TX_ENUM_STARTVALUE, + TX_CLIENTMODE_DIAGNOSTICS +} TX_CLIENTMODE; + + +/*********************************************************************************************************************/ + +/** + TX_CONFIGURATIONTOOL + + \since Version 1.1.0 + + Enumeration for configuration tools. + + @field TX_CONFIGURATIONTOOL_EYEXSETTINGS: + EyeX Settings. Always available. + + @field TX_CONFIGURATIONTOOL_RECALIBRATE: + Re-Calibrate the current profile. + Available when the following is fulfilled: + - Eye Tracking Device Status is "Tracking", "TrackingPaused" or "InvalidConfiguration". + - Eye Tracking Configuration Status is "Valid" or "InvalidCalibration". + - State TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME has a value other than empty string. + + When the Recalibrate tool is active the Eye Tracking Device Status will be "Configuring", i.e. tracking is off. + + @field TX_CONFIGURATIONTOOL_GUESTCALIBRATION: + Create and calibrate a guest profile and set it as active profile. + Available when the following is fulfilled: + - Eye Tracking Device Status is "Tracking", "TrackingPaused" or "InvalidConfiguration". + - Eye Tracking Configuration Status is "Valid" or "InvalidCalibration". + + When the Guest Calibration tool is active the Eye Tracking Device Status will be "Configuring", i.e. tracking is off. + + @field TX_CONFIGURATIONTOOL_CREATENEWPROFILE: + Create and calibrate a new profile and set it as active profile. + Available when the following is fulfilled: + - Eye Tracking Device Status is "Tracking", "TrackingPaused" or "InvalidConfiguration". + - Eye Tracking Configuration Status is "Valid" or "InvalidCalibration". + + When the Create New Profile tool is active the Eye Tracking Device Status will be "Configuring", i.e. tracking is off. + + @field TX_CONFIGURATIONTOOL_TESTEYETRACKING: + Test your eye tracking. + Available when the following is fulfilled: + - Eye Tracking Device Status is "Tracking". + + @field TX_CONFIGURATIONTOOL_DIAGNOSTICS: + Diagnose your eye tracking. + Always available. +*/ + +typedef enum { + TX_CONFIGURATIONTOOL_EYEXSETTINGS = TX_ENUM_STARTVALUE, + TX_CONFIGURATIONTOOL_RECALIBRATE, + TX_CONFIGURATIONTOOL_GUESTCALIBRATION, + TX_CONFIGURATIONTOOL_CREATENEWPROFILE, + TX_CONFIGURATIONTOOL_TESTEYETRACKING, + TX_CONFIGURATIONTOOL_DIAGNOSTICS, + + /* for internal use only */ + TX_CONFIGURATIONTOOL_SETUPDISPLAY = TX_INTERNAL_ENUM_STARTVALUE, + TX_CONFIGURATIONTOOL_EYEPOSITION, + TX_CONFIGURATIONTOOL_EYECAPTURE, + TX_CONFIGURATIONTOOL_FIRMWARE_UPGRADE, + TX_CONFIGURATIONTOOL_CHECKFORUPDATES, + TX_CONFIGURATIONTOOL_RETAILCALIBRATION +} TX_CONFIGURATIONTOOL; + +/*********************************************************************************************************************/ +/** + TX_EYETRACKINGCONFIGURATIONSTATUS + + \since Version 1.1.0 + + Enumeration for configuration status. Gives information about the configuration status of the eye tracker, + for example if it needs to be calibrated or if we need to setup display. Can be used as input to determine + when to enable launching of configuration tools, see txLaunchConfigurationTool + and TX_CONFIGURATIONTOOL. + + @field TX_EYETRACKINGCONFIGURATIONSTATUS_VALID: + The configuration status of the eye tracker is valid. + + @field TX_EYETRACKINGCONFIGURATIONSTATUS_INVALIDMONITORCONFIGURATION: + The monitor where the eye tracker is mounted need to be configured. + + @field TX_EYETRACKINGCONFIGURATIONSTATUS_INVALIDCALIBRATION: + The eye tracker need to be calibrated. If no user profile exists (see state TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME) a new profile should be created. + + @field TX_EYETRACKINGCONFIGURATIONSTATUS_UNKNOWNERROR: + The configuration is in an unknown error state. +*/ + +typedef enum { + TX_EYETRACKINGCONFIGURATIONSTATUS_VALID = TX_ENUM_STARTVALUE, + TX_EYETRACKINGCONFIGURATIONSTATUS_INVALIDMONITORCONFIGURATION, + TX_EYETRACKINGCONFIGURATIONSTATUS_INVALIDCALIBRATION, + TX_EYETRACKINGCONFIGURATIONSTATUS_UNKNOWNERROR +} TX_EYETRACKINGCONFIGURATIONSTATUS; + + +/*********************************************************************************************************************/ + +/** + TX_TRACKEDEYE + + \since Version 1.3.0 + + Enumeration for tracked eye of current profile. + + @field TX_TRACKEDEYES_BOTH: + Track both eyes. + + @field TX_TRACKEDEYES_ONLY_LEFT_EYE: + Track left eye only. + + @field TX_TRACKEDEYES_ONLY_RIGHT_EYE: + Track right eye only. + + @field TX_EYETRACKINGCONFIGURATIONSTATUS_INVALIDMONITORCONFIGURATION: + The monitor where the eye tracker is mounted need to be configured. +*/ +typedef enum { + TX_TRACKEDEYES_BOTH = TX_ENUM_STARTVALUE, + TX_TRACKEDEYES_ONLY_LEFT_EYE, + TX_TRACKEDEYES_ONLY_RIGHT_EYE +} TX_TRACKEDEYES; + + +/*********************************************************************************************************************/ + +/** + TX_HANDSFREEPANNINGMODE + + This is For internal use only! + + Enumeration for the different hands free modes. + Used in TX_PANNABLE_PARAMS for a specific behavior/interactor + + @field TX_HANDSFREEPANNINGMODE_DEFAULT: + Handsfree panning follows the current engine panning handsfree state, which may be set by the user. + + @field TX_HANDSFREEPANNINGMODE_ALWAYSENABLED: + Handsfree panning is always enabled, regardless of engine panning handsfree state. + + @field TX_HANDSFREEPANNINGMODE_ALWAYSDISABLED: + Handsfree panning is always disabled, regardless of engine panning handsfree state. + + */ +typedef enum { + TX_HANDSFREEPANNINGMODE_DEFAULT = 0, + TX_HANDSFREEPANNINGMODE_ALWAYSENABLED, + TX_HANDSFREEPANNINGMODE_ALWAYSDISABLED +} TX_HANDSFREEPANNINGMODE; + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_FRAMEWORK_TYPES__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXInteractor.h b/Tobii EyeX/include/eyex/EyeXInteractor.h new file mode 100755 index 0000000..b753864 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXInteractor.h @@ -0,0 +1,1058 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXInteractor.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_INTERACTOR_API__H__) +#define __TOBII_TX_INTERACTOR_API__H__ + +/*********************************************************************************************************************/ + +/** + txGetInteractorId + + Gets the id of an interactor. + + @param hInteractor [in]: + A TX_CONSTHANDLE to the interactor for which the id should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pInteractorId [out]: + A TX_STRING to which the interactor id will be copied. + Must be at least the size of the interactor id. + Can be NULL to only get the size of the interactor id. + + @param pInteractorIdSize [in,out]: + A pointer to a TX_SIZE which will be set the size of the interactor id. + Must not be NULL. + The value must be 0 if pInteractorId is NULL. + + @return + TX_RESULT_OK: The interactor id or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pInteractorId is invalid (*pInteractorIdSize will be set to the required size). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractorId( + TX_CONSTHANDLE hInteractor, + TX_STRING pInteractorId, + TX_SIZE* pInteractorIdSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorIdHook)( + TX_CONSTHANDLE hInteractor, + TX_STRING pInteractorId, + TX_SIZE* pInteractorIdSize + ); + + +/*********************************************************************************************************************/ + +/** + txGetInteractorParentId + + Gets the id of an interactors parent. + + @param hInteractor [in]: + A TX_CONSTHANDLE to the interactor for which the parent id should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pParentInteractorId [out]: + A TX_STRING to which the parent interactor id will be copied. + Must be at least the size of the parent interactor id. + Can be NULL to only get the size of the parent interactor id. + + @param pInteractorParentIdSize [in,out]: + A pointer to a TX_SIZE which will be set the size of the parent interactor id. + Must not be NULL. + The value must be 0 if pParentInteractorId is NULL. + + @return + TX_RESULT_OK: The parent interactor id or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pParentInteractorId is invalid (*pInteractorParentIdSize will be set to the required size). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractorParentId( + TX_CONSTHANDLE hInteractor, + TX_STRING pParentInteractorId, + TX_SIZE* pInteractorParentIdSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorParentIdHook)( + TX_CONSTHANDLE hInteractor, + TX_STRING pParentInteractorId, + TX_SIZE* pInteractorParentIdSize + ); + + +/*********************************************************************************************************************/ + +/** + txGetInteractorWindowId + + Gets the window id of the interactor. + + @param hInteractor [in]: + A TX_CONSTHANDLE to the interactor for which the window id should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pWindowId [out]: + A TX_STRING to which the window id will be copied. + Must be at least the size of the window id. + Can be NULL to only get the size of the window id. + + @param pWindowIdSize [in,out]: + A pointer to a TX_SIZE which will be set the size of the window id. + Must not be NULL. + The value must be 0 if pWindowId is NULL. + + @return + TX_RESULT_OK: The window id or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pWindowId is invalid (*pWindowIdSize will be set to the required size). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractorWindowId( + TX_CONSTHANDLE hInteractor, + TX_STRING pWindowId, + TX_SIZE* pWindowIdSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorWindowIdHook)( + TX_CONSTHANDLE hInteractor, + TX_STRING pWindowId, + TX_SIZE* pWindowIdSize + ); + + +/*********************************************************************************************************************/ + +/** + txSetInteractorZ + + Sets the z value of an interactor. + The z value of an interactor is used to specify which interactor lies on top of which among siblings. + Note that the z value is local on each level of interactors and therefore only concerns interactors with the same parent. + The z value must be a non negative TX_REAL. + This call will overwrite any previously set z value. + + @param hInteractor [in]: + A TX_HANDLE to the interactor for which to set the z value. + Must not be TX_EMPTY_HANDLE. + + @param z [in]: + The z value as a TX_REAL. + Must be a non negative TX_REAL. + + @return + TX_RESULT_OK: The z value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetInteractorZ( + TX_HANDLE hInteractor, + TX_REAL z + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetInteractorZHook)( + TX_HANDLE hInteractor, + TX_REAL z + ); + + +/*********************************************************************************************************************/ + +/** + txGetInteractorZ + + Gets the z value of an interactor. + + @param hInteractor [in]: + A TX_CONSTHANDLE to the interactor for which to get the z value. + Must not be TX_EMPTY_HANDLE. + + @param pZ [out]: + The pointer to a TX_REAL which will be set to the z value. + Must not be NULL. + + @return + TX_RESULT_OK: The z value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractorZ( + TX_CONSTHANDLE hInteractor, + TX_REAL* pZ + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorZHook)( + TX_CONSTHANDLE hInteractor, + TX_REAL* pZ + ); + + +/*********************************************************************************************************************/ + +/** + txSetInteractorEnabled + + Sets a TX_BOOL flag which specifies if an interactor is enabled or not. + This call will overwrite any previously set enabled flag. + The default value is false. + + @param hInteractor [in]: + A TX_HANDLE to the interactor to enable/disable. + Must not be TX_EMPTY_HANDLE. + + @param enabled [in]: + The flag as a TX_BOOL. + + @return + TX_RESULT_OK: The interactor was successfully set to enabled/disabled. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetInteractorEnabled( + TX_HANDLE hInteractor, + TX_BOOL enabled + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetInteractorEnabledHook)( + TX_HANDLE hInteractor, + TX_BOOL enabled + ); + + +/*********************************************************************************************************************/ + +/** + txGetInteractorEnabled + + Gets the enabled flag from the interactor. + + @param hInteractor [in]: + A TX_CONSTHANDLE to the interactor for which to get the enabled flag. + Must not be TX_EMPTY_HANDLE. + + @param pEnabled [out]: + The pointer to a TX_BOOL which will be set to the enabled flag value. + Must not be NULL. + + @return + TX_RESULT_OK: The enabled flag was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractorEnabled( + TX_CONSTHANDLE hInteractor, + TX_BOOL* pEnabled + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorEnabledHook)( + TX_CONSTHANDLE hInteractor, + TX_BOOL* pEnabled + ); + + +/*********************************************************************************************************************/ + +/** + txSetInteractorDeleted + + Sets a TX_BOOL flag which specifies if an interactor is deleted or not. + This call will overwrite any previously set deleted flag. + The default value is false. + + @param hInteractor [in]: + A TX_HANDLE to the interactor to set as deleted. + Must not be TX_EMPTY_HANDLE. + + @param deleted [in]: + The flag as a TX_BOOL. + + @return + TX_RESULT_OK: The deleted flag on the interactor was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetInteractorDeleted( + TX_HANDLE hInteractor, + TX_BOOL deleted + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetInteractorDeletedHook)( + TX_HANDLE hInteractor, + TX_BOOL deleted + ); + + +/*********************************************************************************************************************/ + +/** + txGetInteractorDeleted + + Gets the deleted flag from the interactor. + + @param hInteractor [in]: + A TX_CONSTHANDLE to the interactor for which to get the deleted flag. + Must not be TX_EMPTY_HANDLE. + + @param pDeleted [out]: + The pointer to a TX_BOOL which will be set to the deleted flag value. + Must not be NULL. + + @return + TX_RESULT_OK: The deleted flag was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractorDeleted( + TX_CONSTHANDLE hInteractor, + TX_BOOL* pDeleted + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorDeletedHook)( + TX_CONSTHANDLE hInteractor, + TX_BOOL* pDeleted + ); + + +/*********************************************************************************************************************/ + +/** + txCreateInteractorBounds + + Creates bounds on an interactor. + If the interactor already has bounds this call will fail. + The bounds will be owned by the interactor and does not need to be deleted explicitly. + + @param hInteractor [in]: + A TX_HANDLE to the interactor on which the bounds should be created. + Must not be TX_EMPTY_HANDLE. + + @param phBounds [out]: + A pointer to a TX_HANDLE which will be set to the newly created bounds. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param boundsType [in]: + The TX_BOUNDSTYPE which specifies what kind of bounds to create. + + @return + TX_RESULT_OK: The bounds was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEBOUNDS: This interactor already has bounds. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateInteractorBounds( + TX_HANDLE hInteractor, + TX_HANDLE* phBounds, + TX_BOUNDSTYPE boundsType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateInteractorBoundsHook)( + TX_HANDLE hInteractor, + TX_HANDLE* phBounds, + TX_BOUNDSTYPE boundsType + ); + + +/*********************************************************************************************************************/ + +/** + txDeleteInteractorBounds + + Deletes the bounds on an interactor. + If the interactor does not have any bounds this call will fail. + The bounds object is owned by the interactor and does not need to be deleted explicitly. + + @param hInteractor [in]: + A TX_HANDLE to the interactor on which to delete the bounds. + Must not be TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The bounds was successfully deleted. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: This interactor does not have any bounds. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txDeleteInteractorBounds( + TX_HANDLE hInteractor + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *DeleteInteractorBoundsHook)( + TX_HANDLE hInteractor + ); + + +/*********************************************************************************************************************/ + +/** + txGetInteractorBounds + + Gets the bounds of an interactor. + If the interactor does not have any bounds this call will fail. + + @param hInteractor [in]: + A TX_CONSTHANDLE to the interactor from which the bounds should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param phBounds [out]: + A pointer to a TX_HANDLE which will be set to the bounds on the interactor. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The bounds was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: This interactor does not have any bounds. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractorBounds( + TX_CONSTHANDLE hInteractor, + TX_HANDLE* phBounds + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorBoundsHook)( + TX_CONSTHANDLE hInteractor, + TX_HANDLE* phBounds + ); + + +/*********************************************************************************************************************/ + +/** + txCreateInteractorBehavior + + Creates a behavior of a specified TX_BEHAVIORTYPE on an interactor. + If the interactor already has a behavior of the specified type this call will fail. + The behavior will be owned by the interactor and does not need to be removed explicitly. + + @param hInteractor [in]: + A TX_HANDLE to the interactor on which the behavior should be created. + Must not be TX_EMPTY_HANDLE. + + @param phBehavior [out]: + A pointer to a TX_HANDLE which will be set to the newly created behavior. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param behaviorType [in]: + The TX_BEHAVIORTYPE which specifies what type of behavior to create. + + @return + TX_RESULT_OK: The behavior was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEBEHAVIOR: This interactor already has a behavior of the specified type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateInteractorBehavior( + TX_HANDLE hInteractor, + TX_HANDLE* phBehavior, + TX_BEHAVIORTYPE behaviorType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateInteractorBehaviorHook)( + TX_HANDLE hInteractor, + TX_HANDLE* phBehavior, + TX_BEHAVIORTYPE behaviorType + ); + + +/*********************************************************************************************************************/ + +/** + txRemoveInteractorBehavior + + Removes a TX_BEHAVIORTYPE from an interactor. + If the interactor does not have a behavior of the specified type this call will fail. + + @param hInteractor [in]: + A TX_HANDLE to the interactor from which the behavior should be removed. + Must not be TX_EMPTY_HANDLE. + + @param behaviorType [in]: + The TX_BEHAVIORTYPE which specifies what type of behavior to remove. + + @return + TX_RESULT_OK: The behavior was successfully removed. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: This interactor does not have a behavior of the specified type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRemoveInteractorBehavior( + TX_HANDLE hInteractor, + TX_BEHAVIORTYPE behaviorType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RemoveInteractorBehaviorHook)( + TX_HANDLE hInteractor, + TX_BEHAVIORTYPE behaviorType + ); + + +/*********************************************************************************************************************/ + +/** + txGetInteractorBehavior + + Gets a TX_BEHAVIORTYPE from an interactor. + If the interactor does not have a behavior of the specified type this call will fail. + + @param hInteractor [in]: + A TX_CONSTHANDLE to the interactor from which the behavior should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param phBehavior [out]: + A pointer to a TX_HANDLE which will be set to the behavior. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param behaviorType [in]: + The TX_BEHAVIORTYPE which specifies what type of behavior to get. + + @return + TX_RESULT_OK: The behavior was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: This interactor does not have a behavior of the specified type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractorBehavior( + TX_CONSTHANDLE hInteractor, + TX_HANDLE* phBehavior, + TX_BEHAVIORTYPE behaviorType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorBehaviorHook)( + TX_CONSTHANDLE hInteractor, + TX_HANDLE* phBehavior, + TX_BEHAVIORTYPE behaviorType + ); + + +/*********************************************************************************************************************/ + +/** + txGetInteractorBehaviors + + Gets the TX_HANDLEs to all behaviors on an interactor. + + @param hInteractor [in]: + A TX_CONSTHANDLE to the interactor from which to get the behaviors. + Must not be TX_EMPTY_HANDLE. + + @param phBehaviors [out]: + A pointer to an array of TX_HANDLEs to which the behavior handles will be copied. + These handles must be released using txReleaseObject to avoid leaks. + Can be NULL to only get the size. + + @param pBehaviorsSize [in,out]: + A pointer to a TX_SIZE which will be set to the number of behaviors. + Must not be NULL. + The value must be 0 if phBehaviors is NULL. + + @return + TX_RESULT_OK: The handles or the required size of the buffer was retrieved successfully. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of the array is invalid. (*pBehaviorsSize will be set to the number of behaviors). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractorBehaviors( + TX_CONSTHANDLE hInteractor, + TX_HANDLE* phBehaviors, + TX_SIZE* pBehaviorsSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorBehaviorsHook)( + TX_CONSTHANDLE hInteractor, + TX_HANDLE* phBehaviors, + TX_SIZE* pBehaviorsSize + ); + + +/*********************************************************************************************************************/ + +/** + txCreateGazeAwareBehavior + + Creates a gaze aware behavior and attaches it to the interactor. + + @param hInteractor [in]: + A TX_HANDLE to the interactor that should have the behavior. + Must not be TX_EMPTY_HANDLE. + + @param pParams [in]: + A pointer to a TX_GAZEAWAREARAMS which specifies the behaviors parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The behavior was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEBEHAVIOR: This interactor already has a behavior of the specified type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateGazeAwareBehavior( + TX_HANDLE hInteractor, + const TX_GAZEAWAREPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateGazeAwareBehaviorHook)( + TX_HANDLE hInteractor, + const TX_GAZEAWAREPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txCreateActivatableBehavior + + Creates an activatable behavior and attaches it to the interactor. + + @param hInteractor [in]: + A TX_HANDLE to the interactor that should have the behavior. + Must not be TX_EMPTY_HANDLE. + + @param pParams [in]: + A pointer to a TX_ACTIVATABLEPARAMS which specifies the behaviors parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The behavior was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEBEHAVIOR: This interactor already has a behavior of the specified type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateActivatableBehavior( + TX_HANDLE hInteractor, + const TX_ACTIVATABLEPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateActivatableBehaviorHook)( + TX_HANDLE hInteractor, + const TX_ACTIVATABLEPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txCreatePannableBehavior + + Creates a pannable behavior and attaches it to the interactor. + + @param hInteractor [in]: + A TX_HANDLE to the interactor that should have the behavior. + Must not be TX_EMPTY_HANDLE. + + @param pParams [in]: + A pointer to a TX_PANNABLEPARAMS which specifies the behaviors parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The behavior was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEBEHAVIOR: This interactor already has a behavior of the specified type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreatePannableBehavior( + TX_HANDLE hInteractor, + const TX_PANNABLEPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreatePannableBehaviorHook)( + TX_HANDLE hInteractor, + const TX_PANNABLEPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txCreateGazePointDataBehavior + + Creates a gaze point data behavior and attaches it to the interactor. + + @param hInteractor [in]: + A TX_HANDLE to the interactor that should have the behavior. + Must not be TX_EMPTY_HANDLE. + + @param pParams [in]: + A pointer to a TX_GAZEPOINTDATAPARAMS which specifies the behaviors parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The behavior was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEBEHAVIOR: This interactor already has a behavior of the specified type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateGazePointDataBehavior( + TX_HANDLE hInteractor, + const TX_GAZEPOINTDATAPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateGazePointDataBehaviorHook)( + TX_HANDLE hInteractor, + const TX_GAZEPOINTDATAPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txCreateFixationDataBehavior + + Creates a fixation data behavior and attaches it to the interactor. + + @param hInteractor [in]: + A TX_HANDLE to the interactor that should have the behavior. + Must not be TX_EMPTY_HANDLE. + + @param options [in]: + A pointer to a TX_FIXATIONDATAPARAMS which specifies the behaviors parameters. + Must not be NULL. + + @return + TX_RESULT_OK: The behavior was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEBEHAVIOR: This interactor already has a behavior of the specified type. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateFixationDataBehavior( + TX_HANDLE hInteractor, + const TX_FIXATIONDATAPARAMS* pParams + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateFixationDataBehaviorHook)( + TX_HANDLE hInteractor, + const TX_FIXATIONDATAPARAMS* pParams + ); + + +/*********************************************************************************************************************/ + +/** + txCreateMask + + Creates an mask on an interactor. + The mask is defined by a matrix of size columnCount * rowCount. The usage of each element in the matrix varies + between diffrent TX_MASKTYPEs. + A mask should typically NOT correspond to the number of pixels covering an interactor, rather it should be smaller. + + @param hInteractor [in]: + A TX_HANDLE to interactor on which to create the mask. + Must not be TX_EMPTY_HANDLE. + + @param phMask [out]: + A pointer to a TX_HANDLE which will be set to the newly created mask. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param maskType [in]: + The type of mask to create. See TX_MASKTYPE. + + @param columnCount [in]: + The width of the mask. + Must be a positive TX_INTEGER. + columnCount*rowCount must not be larger than 65536. + + @param rowCount [in]: + The height of the mask. + Must be a positive TX_INTEGER. + columnCount*rowCount must not be larger than 65536. + + @param pData [in]: + A pointer to buffer of TX_BYTEs which contains the mask elements. + See TX_MASKTYPE for details about mask data for different types. + Must not be NULL. + + @return + TX_RESULT_OK: The mask was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_MASKTOOLARGE: The mask is too large, columnCount*rowCount must not be larger than 65536 (e.g. 256*256, 128*512 etc). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateMask( + TX_HANDLE hInteractor, + TX_HANDLE* phMask, + TX_MASKTYPE maskType, + TX_INTEGER columnCount, + TX_INTEGER rowCount, + const TX_BYTE* pData + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateMaskHook)( + TX_HANDLE hInteractor, + TX_HANDLE* phMask, + TX_MASKTYPE maskType, + TX_INTEGER columnCount, + TX_INTEGER rowCount, + const TX_BYTE* pData + ); + + +/*********************************************************************************************************************/ + +/** + txRemoveMask + + Removes an mask from an interactor. + + @param hInteractor [in]: + A TX_HANDLE to interactor on which to create the mask. + Must not be TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The mask was successfully removed. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRemoveMask( + TX_HANDLE hInteractor + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RemoveMaskHook)( + TX_HANDLE hInteractor + ); + + +/*********************************************************************************************************************/ + +/** + txGetMask + + Retrieves the mask from an interactor. + + @param hInteractor [in]: + A TX_CONSTHANDLE to interactor from which to get the mask. + Must not be TX_EMPTY_HANDLE. + + @param phMask [out]: + A pointer to a TX_HANDLE which will be set to the mask. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The mask was successfully removed. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The interactor does not have an mask. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetMask( + TX_CONSTHANDLE hInteractor, + TX_HANDLE* phMask + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetMaskHook)( + TX_CONSTHANDLE hInteractor, + TX_HANDLE* phMask + ); + + +/*********************************************************************************************************************/ + +/** + txGetMaskData + + Gets the data of an mask. + + @param hMask [in]: + A TX_CONSTHANDLE to mask for which to get the data. + Must not be TX_EMPTY_HANDLE. + + @param pColumnCount [out]: + A TX_INTEGER which will be set to the width of the mask. + Must not be NULL. + + @param pRowCount [out]: + A TX_INTEGER which will be set to the height of the mask. + Must not be NULL. + + @param pData [out]: + A pointer to buffer of TX_BYTEs which contains the mask elements. + Can be NULL to only get the size of the mask. + + @param pDataSize [in,out]: + A pointer to a TX_SIZE which will be set to the size of the data buffer. + Can be NULL to only get the size of the mask. + The value must be 0 if phObjects is NULL. + + @return + TX_RESULT_OK: The data of the mask or the required buffer size was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDBUFFERSIZE: The size of the buffer was to small. (*pDataSize will be set to the required size if not NULL.) + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetMaskData( + TX_CONSTHANDLE hMask, + TX_INTEGER* pColumnCount, + TX_INTEGER* pRowCount, + TX_BYTE* pData, + TX_SIZE* pDataSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetMaskDataHook)( + TX_CONSTHANDLE hMask, + TX_INTEGER* pColumnCount, + TX_INTEGER* pRowCount, + TX_BYTE* pData, + TX_SIZE* pDataSize + ); + + +/*********************************************************************************************************************/ + +/** + txSetMaskBounds + + Sets the bounds of the mask. + By default a mask covers the entire interactor. + + @param hInteractor [in]: + A TX_HANDLE to interactor for which to set the mask bounds. + Must not be TX_EMPTY_HANDLE. + + @param pBounds [in]: + A pointer to a TX_RECT which holds the rectangle data. + Must not be NULL. + + @return + TX_RESULT_OK: The bounds of the mask was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetMaskBounds( + TX_HANDLE hInteractor, + const TX_RECT* pBounds + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetMaskBoundsHook)( + TX_HANDLE hInteractor, + const TX_RECT* pBounds + ); + + +/*********************************************************************************************************************/ + +/** + txClearMaskBounds + + Clears the mask bounds of an interactor. + + @param hInteractor [in]: + A TX_HANDLE to interactor for which to set the mask bounds. + Must not be TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The bounds of the mask was successfully cleared. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txClearMaskBounds( + TX_HANDLE hInteractor + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *ClearMaskBoundsHook)( + TX_HANDLE hInteractor + ); + + +/*********************************************************************************************************************/ + +/** + txGetMaskBounds + + Gets the bounds of the mask. + + @param hInteractor [in]: + A TX_CONSTHANDLE to interactor from which to set the mask bounds. + Must not be TX_EMPTY_HANDLE. + + @param pBounds [out]: + A pointer to a TX_RECT which will hold the rectangle data. + Must not be NULL. + + @return + TX_RESULT_OK: The bounds of the mask was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The interactor does not have any mask bounds specified. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetMaskBounds( + TX_CONSTHANDLE hInteractor, + TX_RECT* pBounds + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetMaskBoundsHook)( + TX_CONSTHANDLE hInteractor, + TX_RECT* pBounds + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_INTERACTOR_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXInternalLiterals.h b/Tobii EyeX/include/eyex/EyeXInternalLiterals.h new file mode 100755 index 0000000..5c8164a --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXInternalLiterals.h @@ -0,0 +1,84 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXInternalLiterals.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_INTERNALLITERALS__H__) +#define __TOBII_TX_INTERNALLITERALS__H__ + +/********************************************************************************************************************* + * Literals + *********************************************************************************************************************/ + + + + /** + * Snapshot internal literals + */ + static const char* TX_INTERNALLITERAL_NONAUTHORITATIVEWINDOWIDS = "NonAuthoritativeWindowIds"; + static const char* TX_INTERNALLITERAL_FOCUSEDTOPLEVELWINDOW = "FocusedTopLevelWindow"; + static const char* TX_INTERNALLITERAL_ISFOCUSEDTOPLEVELWINDOW = "IsFocusedTopLevelWindow"; + + /** + * Callback Response Literals + */ + static const char* TX_INTERNALLITERAL_ISCANCELLED = "IsCancelled"; + +/*********************************************************************************************************************/ + + /** + * Termination Literals + */ + static const char* TX_INTERNALLITERAL_TERMINATEGXWINDOWS = "TerminateGxWindows"; + static const char* TX_INTERNALLITERAL_GLOBALTERMINATEGXSERVER = "Global\\TerminateGxServer"; + + /** + * Internal Raw Gaze Data LiteralsConfiguredEyesWithGaze + **/ + static const char* TX_INTERNALLITERAL_EYEPOSITIONFROMSCREENCENTERMM = "EyePositionFromScreenCenterMM"; + static const char* TX_INTERNALLITERAL_EYEPOSITIONINTRACKBOXNORMALIZED = "EyePositionInTrackBoxNormalized"; + static const char* TX_INTERNALLITERAL_GAZEPOINTFROMSCREENCENTERMM = "GazePointFromScreenCenterMM"; + static const char* TX_INTERNALLITERAL_GAZEPOINTONDISPLAYNORMALIZED = "GazePointOnDisplayNormalized"; + static const char* TX_INTERNALLITERAL_BOTTOMLEFT = "BottomLeft"; + static const char* TX_INTERNALLITERAL_TOPLEFT = "TopLeft"; + static const char* TX_INTERNALLITERAL_TOPRIGHT = "TopRight"; + static const char* TX_INTERNALLITERAL_SCREENBOUNDSMM = "ScreenBoundsMm"; + static const char* TX_INTERNALLITERAL_SCREENBOUNDSPIXELS = "ScreenBoundsPixels"; + static const char* TX_INTERNALLITERAL_CONFIGUREDEYESWITHGAZE = "ConfiguredEyesWithGaze"; + //these below could be in an enum, but wont be, since its an internal stream + static const char* TX_INTERNALLITERAL_CONFIGUREDEYESWITHGAZENONE = "ConfiguredEyesWithGazeNone"; + static const char* TX_INTERNALLITERAL_CONFIGUREDEYESWITHGAZEBOTH = "ConfiguredEyesWithGazeBoth"; + static const char* TX_INTERNALLITERAL_CONFIGUREDEYESWITHGAZELEFT = "ConfiguredEyesWithGazeLeft"; + static const char* TX_INTERNALLITERAL_CONFIGUREDEYESWITHGAZERIGHT = "ConfiguredEyesWithGazeRight"; + + static const char* TX_INTERNALLITERAL_DETECTEDEYES = "DetectedEyes"; + static const char* TX_INTERNALLITERAL_DETECTEDEYESNONE = "DetectedEyesNone"; + static const char* TX_INTERNALLITERAL_DETECTEDEYESBOTH = "DetectedEyesBoth"; + static const char* TX_INTERNALLITERAL_DETECTEDEYESLEFT = "DetectedEyesLeft"; + static const char* TX_INTERNALLITERAL_DETECTEDEYESRIGHT = "DetectedEyesRight"; + + /** + * Internal Zoom Literals + **/ + static const char* TX_INTERNALLITERAL_ZOOMDIRECTION = "ZoomDirection"; + static const char* TX_INTERNALLITERAL_ZOOMGAZEPOINTX = "ZoomGazePointX"; + static const char* TX_INTERNALLITERAL_ZOOMGAZEPOINTY = "ZoomGazePointY"; + + /** + * Internal Eye Position Behavior Literals + **/ + static const char* TX_INTERNALLITERAL_LEFTEYETRACKED = "LeftEyeTracked"; + static const char* TX_INTERNALLITERAL_RIGHTEYETRACKED = "RightEyeTracked"; + + /** + * Internal Process Client Ids + **/ + static const char* TX_INTERNALLITERAL_CLIENTPROCESSIDS = "ClientProcessIds"; + + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_INTERNALLITERALS__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXInternalTypes.h b/Tobii EyeX/include/eyex/EyeXInternalTypes.h new file mode 100755 index 0000000..92c5419 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXInternalTypes.h @@ -0,0 +1,44 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXInternalTypes.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_INTERNAL_TYPES__H__) +#define __TOBII_TX_INTERNAL_TYPES__H__ + +/*********************************************************************************************************************/ + +/** + Callback for an Invalid argument. + + @param functionName [in]: + A TX_CONSTSTRING + + @param parameterName [in]: + A TX_CONSTSTRING + + @param userParam [in]: + Supplied when registering the callback, normally used to respond to the event outside of the callback. + + @return + void + */ +typedef void (TX_CALLCONVENTION *TX_INVALIDARGUMENTCALLBACK)( + TX_CONSTSTRING functionName, + TX_CONSTSTRING parameterName, + TX_USERPARAM userParam + ); + +/*********************************************************************************************************************/ + +typedef enum { + TX_PROPERTYFLAG_NONE = TX_FLAGS_NONE_VALUE, + TX_PROPERTYFLAG_NONREMOVABLE = 1 << 0, + TX_PROPERTYFLAG_MANUALCLONING = 1 << 1 +} TX_PROPERTYFLAGS; + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_INTERNAL_TYPES__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXLiterals.h b/Tobii EyeX/include/eyex/EyeXLiterals.h new file mode 100755 index 0000000..e7b38be --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXLiterals.h @@ -0,0 +1,373 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXLiterals.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_LITERALS__H__) +#define __TOBII_TX_LITERALS__H__ + +/********************************************************************************************************************* + * Literals + *********************************************************************************************************************/ + + + + /** + * Message Literals + */ + static const char* TX_LITERAL_HEADER = "Header"; + static const char* TX_LITERAL_BODY = "Body"; + static const char* TX_LITERAL_ID = "Id"; + static const char* TX_LITERAL_PROCESSID = "ProcessId"; + + /** + * Client Literals + */ + static const char* TX_LITERAL_AGENTID = "AgentId"; + static const char* TX_LITERAL_TARGETPROCESSID = "TargetProcessId"; + static const char* TX_LITERAL_CLIENTMODE = "ClientMode"; + + /** + * Miscellaneous Literals + */ + static const char* TX_LITERAL_TYPE = "Type"; + static const char* TX_LITERAL_TIMESTAMP = "Timestamp"; + static const char* TX_LITERAL_DATA = "Data"; + static const char* TX_LITERAL_PARAMETERS = "Parameters"; + static const char* TX_LITERAL_X = "X"; + static const char* TX_LITERAL_Y = "Y"; + static const char* TX_LITERAL_Z = "Z"; + + /** + * Bounds Literals + */ + static const char* TX_LITERAL_BOUNDS = "Bounds"; + static const char* TX_LITERAL_BOUNDSTYPE = "BoundsType"; + static const char* TX_LITERAL_NONE = "None"; + static const char* TX_LITERAL_RECTANGULAR = "Rectangular"; + static const char* TX_LITERAL_TOP = "Top"; + static const char* TX_LITERAL_LEFT = "Left"; + static const char* TX_LITERAL_RIGHT = "Right"; + static const char* TX_LITERAL_BOTTOM = "Bottom"; + static const char* TX_LITERAL_WIDTH = "Width"; + static const char* TX_LITERAL_HEIGHT = "Height"; + + /** + * Interactor Literals + */ + static const char* TX_LITERAL_ROOTID = "_RootId"; + static const char* TX_LITERAL_GLOBALINTERACTORWINDOWID = "GlobalInteractorWindowId"; + static const char* TX_LITERAL_MASK = "Mask"; + static const char* TX_LITERAL_MASKID = "MaskId"; + static const char* TX_LITERAL_MASKBOUNDS = "MaskBounds"; + + /** + * Mask Literals + */ + static const char* TX_LITERAL_MASKTYPE = "MaskType"; + static const char* TX_LITERAL_ROWCOUNT = "RowCount"; + static const char* TX_LITERAL_COLUMNCOUNT = "ColumnCount"; + + /** + * Gaze Point Data Behavior Literals + */ + static const char* TX_LITERAL_GAZEPOINTDATAMODE = "GazePointDataMode"; + static const char* TX_LITERAL_GAZEPOINTDATAEVENTTYPE = "GazePointDataEventType"; + + /** + * Activation Behavior Literals + */ + static const char* TX_LITERAL_ACTIVATABLEEVENTTYPE = "ActivatableEventType"; + static const char* TX_LITERAL_HASACTIVATIONFOCUS = "HasActivationFocus"; + static const char* TX_LITERAL_HASTENTATIVEACTIVATIONFOCUS = "HasTentativeActivationFocus"; + static const char* TX_LITERAL_ISACTIVATED = "IsActivated"; + static const char* TX_LITERAL_ISTENTATIVEFOCUSENABLED = "IsTentativeFocusEnabled"; + static const char* TX_LITERAL_ISSMALLITEMDETECTIONENABLED = "IsSmallItemDetectionEnabled"; + + /** + * Fixation Data Behavior Literals + */ + static const char* TX_LITERAL_FIXATIONDATAMODE = "FixationDataMode"; + static const char* TX_LITERAL_FIXATIONDATAEVENTTYPE = "FixationDataEventType"; + + /** + * Action data Behavior Literals + */ + static const char* TX_LITERAL_ACTIONDATAEVENTTYPE = "ActionDataEventType"; + static const char* TX_LITERAL_ACTIVATIONMISSED = "ActivationMissed"; + + /** + * Gaze-Aware Behavior Literals + */ + static const char* TX_LITERAL_HASGAZE = "HasGaze"; + static const char* TX_LITERAL_GAZEAWAREMODE = "GazeAwareMode"; + static const char* TX_LITERAL_DELAYTIME = "DelayTime"; + + /** + * Gaze Data Diagnostics Behavior Literals + */ + static const char* TX_LITERAL_QUALITY = "Quality"; + static const char* TX_LITERAL_NOISE = "Noise"; + static const char* TX_LITERAL_INSACCADE = "InSaccade"; + static const char* TX_LITERAL_INFIXATION = "InFixation"; + + /** + * Eye Position Behavior Literals + */ + static const char* TX_LITERAL_LEFTEYEPOSITION = "LeftEyePosition"; + static const char* TX_LITERAL_RIGHTEYEPOSITION = "RightEyePosition"; + static const char* TX_LITERAL_LEFTEYEPOSITIONNORMALIZED = "LeftEyePositionNormalized"; + static const char* TX_LITERAL_RIGHTEYEPOSITIONNORMALIZED = "RightEyePositionNormalized"; + static const char* TX_LITERAL_HASLEFTEYEPOSITION = "HasLeftEyePosition"; + static const char* TX_LITERAL_HASRIGHTEYEPOSITION = "HasRightEyePosition"; + + /** + * Presence Behavior Literals + */ + static const char* TX_LITERAL_PRESENCEDATA = "Presence"; + + + /** + * Pannable Behavior Literals + */ + static const char* TX_LITERAL_PANVELOCITYX = "PanVelocityX"; + static const char* TX_LITERAL_PANVELOCITYY = "PanVelocityY"; + static const char* TX_LITERAL_PANSTEPX = "PanStepX"; + static const char* TX_LITERAL_PANSTEPY = "PanStepY"; + static const char* TX_LITERAL_PANSTEPDURATION = "PanStepDuration"; + static const char* TX_LITERAL_PANHANDSFREE = "PanHandsFree"; + static const char* TX_LITERAL_PANPROFILE = "Profile"; + static const char* TX_LITERAL_PANDIRECTIONSAVAILABLE = "PanDirectionsAvailable"; + static const char* TX_LITERAL_PANPEAKVELOCITY = "PeakVelocity"; + static const char* TX_LITERAL_PANADAPTVELOCITYTOVIEWPORT = "AdaptVelocityToViewport"; + static const char* TX_LITERAL_PANMAXZONERELATIVESIZE = "MaxPanZoneRelativeSize"; + static const char* TX_LITERAL_PANMAXZONESIZE = "MaxPanZoneSize"; + static const char* TX_LITERAL_PANZONESIZE = "PanZoneSize"; + static const char* TX_LITERAL_PANNABLEEVENTTYPE = "PannableEventType"; + + /** + * Callback Response Literals + */ + static const char* TX_LITERAL_REQUESTTYPE = "RequestType"; + static const char* TX_LITERAL_REQUESTID = "RequestId"; + static const char* TX_LITERAL_ERRORMESSAGE = "ErrorMessage"; + static const char* TX_LITERAL_RESULT = "Result"; + + /** + * Interaction Mode Literals + */ + static const char* TX_LITERAL_ACTIONTYPE = "ActionType"; + + /** + * State literals + */ + static const char* TX_LITERAL_STATEPATH = "StatePath"; + static const char* TX_LITERAL_STATEPATHDELIMITER = "."; + + /* + * Configuration Tool Literals + */ + static const char* TX_LITERAL_CONFIGURATIONTOOL = "ConfigurationTool"; + + /* + * Current Profile Literals + */ + static const char* TX_LITERAL_PROFILENAME = "ProfileName"; + + + +/*********************************************************************************************************************/ + +/** + * Literals for state paths. + * + * @field TX_STATEPATH_EYETRACKING: + * The root node for all eyetracking information. + * GETTABLE. + * + * @field TX_STATEPATH_EYETRACKINGSCREENBOUNDS: + * Holds the virtual screen bounds in pixels. + * The value can be retrieved from the state bag as a TX_RECT structure with GetStateValueAsRectangle. + * If the screen bounds can not be determined screen bounds (0, 0, 0, 0) will be returned. + * Replaces deprecated state path TX_STATEPATH_SCREENBOUNDS from version 1.3.0. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGDISPLAYSIZE: + * Holds the display size in millimeters as width and height. + * The value can be retrieved from the state bag as a TX_SIZE2 structure with GetStateValueAsSize2. + * If the display size can not be determined Width and Height (0, 0) will be returned. + * Replaces deprecated state path TX_STATEPATH_DISPLAYSIZE from version 1.3.0. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGSTATE: + * Holds the eye tracking state. The value is of type TX_EYETRACKINGDEVICESTATUS. + * GETTABLE. + * + * @field TX_STATEPATH_EYETRACKINGCURRENTPROFILE: + * Holds the following data: + * "name" - See TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME. + * "trackedeyes" - See TX_STATEPATH_EYETRACKINGCURRENTPROFILETRACKEDEYES. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME: + * Holds the name of the current eye tracking profile. The value is of type TX_STRING. + * Replaces deprecated state path TX_STATEPATH_PROFILENAME from version 1.3.0. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGCURRENTPROFILETRACKEDEYES: + * Holds the tracked eyes of the current eye tracking profile. The value is of type TX_TRACKEDEYES. + * GETTABLE and SETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGPROFILES: + * Holds the list of available eye tracking profiles. The value is an array of TX_STRING. It can be accessed with + * txGetStateValueAsString as a string containing all profiles separated with a null termination character. + * There is also a utility function available to access profiles as a std::vector of std::strings, see Tx::GetStateValueAsArrayOfStrings. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGCONFIGURATIONSTATUS: + * Holds the configuration status of the eye tracker. The value is of type TX_EYETRACKINGCONFIGURATIONSTATUS. + * GETTABLE. + * \since Version 1.1.0 + * + * @field TX_STATEPATH_EYETRACKINGINFO: + * Holds information about the eye tracker. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGINFOMODELNAME: + * Eye tracker model name. The value is of type TX_STRING. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGINFOSERIALNUMBER: + * Eye tracker serial number. The value is of type TX_STRING. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGINFOGENERATION: + * Eye tracker generation name. The value is of type TX_STRING. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGINFOFIRMWAREVERSION: + * Eye tracker firmware version. The value is of type TX_STRING. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_EYETRACKINGINFOEYEXCONTROLLERCOREVERSION: + * EyeX Controller Core Version. The value is of type TX_STRING. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_ENGINEINFOVERSION: + * Reports the engine version. The value is of type TX_STRING. + * Replaces deprecated state path TX_STATEPATH_ENGINEVERSION since version 1.3.0. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_ENGINEINFOINTERNAL: + * Holds the following data: + * "tobiiserviceversion" - The installed version of Tobii Service as TX_STRING or empty string if not installed. + * "tobiieyexcontrollerdriverversion" - The installed version of Tobii EyeX Controller Driver as TX_STRING or empty string if not installed. + * "tobiiusbserviceversion" - The installed version of Tobii USB Service version as TX_STRING or empty string if not installed. + * "tobiieyexinteractionversion" - The installed version of Tobii EyeX Interaction as TX_STRING or empty string if not installed. + * "tobiieyexconfigversion" - The installed version of Tobii EyeX Config as TX_STRING or empty string if not installed. + * GETTABLE. + * \since Version 1.3.0 + * + * @field TX_STATEPATH_USERPRESENCE: + * Holds data about user presence. The value is of type TX_USERPRESENCE. + * The value of TX_USERPRESENCE will be TX_USERPRESENCE_UNKNOWN if there isn't any observer registered for this state. + * GETTABLE. + * + * @field TX_STATEPATH_FAILEDACTION: + * Notifies when interactions fail. The value is of type TX_FAILEDACTIONTYPE. + * SUBSCRIBABLE. + * + * @field TX_STATEPATH_INTERACTIONMODES: + * Holds the current engine interaction mode. The value is of type TX_INTERACTIONMODES. + * GETTABLE. + * \since Version 1.1.0 + * + * @field TX_STATEPATH_PROFILENAME: + * Holds the name of the eye tracking profile used. The value is of type TX_STRING. + * Deprecated, use TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME for engine version 1.3.0 and greater. + * GETTABLE. + * + * @field TX_STATEPATH_ENGINEVERSION: + * Reports the engine version. The value is of type TX_STRING. + * Deprecated, use TX_STATEPATH_ENGINEINFOVERSION for engine version 1.3.0 and greater. + * GETTABLE. + * + * @field TX_STATEPATH_SCREENBOUNDS: + * Holds the virtual screen bounds in pixels. + * The value can be retrieved from the state bag as a TX_RECT structure with GetStateValueAsRectangle. + * If the screen bounds can not be determined screen bounds (0, 0, 0, 0) will be returned. + * Deprecated, use TX_STATEPATH_EYETRACKINGSCREENBOUNDS for engine version 1.3.0 and greater. + * GETTABLE. + * + * @field TX_STATEPATH_DISPLAYSIZE: + * Holds the display size in millimeters as width and height. + * The value can be retrieved from the state bag as a TX_SIZE2 structure with GetStateValueAsSize2. + * If the display size can not be determined Width and Height (0, 0) will be returned. + * Deprecated, use TX_STATEPATH_EYETRACKINGDISPLAYSIZE for engine version 1.3.0 and greater. + * GETTABLE. + * + * @field TX_STATEPATH_CONFIGURATIONSTATUS: + * Holds the configuration status of the eye tracker. The value is of type TX_EYETRACKINGCONFIGURATIONSTATUS. + * \since Version 1.1.0 + * Deprecated, use TX_STATEPATH_EYETRACKINGCONFIGURATIONSTATUS for engine version 1.3.0 and greater. + * GETTABLE. + * + */ + + static const char* TX_STATEPATH_EYETRACKING = "eyeTracking"; + static const char* TX_STATEPATH_EYETRACKINGSCREENBOUNDS = "eyeTracking.screenBounds"; + static const char* TX_STATEPATH_EYETRACKINGDISPLAYSIZE = "eyeTracking.displaySize"; + static const char* TX_STATEPATH_EYETRACKINGSTATE = "eyeTracking.state"; + + static const char* TX_STATEPATH_EYETRACKINGPROFILES = "eyeTracking.profiles"; + static const char* TX_STATEPATH_EYETRACKINGCURRENTPROFILE = "eyeTracking.currentprofile"; + static const char* TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME = "eyeTracking.currentprofile.name"; + static const char* TX_STATEPATH_EYETRACKINGCURRENTPROFILETRACKEDEYES = "eyeTracking.currentprofile.trackedeyes"; + + static const char* TX_STATEPATH_EYETRACKINGCONFIGURATIONSTATUS = "eyeTracking.configurationStatus"; + + static const char* TX_STATEPATH_EYETRACKINGINFO = "eyeTracking.info"; + static const char* TX_STATEPATH_EYETRACKINGINFOMODELNAME = "eyeTracking.info.modelname"; + static const char* TX_STATEPATH_EYETRACKINGINFOSERIALNUMBER = "eyeTracking.info.serialnumber"; + static const char* TX_STATEPATH_EYETRACKINGINFOGENERATION = "eyeTracking.info.generation"; + static const char* TX_STATEPATH_EYETRACKINGINFOFIRMWAREVERSION = "eyeTracking.info.firmwareversion"; + static const char* TX_STATEPATH_EYETRACKINGINFOHASFIXEDDISPLAYAREA = "eyeTracking.info.hasfixeddisplayarea"; + static const char* TX_STATEPATH_EYETRACKINGINFOTOBIIEYEXCONTROLLERCOREVERSION = "eyeTracking.info.tobiieyexcontrollercoreversion"; + + static const char* TX_STATEPATH_ENGINEINFOVERSION = "engine.info.version"; + static const char* TX_STATEPATH_ENGINEINFOINTERNAL = "engine.info.internal"; + + static const char* TX_STATEPATH_GAZETRACKING = "status.gazeTracking"; + + static const char* TX_STATEPATH_USERPRESENCE = "userPresence"; + + static const char* TX_STATEPATH_FAILEDACTION = "failedAction"; + + static const char* TX_STATEPATH_INTERACTIONMODES = "status.interaction.interactionModes"; + + /* Deprecated since version 1.3.0. For compatibility between client libs and engine version 1.2.1 or lesser */ + static const char* TX_STATEPATH_PROFILENAME = "eyeTracking.profileName"; + static const char* TX_STATEPATH_ENGINEVERSION = "engineVersion"; + static const char* TX_STATEPATH_CONFIGURATIONSTATUS = "eyeTracking.configurationStatus"; + static const char* TX_STATEPATH_SCREENBOUNDS = "eyeTracking.screenBounds"; + static const char* TX_STATEPATH_DISPLAYSIZE = "eyeTracking.displaySize"; + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_LITERALS__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXMacros.h b/Tobii EyeX/include/eyex/EyeXMacros.h new file mode 100755 index 0000000..b264989 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXMacros.h @@ -0,0 +1,234 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXMacros.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_MACROS__H__) +#define __TOBII_TX_MACROS__H__ + +/*********************************************************************************************************************/ + +#ifdef WIN32 + #define TX_CALLCONVENTION __cdecl + #ifdef TX_STATIC_LIB + #define TX_API + #else + #ifdef TX_EXPORTING + #define TX_API __declspec(dllexport) + #else + #define TX_API __declspec(dllimport) + #endif /* TX_EXPORTING */ + #endif /* TX_STATIC_LIB */ +#else + #define TX_CALLCONVENTION + #define TX_API +#endif /* WIN32 */ + +/*********************************************************************************************************************/ + +#define TX_PREFIX(prefix, fn) prefix##fn +#define TX_PREFIXSTR2(fn) #fn +#define TX_PREFIXSTR(fn) TX_PREFIXSTR2(tx##fn) + +/*********************************************************************************************************************/ + +/** + * Common macro used for functions that should be public. + */ +#define TX_API_FUNCTION_BASE(impexp, fn, prefix) \ + impexp TX_RESULT TX_CALLCONVENTION prefix##fn + +/** + * Base macro which generates code common for C and CLI/C++ + */ +#if defined(__cplusplus) + #define TX_C_BEGIN extern "C" { + #define TX_C_END } +#else + #define TX_C_BEGIN + #define TX_C_END +#endif + +#define _TX_API_FUNCTION(fnName, paramList) \ + TX_C_BEGIN \ + TX_API_FUNCTION_BASE(TX_API, fnName paramList, tx); \ + typedef TX_RESULT (TX_CALLCONVENTION *fnName##Hook)paramList; \ + TX_API fnName##Hook TX_CALLCONVENTION TX_PREFIX(tx, Set##fnName##Hook)(fnName##Hook); \ + TX_C_END + +#define _TX_API_FUNCTION_CPP(fnName, paramList) \ + TX_API_FUNCTION_BASE(TX_API, fnName paramList, ); \ + typedef TX_RESULT (TX_CALLCONVENTION *fnName##Hook)paramList; \ + TX_API fnName##Hook TX_CALLCONVENTION TX_PREFIX(, Set##fnName##Hook)(fnName##Hook); \ + + +/** + * The final API function generator macro. + * In C this generates the following: + * + * __declspec([dllexport/dllimport]) TX_RESULT __cdecl SomeFunction(parameters); + * __declspec([dllexport/dllimport]) TX_RESULT __cdecl _SomeFunction(parameters); + * typedef TX_RESULT (__cdecl *SomeFunctionHook)(parameters); + * __declspec([dllexport/dllimport]) SetSomeFunctionHook(SomeFunctionHook); + */ +#if !defined(TX_API_FUNCTION) +#define TX_API_FUNCTION(fnName, paramList) \ + _TX_API_FUNCTION(fnName, paramList) +#endif /* !defined(TX_API_FUNCTION) */ + +#if !defined(TX_API_FUNCTION_CPP) +#define TX_API_FUNCTION_CPP(fnName, paramList) \ + namespace Tx {_TX_API_FUNCTION_CPP(fnName, paramList) } +#endif /* !defined(TX_API_FUNCTION_CPP) */ + +/** + * This macro generates the beginning of an enum definition. + */ +#if !defined(TX_BEGIN_ENUM) +#define TX_BEGIN_ENUM(clrName) typedef enum { +#endif /* !defined(TX_BEGIN_ENUM) */ + +/** + * This macro generates the end of an enum definition. + */ +#if !defined(TX_END_ENUM) +#define TX_END_ENUM(name, clrName) } name; +#endif /* !defined(TX_END_ENUM) */ + +/** + * This macro generates the beginning of an enum flags definition. + */ +#if !defined(TX_BEGIN_FLAGS) +#define TX_BEGIN_FLAGS(clrName) TX_BEGIN_ENUM(clrName) +#endif /* !defined(TX_BEGIN_FLAGS) */ + +/** + * This macro generates the end of an enum flags definition. + */ +#if !defined(TX_END_FLAGS) +#define TX_END_FLAGS(name, clrName) TX_END_ENUM(name, clrName) +#endif /* !defined(TX_END_FLAGS) */ + + +#define TX_ENUM_STARTVALUE 1 +#define TX_INTERNAL_ENUM_STARTVALUE 10000000 +#define TX_FLAGS_NONE_VALUE 0 + +/** + * This macro generates a single value in an enum definition. + */ +#if !defined(TX_ENUM_VALUE) +#define TX_ENUM_VALUE(name, clrName) name +#endif /* !defined(TX_ENUM_VALUE) */ + +#if !defined(TX_BEGIN_SCOPE) +#define TX_BEGIN_SCOPE(name) +#endif /* !defined(TX_BEGIN_SCOPE) */ + +#if !defined(TX_END_SCOPE) +#define TX_END_SCOPE +#endif /* !defined(TX_END_SCOPE) */ + +/** + * This macro generates the beginning of message tokens definition. + */ +#if !defined(TX_CONSTANTS_BEGIN) +#define TX_CONSTANTS_BEGIN(name) +#endif /* !defined(TX_CONSTANTS_BEGIN) */ + +/** + * This macro generates the end of message tokens definition. + */ +#if !defined(TX_CONSTANTS_END) +#define TX_CONSTANTS_END +#endif /* !defined(TX_CONSTANTS_END) */ + +/** + * This macro generates a single message token. + */ +#if !defined(TX_LITERALS_VALUE) +#define TX_LITERALS_VALUE(name, clrName, str) static const char* name = str; +#endif /* !defined(TX_LITERALS_VALUE) */ + +#if !defined(TX_CONSTANT_INTEGER_VALUE) +#define TX_CONSTANT_INTEGER_VALUE(name, clrName, value) static const int name = value; +#endif /* !defined(TX_CONSTANT_INTEGER_VALUE) */ + +#if !defined(TX_CONSTANT_REAL_VALUE) +#define TX_CONSTANT_REAL_VALUE(name, clrName, value) static const double name = value; +#endif /* !defined(TX_CONSTANT_REAL_VALUE) */ + +#if !defined(TX_CONSTANT_BYTE_VALUE) +#define TX_CONSTANT_BYTE_VALUE(name, clrName, value) static const unsigned char name = value; +#endif /* !defined(TX_CONSTANT_BYTE_VALUE) */ + +/** + * This macro generates code which marks the beginning of a set of public api functions. + */ +#if !defined(TX_API_FUNCTIONS_BEGIN) +#define TX_API_FUNCTIONS_BEGIN +#endif /* !defined(TX_API_FUNCTIONS_BEGIN) */ + +/** + * This macro generates code which marks the end of a set of public api functions. + */ +#if !defined(TX_API_FUNCTIONS_END) +#define TX_API_FUNCTIONS_END +#endif /* !defined(TX_API_FUNCTIONS_END) */ + +#if !defined(TX_OUT_PARAM) +#define TX_OUT_PARAM(param) param* +#endif /* !defined(TX_OUT_PARAM) */ + +#if !defined(TX_REF_PARAM) +#define TX_REF_PARAM(param) param* +#endif /* !defined(TX_REF_PARAM) */ + +#if !defined(TX_IN_PARAM) +#define TX_IN_PARAM(param) const param* +#endif /* !defined(TX_IN_PARAM) */ + +#if !defined(TX_PTR_PARAM) +#define TX_PTR_PARAM(param) param* +#endif /* !defined(TX_PTR_PARAM) */ + +#if !defined(TX_CONSTPTR_PARAM) +#define TX_CONSTPTR_PARAM(param) const param* +#endif /* !defined(TX_CONSTPTR_PARAM) */ + +#if !defined(TX_CALLBACK_PARAM) +#define TX_CALLBACK_PARAM(param) param +#endif /* !defined(TX_CALLBACK_PARAM) */ + +/*********************************************************************************************************************/ + +#if !defined(TX_DEFINE_CALLABLE) +#define TX_DEFINE_CALLABLE(name, clrName, returnType, paramList) \ + typedef returnType (TX_CALLCONVENTION *name)paramList; +#endif /* !defined(TX_DEFINE_CALLABLE) */ + +#if !defined(TX_STRUCT_BEGIN) +#define TX_STRUCT_BEGIN(name, clrName) \ + typedef struct { +#endif /* !defined(TX_STRUCT_BEGIN) */ + +#if !defined(TX_STRUCT_END) +#define TX_STRUCT_END(name, clrName) \ + } name; +#endif /* !defined(TX_STRUCT_END) */ + + +/*********************************************************************************************************************/ + +/** + Macro that generates a type of the specified type. + */ +#if !defined(TX_DEFINE_TYPE) +#define TX_DEFINE_TYPE(type, name) typedef type name; +#endif /* !defined(TX_TRANSLATE_TYPE) */ + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_MACROS__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXNotification.h b/Tobii EyeX/include/eyex/EyeXNotification.h new file mode 100755 index 0000000..062ab63 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXNotification.h @@ -0,0 +1,82 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXNotification.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_NOTIFICATIONS_API__H__) +#define __TOBII_TX_NOTIFICATIONS_API__H__ + +/*********************************************************************************************************************/ + +/** + txGetNotificationType + + Gets the TX_NOTIFICATIONTYPE of a notification. + + @param hNotification [in]: + A TX_CONSTHANDLE to the notification. + Must not be TX_EMPTY_HANDLE. + + @param pNotificationType [out]: + A pointer to a TX_NOTIFICATIONTYPE which will be set to the type of the notification. + Must not be NULL. + + @return + TX_RESULT_OK: The type of the notification was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetNotificationType( + TX_CONSTHANDLE hNotification, + TX_NOTIFICATIONTYPE* pNotificationType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetNotificationTypeHook)( + TX_CONSTHANDLE hNotification, + TX_NOTIFICATIONTYPE* pNotificationType + ); + + +/*********************************************************************************************************************/ + +/** + txGetNotificationData + + Gets the data of a notification. + + @param hNotification [in]: + A TX_CONSTHANDLE to the notification. + Must not be TX_EMPTY_HANDLE. + + @param phObject [out]: + A pointer to a TX_HANDLE to which the handle of the object used as data will be copied. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The data of the notification was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The notification does not have any data. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetNotificationData( + TX_CONSTHANDLE hNotification, + TX_HANDLE* phObject + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetNotificationDataHook)( + TX_CONSTHANDLE hNotification, + TX_HANDLE* phObject + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_NOTIFICATIONS_API__H__) */ + +/*********************************************************************************************************************/ \ No newline at end of file diff --git a/Tobii EyeX/include/eyex/EyeXObject.h b/Tobii EyeX/include/eyex/EyeXObject.h new file mode 100755 index 0000000..acd7ecf --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXObject.h @@ -0,0 +1,194 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXObject.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_OBJECT_API__H__) +#define __TOBII_TX_OBJECT_API__H__ + +/*********************************************************************************************************************/ + +/** + txGetContext + + Gets the context to which a specified interaction object belongs. + Unlike interaction objects, this handle does not need to be released. + + @param hObject [in]: + A TX_CONSTHANDLE to the interaction object for which the context should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param phContext [out]: + A pointer to a TX_CONSTCONTEXTHANDLE which will be set to the context. + Must not be NULL. + + @return + TX_RESULT_OK: The context was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetContext( + TX_CONSTHANDLE hObject, + TX_CONTEXTHANDLE* phContext + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetContextHook)( + TX_CONSTHANDLE hObject, + TX_CONTEXTHANDLE* phContext + ); + + +/*********************************************************************************************************************/ + +/** + txGetObjectType + + Gets the TX_INTERACTIONOBJECTTYPE of an interaction object. + + @param hObject [in]: + A TX_CONSTHANDLE to the interaction object for which to get the TX_INTERACTIONOBJECTTYPE. + Must not be TX_EMPTY_HANDLE. + + @param phObjectType [out]: + A pointer to a TX_INTERACTIONOBJECTTYPE which will be set to the type of the object. + Must not be NULL. + + @return + TX_RESULT_OK: The TX_INTERACTIONOBJECTTYPE of the object was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetObjectType( + TX_CONSTHANDLE hObject, + TX_INTERACTIONOBJECTTYPE* phObjectType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetObjectTypeHook)( + TX_CONSTHANDLE hObject, + TX_INTERACTIONOBJECTTYPE* phObjectType + ); + + +/*********************************************************************************************************************/ + +/** + txGetObjectTypeName + + Gets the type name of an interaction object. + + @param hObject [in]: + A TX_CONSTHANDLE to the interaction object for which to get the type name. + Must not be TX_EMPTY_HANDLE. + + @param pObjectTypeName [out]: + A TX_STRING to which the type name will be copied. + The string will be null terminated. + May be NULL to only retreive the size. + + @param pObjectTypeNameSize [in,out]: + A pointer to a TX_SIZE which should contain the size of the pObjectTypeName string. + The size will be set to the current number of characters in the type name + 1. + Must not be NULL. + + @return + TX_RESULT_OK: The type name of the object or size of the string was successfully retreived. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of the pObjectTypeName was to small. (*pObjectTypeNameSize will be set to the required size.) + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetObjectTypeName( + TX_CONSTHANDLE hObject, + TX_STRING pObjectTypeName, + TX_SIZE* pObjectTypeNameSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetObjectTypeNameHook)( + TX_CONSTHANDLE hObject, + TX_STRING pObjectTypeName, + TX_SIZE* pObjectTypeNameSize + ); + + +/*********************************************************************************************************************/ + +/** + txReleaseObject + + Releases an interaction object. The object reference count will be decreased by one. + If the reference count hits 0 the object will be destroyed. + The handle will be set to TX_EMPTY_HANDLE. + + @param phObject [in,out]: + A pointer to a TX_HANDLE to the interaction object that should be released. + Must not be NULL. + The value of the pointer must not be TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The object was successfully released. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txReleaseObject( + TX_HANDLE* phObject + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *ReleaseObjectHook)( + TX_HANDLE* phObject + ); + + +/*********************************************************************************************************************/ + +/** + txFormatObjectAsText + + Formats an interaction object as text. (primarily for debugging purposes) + + @param hObject [in]: + A TX_HANDLE to an object. + Must not be TX_EMPTY_HANDLE. + + @param pText [out]: + A TX_STRING to which the formatted text will be copied. + Must be at least the size of the formatted text. + Can be NULL to only get the size of the formatted text. + + @param pTextSize [in,out]: + A pointer to a TX_SIZE which will be set the size of the formatted text. + Must not be NULL. + The value must be 0 if pText is NULL. + + @return + TX_RESULT_OK: The formatted text or required size of the string was successfully retreived. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of the pText was to small. (*pTextSize will be set to the required size.) +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txFormatObjectAsText( + TX_CONSTHANDLE hObject, + TX_STRING pText, + TX_SIZE* pTextSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *FormatObjectAsTextHook)( + TX_CONSTHANDLE hObject, + TX_STRING pText, + TX_SIZE* pTextSize + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_OBJECT_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXProperty.h b/Tobii EyeX/include/eyex/EyeXProperty.h new file mode 100755 index 0000000..2e87634 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXProperty.h @@ -0,0 +1,795 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXProperty.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_PROPERTY_API__H__) +#define __TOBII_TX_PROPERTY_API__H__ + +/*********************************************************************************************************************/ + +#ifdef TOBII_TX_DETAIL + +/*********************************************************************************************************************/ + +/** + txCreatePropertyBag + + Creates a property bag. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to create the property bag. + Must not be TX_EMPTY_HANDLE. + + @param phBag [out]: + A pointer to a TX_HANDLE which will be set to the newly created property bag. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param type [in]: + A TX_PROPERTYBAGTYPE which specifies what type of property bag to create. + + @return + TX_RESULT_OK: The property bag was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreatePropertyBag( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phBag, + TX_PROPERTYBAGTYPE type + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreatePropertyBagHook)( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phBag, + TX_PROPERTYBAGTYPE type + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyBagType + + Gets the TX_PROPERTYBAGTYPE of a property bag. + + @param hBounds [in]: + A TX_CONSTHANDLE to the property bag. + Must not be TX_EMPTY_HANDLE. + + @param pBoundsType [out]: + A pointer to a TX_PROPERTYBAGTYPE which will be set to the type of the property bag. + Must not be NULL. + + @return + TX_RESULT_OK: The type of the property bag was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyBagType( + TX_CONSTHANDLE hBag, + TX_PROPERTYBAGTYPE* pType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyBagTypeHook)( + TX_CONSTHANDLE hBag, + TX_PROPERTYBAGTYPE* pType + ); + + +/*********************************************************************************************************************/ + +/** + txCreateProperty + + Creates a property on an interaction object. + + @param hObject [in]: + A TX_HANDLE to the object on which to create the property. + Must not be TX_EMPTY_HANDLE. + + @param phProperty [out]: + A pointer to a TX_PROPERTYHANDLE which will be set to the newly created property. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param propertyName [in]: + The name of the property. + Can be NULL or empty only if the object is of type TX_INTERACTIONOBJECTTYPE_PROPERTYBAG with bag type + TX_PROPERTYBAGTYPE_ARRAY. + + @return + TX_RESULT_OK: The property was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDPROPERTYNAME: The name of the property was invalid. + TX_RESULT_DUPLICATEPROPERTY: There already exists a property with the specified name on this object. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateProperty( + TX_HANDLE hObject, + TX_PROPERTYHANDLE* phProperty, + TX_CONSTSTRING propertyName + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreatePropertyHook)( + TX_HANDLE hObject, + TX_PROPERTYHANDLE* phProperty, + TX_CONSTSTRING propertyName + ); + + +/*********************************************************************************************************************/ + +/** + txRemoveProperty + + Removes a property from an interaction object. + + @param hObject [in]: + A TX_HANDLE to the object from which to remove the property. + Must not be TX_EMPTY_HANDLE. + + @param propertyName [in]: + The name of the property to remove. + Must not be NULL or empty string. + + @return + TX_RESULT_OK: The property was successfully removed. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: A property with the specified name was not found. + TX_RESULT_PROPERTYNOTREMOVABLE: The specified property can not be removed. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRemoveProperty( + TX_HANDLE hObject, + TX_CONSTSTRING propertyName + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RemovePropertyHook)( + TX_HANDLE hObject, + TX_CONSTSTRING propertyName + ); + + +/*********************************************************************************************************************/ + +/** + txGetProperty + + Gets a property from an interaction object. + + @param hObject [in]: + A TX_CONSTHANDLE to the object from which to get the property. + Must not be TX_EMPTY_HANDLE. + + @param phProperty [out]: + A pointer to a TX_PROPERTYHANDLE which will be set to the property. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param propertyName [in]: + The name of the property to get. + Must not be NULL or empty string. + + @return + TX_RESULT_OK: The property was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDPROPERTYNAME: The name of the property was invalid. + TX_RESULT_NOTFOUND: A property with the specified name was not found. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetProperty( + TX_CONSTHANDLE hObject, + TX_PROPERTYHANDLE* phProperty, + TX_CONSTSTRING propertyName + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyHook)( + TX_CONSTHANDLE hObject, + TX_PROPERTYHANDLE* phProperty, + TX_CONSTSTRING propertyName + ); + + +/*********************************************************************************************************************/ + +/** + txGetProperties + + Gets TX_HANDLEs to all properties on an interaction object. + + @param hObject [in]: + A TX_CONSTHANDLE to the object from which to get the properties. + Must not be TX_EMPTY_HANDLE. + + @param phProperties [out]: + A pointer to an array of TX_PROPERTYHANDLEs to which the property handles will be copied. + Can be NULL to only get the size. + + @param pPropertiesSize [in,out]: + A pointer to a TX_SIZE which will be set to the number of properties. + Must not be NULL. + The value must be 0 if phProperties is NULL. + + @return + TX_RESULT_OK: The handles or the required buffer size was retrieved successfully. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of the array is invalid. (*pPropertiesSize will be set to the number of behaviors). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetProperties( + TX_CONSTHANDLE hObject, + TX_PROPERTYHANDLE* phProperties, + TX_SIZE* pPropertiesSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertiesHook)( + TX_CONSTHANDLE hObject, + TX_PROPERTYHANDLE* phProperties, + TX_SIZE* pPropertiesSize + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyName + + Gets the name of a property. + + @param hProperty [in]: + A TX_CONSTPROPERTYHANDLE to the property for which to get the name. + Must not be TX_EMPTY_HANDLE. + + @param pName [out]: + A TX_STRING to which the property name will be copied. + Must be at least the size of the property name. + Can be NULL to only get the size of the property name. + + @param pNameSize [in,out]: + A pointer to a TX_SIZE which will be set to the size of the property name. + Must not be NULL. + The value must be 0 if pName is NULL. + + @return + TX_RESULT_OK: The property name or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pName is invalid (pNameSize will be set to the required size). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyName( + TX_CONSTPROPERTYHANDLE hProperty, + TX_STRING pName, + TX_SIZE* pNameSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyNameHook)( + TX_CONSTPROPERTYHANDLE hProperty, + TX_STRING pName, + TX_SIZE* pNameSize + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyValueType + + Gets the TX_PROPERTYVALUETYPE of a property. + + @param hProperty [in]: + A TX_CONSTPROPERTYHANDLE to the property. + Must not be TX_EMPTY_HANDLE. + + @param pPropertyType [out]: + A pointer to a TX_PROPERTYVALUETYPE which will be set to the type of the value. + Must not be NULL. + + @return + TX_RESULT_OK: The type of the value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyValueType( + TX_CONSTPROPERTYHANDLE hProperty, + TX_PROPERTYVALUETYPE* pPropertyType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyValueTypeHook)( + TX_CONSTPROPERTYHANDLE hProperty, + TX_PROPERTYVALUETYPE* pPropertyType + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyFlags + + Gets the TX_PROPERTYFLAGS of a property. + + @param hProperty [in]: + A TX_CONSTPROPERTYHANDLE to the property. + Must not be NULL. + + @param pFlags [out]: + A pointer to a TX_PROPERTYFLAGS which will be set to the flags. + Must not be NULL. + + @return + TX_RESULT_OK: The flags were successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyFlags( + TX_CONSTPROPERTYHANDLE hProperty, + TX_PROPERTYFLAGS* pFlags + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyFlagsHook)( + TX_CONSTPROPERTYHANDLE hProperty, + TX_PROPERTYFLAGS* pFlags + ); + + +/*********************************************************************************************************************/ + +/** + txClearPropertyValue + + Clears the value of a property. + The value type will be set to TX_PROPERTYVALUETYPE_EMPTY. + + @param hProperty [in]: + A TX_PROPERTYHANDLE to the property to clear. + Must not be TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The property was successfully cleared. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txClearPropertyValue( + TX_PROPERTYHANDLE hProperty + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *ClearPropertyValueHook)( + TX_PROPERTYHANDLE hProperty + ); + + +/*********************************************************************************************************************/ + +/** + txSetPropertyValueAsInteger + + Sets the value of a property to a TX_INTEGER. + If the property already has a value that will be overwritten, regardless of type. + The value type will be set to TX_PROPERTYVALUETYPE_INTEGER. + + @param hProperty [in]: + A TX_PROPERTYHANDLE to the property for which the value should be set. + Must not be TX_EMPTY_HANDLE. + + @param intValue [in]: + A TX_INTEGER which is the value to set. + + @return + TX_RESULT_OK: The property value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetPropertyValueAsInteger( + TX_PROPERTYHANDLE hProperty, + TX_INTEGER intValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetPropertyValueAsIntegerHook)( + TX_PROPERTYHANDLE hProperty, + TX_INTEGER intValue + ); + + +/*********************************************************************************************************************/ + +/** + txSetPropertyValueAsReal + + Sets the value of a property to a TX_REAL. + If the property already has a value that will be overwritten, regardless of type. + The value type will be set to TX_PROPERTYVALUETYPE_REAL. + + @param hProperty [in]: + A TX_PROPERTYHANDLE to the property for which the value should be set. + Must not be TX_EMPTY_HANDLE. + + @param realValue [in]: + A TX_REAL which is the value to set. + + @return + TX_RESULT_OK: The property value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetPropertyValueAsReal( + TX_PROPERTYHANDLE hProperty, + TX_REAL realValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetPropertyValueAsRealHook)( + TX_PROPERTYHANDLE hProperty, + TX_REAL realValue + ); + + +/*********************************************************************************************************************/ + +/** + txSetPropertyValueAsString + + Sets the value of a property to a string. + If the property already has a value that will be overwritten, regardless of type. + The value type will be set to TX_PROPERTYVALUETYPE_STRING. + + @param hProperty [in]: + A TX_PROPERTYHANDLE to the property for which the value should be set. + Must not be TX_EMPTY_HANDLE. + + @param stringValue [in]: + A TX_CONSTSTRING which is the value to set. + Must not be NULL. + + @return + TX_RESULT_OK: The property value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetPropertyValueAsString( + TX_PROPERTYHANDLE hProperty, + TX_CONSTSTRING stringValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetPropertyValueAsStringHook)( + TX_PROPERTYHANDLE hProperty, + TX_CONSTSTRING stringValue + ); + + +/*********************************************************************************************************************/ + +/** + txSetPropertyValueAsObject + + Sets the value of a property to an interaction object. + If the property already has a value that will be overwritten, regardless of type. + The value type will be set to TX_PROPERTYVALUETYPE_OBJECT. + + @param hProperty [in]: + A TX_PROPERTYHANDLE to the property for which the value should be set. + Must not be TX_EMPTY_HANDLE. + + @param hObject [in]: + A TX_HANDLE to the obejct which is the value to set. + Must not be NULL. + + @return + TX_RESULT_OK: The property value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetPropertyValueAsObject( + TX_PROPERTYHANDLE hProperty, + TX_HANDLE hObject + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetPropertyValueAsObjectHook)( + TX_PROPERTYHANDLE hProperty, + TX_HANDLE hObject + ); + + +/*********************************************************************************************************************/ + +/** + txSetPropertyValueAsBlob + + Sets the value of a property to a blob. + If the property already has a value that will be overwritten, regardless of type. + The value type will be set to TX_PROPERTYVALUETYPE_BLOB. + + @param hProperty [in]: + A TX_PROPERTYHANDLE to the property for which the value should be set. + Must not be TX_EMPTY_HANDLE. + + @param pBuffer [in]: + A pointer to an array of bytes. + Must not be NULL. + + @param blobSize [in]: + A TX_SIZE which specifies the size of the blob (i.e. the number of bytes). + + @return + TX_RESULT_OK: The property value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetPropertyValueAsBlob( + TX_PROPERTYHANDLE hProperty, + const TX_BYTE* pBuffer, + TX_SIZE blobSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetPropertyValueAsBlobHook)( + TX_PROPERTYHANDLE hProperty, + const TX_BYTE* pBuffer, + TX_SIZE blobSize + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyValueAsInteger + + Gets the value of a property as a TX_INTEGER. + If the property does not have a value of this type this call will fail. + + @param hProperty [in]: + A TX_CONSTPROPERTYHANDLE to the property for which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pIntValue [out]: + A pointer to a TX_INTEGER which will be set to the value of the property. + + @return + TX_RESULT_OK: The property value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDPROPERTYTYPE: The value type was not TX_PROPERTYVALUETYPE_INTEGER. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyValueAsInteger( + TX_CONSTPROPERTYHANDLE hProperty, + TX_INTEGER* pIntValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyValueAsIntegerHook)( + TX_CONSTPROPERTYHANDLE hProperty, + TX_INTEGER* pIntValue + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyValueAsReal + + Gets the value of a property as a TX_REAL. + If the property does not have a value or have a value of another type this call will fail. + + @param hProperty [in]: + A TX_CONSTPROPERTYHANDLE to the property for which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pRealValue [out]: + A pointer to a TX_REAL which will be set to the value of the property. + + @return + TX_RESULT_OK: The property value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDPROPERTYTYPE: The value type was not TX_PROPERTYVALUETYPE_REAL. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyValueAsReal( + TX_CONSTPROPERTYHANDLE hProperty, + TX_REAL* pRealValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyValueAsRealHook)( + TX_CONSTPROPERTYHANDLE hProperty, + TX_REAL* pRealValue + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyValueAsString + + Gets the value of a property as a string. + If the property does not have a value or have a value of another type this call will fail. + + @param hProperty [in]: + A TX_CONSTPROPERTYHANDLE to the property for which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pStringValue [out]: + A TX_STRING to which the property value will be copied. + Must be at least the size of the value. + Can be NULL to only get the size of the value. + + @param pStringSize [in,out]: + A pointer to a TX_SIZE which will be set to the size of the property value. + Must not be NULL. + The value must be 0 if pStringValue is NULL. + + @return + TX_RESULT_OK: The property value or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pStringValue is invalid (*pStringSize will be set to the required size). + TX_RESULT_INVALIDPROPERTYTYPE: The value type was not TX_PROPERTYVALUETYPE_STRING. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyValueAsString( + TX_CONSTPROPERTYHANDLE hProperty, + TX_STRING pStringValue, + TX_SIZE* pStringSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyValueAsStringHook)( + TX_CONSTPROPERTYHANDLE hProperty, + TX_STRING pStringValue, + TX_SIZE* pStringSize + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyValueAsObject + + Gets the value of a property as an interaction object. + If the property does not have a value or have a value of another type this call will fail. + + @param hProperty [in]: + A TX_CONSTPROPERTYHANDLE to the property for which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param phObject [out]: + A pointer to a TX_HANDLE which will be set to the value of the property. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The property value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDPROPERTYTYPE: The value type was not TX_PROPERTYVALUETYPE_OBJECT. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyValueAsObject( + TX_CONSTPROPERTYHANDLE hProperty, + TX_HANDLE* phObject + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyValueAsObjectHook)( + TX_CONSTPROPERTYHANDLE hProperty, + TX_HANDLE* phObject + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyValueAsBlob + + Gets the value of a property as a blob. + If the property does not have a value or have a value of another type this call will fail. + + @param hProperty [in]: + A TX_CONSTPROPERTYHANDLE to the property for which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pBuffer [out]: + A pointer to a byte array to which the property value will be copied. + Must be at least the size of the value (i.e. number of bytes in the blob). + Can be NULL to only get the size of the blob. + + @param pBlobSize [in,out]: + A pointer to a TX_SIZE which will be set to the size of the blob. + Must not be NULL. + The value must be 0 if pBuffer is NULL. + + @return + TX_RESULT_OK: The property value or the required size of the buffer was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pBuffer is invalid (*pBlobSize will be set to the required size). + TX_RESULT_INVALIDPROPERTYTYPE: The value type was not TX_PROPERTYVALUETYPE_BLOB. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyValueAsBlob( + TX_CONSTPROPERTYHANDLE hProperty, + TX_BYTE* pBuffer, + TX_SIZE* pBlobSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyValueAsBlobHook)( + TX_CONSTPROPERTYHANDLE hProperty, + TX_BYTE* pBuffer, + TX_SIZE* pBlobSize + ); + + +/*********************************************************************************************************************/ + +/** + txCopyProperties + + Makes a shallow copy of the properties in the source object to the target object. + + @param hSourceObject [in]: + A TX_CONSTHANDLE to the source object. + Must not be TX_EMPTY_HANDLE. + + @param hTargetObject [in]: + A TX_HANDLE to the target object. + Must not be TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The properties were successfully copied. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCopyProperties( + TX_CONSTHANDLE hSourceObject, + TX_HANDLE hTargetObject + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CopyPropertiesHook)( + TX_CONSTHANDLE hSourceObject, + TX_HANDLE hTargetObject + ); + + +/*********************************************************************************************************************/ + +#endif /* define TOBII_TX_DETAIL */ + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_PROPERTY_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXQuery.h b/Tobii EyeX/include/eyex/EyeXQuery.h new file mode 100755 index 0000000..8cc5fa9 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXQuery.h @@ -0,0 +1,136 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXQuery.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_QUERY_API__H__) +#define __TOBII_TX_QUERY_API__H__ + +/*********************************************************************************************************************/ + +/** + txGetQueryBounds + + Gets the bounds of a query. + + @param hQuery [in]: + A TX_CONSTHANDLE to the query from which the bounds should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param phBounds [out]: + A pointer to a TX_HANDLE which will be set to the bounds of the interactor. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The bounds was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: This query does not have any bounds. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetQueryBounds( + TX_CONSTHANDLE hQuery, + TX_HANDLE* phBounds + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetQueryBoundsHook)( + TX_CONSTHANDLE hQuery, + TX_HANDLE* phBounds + ); + + +/*********************************************************************************************************************/ + +/** + txGetQueryWindowIdCount + + Gets the number of window ids held by a query. + The client is expected to add interactors to a snapshot for the windows specified in the query, and + also report these window id's in the snapshot, regardless of if any interactors are found for that window. + + @param hQuery [in]: + A TX_CONSTHANDLE to the query for which the number of window ids should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pWindowIdsCount [out]: + A pointer to a TX_SIZE which will be set the number of window ids. + Must not be NULL. + + @return + TX_RESULT_OK: The number of window ids was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetQueryWindowIdCount( + TX_CONSTHANDLE hQuery, + TX_SIZE* pWindowIdsCount + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetQueryWindowIdCountHook)( + TX_CONSTHANDLE hQuery, + TX_SIZE* pWindowIdsCount + ); + + +/*********************************************************************************************************************/ + +/** + txGetQueryWindowId + + Gets one of the window ids held by a query. Which one is specified by an index. + The client is expected to add interactors to a snapshot for the windows specified in the query, and + also report these window id's in the snapshot, regardless of if any interactors are found for that window. + + @param hQuery [in]: + A TX_CONSTHANDLE to the query for which the window id should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param windowIdIndex [in]: + The index of the window id to get. + Must be a positive integer. + + @param pWindowId [out]: + A TX_STRING to which the window id will be copied. + Must be at least the size of the window id. + Can be NULL to only get the size of the window id. + + @param pWindowIdSize [in,out]: + A pointer to a TX_SIZE which tells the size of pWindowId. + Will be set the size of the window id. + Must not be NULL. + The value must be 0 if pWindowId is NULL. + + @return + TX_RESULT_OK: The window id or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of windowId is invalid (pWindowIdSize will be set to the required size). + TX_RESULT_NOTFOUND: The specified index was out of range. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetQueryWindowId( + TX_CONSTHANDLE hQuery, + TX_INTEGER windowIdIndex, + TX_STRING pWindowId, + TX_SIZE* pWindowIdSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetQueryWindowIdHook)( + TX_CONSTHANDLE hQuery, + TX_INTEGER windowIdIndex, + TX_STRING pWindowId, + TX_SIZE* pWindowIdSize + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_QUERY_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXSharedLiterals.h b/Tobii EyeX/include/eyex/EyeXSharedLiterals.h new file mode 100755 index 0000000..aa96475 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXSharedLiterals.h @@ -0,0 +1,67 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXSharedLiterals.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_SHAREDLITERALS__H__) +#define __TOBII_TX_SHAREDLITERALS__H__ + +/********************************************************************************************************************* + * Literals + *********************************************************************************************************************/ + + + /** + * State literals + */ + static const char* TX_SHAREDLITERAL_STATEPATH = "StatePath"; + + /** + * Snapshot Literals + */ + static const char* TX_SHAREDLITERAL_WINDOWIDS = "WindowIds"; + static const char* TX_SHAREDLITERAL_INTERACTORS = "Interactors"; + static const char* TX_SHAREDLITERAL_METADATA = "Metadata"; + static const char* TX_SHAREDLITERAL_SERIALNUMBER = "SerialNumber"; + + static const char* TX_SHAREDLITERAL_MESSAGETYPE = "MessageType"; + static const char* TX_SHAREDLITERAL_WINDOWID = "WindowId"; + static const char* TX_SHAREDLITERAL_COMMANDTYPE = "CommandType"; + static const char* TX_SHAREDLITERAL_ISVISIBLE = "IsVisible"; + + /** + * Callback Response Literals + */ + static const char* TX_SHAREDLITERAL_NOTIFICATIONTYPE = "NotificationType"; + + /** + * Interactor Literals + */ + static const char* TX_SHAREDLITERAL_BEHAVIORTYPE = "BehaviorType"; + static const char* TX_SHAREDLITERAL_BEHAVIORS = "Behaviors"; + static const char* TX_SHAREDLITERAL_PARENTID = "ParentId"; + static const char* TX_SHAREDLITERAL_INTERACTORID = "InteractorId"; + static const char* TX_SHAREDLITERAL_ISENABLED = "IsEnabled"; + static const char* TX_SHAREDLITERAL_ISDELETED = "IsDeleted"; + + + + + + + static const char* TX_CONNECTIONTOKEN_GETVERSION = "GET_VERSION"; + static const char* TX_CONNECTIONTOKEN_GETMINORVERSION = "GET_MINORVERSION"; + static const char* TX_CONNECTIONTOKEN_CONNECT = "CONNECT"; + static const char* TX_CONNECTIONTOKEN_CLIENTVERSION = "CLIENT_VERSION"; + static const char* TX_CONNECTIONTOKEN_CLIENTMODE = "CLIENT_MODE"; + static const char* TX_CONNECTIONTOKEN_CLIENTID = "CLIENT_ID"; + static const char* TX_CONNECTIONTOKEN_LITERALLIST = "LITERAL_LIST"; + + + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_SHAREDLITERALS__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXSnapshot.h b/Tobii EyeX/include/eyex/EyeXSnapshot.h new file mode 100755 index 0000000..d53fa0c --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXSnapshot.h @@ -0,0 +1,670 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXSnapshot.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_SNAPSHOT_API__H__) +#define __TOBII_TX_SNAPSHOT_API__H__ + +/*********************************************************************************************************************/ + +/** + txCreateSnapshot + + Creates a snapshot. + A snapshot is used to provide the current state of interactors for a specfic region of the screen to the client. + This function can also be used to create a snapshot containing global interactors, but it is recommended to + use txCreateGlobalInteractorSnapshot for this. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to create the snapshot. + Must not be TX_EMPTY_HANDLE. + + @param phSnapshot [out]: + A pointer to a TX_HANDLE which will be set to the newly created snapshot. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The snapshot was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateSnapshot( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phSnapshot + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateSnapshotHook)( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phSnapshot + ); + + +/*********************************************************************************************************************/ + +/** + txCreateSnapshotWithQueryBounds + + Creates a snapshot with the same bounds as the supplied query. + This is a specialization of txCreateSnapshot. Normally, when a snapshot is comitted as a response to a query, + it is sufficient to create a snapshot with the same bounds as the query instead of calculating the bounds + based on the interactors. + + @param hQuery [in]: + A TX_CONSTHANDLE to the query this snapshot relates to. + Must not be TX_EMPTY_HANDLE. + + @param phSnapshot [out]: + A pointer to a TX_HANDLE which will be set to the newly created snapshot. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The snapshot was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateSnapshotWithQueryBounds( + TX_CONSTHANDLE hQuery, + TX_HANDLE* phSnapshot + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateSnapshotWithQueryBoundsHook)( + TX_CONSTHANDLE hQuery, + TX_HANDLE* phSnapshot + ); + + +/*********************************************************************************************************************/ + +/** + txCreateSnapshotForQuery + + Creates a snapshot with the same bounds and window ids as the supplied query. + This is a specialization of txCreateSnapshot that makes it easier to quickly create a typical snapshot for a query. + + @param hQuery [in]: + A TX_CONSTHANDLE to the query this snapshot relates to. + Must not be TX_EMPTY_HANDLE. + + @param phSnapshot [out]: + A pointer to a TX_HANDLE which will be set to the newly created snapshot. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The snapshot was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateSnapshotForQuery( + TX_CONSTHANDLE hQuery, + TX_HANDLE* phSnapshot + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateSnapshotForQueryHook)( + TX_CONSTHANDLE hQuery, + TX_HANDLE* phSnapshot + ); + + +/*********************************************************************************************************************/ + +/** + txCommitSnapshotAsync + + Commits a snapshot asynchronously. + The snapshot will be sent to the client. + + @param hSnapshot [in]: + A TX_HANDLE to the snapshot that should be committed. + Must not be TX_EMPTY_HANDLE. + + @param completionHandler [in]: + A TX_ASYNCDATACALLBACK to the function that will handle the snapshot result. + + The async data object provided by the TX_ASYNCDATACALLBACK will contain a result code which can be retrieved using + txGetAsyncDataResult(). The result code will be one of the follwing: + + TX_RESULT_OK: + The snapshot was succesfully commited to the client. + + TX_RESULT_INVALIDSNAPSHOT: + The snapshot was rejected by the client. + + TX_RESULT_CANCELLED: + The asynchronous operation was cancelled. + + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The snapshot was successfully commited. The actual result of the snapshot will be provided to the callback. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCommitSnapshotAsync( + TX_HANDLE hSnapshot, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CommitSnapshotAsyncHook)( + TX_HANDLE hSnapshot, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); + + + +/*********************************************************************************************************************/ + +/** + txGetSnapshotBounds + + Gets the bounds of a snapshot. + If the snapshot does not have any bounds this call will fail. + + @param hSnapshot [in]: + A TX_CONSTHANDLE to the snapshot for which the bounds should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param phBounds [out]: + A pointer to a TX_HANDLE which will be set to the bounds of the snapshot. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The bounds was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The snapshot does not have any bounds. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetSnapshotBounds( + TX_CONSTHANDLE hSnapshot, + TX_HANDLE* phBounds + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetSnapshotBoundsHook)( + TX_CONSTHANDLE hSnapshot, + TX_HANDLE* phBounds + ); + + +/*********************************************************************************************************************/ + +/** + txGetSnapshotWindowIdCount + + Gets the number of window ids held by a snapshot. + + @param hSnapshot [in]: + A TX_CONSTHANDLE to the snapshot for which the number of window ids should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param pWindowIdsCount [out]: + A pointer to a TX_SIZE which will be set to the number of window ids. + Must not be NULL. + + @return + TX_RESULT_OK: The number of window ids was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetSnapshotWindowIdCount( + TX_CONSTHANDLE hSnapshot, + TX_SIZE* pWindowIdsCount + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetSnapshotWindowIdCountHook)( + TX_CONSTHANDLE hSnapshot, + TX_SIZE* pWindowIdsCount + ); + + +/*********************************************************************************************************************/ + +/** + txGetSnapshotWindowId + + Gets one of the window ids held by a snapshot. Which one is specified by an index. + + @param hSnapshot [in]: + A TX_CONSTHANDLE to the snapshot for which the window id should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param windowIdIndex [in]: + The index of the window id to get. + Must be a positive integer. + + @param pWindowId [out]: + A TX_STRING to which the window id will be copied. + Must be at least the size of the window id. + Can be NULL to only get the size of the window id. + + @param pWindowIdSize [in,out]: + A pointer to a TX_SIZE which tells the size of pWindowId. + Will be set to the size of the window id. + Must not be NULL. + The value must be 0 if pWindowId is NULL. + + @return + TX_RESULT_OK: The window id or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of windowId is invalid (pWindowIdSize will be set to the required size). + TX_RESULT_NOTFOUND: The specified index was out of range. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetSnapshotWindowId( + TX_CONSTHANDLE hSnapshot, + TX_INTEGER windowIdIndex, + TX_STRING pWindowId, + TX_SIZE* pWindowIdSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetSnapshotWindowIdHook)( + TX_CONSTHANDLE hSnapshot, + TX_INTEGER windowIdIndex, + TX_STRING pWindowId, + TX_SIZE* pWindowIdSize + ); + + +/*********************************************************************************************************************/ + +/** + txAddSnapshotWindowId + + Adds a window id to a snapshot. + If a specific window id has already been added this call will be ignored. + + @param hSnapshot [in]: + A TX_HANDLE to the snapshot to which the window id should be added. + Must not be TX_EMPTY_HANDLE. + + @param windowId [in]: + The window id as a string (window id corresponds to the windows handle on Windows). + Must not be NULL or empty string. + + @return + TX_RESULT_OK: The window id was successfully added. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txAddSnapshotWindowId( + TX_HANDLE hSnapshot, + TX_CONSTSTRING windowId + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *AddSnapshotWindowIdHook)( + TX_HANDLE hSnapshot, + TX_CONSTSTRING windowId + ); + + +/*********************************************************************************************************************/ + +/** + txCreateInteractor + + Creates an interactor in a snapshot. + If an interactor with the same id has already been created this call will fail. + The interactor will be owned by the snapshot and does not need to be removed explicitly. + + @param hSnapshot [in]: + A TX_HANDLE to the snapshot in which the interactor should be created. + Must not be TX_EMPTY_HANDLE. + + @param phInteractor [out]: + A pointer to a TX_HANDLE which will be set to the newly created interactor. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param interactorId [in]: + The interactor id as a TX_CONSTSTRING. + Whenever some interaction happens to an interactor this specifies on which interactor the interaction occurred. + Must not be NULL or empty string. + + @param parentId [in]: + The parent interactor id as a TX_CONSTSTRING. + If this interactor does not have an explicit parent the id should be set to TX_LITERAL_ROOTID. + Commiting a snapshot which contains orphan interactors will fail. + Must not be NULL or empty string. + + @param windowId [in]: + The window id as a TX_CONSTSTRING. + Sets the top level window id of an interactor (window id corresponds to the windows handle on Windows). + Each interactor needs to specify the top level window id in which it was found. + Should be set to TX_LITERAL_GLOBALINTERACTORWINDOWID if this is a global interactor. + Must not be NULL or empty string. + + @return + TX_RESULT_OK: The interactor was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEINTERACTOR: An interactor with the same id already exists in this snapshot. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateInteractor( + TX_HANDLE hSnapshot, + TX_HANDLE* phInteractor, + TX_CONSTSTRING interactorId, + TX_CONSTSTRING parentId, + TX_CONSTSTRING windowId + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateInteractorHook)( + TX_HANDLE hSnapshot, + TX_HANDLE* phInteractor, + TX_CONSTSTRING interactorId, + TX_CONSTSTRING parentId, + TX_CONSTSTRING windowId + ); + + +/*********************************************************************************************************************/ + +/** + txCreateRectangularInteractor + + Creates a rectangular interactor in a snapshot, with all required parameters. + If an interactor with the same id has already been created this call will fail. + The interactor will be owned by the snapshot and does not need to be removed explicitly. + + @param hSnapshot [in]: + A TX_HANDLE to the snapshot in which the interactor should be created. + Must not be TX_EMPTY_HANDLE. + + @param phInteractor [out]: + A pointer to a TX_HANDLE which will be set to the newly created interactor. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param interactorId [in]: + The interactor id as a TX_CONSTSTRING. + Whenever some interaction happens to an interactor this specifies on which interactor the interaction occurred. + Must not be NULL or empty string. + + @param pBounds [in, out]: + The rectangular dimensions of the interactor. + Must not be NULL or empty string. + + @param parentId [in]: + The parent interactor id as a TX_CONSTSTRING. + If this interactor does not have an explicit parent the id should be set to TX_LITERAL_ROOTID. + Commiting a snapshot which contains orphan interactors will fail. + Must not be NULL or empty string. + + @param windowId [in]: + The window id as a TX_CONSTSTRING. + Sets the top level window id of an interactor (window id corresponds to the windows handle on Windows). + Each interactor needs to specify the top level window id in which it was found. + Should be set to TX_LITERAL_GLOBALINTERACTORWINDOWID if this is a global interactor. + Must not be NULL or empty string. + + @return + TX_RESULT_OK: The interactor was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEINTERACTOR: An interactor with the same id already exists in this snapshot. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateRectangularInteractor( + TX_HANDLE hSnapshot, + TX_HANDLE* phInteractor, + TX_CONSTSTRING interactorId, + TX_RECT* pBounds, + TX_CONSTSTRING parentId, + TX_CONSTSTRING windowId + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateRectangularInteractorHook)( + TX_HANDLE hSnapshot, + TX_HANDLE* phInteractor, + TX_CONSTSTRING interactorId, + TX_RECT* pBounds, + TX_CONSTSTRING parentId, + TX_CONSTSTRING windowId + ); + + +/*********************************************************************************************************************/ + +/** + txRemoveInteractor. For internal use only. + + Removes an interactor from a snapshot. + If an interactor with the specified id does not exist this call will fail. + The interactor is owned by the snapshot and does not need to be removed explicitly. + + @param hSnapshot [in]: + A TX_HANDLE to the snapshot from which the interactor should be removed. + Must not be TX_EMPTY_HANDLE. + + @param interactorId [in]: + The id of the interactor to remove. + Must not be NULL or empty string. + + @return + TX_RESULT_OK: The interactor was successfully removed. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: An interactor with the specified id does not exists in the snapshot. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRemoveInteractor( + TX_HANDLE hSnapshot, + TX_CONSTSTRING interactorId + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RemoveInteractorHook)( + TX_HANDLE hSnapshot, + TX_CONSTSTRING interactorId + ); + + +/*********************************************************************************************************************/ + +/** + txGetInteractors + + Gets TX_HANDLEs to all interactors in a snapshot. + + @param hSnapshot [in]: + A TX_CONSTHANDLE to the snapshot from which to get the interactors. + Must not be TX_EMPTY_HANDLE. + + @param phInteractors [out]: + A pointer to an array of TX_HANDLEs to which the interactor handles will be copied. + These handles must be released using txReleaseObject to avoid leaks. + Can be NULL but to only get the size. + + @param pInteractorsSize [in,out]: + A pointer to a TX_SIZE which will be set to the number of interactors. + Must not be NULL. + The value must be 0 if phInteractors is NULL. + + @return + TX_RESULT_OK: The handles or the required size of the buffer were retrieved successfully. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of the array is invalid. (*pInteractorsSize will be set to the number of interactors). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetInteractors( + TX_CONSTHANDLE hSnapshot, + TX_HANDLE* phInteractors, + TX_SIZE* pInteractorsSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetInteractorsHook)( + TX_CONSTHANDLE hSnapshot, + TX_HANDLE* phInteractors, + TX_SIZE* pInteractorsSize + ); + + +/*********************************************************************************************************************/ + +/** + txCreateSnapshotBounds + + Creates bounds on a snapshot. + The bounds of a snapshot should specify a rectangle that defines the region of the screen for which interactors + are provided. Typically these are the same bounds as on the query. + The bounds may cover a larger area, thus telling the client where there is empty space. + If the bounds does not at least intersect the interactors provided in the snapshot txCommitSnapshotAsync will fail. + If the snapshot already have bounds this call will fail. + + @param hSnapshot [in]: + A TX_HANDLE to the snapshot on which the bounds should be created. + Must not be TX_EMPTY_HANDLE. + + @param phBounds [out]: + A pointer to a TX_HANDLE which will be set to the newly created bounds. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param boundsType [in]: + A TX_BOUNDSTYPE which specifies the type of bounds to create. + + @return + TX_RESULT_OK: The bounds was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_DUPLICATEBOUNDS: The snapshot already has bounds. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateSnapshotBounds( + TX_HANDLE hSnapshot, + TX_HANDLE* phBounds, + TX_BOUNDSTYPE boundsType + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateSnapshotBoundsHook)( + TX_HANDLE hSnapshot, + TX_HANDLE* phBounds, + TX_BOUNDSTYPE boundsType + ); + + +/*********************************************************************************************************************/ + +/** + txDeleteSnapshotBounds + + Deletes the bounds on a snapshot. + If the snapshot does not have any bounds this call will fail. + + @param hSnapshot [in]: + A TX_HANDLE to the snapshot on which the bounds should be deleted. + Must not be TX_EMPTY_HANDLE. + + @return + TX_RESULT_OK: The bounds was successfully deleted. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The snapshot does not have any bounds. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txDeleteSnapshotBounds( + TX_HANDLE hSnapshot + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *DeleteSnapshotBoundsHook)( + TX_HANDLE hSnapshot + ); + + +/*********************************************************************************************************************/ + +/** + txCreateGlobalInteractorSnapshot + + Creates a global Interactor Snapshot. + + Creates a snapshot with: + Bounds with boundsType TX_BOUNDSTYPE_NONE, + windowId as TX_LITERAL_GLOBALINTERACTORWINDOWID, + One interactor with: + Bounds with boundsType TX_BOUNDSTYPE_NONE, + ParentId as TX_LITERAL_ROOTID + WindowId as TX_LITERAL_GLOBALINTERACTORWINDOWID, + InteractorId as @interactorId. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to create the snapshot. + Must not be TX_EMPTY_HANDLE. + + @param interactorId [in]: + The Id of the interactor that will be added to the snapshot. + Must not be the empty string. + + @param type [in]: + The type of the behavior on the interactor. + + @param hSnapshot [out]: + A pointer to a handle of the created snapshot. + + @param hInteractor [out]: + A pointer to a handle of the created interactor object. + + @return + TX_RESULT_OK: The interactor was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateGlobalInteractorSnapshot( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING interactorId, + TX_HANDLE* hSnapshot, + TX_HANDLE* hInteractor + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateGlobalInteractorSnapshotHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING interactorId, + TX_HANDLE* hSnapshot, + TX_HANDLE* hInteractor + ); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_SNAPSHOT_API__H__) */ + +/*********************************************************************************************************************/ diff --git a/Tobii EyeX/include/eyex/EyeXStates.h b/Tobii EyeX/include/eyex/EyeXStates.h new file mode 100755 index 0000000..9bc2038 --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXStates.h @@ -0,0 +1,933 @@ +/********************************************************************************************************************* + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + * EyeXStates.h + *********************************************************************************************************************/ + +#if !defined(__TOBII_TX_STATES_API__H__) +#define __TOBII_TX_STATES_API__H__ + +/*********************************************************************************************************************/ + +/** + txGetStateAsync + + Gets a state from the client. The state will be delivered as a TX_HANDLE to a state bag. The handle will be + TX_EMPTY_HANDLE if the requested state was not found. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context from which to get the state. + Must not be TX_EMPTY_HANDLE. + + @param statePath [in]: + A string that specifies the path of the state to get. + Must not start with, end with or have two consecutive dots (.). + Must not be NULL or empty string. + + @param completionHandler [in]: + The TX_ASYNCDATACALLBACK that will be invoked when the result have arrived from the client. + Must not be NULL. + + The data provided by the TX_ASYNCDATACALLBACK will contain a result code which can be retrieved using + txGetAsyncDataResult(). The result code will be one of the follwing: + + TX_RESULT_OK: + The state was succesfully retrieved. + + TX_RESULT_NOTFOUND: + The state was not found. + + TX_RESULT_CANCELLED: + The asynchronous operation was cancelled. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The state request was successfully sent to the client. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetStateAsync( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING statePath, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetStateAsyncHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING statePath, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ + +/** + txGetState + + Gets a state from the client synchronously. + This method will block until the state has been retrieved or until the operation has failed. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context from which to get the state. + Must not be TX_EMPTY_HANDLE. + + @param statePath [in]: + A string that specifies the path of the state to get. + Must not start with, end with or have two consecutive dots (.). + Must not be NULL or empty string. + + @param phStateBag [out]: + A pointer TX_HANDLE which will be set to the state bag. + Will be set to TX_EMPTY_HANDLE if not found. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The state was succcessfully retrieved. + TX_RESULT_NOTFOUND: The state was not found. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_CANCELLED: The operation was cancelled. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetState( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING statePath, + TX_HANDLE* phStateBag + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetStateHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING statePath, + TX_HANDLE* phStateBag + ); + + +/*********************************************************************************************************************/ + +/** + txSetStateAsync + + Sets a state on the client. For internal use only. + + @param hStateBag [in]: + A handle to the state bag which contains the path and data to set. + + @param completionHandler [in]: + The TX_ASYNCDATACALLBACK that will be invoked when the result have arrived from the client. + Can be NULL to ignore the result. + + The data provided by the TX_ASYNCDATACALLBACK will contain a result code which can be retrieved using + txGetAsyncDataResult(). The result code will be one of the follwing: + + TX_RESULT_OK: + The state was succesfully set. + + TX_RESULT_CANCELLED: + The asynchronous operation was cancelled. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the completion callback. + Can be NULL. + + @return + TX_RESULT_OK: The set state request was successfully sent to the client. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetStateAsync( + TX_HANDLE hStateBag, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetStateAsyncHook)( + TX_HANDLE hStateBag, + TX_ASYNCDATACALLBACK completionHandler, + TX_USERPARAM userParam + ); + + +/*********************************************************************************************************************/ + +/** + txCreateStateBag + + Creates a state bag. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to create the state bag. + Must not be TX_EMPTY_HANDLE. + + @param phStateBag [out]: + A pointer to a TX_HANDLE which will be set to the newly created state bag. + This handle must be released using txReleaseObject to avoid leaks. + Must not be NULL. + The value of the pointer must be set to TX_EMPTY_HANDLE. + + @param statePath [in]: + A string that specifies which path this state bag represents. + Must not start with, end with or have two consecutive dots (.). + Must not be NULL or empty string. + + @return + TX_RESULT_OK: The state bag was successfully created. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txCreateStateBag( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phStateBag, + TX_CONSTSTRING statePath + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *CreateStateBagHook)( + TX_CONTEXTHANDLE hContext, + TX_HANDLE* phStateBag, + TX_CONSTSTRING statePath + ); + + +/*********************************************************************************************************************/ + +/** + txGetStateBagPath + + Gets the path that a state bag represents. + + @param hStateBag [in]: + A TX_CONSTHANDLE to the state bag. + Must not be TX_EMPTY_HANDLE. + + @param pStatePath [out]: + A TX_STRING to which the state path will be copied. + Must be at least the size of the value. + Can be NULL to only get the size of the path. + + @param pStatePathSize [in,out]: + A pointer to a TX_SIZE which will be set to the size of the state path. + Must not be NULL. + The value must be 0 if pStatePath is NULL. + + @return + TX_RESULT_OK: The path of the state bag or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pStatePath is invalid (*pStatePathSize will be set to the required size). + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetStateBagPath( + TX_CONSTHANDLE hStateBag, + TX_STRING pStatePath, + TX_SIZE* pStatePathSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetStateBagPathHook)( + TX_CONSTHANDLE hStateBag, + TX_STRING pStatePath, + TX_SIZE* pStatePathSize + ); + + +/*********************************************************************************************************************/ + +/** + txRegisterStateObserver + + Registers observation of a specified state path. + If connection to the client is currently not present this registration will be stored and applied once connection + has been established. The registration will also be reapplied if the connection is dropped and reestablished. + Multiple registrations of the same state path will be ignored. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to register the state observation. + Must not be TX_EMPTY_HANDLE. + + @param statePath [in]: + The state path as a TX_CONSTSTRING. + Must not start with, end with or have two consecutive dots (.). + Must not be NULL or empty string. + + @return + TX_RESULT_OK: The state path was successfully registered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRegisterStateObserver( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING statePath + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RegisterStateObserverHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING statePath + ); + + +/*********************************************************************************************************************/ + +/** + txUnregisterStateObserver + + Unregisters observation of a specified state path. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to unregister the state observation. + Must not be TX_EMPTY_HANDLE. + + @param statePath [in]: + The state path as a TX_CONSTSTRING. + Must not start with, end with or have two consecutive dots (.). + Must not be NULL or empty string. + + @return + TX_RESULT_OK: The state path was successfully unregistered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOT_FOUND: The state path was not observed. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txUnregisterStateObserver( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING statePath + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *UnregisterStateObserverHook)( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING statePath + ); + + +/*********************************************************************************************************************/ + +/** + txGetStateValueAsInteger + + Gets a value from a state bag as a TX_INTEGER. + If a state value can not be found on the specified path or the value is of another type this call will fail. + + @param hStateBag [in]: + A TX_CONSTHANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath, [in]: + The path to the value. + + @param pIntValue [out]: + A pointer to a TX_INTEGER which will be set to the value. + + @return + TX_RESULT_OK: The state value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The value was not found. + TX_RESULT_INVALIDPROPERTYTYPE: The value type was not TX_PROPERTYVALUETYPE_INTEGER. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetStateValueAsInteger( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_INTEGER* pIntValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetStateValueAsIntegerHook)( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_INTEGER* pIntValue + ); + + +/*********************************************************************************************************************/ + +/** + txGetStateValueAsReal + + Gets a value from a state bag as a TX_REAL. + If a state value can not be found on the specified path or the value is of another type this call will fail. + + @param hStateBag [in]: + A TX_CONSTHANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath [in]: + The path to the value. + + @param pRealValue [out]: + A pointer to a TX_REAL which will be set to the value. + + @return + TX_RESULT_OK: The state value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The value was not found. + TX_RESULT_INVALIDPROPERTYTYPE: The value type was not TX_PROPERTYVALUETYPE_REAL. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetStateValueAsReal( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_REAL* pRealValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetStateValueAsRealHook)( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_REAL* pRealValue + ); + + +/*********************************************************************************************************************/ + +/** + txGetStateValueAsString + + Gets a value from a state bag as a TX_STRING. + If a state value can not be found on the specified path or the value is of another type this call will fail. + + @param hStateBag [in]: + A TX_CONSTHANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath [in]: + The path to the value. + + @param pStringValue [out]: + A TX_STRING to which the state value will be copied. + Must be at least the size of the value. + Can be NULL to only get the size of the value. + If the state value is an array of strings the returned string will contain all strings + separated with null termination and with an extra ending null termination. + + @param pStringSize [in,out]: + A pointer to a TX_SIZE which will be set to the size of the state value. + Must not be NULL. + The value must be 0 if pStringValue is NULL. + + @return + TX_RESULT_OK: The state value or the required size of the string was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDBUFFERSIZE: The size of pStringValue is invalid (*pStringSize will be set to the required size). + TX_RESULT_NOTFOUND: The value was not found. + TX_RESULT_INVALIDPROPERTYTYPE: The value type was not TX_PROPERTYVALUETYPE_STRING or array of TX_PROPERTYVALUETYPE_STRING. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetStateValueAsString( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_STRING pStringValue, + TX_SIZE* pStringSize + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetStateValueAsStringHook)( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_STRING pStringValue, + TX_SIZE* pStringSize + ); + + +/*********************************************************************************************************************/ + +/** + txGetStateValueAsRectangle + + Gets a value from a state bag as a TX_RECT. + If a state value can not be found on the specified path or the value is of another type this call will fail. + + @param hStateBag [in]: + A TX_CONSTHANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath [in]: + The path to the value. + + @param pRectangle [out]: + A pointer to a TX_RECT which will have its members set. + Must not be NULL. + + @return + TX_RESULT_OK: The state value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The value was not found. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetStateValueAsRectangle( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_RECT* pRectValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetStateValueAsRectangleHook)( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_RECT* pRectValue + ); + + +/*********************************************************************************************************************/ + +/** + txGetStateValueAsVector2 + + Gets a value from a state bag as a TX_VECTOR2. + If a state value can not be found on the specified path or the value is of another type this call will fail. + + @param hStateBag [in]: + A TX_CONSTHANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath [in]: + The path to the value. + + @param pVector2Value [out]: + A pointer to a TX_VECTOR2 which will have its members set. + Must not be NULL. + + @return + TX_RESULT_OK: The state value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The value was not found. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetStateValueAsVector2( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_VECTOR2* pVector2Value + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetStateValueAsVector2Hook)( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_VECTOR2* pVector2Value + ); + + +/*********************************************************************************************************************/ + +/** + txGetStateValueAsSize2 + + Gets a value from a state bag as a TX_SIZE2. + If a state value can not be found on the specified path or the value is of another type this call will fail. + + @param hStateBag [in]: + A TX_CONSTHANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath [in]: + The path to the value. + + @param pSizeValue [out]: + A pointer to a TX_SIZE2 which will have its members set. + Must not be NULL. + + @return + TX_RESULT_OK: The state value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The value was not found. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetStateValueAsSize2( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_SIZE2* pSizeValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetStateValueAsSize2Hook)( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_SIZE2* pSizeValue + ); + + +/*********************************************************************************************************************/ + +/** + txSetStateValueAsInteger + + Sets a value in a state bag to a TX_INTEGER. + + @param hStateBag [in]: + A TX_HANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath, [in]: + The path to the value. + + @param intValue [in]: + A TX_INTEGER which is the value to set. + + @return + TX_RESULT_OK: The state value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetStateValueAsInteger( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_INTEGER intValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetStateValueAsIntegerHook)( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_INTEGER intValue + ); + + +/*********************************************************************************************************************/ + +/** + txSetStateValueAsReal + + Sets a value in a state bag to a TX_REAL. + + @param hStateBag [in]: + A TX_HANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath, [in]: + The path to the value. + + @param intValue [in]: + A TX_REAL which is the value to set. + + @return + TX_RESULT_OK: The state value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetStateValueAsReal( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_REAL realValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetStateValueAsRealHook)( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_REAL realValue + ); + + +/*********************************************************************************************************************/ + +/** + txSetStateValueAsString + + Sets a value in a state bag to a string. + + @param hStateBag [in]: + A TX_HANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath, [in]: + The path to the value. + + @param stringValue [in]: + A TX_CONSTSTRING which is the value to set. + + @return + TX_RESULT_OK: The state value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetStateValueAsString( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_CONSTSTRING stringValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetStateValueAsStringHook)( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_CONSTSTRING stringValue + ); + + +/*********************************************************************************************************************/ + +/** + txSetStateValueAsRectangle + + Sets a value in a state bag to a TX_RECT. + + @param hStateBag [in]: + A TX_HANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath, [in]: + The path to the value. + + @param pRectValue [in]: + A pointer to a TX_RECT which is the value to set. + Must not be NULL. + + @return + TX_RESULT_OK: The state value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetStateValueAsRectangle( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + const TX_RECT* pRectValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetStateValueAsRectangleHook)( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + const TX_RECT* pRectValue + ); + + +/*********************************************************************************************************************/ + +/** + txSetStateValueAsVector2 + + Sets a value in a state bag to a TX_VECTOR2. + + @param hStateBag [in]: + A TX_HANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath, [in]: + The path to the value. + + @param pVector2Value [in]: + A pointer to a TX_VECTOR2 which is the value to set. + Must not be NULL. + + @return + TX_RESULT_OK: The state value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetStateValueAsVector2( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + const TX_VECTOR2* pVector2Value + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetStateValueAsVector2Hook)( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + const TX_VECTOR2* pVector2Value + ); + + +/*********************************************************************************************************************/ + +/** + txSetStateValueAsSize2 + + Sets a value in a state bag to a TX_SIZE2. + + @param hStateBag [in]: + A TX_HANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath, [in]: + The path to the value. + + @param pSizeValue [in]: + A pointer to a TX_SIZE2 which is the value to set. + Must not be NULL. + + @return + TX_RESULT_OK: The state value was successfully set. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txSetStateValueAsSize2( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + const TX_SIZE2* pSizeValue + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *SetStateValueAsSize2Hook)( + TX_HANDLE hStateBag, + TX_CONSTSTRING valuePath, + const TX_SIZE2* pSizeValue + ); + + +/*********************************************************************************************************************/ + +/** + txGetPropertyForStateValue + + Gets a property for a specified state value. + If the property for state value can not be found on the specified path or the value is of another type this call + will fail. + + This function is typically only used by bindings. + + @param hStateBag [in]: + A TX_CONSTHANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param phProperty [out]: + A pointer to a TX_PROPERTYHANDLE which will be set to the property for the state value. + + @param valuePath [in]: + The path to the value. + May not be NULL. + + @param createIfNotFound [in]: + Specifies if the property should be created if it does not exist. + + @return + TX_RESULT_OK: The state value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The property was not found. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txGetPropertyForStateValue( + TX_CONSTHANDLE hStateBag, + TX_PROPERTYHANDLE* phProperty, + TX_CONSTSTRING valuePath, + TX_BOOL createIfNotFound + ); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *GetPropertyForStateValueHook)( + TX_CONSTHANDLE hStateBag, + TX_PROPERTYHANDLE* phProperty, + TX_CONSTSTRING valuePath, + TX_BOOL createIfNotFound + ); + + +/*********************************************************************************************************************/ + +/** + txRegisterStateChangedHandler + + Registers a state changed handler. + This is a helper which automatically registers a notification message handler and a state observer. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to listen for state changes. + Must not be TX_EMPTY_HANDLE. + + @param pTicket [out]: + A pointer to a TX_TICKET which will represent this registration. + This ticket should be used for unregistration. + Must not be NULL. + + @param statePath [in]: + A string that specifies the path of the state to register state changed handler for. + Must not start with, end with or have two consecutive dots (.). + Must not be NULL or empty string. + + @param handler [in]: + A TX_ASYNCDATACALLBACK which will be called when a state changes. + Must not be NULL. + + @param userParam [in]: + A TX_USERPARAM which will be provided as a parameter to the callback. + + @return + TX_RESULT_OK: The Query Handler was successfully registered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_INVALIDTHREAD: Attempted to call the function from a callback thread. + */ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txRegisterStateChangedHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_CONSTSTRING statePath, + TX_ASYNCDATACALLBACK handler, + TX_USERPARAM userParam); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *RegisterStateChangedHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_CONSTSTRING statePath, + TX_ASYNCDATACALLBACK handler, + TX_USERPARAM userParam); + + +/*********************************************************************************************************************/ + +/** + txUnregisterStateChangedHandler + + Unregisters a previously registered state changed handler callback. + + @param hContext [in]: + A TX_CONTEXTHANDLE to the context on which to unregister the callback. + Must not be TX_EMPTY_HANDLE. + + @param ticket [in]: + A TX_TICKET which represents the registration. + Must not be TX_INVALID_TICKET + + @return + TX_RESULT_OK: The callback was successfully unregistered. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: A registration for the specified ticket could not be found. +*/ +TX_C_BEGIN +TX_API TX_RESULT TX_CALLCONVENTION txUnregisterStateChangedHandler( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket); +TX_C_END + +typedef TX_RESULT (TX_CALLCONVENTION *UnregisterStateChangedHandlerHook)( + TX_CONTEXTHANDLE hContext, + TX_TICKET ticket); + + +/*********************************************************************************************************************/ + +#endif /* !defined(__TOBII_TX_STATES_API__H__) */ + +/*********************************************************************************************************************/ + diff --git a/Tobii EyeX/include/eyex/EyeXUtils.h b/Tobii EyeX/include/eyex/EyeXUtils.h new file mode 100755 index 0000000..7adedff --- /dev/null +++ b/Tobii EyeX/include/eyex/EyeXUtils.h @@ -0,0 +1,351 @@ +/********************************************************************************************************************* +* Copyright 2013-2014 Tobii Technology AB. All rights reserved. +* EyeXUtils.h +*********************************************************************************************************************/ + +#if !defined(__TOBII_TX_UTILS__H__) +#define __TOBII_TX_UTILS__H__ + +/*********************************************************************************************************************/ + +#if defined(__cplusplus) + +#include +#include +#include + +namespace Tx +{ + namespace Utils + { + template + class ScopedHandleTemplate + { + public: + ScopedHandleTemplate(THandle handle = TX_EMPTY_HANDLE) + : _handle(handle) + {} + + ~ScopedHandleTemplate() + { + SafeRelease(); + } + + THandle* operator &() + { + SafeRelease(); + return &_handle; + } + + operator const THandle () const + { + return _handle; + } + + THandle Detach() + { + auto handle = _handle; + _handle = TX_EMPTY_HANDLE; + return handle; + } + + bool IsAttached() const + { + return _handle != TX_EMPTY_HANDLE; + } + + private: + void SafeRelease() + { + if(!IsAttached()) + return; + + txReleaseObject(&_handle); + Detach(); + } + + private: + THandle _handle; + }; + + typedef ScopedHandleTemplate ScopedHandle; + + template + inline TX_RESULT GetBufferData(std::vector& targetBuffer, std::function fnGetBuf) + { + TX_RESULT resultCode; + TX_SIZE size; + + if(targetBuffer.empty()) + { + size = 0; + resultCode = fnGetBuf(nullptr, &size); + + if(resultCode == TX_RESULT_OK && size == 0) + return resultCode; + } + else + { + size = (TX_SIZE)targetBuffer.size(); + resultCode = fnGetBuf((TElement*)&targetBuffer[0], &size); + + if(resultCode == TX_RESULT_OK) + return resultCode; + } + + targetBuffer.resize(size); + resultCode = fnGetBuf((TElement*)&targetBuffer[0], &size); + + return resultCode; + } + + template + inline TX_RESULT GetBufferData(std::vector& targetBuffer, TX_RESULT (*pFn)(THandle1, TElement2*, TX_SIZE*), THandle2 handle) + { + std::function fnGetBuf = [handle, pFn](TElement1* pBuf, TX_SIZE* pSize) + { + return pFn(handle, (TElement2*)pBuf, pSize); + }; + + return GetBufferData(targetBuffer, fnGetBuf); + } + + inline TX_RESULT GetString(std::string* pTargetString, std::function fnGetString, TX_SIZE estimatedLength = 0) + { + std::vector buf(estimatedLength); + auto result = GetBufferData(buf, fnGetString); + if(result != TX_RESULT_OK) + return result; + + *pTargetString = &buf[0]; + return TX_RESULT_OK; + } + + template + inline TX_RESULT GetString(std::string* pTargetString, TX_RESULT (*pFn)(THandle1, TX_STRING, TX_SIZE*), THandle2 handle, TX_SIZE estimatedLength = 0) + { + auto fnGetString = [handle, pFn](TX_STRING pStr, TX_SIZE* pSize) + { + return pFn(handle, pStr, pSize); + }; + + return GetString(pTargetString, fnGetString); + } + } +} + +#endif /* defined(__cplusplus) */ + +#if !defined(TX_NODEBUGOBJECT) + +static const char* __txDbgObject(TX_CONSTHANDLE hObject) +{ + static char buf[65536]; + TX_SIZE bufSize; + + bufSize = sizeof(buf); + txFormatObjectAsText(hObject, buf, &bufSize); + return buf; +} + +typedef const char* (*TX_DEBUGOBJECT)(TX_CONSTHANDLE hObject); +static TX_DEBUGOBJECT txDebugObject = __txDbgObject; + +#endif /* !defined(TX_NODEBUGOBJECT) */ + +#if defined(__cplusplus) + +#if !defined(TX_NODEBUGOBJECT) + +// This variation is needed to make ScopedHandles debuggable in Visual Studios watch window +static const char* __txDbgScoped(const Tx::Utils::ScopedHandle& hObject) +{ + return txDebugObject(hObject); +} + +typedef const char* (*TX_DEBUGSCOPEDHANDLE)(const Tx::Utils::ScopedHandle& hObject); +static TX_DEBUGSCOPEDHANDLE txDebugScopedHandle = __txDbgScoped; + +#endif /* !defined(TX_NODEBUGOBJECT) */ + + +/*********************************************************************************************************************/ + +/** + Tx::CommitSnapshotAsync. This is a functional-enabled version of txCommitSnapshotAsync defined in EyeXSnapshot.h + */ + +/*********************************************************************************************************************/ + + +TX_API_FUNCTION_CPP(CommitSnapshotAsync, ( + TX_HANDLE hSnapshot, + const Tx::AsyncDataCallback& completionHandler + )); + +/*********************************************************************************************************************/ + +/** + Tx::GetStateAsync. This is a functional-enabled version of txGetStateAsync defined in EyeXStates.h + */ + +/*********************************************************************************************************************/ + +TX_API_FUNCTION_CPP(GetStateAsync,( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING statePath, + const Tx::AsyncDataCallback& completionHandler)); + +/*********************************************************************************************************************/ + +/** + Tx::SetStateAsync. This is a functional-enabled version of txESetStateAsync defined in EyeXStates.h + */ + +/*********************************************************************************************************************/ + +TX_API_FUNCTION_CPP(SetStateAsync, ( + TX_HANDLE hStateBag, + const Tx::AsyncDataCallback& completionHandler)); + +/*********************************************************************************************************************/ + +/** + Tx::RegisterStateChangedHandler. This is a functional-enabled version of txRegisterStateChangedHandler defined in EyeXStates.h + */ + +/*********************************************************************************************************************/ + +TX_API_FUNCTION_CPP(RegisterStateChangedHandler, ( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_CONSTSTRING statePath, + const Tx::AsyncDataCallback& handler)); + +/*********************************************************************************************************************/ + +/** + Tx::ExecuteCommandAsync. This is a functional-enabled version of txExecuteCommandAsync defined in EyeXCommand.h + */ + +/*********************************************************************************************************************/ + +TX_API_FUNCTION_CPP(ExecuteCommandAsync, ( + TX_HANDLE hCommand, + const Tx::AsyncDataCallback& completionHandler + )); + +/*********************************************************************************************************************/ + +/** + Tx::RegisterMessageHandler. This is a functional-enabled version of txRegisterMessageHandler defined in EyeXContext.h + */ + +/*********************************************************************************************************************/ + +TX_API_FUNCTION_CPP(RegisterMessageHandler,( + TX_CONTEXTHANDLE hContext, + TX_TICKET* pTicket, + TX_MESSAGETYPE messageType, + TX_HANDLE hOptions, + const Tx::AsyncDataCallback& completionHandler)); + +/*********************************************************************************************************************/ + +/** + Tx::DisableBuiltinKeys. This is a functional-enabled version of txDisableBuiltinKeys defined in EyeXActions.h + */ + +/*********************************************************************************************************************/ + +TX_API_FUNCTION_CPP(DisableBuiltinKeys,( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING windowId, + const Tx::AsyncDataCallback& completionHandler)); + +/*********************************************************************************************************************/ + +/** + Tx::EnableBuiltinKeys. This is a functional-enabled version of txEnableBuiltinKeys defined in EyeXActions.h + */ + +/*********************************************************************************************************************/ + +TX_API_FUNCTION_CPP(EnableBuiltinKeys,( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING windowId, + const Tx::AsyncDataCallback& completionHandler)); + +/*********************************************************************************************************************/ + +/** + Tx::LaunchConfigurationTool. This is a functional-enabled version of txLaunchConfigurationTool defined in EyeXActions.h +*/ + +/*********************************************************************************************************************/ + +TX_API_FUNCTION_CPP(LaunchConfigurationTool, ( + TX_CONTEXTHANDLE hContext, + TX_CONFIGURATIONTOOL configurationTool, + const Tx::AsyncDataCallback& completionHandler)); + +/*********************************************************************************************************************/ + +/** + Tx::SetCurrentProfile. This is a functional-enabled version of txSetCurrentProfile defined in EyeXActions.h +*/ + +/*********************************************************************************************************************/ + +TX_API_FUNCTION_CPP(SetCurrentProfile, ( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING profileName, + const Tx::AsyncDataCallback& completionHandler)); + +/*********************************************************************************************************************/ + +/** + Tx::DeleteProfile. This is a functional-enabled version of txDeleteProfile defined in EyeXActions.h +*/ + +TX_API_FUNCTION_CPP(DeleteProfile, ( + TX_CONTEXTHANDLE hContext, + TX_CONSTSTRING profileName, + const Tx::AsyncDataCallback& completionHandler)); + +/*********************************************************************************************************************/ + +/** +* Tx::GetStateValueAsArrayOfUnicodeStrings. This is a utility function to get state values as an array of strings. + + \Since 1.3.0 + + @param hStateBag [in]: + A TX_CONSTHANDLE to the state bag from which the value should be retrieved. + Must not be TX_EMPTY_HANDLE. + + @param valuePath [in]: + The path to the value. + + @param valuePath [out]: + A vector of strings to which the string values will be copied. + + @return + TX_RESULT_OK: The state value was successfully retrieved. + TX_RESULT_EYEXNOTINITIALIZED: The EyeX client environment is not initialized. + TX_RESULT_INVALIDARGUMENT: An invalid argument was passed to the function. + TX_RESULT_NOTFOUND: The value was not found. + TX_RESULT_INVALIDPROPERTYTYPE: The value type was not TX_PROPERTYVALUETYPE_STRING or array of TX_PROPERTYVALUETYPE_STRING. +*/ +TX_API_FUNCTION_CPP(GetStateValueAsArrayOfStrings, ( + TX_CONSTHANDLE hStateBag, + TX_CONSTSTRING valuePath, + TX_REF_PARAM(std::vector) arrayOfStrings)); + +/*********************************************************************************************************************/ + +#endif /* defined(__cplusplus) */ + +#endif /* !defined(__TOBII_TX_UTILS__H__) */ + +/*********************************************************************************************************************/ \ No newline at end of file diff --git a/Tobii EyeX/lib/x64/Tobii.EyeX.Client.dll b/Tobii EyeX/lib/x64/Tobii.EyeX.Client.dll new file mode 100755 index 0000000..77d046a Binary files /dev/null and b/Tobii EyeX/lib/x64/Tobii.EyeX.Client.dll differ diff --git a/Tobii EyeX/lib/x64/Tobii.EyeX.Client.lib b/Tobii EyeX/lib/x64/Tobii.EyeX.Client.lib new file mode 100755 index 0000000..39ae0c0 Binary files /dev/null and b/Tobii EyeX/lib/x64/Tobii.EyeX.Client.lib differ diff --git a/Tobii EyeX/lib/x86/Tobii.EyeX.Client.dll b/Tobii EyeX/lib/x86/Tobii.EyeX.Client.dll new file mode 100755 index 0000000..0e1e975 Binary files /dev/null and b/Tobii EyeX/lib/x86/Tobii.EyeX.Client.dll differ diff --git a/Tobii EyeX/lib/x86/Tobii.EyeX.Client.lib b/Tobii EyeX/lib/x86/Tobii.EyeX.Client.lib new file mode 100755 index 0000000..2f43c17 Binary files /dev/null and b/Tobii EyeX/lib/x86/Tobii.EyeX.Client.lib differ diff --git a/Tobii EyeX/samples/.vs/Samples/v14/.suo b/Tobii EyeX/samples/.vs/Samples/v14/.suo new file mode 100755 index 0000000..c6b0831 Binary files /dev/null and b/Tobii EyeX/samples/.vs/Samples/v14/.suo differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.cpp b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.cpp new file mode 100755 index 0000000..4fbe055 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.cpp @@ -0,0 +1,54 @@ +/* + * ActivatableBoardGame sample: + * This is an example that demonstrates the use of Activatable interactors in the context of a board game. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#include "stdafx.h" +#include +#include +#include +#include "Resource.h" +#include "Board.h" +#include "BoardWindow.h" + +#pragma comment (lib, "Gdiplus.lib") + +// Application entry point. +int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, + _In_opt_ HINSTANCE hPrevInstance, + _In_ LPTSTR lpCmdLine, + _In_ int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + // initialize the GDI+ library. + ULONG_PTR gdiplusToken; + Gdiplus::GdiplusStartupInput gdiplusStartupInput; + Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + // initialize the Board and the BoardWindow. + // these will be un-initialized automatically when they fall out of scope. + Board board(8); + BoardWindow::RegisterWindowClass(hInstance); + BoardWindow window(board, hInstance, nCmdShow); + + HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_GOBANG)); + + // Main message loop + MSG msg; + while (GetMessage(&msg, NULL, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + Gdiplus::GdiplusShutdown(gdiplusToken); + + return (int) msg.wParam; +} diff --git a/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.ico b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.ico new file mode 100755 index 0000000..449296f Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.ico differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.rc b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.rc new file mode 100755 index 0000000..718dee1 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.rc differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.vcxproj b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.vcxproj new file mode 100755 index 0000000..5b82b9c --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.vcxproj @@ -0,0 +1,193 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {2732E876-973B-4453-AA9F-D306EFB11922} + Win32Proj + ActivatableBoardGame + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\..\include;%(AdditionalIncludeDirectories) + + + Windows + true + ..\..\lib\x86 + + + true + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\..\include;%(AdditionalIncludeDirectories) + + + Windows + true + ..\..\lib\x64 + + + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\..\include;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + ..\..\lib\x86 + + + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\..\include;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + ..\..\lib\x64 + + + true + + + + + + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.vcxproj.filters b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.vcxproj.filters new file mode 100755 index 0000000..9baf12a --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/ActivatableBoardGame.vcxproj.filters @@ -0,0 +1,70 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Board.cpp b/Tobii EyeX/samples/ActivatableBoardGame/Board.cpp new file mode 100755 index 0000000..e59fc92 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/Board.cpp @@ -0,0 +1,220 @@ +/* + * ActivatableBoardGame sample: + * This is an example that demonstrates the use of Activatable interactors in the context of a board game. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#include "stdafx.h" +#include "Board.h" +#include +#include +#include "Observer.h" + +// initialize the random number generator. +auto const seed = std::random_device()(); +std::mt19937 Board::_randomNumberGenerator(seed); + +Board::Board(int size) + : _size(size), _board(nullptr), _boardChangedObserver(nullptr) +{ + _board = new Marker[_size * _size]; + BeginNewGame(); +} + +Board::~Board() +{ + delete[] _board; +} + +void Board::InitBoard() +{ + for (int i = 0; i < _size; ++i) + { + for (int j = 0; j < _size; ++j) + { + SetMarkerAt(Position(i, j), Marker::None); + } + } + + SetMarkerAt(Position((_size - 1) / 2, (_size - 1) / 2), Marker::X); + SetMarkerAt(Position((_size - 1) / 2, (_size - 1) / 2 + 1), Marker::O); + SetMarkerAt(Position((_size - 1) / 2 + 1, (_size - 1) / 2), Marker::O); + SetMarkerAt(Position((_size - 1) / 2 + 1, (_size - 1) / 2 + 1), Marker::X); +} + +Board::Marker Board::GetMarkerAt(Position position) const +{ + assert(IsValidPosition(position)); + + return _board[position.column + position.row * _size]; +} + +void Board::SetMarkerAt(Position position, Marker marker) +{ + assert(IsValidPosition(position)); + + _board[position.column + position.row * _size] = marker; + + NotifyObserver(); +} + +void Board::MakeHumanPlayerMove(Position position) +{ + if (_playerInTurn == Marker::X && + !IsGameOver() && + GetMarkerAt(position) == Marker::None) + { + MakeMove(position); + + if (!IsGameOver()) + { + MakeAIPlayerMove(); + } + } +} + +bool Board::CanMakeMoveAt(Position position) const +{ + return IsValidPosition(position) && + GetMarkerAt(position) == Marker::None; +} + +void Board::BeginNewGame() +{ + InitBoard(); + _playerInTurn = Marker::X; + _winner = Marker::None; +} + +bool Board::IsValidPosition(Position position) const +{ + return 0 <= position.row && position.row < _size && + 0 <= position.column && position.column < _size; +} + +void Board::MakeAIPlayerMove() +{ + // generate the list of all possible moves. not that they are good or anything, just possible. + std::vector possibleMoves; + for (int i = 0; i < _size; i++) + { + for (int j = 0; j < _size; j++) + { + Position position(i, j); + if (GetMarkerAt(position) == Marker::None) + { + possibleMoves.push_back(position); + } + } + } + + // since we check whether the game is a draw before calling this method, there should always be at least one possible move. + assert(possibleMoves.size() > 0); + + // pick a move at random. + std::uniform_int_distribution idist(0, (int)possibleMoves.size() - 1); + int randomMoveIndex = idist(_randomNumberGenerator); + MakeMove(possibleMoves[randomMoveIndex]); +} + +void Board::MakeMove(Position position) +{ + SetMarkerAt(position, _playerInTurn); + _playerInTurn = (_playerInTurn == Marker::O) ? Marker::X : Marker::O; + + DetectWinner(position); + DetectDrawGame(); +} + +void Board::DetectWinner(Position position) +{ + auto marker = GetMarkerAt(position); + + for (int i = 0; i < OrientationMaxValue; ++i) + { + Orientation orientation = (Orientation)i; + int sequenceLength(1); + + bool directions[] = { true, false }; + + for each (auto forward in directions) + { + auto neighbor = GetAdjacentPosition(position, orientation, forward); + while (IsValidPosition(neighbor) && GetMarkerAt(neighbor) == marker) + { + sequenceLength++; + neighbor = GetAdjacentPosition(neighbor, orientation, forward); + } + } + + if (sequenceLength >= WinningSequenceLength) + { + _winner = marker; + _playerInTurn = Marker::None; + NotifyObserver(); + } + } +} + +void Board::DetectDrawGame() +{ + // if there is an empty position, the game isn't a draw (yet). + for (int i = 0; i < _size; ++i) + { + for (int j = 0; j < _size; ++j) + { + if (GetMarkerAt(Position(i, j)) == Marker::None) + { + return; + } + } + } + + // no empty positions found: it's a draw. + _playerInTurn = Marker::None; + NotifyObserver(); +} + +Board::Position Board::GetAdjacentPosition(Position position, Orientation orientation, bool forward) const +{ + Position delta(-1, -1); + switch (orientation) + { + case Orientation::North: + delta = Position(+1, 0); + break; + case Orientation::East: + delta = Position(0, +1); + break; + case Orientation::Northeast: + delta = Position(+1, +1); + break; + case Orientation::Southeast: + delta = Position(-1, +1); + break; + default: + assert(false); + } + + if (!forward) + { + delta.row = -delta.row; + delta.column = -delta.column; + } + + return Position(position.row + delta.row, position.column + delta.column); +} + +void Board::RegisterBoardChangedObserver(Observer* boardChangedObserver) +{ + _boardChangedObserver = boardChangedObserver; +} + +void Board::NotifyObserver() +{ + if (_boardChangedObserver) + { + _boardChangedObserver->SubjectChanged(); + } +} diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Board.h b/Tobii EyeX/samples/ActivatableBoardGame/Board.h new file mode 100755 index 0000000..d6abbe3 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/Board.h @@ -0,0 +1,110 @@ +/* + * Board class: Implements the game logic and the not-so-clever AI player for the exciting Gobang game. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#pragma once + +#include + +class Observer; + +class Board +{ +public: + // Represents a position on the board. + struct Position + { + int row; + int column; + + Position(int paramRow, int paramColumn) : row(paramRow), column(paramColumn) { } + }; + + // Possible contents of a board position. + enum Marker + { + None, + X, + O + }; + + Board(int size); + virtual ~Board(); + + // gets the size of the board, which is assumed to be square: the number of positions on each side. + int Size() const { return _size; } + + // indicates whether the game is over. + bool IsGameOver() const { return _playerInTurn == Marker::None; } + + // gets the "name" of the lucky winner. + Marker GetWinner() const { return _winner; } + + // gets what's on the board at a given position. + Marker GetMarkerAt(Position position) const; + + // indicates whether it is possible to place a marker at a given position. + bool CanMakeMoveAt(Position position) const; + + // makes a move for the human player (which will also trigger an AI move). + void MakeHumanPlayerMove(Position position); + + // restarts the game. + void BeginNewGame(); + + // registers an observer that is notified when the board has changed. + void RegisterBoardChangedObserver(Observer* boardChangedObserver); + +private: + enum Orientation + { + North, + East, + Northeast, + Southeast, + OrientationMaxValue + }; + + // tests whether a position is on the board. + bool IsValidPosition(Position position) const; + + // gets a position adjacent to the given one, in a particular direction. + Position GetAdjacentPosition(Position position, Orientation orientation, bool forward) const; + + // prepares the board for a new, exciting game. + void InitBoard(); + + // lets the miserable AI player make a move. + void MakeAIPlayerMove(); + + // makes a move: places a marker and checks whether anyone has won or if it's a draw game. + void MakeMove(Position position); + + // places a marker at the given position. + void SetMarkerAt(Position position, Marker marker); + + // checks if the given position is part of a winning sequence. + void DetectWinner(Position position); + + // checks if the game is a draw. + void DetectDrawGame(); + + // notifies the observer, if any, that the board has changed. + void NotifyObserver(); + + static const int WinningSequenceLength = 5; + + static std::mt19937 _randomNumberGenerator; + + int _size; + Marker* _board; + Marker _playerInTurn; + Marker _winner; + Observer* _boardChangedObserver; + + // private copy constructor and operator making the class non-copyable (declared but not implemented). + Board(const Board&); + Board& operator = (const Board&); +}; diff --git a/Tobii EyeX/samples/ActivatableBoardGame/BoardWindow.cpp b/Tobii EyeX/samples/ActivatableBoardGame/BoardWindow.cpp new file mode 100755 index 0000000..7f8b9a7 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/BoardWindow.cpp @@ -0,0 +1,488 @@ +/* + * ActivatableBoardGame sample: + * This is an example that demonstrates the use of Activatable interactors in the context of a board game. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#include "stdafx.h" +#include "BoardWindow.h" +#include "Board.h" +#include "resource.h" + +// window messages used for notifications from the EyeXHost. +#define WM_EYEX_HOST_STATUS_CHANGED WM_USER + 0 +#define WM_FOCUSED_REGION_CHANGED WM_USER + 1 +#define WM_REGION_ACTIVATED WM_USER + 2 + +// color scheme. +const Gdiplus::Color BoardWindow::BackgroundGazeInteractionFunctionalColor = Gdiplus::Color(134, 152, 172); // blue +const Gdiplus::Color BoardWindow::BackgroundMouseOnlyColor = Gdiplus::Color(164, 156, 153); // grey +const Gdiplus::Color BoardWindow::GridColor = Gdiplus::Color(110, 57, 88, 109); // dark blue +const Gdiplus::Color BoardWindow::MarkerColor = Gdiplus::Color(242, 233, 216); // off white +const Gdiplus::Color BoardWindow::HighlightColor = Gdiplus::Color(20, 242, 233, 216); // transparent off white +const Gdiplus::Color BoardWindow::WonMessageColor = Gdiplus::Color(200, 64, 82, 60); // transparent dark green +const Gdiplus::Color BoardWindow::LostMessageColor = Gdiplus::Color(200, 155, 109, 135); // transparent grape + +// constants. +const int BoardWindow::SquareSize = 100; +const int BoardWindow::MarkerMargin = 14; +const int BoardWindow::MarkerDiameter = SquareSize - MarkerMargin * 2; +const TCHAR* BoardWindow::WindowClassName = _T("GobangBoard"); + +BoardWindow::BoardWindow(Board& board, HINSTANCE hInstance, int nCmdShow) + : _board(board), _hInstance(hInstance), _hWnd(0), _hMenu(0), _leftMargin(0), _upperMargin(0) +{ + // create the window instance. + _hWnd = CreateWindow( + WindowClassName, + _T("Gobang!"), + WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU, + CW_USEDEFAULT, + CW_USEDEFAULT, + (_board.Size() + 1) * SquareSize, + (_board.Size() + 1) * SquareSize + 40, + NULL, + NULL, + hInstance, + NULL); + + if (!_hWnd) + { + throw new std::runtime_error("Could not create main window."); + } + + _hMenu = GetMenu(_hWnd); + + // write the "this" pointer to the extra window memory so that we can reference back to this + // object from the window function. + SetWindowLongPtr(_hWnd, 0, (LONG_PTR)this); + + ShowWindow(_hWnd, nCmdShow); + UpdateWindow(_hWnd); + + _board.RegisterBoardChangedObserver(this); + + // initialize the EyeX host and the activatable regions. + _eyeXHost.Init(_hWnd, WM_EYEX_HOST_STATUS_CHANGED, WM_FOCUSED_REGION_CHANGED, WM_REGION_ACTIVATED); + UpdateActivatableRegions(); +} + +BoardWindow::~BoardWindow() +{ +} + +void BoardWindow::RegisterWindowClass(HINSTANCE hInstance) +{ + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = sizeof(void*); // make room for the "this" pointer. + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_GOBANG)); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = 0; + wcex.lpszMenuName = MAKEINTRESOURCE(IDC_GOBANG); + wcex.lpszClassName = WindowClassName; + wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); + + RegisterClassEx(&wcex); +} + +// Callback function invoked when the Board has changed. +void BoardWindow::SubjectChanged() +{ + InvalidateRect(_hWnd, NULL, FALSE); + UpdateActivatableRegions(); +} + +// Callback function invoked from the message loop to process a Windows message. +LRESULT CALLBACK BoardWindow::WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + + // read the "this" pointer from extra window memory. + BoardWindow* instance = reinterpret_cast(GetWindowLongPtr(hWnd, 0)); + + switch (message) + { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + + // Parse the menu selections: + switch (wmId) + { + case IDM_NEWGAME: + instance->OnNewGameClicked(); + break; + + case IDM_ABOUT: + DialogBox(instance->_hInstance, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); + break; + + case IDM_EXIT: + DestroyWindow(hWnd); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + + case WM_LBUTTONDOWN: + { + // mouse button pressed; possibly on a board square. + auto point = MAKEPOINTS(lParam); + instance->OnSquareClicked(point); + } + break; + + case WM_PAINT: + instance->UpdateMargins(); + hdc = BeginPaint(hWnd, &ps); + instance->OnDraw(hdc); + EndPaint(hWnd, &ps); + break; + + case WM_ERASEBKGND: + // no background erasing needed since our OnDraw method draws the entire window. + return TRUE; + + case WM_EYEX_HOST_STATUS_CHANGED: + // the background color of the board indicates whether we have a working connection to the engine or not. + // so, when the status changes, we force a redraw of the window. + InvalidateRect(hWnd, 0, FALSE); + break; + + case WM_FOCUSED_REGION_CHANGED: + // redraw to display the new focus state. + InvalidateRect(hWnd, 0, FALSE); + break; + + case WM_REGION_ACTIVATED: + instance->OnSquareActivated((UINT)wParam); + break; + + case WM_WINDOWPOSCHANGED: + // the window was moved, so we need to refresh the screen bounds of our activatable regions. + instance->UpdateActivatableRegions(); + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + case WM_KEYUP: + // trigger an activation command when space is released. + if (VK_SPACE == wParam) + { + instance->_eyeXHost.TriggerActivation(); + } + break; + + case WM_KEYDOWN: + // trigger activation mode on when space is pressed down (so activation focus changed events are received, and a highlight can be drawn). + if (VK_SPACE == wParam) + { + instance->_eyeXHost.TriggerActivationModeOn(); + } + break; + + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + + return 0; +} + +void BoardWindow::OnDraw(HDC hdc) +{ + // use double-buffer drawing to speed up the drawing and reduce flicker. + // (the drawing is performed on a bitmap, which is then blitted to the screen in one fell swoop.) + + RECT rect; + GetClientRect(_hWnd, &rect); + Gdiplus::Bitmap bitmap(rect.right - rect.left, rect.bottom - rect.top); + Gdiplus::Graphics graphics(&bitmap); + + // draw the background in a color which depends on the state of the connection to the engine. + // blue if the connection is functional, gray otherwise. + Gdiplus::Color backgroundColor(BackgroundGazeInteractionFunctionalColor); + if (!_eyeXHost.IsFunctional()) + { + backgroundColor = BackgroundMouseOnlyColor; + } + Gdiplus::SolidBrush backgroundBrush(backgroundColor); + graphics.FillRectangle(&backgroundBrush, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); + + // draw the grid + DrawGrid(&graphics); + + // draw the markers + Gdiplus::Pen markerPen(MarkerColor, 5.0F); + for (int row = 0; row < _board.Size(); row++) + { + for (int col = 0; col < _board.Size(); col++) + { + switch (_board.GetMarkerAt(Board::Position(row, col))) + { + case Board::Marker::X: + DrawXMarker(&graphics, &markerPen, row, col); + break; + + case Board::Marker::O: + DrawOMarker(&graphics, &markerPen, row, col); + break; + } + } + } + + // draw the focus highlight + int focusedRegionId = _eyeXHost.GetFocusedRegionId(); + if (focusedRegionId >= 0) + { + DrawHighlight(&graphics, RegionIdToBoardRow(focusedRegionId), RegionIdToBoardColumn(focusedRegionId)); + } + + // draw the game over message + if (_board.IsGameOver()) + { + WCHAR* message; + Gdiplus::Color messageColor(0,0,0); + switch (_board.GetWinner()) + { + case Board::Marker::X: + message = L"YOU WON :)"; + messageColor = WonMessageColor; + break; + + case Board::Marker::O: + message = L"YOU LOST :("; + messageColor = LostMessageColor; + break; + + default: + message = L"DRAW"; + messageColor = LostMessageColor; + break; + } + + DrawGameOver(&graphics, message, messageColor); + } + + Gdiplus::Graphics screen(hdc); + screen.DrawImage(&bitmap, 0, 0); +} + +void BoardWindow::DrawGrid(Gdiplus::Graphics *graphics) +{ + const int lineMargin = 14; + + Gdiplus::Pen gridPen(GridColor); + gridPen.SetDashStyle(Gdiplus::DashStyleDash); + + // horizontal lines + auto x0 = _leftMargin - lineMargin; + auto x1 = _leftMargin + _board.Size() * SquareSize + lineMargin; + for (int i = 0; i <= _board.Size(); i++) + { + auto y = _upperMargin + i * SquareSize; + graphics->DrawLine(&gridPen, x0, y, x1, y); + } + + // vertical lines + auto y0 = _upperMargin - lineMargin; + auto y1 = _upperMargin + _board.Size() * SquareSize + lineMargin; + for (int j = 0; j <= _board.Size(); j++) + { + auto x = _leftMargin + j * SquareSize; + graphics->DrawLine(&gridPen, x, y0, x, y1); + } + + // dots that guide the eye to the center of the square + Gdiplus::SolidBrush gridBrush(GridColor); + for (int i = 0; i <= _board.Size(); i++) + { + for (int j = 0; j <= _board.Size(); j++) + { + auto x = _leftMargin + (j + 0.5) * SquareSize; + auto y = _upperMargin + (i + 0.5) * SquareSize; + graphics->FillEllipse(&gridBrush, (Gdiplus::REAL)(x - 1), (Gdiplus::REAL)(y - 1), (Gdiplus::REAL)3, (Gdiplus::REAL)3); + } + } +} + +void BoardWindow::DrawHighlight(Gdiplus::Graphics *graphics, INT row, INT column) +{ + Gdiplus::SolidBrush highlightBrush(HighlightColor); + + int x = BoardToClientAreaX(column) + 1; + int y = BoardToClientAreaY(row) + 1; + + graphics->FillRectangle(&highlightBrush, x, y, SquareSize - 1, SquareSize - 1); +} + +void BoardWindow::DrawOMarker(Gdiplus::Graphics *graphics, Gdiplus::Pen *markerPen, INT row, INT column) +{ + int x = BoardToClientAreaX(column) + MarkerMargin; + int y = BoardToClientAreaY(row) + MarkerMargin; + + graphics->DrawEllipse(markerPen, x, y, MarkerDiameter, MarkerDiameter); +} + +void BoardWindow::DrawXMarker(Gdiplus::Graphics *graphics, Gdiplus::Pen *markerPen, INT row, INT column) +{ + int x = BoardToClientAreaX(column) + MarkerMargin; + int y = BoardToClientAreaY(row) + MarkerMargin; + + graphics->DrawLine(markerPen, x, y + MarkerDiameter, x + MarkerDiameter, y); + graphics->DrawLine(markerPen, x, y, x + MarkerDiameter, y + MarkerDiameter); +} + +void BoardWindow::DrawGameOver(Gdiplus::Graphics *graphics, WCHAR* message, const Gdiplus::Color& messageColor) +{ + Gdiplus::Font myFont(L"Arial", 72); + + RECT rect; + GetClientRect(_hWnd, &rect); + Gdiplus::RectF layoutRect((float)rect.left, (float)rect.top, (float)(rect.right - rect.left), (float)(rect.bottom - rect.top)); + + Gdiplus::StringFormat format; + format.SetAlignment(Gdiplus::StringAlignmentCenter); + format.SetLineAlignment(Gdiplus::StringAlignmentCenter); + + Gdiplus::SolidBrush messageBrush(messageColor); + + graphics->DrawString( + message, + (INT)wcslen(message), + &myFont, + layoutRect, + &format, + &messageBrush); +} + +INT BoardWindow::BoardToClientAreaX(INT column) +{ + return column * SquareSize + _leftMargin; +} + +INT BoardWindow::BoardToClientAreaY(INT row) +{ + return row * SquareSize + _upperMargin; +} + +INT BoardWindow::ClientAreaToBoardColumn(INT x) +{ + return (x - _upperMargin) / SquareSize; +} + +INT BoardWindow::ClientAreaToBoardRow(INT y) +{ + return (y - _leftMargin) / SquareSize; +} + +int BoardWindow::BoardPositionToRegionId(int row, int column) +{ + return column + row * _board.Size(); +} + +int BoardWindow::RegionIdToBoardRow(int regionId) +{ + return regionId / _board.Size(); +} + +int BoardWindow::RegionIdToBoardColumn(int regionId) +{ + return regionId % _board.Size(); +} + +void BoardWindow::UpdateMargins() +{ + RECT rect; + GetClientRect(_hWnd, &rect); + _upperMargin = ((rect.bottom - rect.top) - _board.Size() * SquareSize) / 2; + _leftMargin = ((rect.right - rect.left) - _board.Size() * SquareSize) / 2; +} + +void BoardWindow::OnSquareClicked(POINTS point) +{ + MakeHumanPlayerMove(ClientAreaToBoardRow(point.y), ClientAreaToBoardColumn(point.x)); +} + +void BoardWindow::OnSquareActivated(UINT regionId) +{ + MakeHumanPlayerMove(RegionIdToBoardRow(regionId), RegionIdToBoardColumn(regionId)); +} + +void BoardWindow::MakeHumanPlayerMove(int row, int column) +{ + Board::Position position(row, column); + if (_board.CanMakeMoveAt(position)) + { + _board.MakeHumanPlayerMove(position); + } +} + +void BoardWindow::UpdateActivatableRegions() +{ + std::vector regions; + + if (!_board.IsGameOver()) + { + for (int row = 0; row < _board.Size(); row++) + { + for (int column = 0; column < _board.Size(); column++) + { + POINT point; + point.x = BoardToClientAreaX(column); + point.y = BoardToClientAreaY(row); + ClientToScreen(_hWnd, &point); + + RECT bounds; + bounds.left = point.x; + bounds.top = point.y; + bounds.right = point.x + SquareSize; + bounds.bottom = point.y + SquareSize; + + regions.push_back(EyeXHost::ActivatableRegion(BoardPositionToRegionId(row, column), bounds)); + } + } + } + + _eyeXHost.SetActivatableRegions(regions); +} + +void BoardWindow::OnNewGameClicked() +{ + _board.BeginNewGame(); + UpdateActivatableRegions(); +} + +// Message handler for about box. +INT_PTR CALLBACK BoardWindow::About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + switch (message) + { + case WM_INITDIALOG: + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) + { + EndDialog(hDlg, LOWORD(wParam)); + return (INT_PTR)TRUE; + } + break; + } + + return (INT_PTR)FALSE; +} diff --git a/Tobii EyeX/samples/ActivatableBoardGame/BoardWindow.h b/Tobii EyeX/samples/ActivatableBoardGame/BoardWindow.h new file mode 100755 index 0000000..50dc346 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/BoardWindow.h @@ -0,0 +1,94 @@ +/* + * BoardWindow class: Responsible for the game window and the GDI+ drawing. + * Listens to notifications from the Board. + * Owns the EyeX host. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#pragma once + +#include +#include +#include +#include "Observer.h" +#include "EyeXHost.h" + +class Board; + +class BoardWindow : Observer +{ +public: + BoardWindow(Board& board, HINSTANCE hInstance, int nCmdShow); + virtual ~BoardWindow(); + + // registers the window class; must be called once at application initialization. + static void RegisterWindowClass(HINSTANCE hInstance); + + // From Observer + void SubjectChanged(); + +private: + // window procedure for the main window. + static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); + + // window procedure for the About dialog. + static INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); + + // GDI+ drawing methods. + void OnDraw(HDC hdc); + void DrawGrid(Gdiplus::Graphics *graphics); + void DrawHighlight(Gdiplus::Graphics* graphics, int row, int column); + void DrawXMarker(Gdiplus::Graphics* graphics, Gdiplus::Pen* pen, int row, int column); + void DrawOMarker(Gdiplus::Graphics* graphics, Gdiplus::Pen* pen, int row, int column); + void DrawGameOver(Gdiplus::Graphics* graphics, WCHAR* message, const Gdiplus::Color& messageColor); + + // coordinate/board position mapping methods. + int BoardToClientAreaX(int column); + int BoardToClientAreaY(int row); + int ClientAreaToBoardColumn(int x); + int ClientAreaToBoardRow(int y); + + // region id/board position mapping methods. + int BoardPositionToRegionId(int row, int column); + int RegionIdToBoardRow(int regionId); + int RegionIdToBoardColumn(int regionId); + + // re-calculates the margins based on the size of the window. + void UpdateMargins(); + + // reports all vacant board positions as activatable regions to the EyeX host. + void UpdateActivatableRegions(); + + // makes a move at the given position. + void MakeHumanPlayerMove(int row, int column); + + // event handlers. + void OnSquareClicked(POINTS point); + void OnSquareActivated(UINT regionId); + void OnNewGameClicked(); + + static const Gdiplus::Color BackgroundGazeInteractionFunctionalColor; + static const Gdiplus::Color BackgroundMouseOnlyColor; + static const Gdiplus::Color GridColor; + static const Gdiplus::Color MarkerColor; + static const Gdiplus::Color HighlightColor; + static const Gdiplus::Color WonMessageColor; + static const Gdiplus::Color LostMessageColor; + static const int SquareSize; + static const int MarkerMargin; + static const int MarkerDiameter; + static const TCHAR* WindowClassName; + + Board& _board; + EyeXHost _eyeXHost; + HINSTANCE _hInstance; + HWND _hWnd; + HMENU _hMenu; + int _leftMargin; + int _upperMargin; + + // private copy constructor and operator making the class non-copyable (declared but not implemented). + BoardWindow(const BoardWindow&); + BoardWindow& operator = (const BoardWindow&); +}; diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/ActivatableBoardGame.lastbuildstate b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/ActivatableBoardGame.lastbuildstate new file mode 100755 index 0000000..5cd4c3b --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/ActivatableBoardGame.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 +Debug|Win32|D:\dev\tobii\samples\| diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.command.1.tlog b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.command.1.tlog new file mode 100755 index 0000000..001d8ba Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.command.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.read.1.tlog b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.read.1.tlog new file mode 100755 index 0000000..ff00e89 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.read.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.write.1.tlog b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.write.1.tlog new file mode 100755 index 0000000..f3a1acb Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/CL.write.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.command.1.tlog b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.command.1.tlog new file mode 100755 index 0000000..5f8e2da Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.command.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.read.1.tlog b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.read.1.tlog new file mode 100755 index 0000000..de1b91d Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.read.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.write.1.tlog b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.write.1.tlog new file mode 100755 index 0000000..97ed8cf Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/link.write.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.command.1.tlog b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.command.1.tlog new file mode 100755 index 0000000..57e38ff Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.command.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.read.1.tlog b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.read.1.tlog new file mode 100755 index 0000000..7e1acc5 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.read.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.write.1.tlog b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.write.1.tlog new file mode 100755 index 0000000..6c4a07a Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Activata.2732E876.tlog/rc.write.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.log b/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.log new file mode 100755 index 0000000..8d71d0b --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.log @@ -0,0 +1,8 @@ + stdafx.cpp + EyeXHost.cpp +d:\dev\tobii\samples\activatableboardgame\eyexhost.cpp(243): warning C4477: 'sprintf_s' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'HWND' + ActivatableBoardGame.cpp + BoardWindow.cpp + Board.cpp + Generating Code... + ActivatableBoardGame.vcxproj -> D:\dev\tobii\samples\Debug\ActivatableBoardGame.exe diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.obj b/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.obj new file mode 100755 index 0000000..cdf81f4 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.obj differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.pch b/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.pch new file mode 100755 index 0000000..d560dcc Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.pch differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.res b/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.res new file mode 100755 index 0000000..6aae112 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/ActivatableBoardGame.res differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/Board.obj b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Board.obj new file mode 100755 index 0000000..32b7253 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/Board.obj differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/BoardWindow.obj b/Tobii EyeX/samples/ActivatableBoardGame/Debug/BoardWindow.obj new file mode 100755 index 0000000..15d39e6 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/BoardWindow.obj differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/EyeXHost.obj b/Tobii EyeX/samples/ActivatableBoardGame/Debug/EyeXHost.obj new file mode 100755 index 0000000..69a81a1 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/EyeXHost.obj differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/stdafx.obj b/Tobii EyeX/samples/ActivatableBoardGame/Debug/stdafx.obj new file mode 100755 index 0000000..cb850a6 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/stdafx.obj differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/vc140.idb b/Tobii EyeX/samples/ActivatableBoardGame/Debug/vc140.idb new file mode 100755 index 0000000..46ca7f9 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/vc140.idb differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Debug/vc140.pdb b/Tobii EyeX/samples/ActivatableBoardGame/Debug/vc140.pdb new file mode 100755 index 0000000..8d46bc5 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Debug/vc140.pdb differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/EyeXHost.cpp b/Tobii EyeX/samples/ActivatableBoardGame/EyeXHost.cpp new file mode 100755 index 0000000..410a6cf --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/EyeXHost.cpp @@ -0,0 +1,377 @@ +/* + * ActivatableBoardGame sample: + * This is an example that demonstrates the use of Activatable interactors in the context of a board game. + * + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + */ + +#include "stdafx.h" +#include "EyeXHost.h" +#include +#include +#include +#include + +#pragma comment (lib, "Tobii.EyeX.Client.lib") + +#if INTPTR_MAX == INT64_MAX +#define WINDOW_HANDLE_FORMAT "%lld" +#else +#define WINDOW_HANDLE_FORMAT "%d" +#endif + +EyeXHost::EyeXHost() + : _state(Initializing), + _hWnd(nullptr), + _statusChangedMessage(0), _focusedRegionChangedMessage(0), _regionActivatedMessage(0), + _focusedRegionId(-1), + _context(TX_EMPTY_HANDLE), + _connectionStateChangedTicket(0), _queryHandlerTicket(0), _eventHandlerTicket(0) +{ + // initialize the EyeX Engine client library. + txInitializeEyeX(TX_EYEXCOMPONENTOVERRIDEFLAG_NONE, nullptr, nullptr, nullptr, nullptr); + + // create a context and register event handlers, but don't enable the connection to the engine just yet. + // we'll enable the connection in the Init method, when we're ready to handle the + // connection-status-changed notifications. + bool success = txCreateContext(&_context, TX_FALSE) == TX_RESULT_OK; + success &= RegisterConnectionStateChangedHandler(); + success &= RegisterQueryHandler(); + success &= RegisterEventHandler(); + + if (!success) + { + SetState(Failed); + } +} + +EyeXHost::~EyeXHost() +{ + if (_context != TX_EMPTY_HANDLE) + { + // shut down, then release the context. + txShutdownContext(_context, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE); + txReleaseContext(&_context); + } +} + +void EyeXHost::Init(HWND hWnd, UINT statusChangedMessage, UINT focusedRegionChangedMessage, UINT regionActivatedMessage) +{ + _hWnd = hWnd; + _statusChangedMessage = statusChangedMessage; + _focusedRegionChangedMessage = focusedRegionChangedMessage; + _regionActivatedMessage = regionActivatedMessage; + + // connect to the engine. + if (txEnableConnection(_context) != TX_RESULT_OK) + { + SetState(Failed); + } +} + +void EyeXHost::SetActivatableRegions(const std::vector& regions) +{ + std::lock_guard lock(_mutex); + + _regions.assign(regions.begin(), regions.end()); + ResetFocusedRegionIdIfNonExistent(); +} + +int EyeXHost::GetFocusedRegionId() const +{ + std::lock_guard lock(const_cast(_mutex)); + + return _focusedRegionId; +} + +void EyeXHost::TriggerActivation() +{ + TX_HANDLE command(TX_EMPTY_HANDLE); + txCreateActionCommand(_context, &command, TX_ACTIONTYPE_ACTIVATE); + txExecuteCommandAsync(command, NULL, NULL); + txReleaseObject(&command); +} + +void EyeXHost::TriggerActivationModeOn() +{ + TX_HANDLE command(TX_EMPTY_HANDLE); + txCreateActionCommand(_context, &command, TX_ACTIONTYPE_ACTIVATIONMODEON); + txExecuteCommandAsync(command, NULL, NULL); + txReleaseObject(&command); +} + +void EyeXHost::SetFocusedRegionId(int regionId) +{ + std::lock_guard lock(_mutex); + + _focusedRegionId = regionId; + ResetFocusedRegionIdIfNonExistent(); + PostMessage(_hWnd, _focusedRegionChangedMessage, 0, 0); +} + +// this method assumes that the mutex is held during the call. +void EyeXHost::ResetFocusedRegionIdIfNonExistent() +{ + for (auto region : _regions) + { + if (region.id == _focusedRegionId) + { + return; + } + } + + _focusedRegionId = -1; +} + +bool EyeXHost::IsFunctional() const +{ + return _state == Initializing || + _state == Connected; +} + +void EyeXHost::SetState(State state) +{ + std::lock_guard lock(_mutex); + + if (_state != state) + { + _state = state; + + // note the use of the asynchronous PostMessage function to marshal the event to the main thread. + // (this method is called from OnEngineConnectionStateChanged, which is typically invoked on a worker thread.) + PostMessage(_hWnd, _statusChangedMessage, 0, 0); + } +} + +bool EyeXHost::RegisterConnectionStateChangedHandler() +{ + // we pass the "this" pointer as the user parameter when registering the event handler, + // so that we can access it in the callback function. + + auto connectionStateChangedTrampoline = [](TX_CONNECTIONSTATE connectionState, TX_USERPARAM userParam) + { + static_cast(userParam)->OnEngineConnectionStateChanged(connectionState); + }; + + bool success = txRegisterConnectionStateChangedHandler( + _context, + &_connectionStateChangedTicket, + connectionStateChangedTrampoline, + this) == TX_RESULT_OK; + + return success; +} + +bool EyeXHost::RegisterQueryHandler() +{ + auto queryHandlerTrampoline = [](TX_CONSTHANDLE hObject, TX_USERPARAM userParam) + { + static_cast(userParam)->HandleQuery(hObject); + }; + + bool success = txRegisterQueryHandler( + _context, + &_queryHandlerTicket, + queryHandlerTrampoline, + this) == TX_RESULT_OK; + + return success; +} + +bool EyeXHost::RegisterEventHandler() +{ + auto eventHandlerTrampoline = [](TX_CONSTHANDLE hObject, TX_USERPARAM userParam) + { + static_cast(userParam)->HandleEvent(hObject); + }; + + bool success = txRegisterEventHandler(_context, + &_eventHandlerTicket, + eventHandlerTrampoline, + this) == TX_RESULT_OK; + + return success; +} + +void EyeXHost::OnEngineConnectionStateChanged(TX_CONNECTIONSTATE connectionState) +{ + switch (connectionState) + { + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_CONNECTED: + SetState(Connected); + break; + + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_DISCONNECTED: + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_TRYINGTOCONNECT: + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_SERVERVERSIONTOOLOW: + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_SERVERVERSIONTOOHIGH: + SetState(Disconnected); + break; + + default: + break; + } +} + +void EyeXHost::HandleQuery(TX_CONSTHANDLE hAsyncData) +{ + std::lock_guard lock(_mutex); + + // NOTE. This method will fail silently if, for example, the connection is lost before the snapshot has been committed, + // or if we run out of memory. This is by design, because there is nothing we can do to recover from these errors anyway. + + TX_HANDLE hQuery(TX_EMPTY_HANDLE); + txGetAsyncDataContent(hAsyncData, &hQuery); + + const int bufferSize = 20; + TX_CHAR stringBuffer[bufferSize]; + + // read the query bounds from the query, that is, the area on the screen that the query concerns. + // the query region is always rectangular. + TX_HANDLE hBounds(TX_EMPTY_HANDLE); + txGetQueryBounds(hQuery, &hBounds); + TX_REAL pX, pY, pWidth, pHeight; + txGetRectangularBoundsData(hBounds, &pX, &pY, &pWidth, &pHeight); + txReleaseObject(&hBounds); + Gdiplus::Rect queryBounds((INT)pX, (INT)pY, (INT)pWidth, (INT)pHeight); + + // create a new snapshot with the same window id and bounds as the query. + TX_HANDLE hSnapshot(TX_EMPTY_HANDLE); + txCreateSnapshotForQuery(hQuery, &hSnapshot); + + TX_CHAR windowIdString[bufferSize]; + sprintf_s(windowIdString, bufferSize, WINDOW_HANDLE_FORMAT, _hWnd); + + if (QueryIsForWindowId(hQuery, windowIdString)) + { + // define options for our activatable regions: no, we don't want tentative focus events. + TX_ACTIVATABLEPARAMS params = { TX_FALSE }; + + // iterate through all regions and create interactors for those that overlap with the query bounds. + for (auto region : _regions) + { + Gdiplus::Rect regionBounds((INT)region.bounds.left, (INT)region.bounds.top, + (INT)(region.bounds.right - region.bounds.left), (INT)(region.bounds.bottom - region.bounds.top)); + + if (queryBounds.IntersectsWith(regionBounds)) + { + TX_HANDLE hInteractor(TX_EMPTY_HANDLE); + sprintf_s(stringBuffer, bufferSize, "%d", region.id); + + TX_RECT bounds; + bounds.X = region.bounds.left; + bounds.Y = region.bounds.top; + bounds.Width = region.bounds.right - region.bounds.left; + bounds.Height = region.bounds.bottom - region.bounds.top; + + txCreateRectangularInteractor(hSnapshot, &hInteractor, stringBuffer, &bounds, TX_LITERAL_ROOTID, windowIdString); + txCreateActivatableBehavior(hInteractor, ¶ms); + + txReleaseObject(&hInteractor); + } + } + } + + txCommitSnapshotAsync(hSnapshot, OnSnapshotCommitted, nullptr); + txReleaseObject(&hSnapshot); + txReleaseObject(&hQuery); +} + +void EyeXHost::HandleEvent(TX_CONSTHANDLE hAsyncData) +{ + TX_HANDLE hEvent(TX_EMPTY_HANDLE); + txGetAsyncDataContent(hAsyncData, &hEvent); + + // NOTE. Uncomment the following line of code to view the event object. The same function can be used with any interaction object. + //OutputDebugStringA(txDebugObject(hEvent)); + + // read the interactor ID from the event. + const int bufferSize = 20; + TX_CHAR stringBuffer[bufferSize]; + TX_SIZE idLength(bufferSize); + if (txGetEventInteractorId(hEvent, stringBuffer, &idLength) == TX_RESULT_OK) + { + int interactorId = atoi(stringBuffer); + + HandleActivatableEvent(hEvent, interactorId); + } + + txReleaseObject(&hEvent); +} + +void EyeXHost::HandleActivatableEvent(TX_HANDLE hEvent, int interactorId) +{ + TX_HANDLE hActivatable(TX_EMPTY_HANDLE); + if (txGetEventBehavior(hEvent, &hActivatable, TX_BEHAVIORTYPE_ACTIVATABLE) == TX_RESULT_OK) + { + TX_ACTIVATABLEEVENTTYPE eventType; + if (txGetActivatableEventType(hActivatable, &eventType) == TX_RESULT_OK) + { + if (eventType == TX_ACTIVATABLEEVENTTYPE_ACTIVATED) + { + OnActivated(hActivatable, interactorId); + } + else if (eventType == TX_ACTIVATABLEEVENTTYPE_ACTIVATIONFOCUSCHANGED) + { + OnActivationFocusChanged(hActivatable, interactorId); + } + } + + txReleaseObject(&hActivatable); + } +} + +void EyeXHost::OnActivationFocusChanged(TX_HANDLE hBehavior, int interactorId) +{ + TX_ACTIVATIONFOCUSCHANGEDEVENTPARAMS eventData; + if (txGetActivationFocusChangedEventParams(hBehavior, &eventData) == TX_RESULT_OK) + { + if (eventData.HasActivationFocus) + { + SetFocusedRegionId(interactorId); + } + else + { + SetFocusedRegionId(-1); + } + } +} + +void EyeXHost::OnActivated(TX_HANDLE hBehavior, int interactorId) +{ + PostMessage(_hWnd, _regionActivatedMessage, interactorId, 0); +} + +void TX_CALLCONVENTION EyeXHost::OnSnapshotCommitted(TX_CONSTHANDLE hAsyncData, TX_USERPARAM param) +{ + // check the result code using an assertion. + // this will catch validation errors and runtime errors in debug builds. in release builds it won't do anything. + + TX_RESULT result = TX_RESULT_UNKNOWN; + txGetAsyncDataResultCode(hAsyncData, &result); + assert(result == TX_RESULT_OK || result == TX_RESULT_CANCELLED); +} + +bool EyeXHost::QueryIsForWindowId(TX_HANDLE hQuery, const TX_CHAR* windowId) +{ + const int bufferSize = 20; + TX_CHAR buffer[bufferSize]; + + TX_SIZE count; + if (TX_RESULT_OK == txGetQueryWindowIdCount(hQuery, &count)) + { + for (int i = 0; i < count; i++) + { + TX_SIZE size = bufferSize; + if (TX_RESULT_OK == txGetQueryWindowId(hQuery, i, buffer, &size)) + { + if (0 == strcmp(windowId, buffer)) + { + return true; + } + } + } + } + + return false; +} diff --git a/Tobii EyeX/samples/ActivatableBoardGame/EyeXHost.h b/Tobii EyeX/samples/ActivatableBoardGame/EyeXHost.h new file mode 100755 index 0000000..98aa84d --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/EyeXHost.h @@ -0,0 +1,111 @@ +/* + * EyeXHost class: Responsible for the gaze interaction within a window. + * Holds the current set of activatable regions and acts as a simple interactor repository. + * Sends notifications as Windows messages so that they are received on the main thread and can be handled there. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#pragma once + +#include +#include +#include +#include "eyex/EyeX.h" + +class EyeXHost +{ +public: + // Represents an activatable region, that is, one particular kind of interactor. + struct ActivatableRegion + { + int id; + RECT bounds; + + ActivatableRegion(int paramId, RECT paramBounds) : id(paramId), bounds(paramBounds) { } + }; + + EyeXHost(); + virtual ~EyeXHost(); + + // attaches to the window with the given handle. + // the message parameters are custom windows messages sent to the window when an event has occurred. + void Init(HWND hWnd, UINT statusChangedMessage, UINT focusedRegionChangedMessage, UINT regionActivatedMessage); + + // updates the collection (repository) of activatable regions. + void SetActivatableRegions(const std::vector& regions); + + // gets the ID of the region that currently has the activation focus. + int GetFocusedRegionId() const; + + // triggers an activation ("direct click"). + void TriggerActivation(); + + // trigger a request to the EyeX Engine to switch activation mode on. + // this will trigger Activation Focus Changed events to be raised for the + // interactor the user is looking at/no longer looking at. + // in this sample, the focus is used to draw a highlight on in the square + // that is about to be "clicked" - where the "X" will be placed. + void TriggerActivationModeOn(); + + // indicates whether the connection to the EyeX Engine is working. + bool IsFunctional() const; + +private: + enum State + { + Initializing, + Connected, + Disconnected, + Failed + }; + + // registers handlers for notifications from the engine. + bool RegisterConnectionStateChangedHandler(); + bool RegisterQueryHandler(); + bool RegisterEventHandler(); + + // event handlers. + void OnEngineConnectionStateChanged(TX_CONNECTIONSTATE connectionState); + void HandleQuery(TX_CONSTHANDLE hAsyncData); + void HandleEvent(TX_CONSTHANDLE hAsyncData); + void HandleActivatableEvent(TX_HANDLE hEvent, int interactorId); + void OnActivationFocusChanged(TX_HANDLE hBehavior, int interactorId); + void OnActivated(TX_HANDLE hBehavior, int interactorId); + + // callback function invoked when a snapshot has been committed. + static void TX_CALLCONVENTION OnSnapshotCommitted(TX_CONSTHANDLE hAsyncData, TX_USERPARAM param); + + // sets the internal state. + void SetState(State state); + + // sets the ID of the region that currently has the activation focus. + void SetFocusedRegionId(int regionId); + + // clears the focused region ID if there is no matching region in the repository. + void ResetFocusedRegionIdIfNonExistent(); + + static bool QueryIsForWindowId(TX_HANDLE hQuery, const TX_CHAR* windowId); + + // mutex protecting the state of the object from race conditions caused by multiple threads. + // (for example, a call to SetActivatableRegions from the main thread while the HandleQuery + // method is iterating through the regions on a worker thread.) + std::mutex _mutex; + State _state; + std::vector _regions; + int _focusedRegionId; + TX_CONTEXTHANDLE _context; + TX_TICKET _connectionStateChangedTicket; + TX_TICKET _queryHandlerTicket; + TX_TICKET _eventHandlerTicket; + + // attached window and custom messages. + HWND _hWnd; + UINT _statusChangedMessage; + UINT _focusedRegionChangedMessage; + UINT _regionActivatedMessage; + + // private copy constructor and operator making the class non-copyable (declared but not implemented). + EyeXHost(const EyeXHost&); + EyeXHost& operator = (const EyeXHost&); +}; diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Observer.h b/Tobii EyeX/samples/ActivatableBoardGame/Observer.h new file mode 100755 index 0000000..8aa98c1 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/Observer.h @@ -0,0 +1,13 @@ +/* + * Observer interface: Standard Observer interface used for notifying an object of a change in another object. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#pragma once + +class Observer +{ +public: + virtual void SubjectChanged() = 0; +}; diff --git a/Tobii EyeX/samples/ActivatableBoardGame/Resource.h b/Tobii EyeX/samples/ActivatableBoardGame/Resource.h new file mode 100755 index 0000000..6a23727 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/Resource.h differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/small.ico b/Tobii EyeX/samples/ActivatableBoardGame/small.ico new file mode 100755 index 0000000..449296f Binary files /dev/null and b/Tobii EyeX/samples/ActivatableBoardGame/small.ico differ diff --git a/Tobii EyeX/samples/ActivatableBoardGame/stdafx.cpp b/Tobii EyeX/samples/ActivatableBoardGame/stdafx.cpp new file mode 100755 index 0000000..92e931f --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/stdafx.cpp @@ -0,0 +1,3 @@ +// stdafx.cpp : source file that includes just the standard includes + +#include "stdafx.h" diff --git a/Tobii EyeX/samples/ActivatableBoardGame/stdafx.h b/Tobii EyeX/samples/ActivatableBoardGame/stdafx.h new file mode 100755 index 0000000..705c92c --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/stdafx.h @@ -0,0 +1,17 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include diff --git a/Tobii EyeX/samples/ActivatableBoardGame/targetver.h b/Tobii EyeX/samples/ActivatableBoardGame/targetver.h new file mode 100755 index 0000000..90e767b --- /dev/null +++ b/Tobii EyeX/samples/ActivatableBoardGame/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.cpp b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.cpp new file mode 100755 index 0000000..8cee1c3 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.cpp @@ -0,0 +1,357 @@ +/* + * ActivatableButtons sample: + * This is an example that demonstrates the Activatable behavior. + * It features two buttons that can be clicked by looking at the button and pressing the space bar. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#include "stdafx.h" +#include +#include +#include +#include "resource.h" +#include "EyeXHost.h" + +#pragma comment (lib, "Gdiplus.lib") + +// window messages used for notifications from the EyeXHost. +#define WM_EYEX_HOST_STATUS_CHANGED WM_USER + 0 +#define WM_REGION_GOT_ACTIVATION_FOCUS WM_USER + 1 +#define WM_REGION_ACTIVATED WM_USER + 2 + +// constants. +static const Gdiplus::Color OriginalBackgroundColor(66, 173, 209); +static const Gdiplus::Color OtherBackgroundColor(89, 169, 108); +static const int ChangeButtonLeft = 50; +static const int ResetButtonLeft = 260; +static const int ButtonTop = 100; +static const int ButtonWidth = 160; +static const int ButtonHeight = 100; +static const TCHAR* g_szWindowClass = _T("ActivatableButtons"); + +// global variables. +static EyeXHost g_eyeXHost; +static HWND g_hWnd; +static HWND g_hChangeButton; +static HWND g_hResetButton; +static bool g_useOriginalColor = true; + +// gets the bounds of a button in screen coordinates. +RECT GetScreenBounds(HWND hButton) +{ + POINT point = { 0, 0 }; + ClientToScreen(hButton, &point); + + RECT bounds; + bounds.left = point.x; + bounds.top = point.y; + bounds.right = bounds.left + ButtonWidth; + bounds.bottom = bounds.top + ButtonHeight; + + return bounds; +} + +// reports the buttons as activatable regions to the EyeX host. +void UpdateActivatableRegions() +{ + std::vector regions; + + regions.push_back(EyeXHost::ActivatableRegion(IDC_CHANGE_COLOR_BUTTON, GetScreenBounds(g_hChangeButton))); + regions.push_back(EyeXHost::ActivatableRegion(IDC_RESET_COLOR_BUTTON, GetScreenBounds(g_hResetButton))); + + g_eyeXHost.SetActivatableRegions(regions); +} + +// event handler invoked when a "status changed" event has been received from the EyeX host. +void OnStatusChanged(bool engineConnectionIsFunctional) +{ + // update the window title to reflect the engine connection state. + if (engineConnectionIsFunctional) + { + SetWindowText(g_hWnd, _T("ActivatableButtons - Use Ur Eyez! :)")); + } + else + { + SetWindowText(g_hWnd, _T("ActivatableButtons - Mouse Only :(")); + } +} + +// event handler invoked when a region has received the activation focus. +void OnRegionGotActivationFocus(UINT regionId) +{ + // set the keyboard focus to the corresponding button. + switch(regionId) + { + case IDC_CHANGE_COLOR_BUTTON: + SetFocus(g_hChangeButton); + break; + + case IDC_RESET_COLOR_BUTTON: + SetFocus(g_hResetButton); + break; + } +} + +// event handler invoked when the "change color" button has been activated. +void OnChangeColorActivated() +{ + g_useOriginalColor = false; + InvalidateRect(g_hWnd, 0, FALSE); +} + +// event handler invoked when the "reset color" button has been activated. +void OnResetColorActivated() +{ + g_useOriginalColor = true; + InvalidateRect(g_hWnd, 0, FALSE); +} + +// event handler invoked when a region has received an activation event. +void OnRegionActivated(UINT regionId) +{ + // route the event to the corresponding button. + switch(regionId) + { + case IDC_CHANGE_COLOR_BUTTON: + OnChangeColorActivated(); + break; + + case IDC_RESET_COLOR_BUTTON: + OnResetColorActivated(); + break; + } +} + +void OnDraw(HDC hdc) +{ + Gdiplus::Graphics graphics(hdc); + + RECT rect; + GetClientRect(g_hWnd, &rect); + + Gdiplus::Color backgroundColor(OriginalBackgroundColor); + if (!g_useOriginalColor) + { + backgroundColor = OtherBackgroundColor; + } + + Gdiplus::SolidBrush backgroundBrush(backgroundColor); + graphics.FillRectangle(&backgroundBrush, rect.left, rect.top, rect.right - rect.left, rect.bottom - rect.top); + + const TCHAR* message = _T("Click the buttons with your eyes! Look at a button and press the space bar to click. ") + _T("(Make sure the window has input focus.)"); + Gdiplus::Font font(_T("Arial"), 10); + Gdiplus::SolidBrush textBrush(Gdiplus::Color::Black); + Gdiplus::RectF textRect((Gdiplus::REAL)10, + (Gdiplus::REAL)(ButtonTop + ButtonHeight + 20), + (Gdiplus::REAL)(rect.right - 20), + (Gdiplus::REAL)(rect.bottom - rect.top)); + Gdiplus::StringFormat textFormat; + graphics.DrawString(message, (INT)_tcslen(message), &font, textRect, &textFormat, &textBrush); +} + +// +// FUNCTION: WndProc(HWND, UINT, WPARAM, LPARAM) +// +// PURPOSE: Processes messages for the main window. +// +// WM_COMMAND - process the application menu +// WM_PAINT - Paint the main window +// WM_DESTROY - post a quit message and return +// +// +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + PAINTSTRUCT ps; + HDC hdc; + + switch (message) + { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + switch (wmId) + { + case IDC_CHANGE_COLOR_BUTTON: + OnChangeColorActivated(); + break; + + case IDC_RESET_COLOR_BUTTON: + OnResetColorActivated(); + break; + + case IDM_EXIT: + DestroyWindow(hWnd); + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + + case WM_CREATE: + { + g_hChangeButton = CreateWindow( + _T("BUTTON"), + _T("Change color"), + WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON, + ChangeButtonLeft, ButtonTop, ButtonWidth, ButtonHeight, + hWnd, + (HMENU)IDC_CHANGE_COLOR_BUTTON, + GetModuleHandle(NULL), + NULL); + g_hResetButton = CreateWindow( + _T("BUTTON"), + _T("Reset color"), + WS_TABSTOP|WS_VISIBLE|WS_CHILD|BS_DEFPUSHBUTTON, + ResetButtonLeft, ButtonTop, ButtonWidth, ButtonHeight, + hWnd, + (HMENU)IDC_RESET_COLOR_BUTTON, + GetModuleHandle(NULL), + NULL); + } + break; + + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + OnDraw(hdc); + EndPaint(hWnd, &ps); + break; + + case WM_ERASEBKGND: + // no background erasing needed since our OnDraw method draws the entire window. + return TRUE; + + case WM_EYEX_HOST_STATUS_CHANGED: + OnStatusChanged(wParam != FALSE); + break; + + case WM_REGION_GOT_ACTIVATION_FOCUS: + OnRegionGotActivationFocus((UINT)wParam); + break; + + case WM_REGION_ACTIVATED: + OnRegionActivated((UINT)wParam); + break; + + case WM_WINDOWPOSCHANGED: + UpdateActivatableRegions(); + break; + + case WM_DESTROY: + PostQuitMessage(0); + break; + + case WM_KEYDOWN: + // trigger an activation command when space is pressed. + if (VK_SPACE == wParam) + { + g_eyeXHost.TriggerActivation(); + } + break; + + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + +// +// FUNCTION: MyRegisterClass() +// +// PURPOSE: Registers the window class. +// +ATOM MyRegisterClass(HINSTANCE hInstance) +{ + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ACTIVATABLEBUTTONS)); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = 0; + wcex.lpszMenuName = MAKEINTRESOURCE(IDC_ACTIVATABLEBUTTONS); + wcex.lpszClassName = g_szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); + + return RegisterClassEx(&wcex); +} + +// +// FUNCTION: InitInstance(HINSTANCE, int) +// +// PURPOSE: Saves instance handle and creates main window +// +// COMMENTS: +// +// In this function, we save the instance handle in a global variable and +// create and display the main program window. +// +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + g_hWnd = CreateWindow(g_szWindowClass, _T(""), WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, 490, 380, NULL, NULL, hInstance, NULL); + + if (!g_hWnd) + { + return FALSE; + } + + ShowWindow(g_hWnd, nCmdShow); + UpdateWindow(g_hWnd); + + // initialize the EyeX host and the activatable regions. + g_eyeXHost.Init(g_hWnd, WM_EYEX_HOST_STATUS_CHANGED, WM_REGION_GOT_ACTIVATION_FOCUS, WM_REGION_ACTIVATED); + UpdateActivatableRegions(); + + return TRUE; +} + +// Application entry point. +int APIENTRY _tWinMain(_In_ HINSTANCE hInstance, + _In_opt_ HINSTANCE hPrevInstance, + _In_ LPTSTR lpCmdLine, + _In_ int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + // Initialize gdiplus + ULONG_PTR gdiplusToken; + Gdiplus::GdiplusStartupInput gdiplusStartupInput; + Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + MyRegisterClass(hInstance); + + // Perform application initialization: + if (!InitInstance (hInstance, nCmdShow)) + { + return FALSE; + } + + HACCEL hAccelTable; + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_ACTIVATABLEBUTTONS)); + + // Main message loop: + MSG msg; + while (GetMessage(&msg, NULL, 0, 0)) + { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) + { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + // Shutdown: + Gdiplus::GdiplusShutdown(gdiplusToken); + + return (int) msg.wParam; +} diff --git a/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.ico b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.ico new file mode 100755 index 0000000..449296f Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.ico differ diff --git a/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.rc b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.rc new file mode 100755 index 0000000..8f97f8c Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.rc differ diff --git a/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.vcxproj b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.vcxproj new file mode 100755 index 0000000..9bc381e --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.vcxproj @@ -0,0 +1,188 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {3E2A1867-D554-4655-8F03-B6A4C06D4967} + Win32Proj + ActivatableButtons + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\..\include;%(AdditionalIncludeDirectories) + + + Windows + true + ..\..\lib\x86 + + + true + + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\..\include;%(AdditionalIncludeDirectories) + + + Windows + true + ..\..\lib\x64 + + + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\..\include;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + ..\..\lib\x86 + + + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + ..\..\include;%(AdditionalIncludeDirectories) + + + Windows + true + true + true + ..\..\lib\x64 + + + true + + + + + + + + + + + + + Create + Create + Create + Create + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.vcxproj.filters b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.vcxproj.filters new file mode 100755 index 0000000..dd3cdd3 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/ActivatableButtons.vcxproj.filters @@ -0,0 +1,55 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + + + Resource Files + + + Resource Files + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/ActivatableButtons.lastbuildstate b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/ActivatableButtons.lastbuildstate new file mode 100755 index 0000000..5cd4c3b --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/ActivatableButtons.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 +Debug|Win32|D:\dev\tobii\samples\| diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.command.1.tlog b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.command.1.tlog new file mode 100755 index 0000000..8c2918b Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.command.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.read.1.tlog b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.read.1.tlog new file mode 100755 index 0000000..64925ad Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.read.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.write.1.tlog b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.write.1.tlog new file mode 100755 index 0000000..54a1b52 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/CL.write.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.command.1.tlog b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.command.1.tlog new file mode 100755 index 0000000..5c8ec49 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.command.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.read.1.tlog b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.read.1.tlog new file mode 100755 index 0000000..5822f11 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.read.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.write.1.tlog b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.write.1.tlog new file mode 100755 index 0000000..2f69de6 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/link.write.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.command.1.tlog b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.command.1.tlog new file mode 100755 index 0000000..4506a2b Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.command.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.read.1.tlog b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.read.1.tlog new file mode 100755 index 0000000..a3ad644 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.read.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.write.1.tlog b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.write.1.tlog new file mode 100755 index 0000000..952d17c Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/Activata.3E2A1867.tlog/rc.write.1.tlog differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.log b/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.log new file mode 100755 index 0000000..87b519f --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.log @@ -0,0 +1,6 @@ + stdafx.cpp + EyeXHost.cpp +d:\dev\tobii\samples\activatablebuttons\eyexhost.cpp(158): warning C4477: 'sprintf_s' : format string '%d' requires an argument of type 'int', but variadic argument 1 has type 'HWND' + ActivatableButtons.cpp + Generating Code... + ActivatableButtons.vcxproj -> D:\dev\tobii\samples\Debug\ActivatableButtons.exe diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.obj b/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.obj new file mode 100755 index 0000000..d058330 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.obj differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.pch b/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.pch new file mode 100755 index 0000000..cee1ac5 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.pch differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.res b/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.res new file mode 100755 index 0000000..9cfd8cd Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/ActivatableButtons.res differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/EyeXHost.obj b/Tobii EyeX/samples/ActivatableButtons/Debug/EyeXHost.obj new file mode 100755 index 0000000..b7e4d31 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/EyeXHost.obj differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/stdafx.obj b/Tobii EyeX/samples/ActivatableButtons/Debug/stdafx.obj new file mode 100755 index 0000000..b3c70a5 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/stdafx.obj differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/vc140.idb b/Tobii EyeX/samples/ActivatableButtons/Debug/vc140.idb new file mode 100755 index 0000000..ec0d0d4 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/vc140.idb differ diff --git a/Tobii EyeX/samples/ActivatableButtons/Debug/vc140.pdb b/Tobii EyeX/samples/ActivatableButtons/Debug/vc140.pdb new file mode 100755 index 0000000..8f0aa96 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Debug/vc140.pdb differ diff --git a/Tobii EyeX/samples/ActivatableButtons/EyeXHost.cpp b/Tobii EyeX/samples/ActivatableButtons/EyeXHost.cpp new file mode 100755 index 0000000..3291e54 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/EyeXHost.cpp @@ -0,0 +1,294 @@ +/* + * ActivatableButtons sample: + * This is an example that demonstrates the Activatable behavior. + * It features two buttons that can be clicked by looking at the button and pressing the space bar. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#include "stdafx.h" +#include "EyeXHost.h" +#include +#include +#include +#include + +#pragma comment (lib, "Tobii.EyeX.Client.lib") + +#if INTPTR_MAX == INT64_MAX +#define WINDOW_HANDLE_FORMAT "%lld" +#else +#define WINDOW_HANDLE_FORMAT "%d" +#endif + +EyeXHost::EyeXHost() + : _hWnd(nullptr), _statusChangedMessage(0), _focusedRegionChangedMessage(0), _regionActivatedMessage(0) +{ + // initialize the EyeX Engine client library. + txInitializeEyeX(TX_EYEXCOMPONENTOVERRIDEFLAG_NONE, nullptr, nullptr, nullptr, nullptr); + + // create a context and register event handlers. + txCreateContext(&_context, TX_FALSE); + RegisterConnectionStateChangedHandler(); + RegisterQueryHandler(); + RegisterEventHandler(); +} + +EyeXHost::~EyeXHost() +{ + if (_context != TX_EMPTY_HANDLE) + { + // shut down, then release the context. + txShutdownContext(_context, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE); + txReleaseContext(&_context); + } +} + +void EyeXHost::Init(HWND hWnd, UINT statusChangedMessage, UINT focusedRegionChangedMessage, UINT regionActivatedMessage) +{ + _hWnd = hWnd; + _statusChangedMessage = statusChangedMessage; + _focusedRegionChangedMessage = focusedRegionChangedMessage; + _regionActivatedMessage = regionActivatedMessage; + + // connect to the engine. + if (txEnableConnection(_context) != TX_RESULT_OK) + { + PostMessage(_hWnd, _statusChangedMessage, false, 0); + } +} + +void EyeXHost::SetActivatableRegions(const std::vector& regions) +{ + std::lock_guard lock(_mutex); + + _regions.assign(regions.begin(), regions.end()); +} + +void EyeXHost::TriggerActivation() +{ + TX_HANDLE command(TX_EMPTY_HANDLE); + txCreateActionCommand(_context, &command, TX_ACTIONTYPE_ACTIVATE); + txExecuteCommandAsync(command, NULL, NULL); + txReleaseObject(&command); +} + +void EyeXHost::OnEngineConnectionStateChanged(TX_CONNECTIONSTATE connectionState) +{ + // note the use of the asynchronous PostMessage function to marshal the event to the main thread. + // (this callback function is typically invoked on a worker thread.) + switch (connectionState) + { + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_CONNECTED: + PostMessage(_hWnd, _statusChangedMessage, true, 0); + break; + + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_DISCONNECTED: + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_TRYINGTOCONNECT: + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_SERVERVERSIONTOOLOW: + case TX_CONNECTIONSTATE::TX_CONNECTIONSTATE_SERVERVERSIONTOOHIGH: + PostMessage(_hWnd, _statusChangedMessage, false, 0); + break; + + default: + break; + } +} + +bool EyeXHost::RegisterConnectionStateChangedHandler() +{ + auto connectionStateChangedTrampoline = [](TX_CONNECTIONSTATE connectionState, TX_USERPARAM userParam) + { + static_cast(userParam)->OnEngineConnectionStateChanged(connectionState); + }; + + bool success = txRegisterConnectionStateChangedHandler(_context, &_connectionStateChangedTicket, connectionStateChangedTrampoline, this) == TX_RESULT_OK; + return success; +} + +bool EyeXHost::RegisterQueryHandler() +{ + auto queryHandlerTrampoline = [](TX_CONSTHANDLE hObject, TX_USERPARAM userParam) + { + static_cast(userParam)->HandleQuery(hObject); + }; + + bool success = txRegisterQueryHandler(_context, &_queryHandlerTicket, queryHandlerTrampoline, this) == TX_RESULT_OK; + return success; +} + +bool EyeXHost::RegisterEventHandler() +{ + auto eventHandlerTrampoline = [](TX_CONSTHANDLE hObject, TX_USERPARAM userParam) + { + static_cast(userParam)->HandleEvent(hObject); + }; + + bool success = txRegisterEventHandler(_context, &_eventHandlerTicket, eventHandlerTrampoline, this) == TX_RESULT_OK; + return success; +} + +void EyeXHost::HandleQuery(TX_CONSTHANDLE hAsyncData) +{ + std::lock_guard lock(_mutex); + + // NOTE. This method will fail silently if, for example, the connection is lost before the snapshot has been committed, + // or if we run out of memory. This is by design, because there is nothing we can do to recover from these errors anyway. + + TX_HANDLE hQuery(TX_EMPTY_HANDLE); + txGetAsyncDataContent(hAsyncData, &hQuery); + + const int bufferSize = 20; + TX_CHAR stringBuffer[bufferSize]; + + // read the query bounds from the query, that is, the area on the screen that the query concerns. + // the query region is always rectangular. + TX_HANDLE hBounds(TX_EMPTY_HANDLE); + txGetQueryBounds(hQuery, &hBounds); + TX_REAL pX, pY, pWidth, pHeight; + txGetRectangularBoundsData(hBounds, &pX, &pY, &pWidth, &pHeight); + txReleaseObject(&hBounds); + Gdiplus::Rect queryBounds((INT)pX, (INT)pY, (INT)pWidth, (INT)pHeight); + + // create a new snapshot with the same window id and bounds as the query. + TX_HANDLE hSnapshot(TX_EMPTY_HANDLE); + txCreateSnapshotForQuery(hQuery, &hSnapshot); + + TX_CHAR windowIdString[bufferSize]; + sprintf_s(windowIdString, bufferSize, WINDOW_HANDLE_FORMAT, _hWnd); + + if (QueryIsForWindowId(hQuery, windowIdString)) + { + // define options for our activatable regions: no, we don't want tentative focus events. + TX_ACTIVATABLEPARAMS params = { TX_FALSE }; + + // iterate through all regions and create interactors for those that overlap with the query bounds. + for (auto region : _regions) + { + Gdiplus::Rect regionBounds((INT)region.bounds.left, (INT)region.bounds.top, + (INT)(region.bounds.right - region.bounds.left), (INT)(region.bounds.bottom - region.bounds.top)); + + if (queryBounds.IntersectsWith(regionBounds)) + { + TX_HANDLE hInteractor(TX_EMPTY_HANDLE); + + sprintf_s(stringBuffer, bufferSize, "%d", region.id); + + TX_RECT bounds; + bounds.X = region.bounds.left; + bounds.Y = region.bounds.top; + bounds.Width = region.bounds.right - region.bounds.left; + bounds.Height = region.bounds.bottom - region.bounds.top; + + txCreateRectangularInteractor(hSnapshot, &hInteractor, stringBuffer, &bounds, TX_LITERAL_ROOTID, windowIdString); + txCreateActivatableBehavior(hInteractor, ¶ms); + + txReleaseObject(&hInteractor); + } + } + } + + txCommitSnapshotAsync(hSnapshot, OnSnapshotCommitted, nullptr); + txReleaseObject(&hSnapshot); + txReleaseObject(&hQuery); +} + +void EyeXHost::HandleEvent(TX_CONSTHANDLE hAsyncData) +{ + TX_HANDLE hEvent(TX_EMPTY_HANDLE); + txGetAsyncDataContent(hAsyncData, &hEvent); + + // NOTE. Uncomment the following line of code to view the event object. The same function can be used with any interaction object. + //OutputDebugStringA(txDebugObject(hEvent)); + + // read the interactor ID from the event. + const int bufferSize = 20; + TX_CHAR stringBuffer[bufferSize]; + TX_SIZE idLength(bufferSize); + if (txGetEventInteractorId(hEvent, stringBuffer, &idLength) == TX_RESULT_OK) + { + int interactorId = atoi(stringBuffer); + + HandleActivatableEvent(hEvent, interactorId); + } + + txReleaseObject(&hEvent); +} + +void EyeXHost::HandleActivatableEvent(TX_HANDLE hEvent, int interactorId) +{ + TX_HANDLE hActivatable(TX_EMPTY_HANDLE); + if (txGetEventBehavior(hEvent, &hActivatable, TX_BEHAVIORTYPE_ACTIVATABLE) == TX_RESULT_OK) + { + TX_ACTIVATABLEEVENTTYPE eventType; + if (txGetActivatableEventType(hActivatable, &eventType) == TX_RESULT_OK) + { + if (eventType == TX_ACTIVATABLEEVENTTYPE_ACTIVATED) + { + OnActivated(hActivatable, interactorId); + } + else if (eventType == TX_ACTIVATABLEEVENTTYPE_ACTIVATIONFOCUSCHANGED) + { + OnActivationFocusChanged(hActivatable, interactorId); + } + } + + txReleaseObject(&hActivatable); + } +} + +void EyeXHost::OnActivationFocusChanged(TX_HANDLE hBehavior, int interactorId) +{ + TX_ACTIVATIONFOCUSCHANGEDEVENTPARAMS eventData; + if (txGetActivationFocusChangedEventParams(hBehavior, &eventData) == TX_RESULT_OK) + { + if (eventData.HasActivationFocus) + { + PostMessage(_hWnd, _focusedRegionChangedMessage, interactorId, 0); + } + else + { + PostMessage(_hWnd, _focusedRegionChangedMessage, -1, 0); + } + + } +} + +void EyeXHost::OnActivated(TX_HANDLE hBehavior, int interactorId) +{ + PostMessage(_hWnd, _regionActivatedMessage, interactorId, 0); +} + +void TX_CALLCONVENTION EyeXHost::OnSnapshotCommitted(TX_CONSTHANDLE hAsyncData, TX_USERPARAM param) +{ + // check the result code using an assertion. + // this will catch validation errors and runtime errors in debug builds. in release builds it won't do anything. + + TX_RESULT result = TX_RESULT_UNKNOWN; + txGetAsyncDataResultCode(hAsyncData, &result); + assert(result == TX_RESULT_OK || result == TX_RESULT_CANCELLED); +} + +bool EyeXHost::QueryIsForWindowId(TX_HANDLE hQuery, const TX_CHAR* windowId) +{ + const int bufferSize = 20; + TX_CHAR buffer[bufferSize]; + + TX_SIZE count; + if (TX_RESULT_OK == txGetQueryWindowIdCount(hQuery, &count)) + { + for (int i = 0; i < count; i++) + { + TX_SIZE size = bufferSize; + if (TX_RESULT_OK == txGetQueryWindowId(hQuery, i, buffer, &size)) + { + if (0 == strcmp(windowId, buffer)) + { + return true; + } + } + } + } + + return false; +} diff --git a/Tobii EyeX/samples/ActivatableButtons/EyeXHost.h b/Tobii EyeX/samples/ActivatableButtons/EyeXHost.h new file mode 100755 index 0000000..6ee7493 --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/EyeXHost.h @@ -0,0 +1,79 @@ +/* + * EyeXHost class: Responsible for the gaze interaction within a window. + * Holds the current set of activatable regions and acts as a simple interactor repository. + * Sends notifications as Windows messages so that they are received on the main thread and can be handled there. + * + * Copyright 2013 Tobii Technology AB. All rights reserved. + */ + +#pragma once + +#include +#include +#include +#include "eyex/EyeX.h" + +class EyeXHost +{ +public: + // Represents an activatable region, that is, one particular kind of interactor. + struct ActivatableRegion + { + int id; + RECT bounds; + + ActivatableRegion(int paramId, RECT paramBounds) : id(paramId), bounds(paramBounds) { } + }; + + EyeXHost(); + virtual ~EyeXHost(); + + // attaches to the window with the given handle. + // the message parameters are custom windows messages sent to the window when an event has occurred. + void Init(HWND hWnd, UINT statusChangedMessage, UINT focusedRegionChangedMessage, UINT regionActivatedMessage); + + // updates the collection (repository) of activatable regions. + void SetActivatableRegions(const std::vector& regions); + + // triggers an activation ("direct click"). + void TriggerActivation(); + +private: + // registers handlers for notifications from the engine. + bool RegisterConnectionStateChangedHandler(); + bool RegisterQueryHandler(); + bool RegisterEventHandler(); + + // event handlers. + void OnEngineConnectionStateChanged(TX_CONNECTIONSTATE connectionState); + void HandleQuery(TX_CONSTHANDLE hAsyncData); + void HandleEvent(TX_CONSTHANDLE hAsyncData); + void HandleActivatableEvent(TX_HANDLE hEvent, int interactorId); + void OnActivationFocusChanged(TX_HANDLE hBehavior, int interactorId); + void OnActivated(TX_HANDLE hBehavior, int interactorId); + + // callback function invoked when a snapshot has been committed. + static void TX_CALLCONVENTION OnSnapshotCommitted(TX_CONSTHANDLE hAsyncData, TX_USERPARAM param); + + static bool QueryIsForWindowId(TX_HANDLE hQuery, const TX_CHAR* windowId); + + // mutex protecting the state of the object from race conditions caused by multiple threads. + // (for example, a call to SetActivatableRegions from the main thread while the HandleQuery + // method is iterating through the regions on a worker thread.) + std::mutex _mutex; + std::vector _regions; + TX_CONTEXTHANDLE _context; + TX_TICKET _connectionStateChangedTicket; + TX_TICKET _queryHandlerTicket; + TX_TICKET _eventHandlerTicket; + + // attached window and custom messages. + HWND _hWnd; + UINT _statusChangedMessage; + UINT _focusedRegionChangedMessage; + UINT _regionActivatedMessage; + + // private copy constructor and operator making the class non-copyable (declared but not implemented). + EyeXHost(const EyeXHost&); + EyeXHost& operator = (const EyeXHost&); +}; diff --git a/Tobii EyeX/samples/ActivatableButtons/Resource.h b/Tobii EyeX/samples/ActivatableButtons/Resource.h new file mode 100755 index 0000000..0d9e811 Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/Resource.h differ diff --git a/Tobii EyeX/samples/ActivatableButtons/small.ico b/Tobii EyeX/samples/ActivatableButtons/small.ico new file mode 100755 index 0000000..449296f Binary files /dev/null and b/Tobii EyeX/samples/ActivatableButtons/small.ico differ diff --git a/Tobii EyeX/samples/ActivatableButtons/stdafx.cpp b/Tobii EyeX/samples/ActivatableButtons/stdafx.cpp new file mode 100755 index 0000000..92e931f --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/stdafx.cpp @@ -0,0 +1,3 @@ +// stdafx.cpp : source file that includes just the standard includes + +#include "stdafx.h" diff --git a/Tobii EyeX/samples/ActivatableButtons/stdafx.h b/Tobii EyeX/samples/ActivatableButtons/stdafx.h new file mode 100755 index 0000000..705c92c --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/stdafx.h @@ -0,0 +1,17 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + +// C RunTime Header Files +#include +#include +#include +#include diff --git a/Tobii EyeX/samples/ActivatableButtons/targetver.h b/Tobii EyeX/samples/ActivatableButtons/targetver.h new file mode 100755 index 0000000..90e767b --- /dev/null +++ b/Tobii EyeX/samples/ActivatableButtons/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/Tobii EyeX/samples/CopyEyeXDllToOutputDirectory.targets b/Tobii EyeX/samples/CopyEyeXDllToOutputDirectory.targets new file mode 100755 index 0000000..bdc798e --- /dev/null +++ b/Tobii EyeX/samples/CopyEyeXDllToOutputDirectory.targets @@ -0,0 +1,19 @@ + + + + + + $(BuildLinkAction);CopyEyeXDllToOutputDirectory + + + + Tobii.EyeX.Client.dll + ..\..\lib\x64\$(EyeXDllName) + ..\..\lib\x86\$(EyeXDllName) + + + + + + + diff --git a/Tobii EyeX/samples/Debug/ActivatableBoardGame.exe b/Tobii EyeX/samples/Debug/ActivatableBoardGame.exe new file mode 100755 index 0000000..e13b5d0 Binary files /dev/null and b/Tobii EyeX/samples/Debug/ActivatableBoardGame.exe differ diff --git a/Tobii EyeX/samples/Debug/ActivatableBoardGame.ilk b/Tobii EyeX/samples/Debug/ActivatableBoardGame.ilk new file mode 100755 index 0000000..86410d6 Binary files /dev/null and b/Tobii EyeX/samples/Debug/ActivatableBoardGame.ilk differ diff --git a/Tobii EyeX/samples/Debug/ActivatableBoardGame.pdb b/Tobii EyeX/samples/Debug/ActivatableBoardGame.pdb new file mode 100755 index 0000000..647659b Binary files /dev/null and b/Tobii EyeX/samples/Debug/ActivatableBoardGame.pdb differ diff --git a/Tobii EyeX/samples/Debug/ActivatableButtons.exe b/Tobii EyeX/samples/Debug/ActivatableButtons.exe new file mode 100755 index 0000000..fbb924d Binary files /dev/null and b/Tobii EyeX/samples/Debug/ActivatableButtons.exe differ diff --git a/Tobii EyeX/samples/Debug/ActivatableButtons.ilk b/Tobii EyeX/samples/Debug/ActivatableButtons.ilk new file mode 100755 index 0000000..dae3b90 Binary files /dev/null and b/Tobii EyeX/samples/Debug/ActivatableButtons.ilk differ diff --git a/Tobii EyeX/samples/Debug/ActivatableButtons.pdb b/Tobii EyeX/samples/Debug/ActivatableButtons.pdb new file mode 100755 index 0000000..66c7dd9 Binary files /dev/null and b/Tobii EyeX/samples/Debug/ActivatableButtons.pdb differ diff --git a/Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.exe b/Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.exe new file mode 100755 index 0000000..eb8dea2 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.exe differ diff --git a/Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.ilk b/Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.ilk new file mode 100755 index 0000000..1104292 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.ilk differ diff --git a/Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.pdb b/Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.pdb new file mode 100755 index 0000000..c00ee89 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalEyePositionDataStream.pdb differ diff --git a/Tobii EyeX/samples/Debug/MinimalFixationDataStream.exe b/Tobii EyeX/samples/Debug/MinimalFixationDataStream.exe new file mode 100755 index 0000000..cede5c1 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalFixationDataStream.exe differ diff --git a/Tobii EyeX/samples/Debug/MinimalFixationDataStream.ilk b/Tobii EyeX/samples/Debug/MinimalFixationDataStream.ilk new file mode 100755 index 0000000..eb7355f Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalFixationDataStream.ilk differ diff --git a/Tobii EyeX/samples/Debug/MinimalFixationDataStream.pdb b/Tobii EyeX/samples/Debug/MinimalFixationDataStream.pdb new file mode 100755 index 0000000..ba64025 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalFixationDataStream.pdb differ diff --git a/Tobii EyeX/samples/Debug/MinimalGazeDataStream.exe b/Tobii EyeX/samples/Debug/MinimalGazeDataStream.exe new file mode 100755 index 0000000..38cca37 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalGazeDataStream.exe differ diff --git a/Tobii EyeX/samples/Debug/MinimalGazeDataStream.ilk b/Tobii EyeX/samples/Debug/MinimalGazeDataStream.ilk new file mode 100755 index 0000000..82cdd05 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalGazeDataStream.ilk differ diff --git a/Tobii EyeX/samples/Debug/MinimalGazeDataStream.pdb b/Tobii EyeX/samples/Debug/MinimalGazeDataStream.pdb new file mode 100755 index 0000000..f2b24b2 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalGazeDataStream.pdb differ diff --git a/Tobii EyeX/samples/Debug/MinimalStatusNotifications.exe b/Tobii EyeX/samples/Debug/MinimalStatusNotifications.exe new file mode 100755 index 0000000..8354e4f Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalStatusNotifications.exe differ diff --git a/Tobii EyeX/samples/Debug/MinimalStatusNotifications.ilk b/Tobii EyeX/samples/Debug/MinimalStatusNotifications.ilk new file mode 100755 index 0000000..771b8f9 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalStatusNotifications.ilk differ diff --git a/Tobii EyeX/samples/Debug/MinimalStatusNotifications.pdb b/Tobii EyeX/samples/Debug/MinimalStatusNotifications.pdb new file mode 100755 index 0000000..c73bf24 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalStatusNotifications.pdb differ diff --git a/Tobii EyeX/samples/Debug/MinimalUserProfiles.exe b/Tobii EyeX/samples/Debug/MinimalUserProfiles.exe new file mode 100755 index 0000000..7c21075 Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalUserProfiles.exe differ diff --git a/Tobii EyeX/samples/Debug/MinimalUserProfiles.ilk b/Tobii EyeX/samples/Debug/MinimalUserProfiles.ilk new file mode 100755 index 0000000..6b20d3f Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalUserProfiles.ilk differ diff --git a/Tobii EyeX/samples/Debug/MinimalUserProfiles.pdb b/Tobii EyeX/samples/Debug/MinimalUserProfiles.pdb new file mode 100755 index 0000000..897badd Binary files /dev/null and b/Tobii EyeX/samples/Debug/MinimalUserProfiles.pdb differ diff --git a/Tobii EyeX/samples/Debug/Tobii.EyeX.Client.dll b/Tobii EyeX/samples/Debug/Tobii.EyeX.Client.dll new file mode 100755 index 0000000..0e1e975 Binary files /dev/null and b/Tobii EyeX/samples/Debug/Tobii.EyeX.Client.dll differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.command.1.tlog b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.command.1.tlog new file mode 100755 index 0000000..778592a Binary files /dev/null and b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.read.1.tlog b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.read.1.tlog new file mode 100755 index 0000000..d263c73 Binary files /dev/null and b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.write.1.tlog b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.write.1.tlog new file mode 100755 index 0000000..66e1721 Binary files /dev/null and b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/CL.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/MinimalEyePositionDataStream.lastbuildstate b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/MinimalEyePositionDataStream.lastbuildstate new file mode 100755 index 0000000..5cd4c3b --- /dev/null +++ b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/MinimalEyePositionDataStream.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 +Debug|Win32|D:\dev\tobii\samples\| diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.command.1.tlog b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.command.1.tlog new file mode 100755 index 0000000..063463c Binary files /dev/null and b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.read.1.tlog b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.read.1.tlog new file mode 100755 index 0000000..0209802 Binary files /dev/null and b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.write.1.tlog b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.write.1.tlog new file mode 100755 index 0000000..dfdfde0 Binary files /dev/null and b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalE.6D2CFFFE.tlog/link.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalEyePositionDataStream.log b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalEyePositionDataStream.log new file mode 100755 index 0000000..f4e7d98 --- /dev/null +++ b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalEyePositionDataStream.log @@ -0,0 +1,2 @@ + MinimalEyePositionDataStream.c + MinimalEyePositionDataStream.vcxproj -> D:\dev\tobii\samples\Debug\MinimalEyePositionDataStream.exe diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalEyePositionDataStream.obj b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalEyePositionDataStream.obj new file mode 100755 index 0000000..94714f2 Binary files /dev/null and b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/MinimalEyePositionDataStream.obj differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/vc140.idb b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/vc140.idb new file mode 100755 index 0000000..65a10a3 Binary files /dev/null and b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/vc140.idb differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/vc140.pdb b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/vc140.pdb new file mode 100755 index 0000000..b8a41a3 Binary files /dev/null and b/Tobii EyeX/samples/MinimalEyePositionDataStream/Debug/vc140.pdb differ diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.c b/Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.c new file mode 100755 index 0000000..b979c6c --- /dev/null +++ b/Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.c @@ -0,0 +1,199 @@ +/* + * This is an example that demonstrates how to connect to the EyeX Engine and subscribe to the eye position data stream. + * + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + */ + +#include +#include +#include +#include +#include "eyex/EyeX.h" + +#pragma comment (lib, "Tobii.EyeX.Client.lib") + +// ID of the global interactor that provides our data stream; must be unique within the application. +static const TX_STRING InteractorId = "Fluttershy"; + +// global variables +static TX_HANDLE g_hGlobalInteractorSnapshot = TX_EMPTY_HANDLE; + +/* + * Initializes g_hGlobalInteractorSnapshot with an interactor that has the Eye Position behavior. + */ +BOOL InitializeGlobalInteractorSnapshot(TX_CONTEXTHANDLE hContext) +{ + TX_HANDLE hInteractor = TX_EMPTY_HANDLE; + TX_HANDLE hBehaviorWithoutParameters = TX_EMPTY_HANDLE; + + BOOL success; + + success = txCreateGlobalInteractorSnapshot( + hContext, + InteractorId, + &g_hGlobalInteractorSnapshot, + &hInteractor) == TX_RESULT_OK; + success &= txCreateInteractorBehavior(hInteractor, &hBehaviorWithoutParameters, TX_BEHAVIORTYPE_EYEPOSITIONDATA) == TX_RESULT_OK; + + txReleaseObject(&hInteractor); + + return success; +} + +/* + * Callback function invoked when a snapshot has been committed. + */ +void TX_CALLCONVENTION OnSnapshotCommitted(TX_CONSTHANDLE hAsyncData, TX_USERPARAM param) +{ + // check the result code using an assertion. + // this will catch validation errors and runtime errors in debug builds. in release builds it won't do anything. + + TX_RESULT result = TX_RESULT_UNKNOWN; + txGetAsyncDataResultCode(hAsyncData, &result); + assert(result == TX_RESULT_OK || result == TX_RESULT_CANCELLED); +} + +/* + * Callback function invoked when the status of the connection to the EyeX Engine has changed. + */ +void TX_CALLCONVENTION OnEngineConnectionStateChanged(TX_CONNECTIONSTATE connectionState, TX_USERPARAM userParam) +{ + switch (connectionState) { + case TX_CONNECTIONSTATE_CONNECTED: { + BOOL success; + printf("The connection state is now CONNECTED (We are connected to the EyeX Engine)\n"); + // commit the snapshot with the global interactor as soon as the connection to the engine is established. + // (it cannot be done earlier because committing means "send to the engine".) + success = txCommitSnapshotAsync(g_hGlobalInteractorSnapshot, OnSnapshotCommitted, NULL) == TX_RESULT_OK; + if (!success) { + printf("Failed to initialize the data stream.\n"); + } + else { + printf("Waiting for eye position data to start streaming...\n"); + } + } + break; + + case TX_CONNECTIONSTATE_DISCONNECTED: + printf("The connection state is now DISCONNECTED (We are disconnected from the EyeX Engine)\n"); + break; + + case TX_CONNECTIONSTATE_TRYINGTOCONNECT: + printf("The connection state is now TRYINGTOCONNECT (We are trying to connect to the EyeX Engine)\n"); + break; + + case TX_CONNECTIONSTATE_SERVERVERSIONTOOLOW: + printf("The connection state is now SERVER_VERSION_TOO_LOW: this application requires a more recent version of the EyeX Engine to run.\n"); + break; + + case TX_CONNECTIONSTATE_SERVERVERSIONTOOHIGH: + printf("The connection state is now SERVER_VERSION_TOO_HIGH: this application requires an older version of the EyeX Engine to run.\n"); + break; + } +} + +/* + * Handles an event from the Eye Position data stream. + */ +void OnEyePositionDataEvent(TX_HANDLE hEyePositionDataBehavior) +{ + COORD position = {0,8}; + TX_EYEPOSITIONDATAEVENTPARAMS eventParams; + if (txGetEyePositionDataEventParams(hEyePositionDataBehavior, &eventParams) == TX_RESULT_OK) { + SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), position); + + // Output information about the left eye. + printf("LEFT EYE\n"); + printf("========\n"); + printf("3D position: (%.1f, %.1f, %.1f) \n", + eventParams.LeftEyeX, eventParams.LeftEyeY, eventParams.LeftEyeZ); + printf("Normalized : (%.1f, %.1f, %.1f) \n", + eventParams.LeftEyeXNormalized, eventParams.LeftEyeYNormalized, eventParams.LeftEyeZNormalized); + + // Output information about the right eye. + printf("\n"); + printf("RIGHT EYE\n"); + printf("=========\n"); + printf("3D position: (%.1f, %.1f, %.1f) \n", + eventParams.RightEyeX, eventParams.RightEyeY, eventParams.RightEyeZ); + printf("Normalized : (%.1f, %.1f, %.1f) \n", + eventParams.RightEyeXNormalized, eventParams.RightEyeYNormalized, eventParams.RightEyeZNormalized); + + printf("\n"); + printf("The 3D position consists of X,Y,Z coordinates expressed in millimeters \n"); + printf("in relation to the center of the screen where the eye tracker is mounted. \n"); + printf("\n"); + printf("The normalized coordinates are expressed in relation to the track box, \n"); + printf("i.e. the volume in which the eye tracker is theoretically able to track eyes. \n"); + printf("- (0,0,0) represents the upper, right corner closest to the eye tracker. \n"); + printf("- (1,1,1) represents the lower, left corner furthest away from the eye tracker. \n"); + } else { + printf("Failed to interpret eye position data event packet.\n"); + } +} + +/* + * Callback function invoked when an event has been received from the EyeX Engine. + */ +void TX_CALLCONVENTION HandleEvent(TX_CONSTHANDLE hAsyncData, TX_USERPARAM userParam) +{ + TX_HANDLE hEvent = TX_EMPTY_HANDLE; + TX_HANDLE hBehavior = TX_EMPTY_HANDLE; + + txGetAsyncDataContent(hAsyncData, &hEvent); + + // NOTE. Uncomment the following line of code to view the event object. The same function can be used with any interaction object. + //OutputDebugStringA(txDebugObject(hEvent)); + + if (txGetEventBehavior(hEvent, &hBehavior, TX_BEHAVIORTYPE_EYEPOSITIONDATA) == TX_RESULT_OK) { + OnEyePositionDataEvent(hBehavior); + txReleaseObject(&hBehavior); + } + + // NOTE since this is a very simple application with a single interactor and a single data stream, + // our event handling code can be very simple too. A more complex application would typically have to + // check for multiple behaviors and route events based on interactor IDs. + + txReleaseObject(&hEvent); +} + +/* + * 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; +} diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.vcxproj b/Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.vcxproj new file mode 100755 index 0000000..fa69b14 --- /dev/null +++ b/Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.vcxproj @@ -0,0 +1,160 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + {6D2CFFFE-00E9-41C8-B389-059DA9AABDFC} + Win32Proj + MinimalEyePositionDataStream + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + ..\..\lib\x86 + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + ..\..\lib\x64 + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + true + true + ..\..\lib\x86 + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + true + true + ..\..\lib\x64 + + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.vcxproj.filters b/Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.vcxproj.filters new file mode 100755 index 0000000..eded50f --- /dev/null +++ b/Tobii EyeX/samples/MinimalEyePositionDataStream/MinimalEyePositionDataStream.vcxproj.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.command.1.tlog b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.command.1.tlog new file mode 100755 index 0000000..71e55ee Binary files /dev/null and b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.read.1.tlog b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.read.1.tlog new file mode 100755 index 0000000..5f407c0 Binary files /dev/null and b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.write.1.tlog b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.write.1.tlog new file mode 100755 index 0000000..d898b96 Binary files /dev/null and b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/CL.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/MinimalFixationDataStream.lastbuildstate b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/MinimalFixationDataStream.lastbuildstate new file mode 100755 index 0000000..5cd4c3b --- /dev/null +++ b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/MinimalFixationDataStream.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 +Debug|Win32|D:\dev\tobii\samples\| diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.command.1.tlog b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.command.1.tlog new file mode 100755 index 0000000..e5015ab Binary files /dev/null and b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.read.1.tlog b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.read.1.tlog new file mode 100755 index 0000000..e83e6a0 Binary files /dev/null and b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.write.1.tlog b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.write.1.tlog new file mode 100755 index 0000000..51ff531 Binary files /dev/null and b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalF.9345876F.tlog/link.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalFixationDataStream.log b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalFixationDataStream.log new file mode 100755 index 0000000..4122cb4 --- /dev/null +++ b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalFixationDataStream.log @@ -0,0 +1,2 @@ + MinimalFixationDataStream.c + MinimalFixationDataStream.vcxproj -> D:\dev\tobii\samples\Debug\MinimalFixationDataStream.exe diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalFixationDataStream.obj b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalFixationDataStream.obj new file mode 100755 index 0000000..16c002d Binary files /dev/null and b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/MinimalFixationDataStream.obj differ diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/vc140.idb b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/vc140.idb new file mode 100755 index 0000000..9079705 Binary files /dev/null and b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/vc140.idb differ diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/Debug/vc140.pdb b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/vc140.pdb new file mode 100755 index 0000000..01d5e16 Binary files /dev/null and b/Tobii EyeX/samples/MinimalFixationDataStream/Debug/vc140.pdb differ diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.c b/Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.c new file mode 100755 index 0000000..92b530e --- /dev/null +++ b/Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.c @@ -0,0 +1,181 @@ +/* + * This is an example that demonstrates how to connect to the EyeX Engine and subscribe to the fixation data stream. + * + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + */ + +#include +#include +#include +#include +#include "eyex/EyeX.h" + +#pragma comment (lib, "Tobii.EyeX.Client.lib") + +// ID of the global interactor that provides our data stream; must be unique within the application. +static const TX_STRING InteractorId = "Rainbow Dash"; + +// global variables +static TX_HANDLE g_hGlobalInteractorSnapshot = TX_EMPTY_HANDLE; + +/* + * Initializes g_hGlobalInteractorSnapshot with an interactor that has the Fixation Data behavior. + */ +BOOL InitializeGlobalInteractorSnapshot(TX_CONTEXTHANDLE hContext) +{ + TX_HANDLE hInteractor = TX_EMPTY_HANDLE; + TX_FIXATIONDATAPARAMS params = { TX_FIXATIONDATAMODE_SENSITIVE }; + BOOL success; + + success = txCreateGlobalInteractorSnapshot( + hContext, + InteractorId, + &g_hGlobalInteractorSnapshot, + &hInteractor) == TX_RESULT_OK; + success &= txCreateFixationDataBehavior(hInteractor, ¶ms) == TX_RESULT_OK; + + txReleaseObject(&hInteractor); + + return success; +} + +/* + * Callback function invoked when a snapshot has been committed. + */ +void TX_CALLCONVENTION OnSnapshotCommitted(TX_CONSTHANDLE hAsyncData, TX_USERPARAM param) +{ + // check the result code using an assertion. + // this will catch validation errors and runtime errors in debug builds. in release builds it won't do anything. + + TX_RESULT result = TX_RESULT_UNKNOWN; + txGetAsyncDataResultCode(hAsyncData, &result); + assert(result == TX_RESULT_OK || result == TX_RESULT_CANCELLED); +} + +/* + * Callback function invoked when the status of the connection to the EyeX Engine has changed. + */ +void TX_CALLCONVENTION OnEngineConnectionStateChanged(TX_CONNECTIONSTATE connectionState, TX_USERPARAM userParam) +{ + switch (connectionState) { + case TX_CONNECTIONSTATE_CONNECTED: { + BOOL success; + printf("The connection state is now CONNECTED (We are connected to the EyeX Engine)\n"); + // commit the snapshot with the global interactor as soon as the connection to the engine is established. + // (it cannot be done earlier because committing means "send to the engine".) + success = txCommitSnapshotAsync(g_hGlobalInteractorSnapshot, OnSnapshotCommitted, NULL) == TX_RESULT_OK; + if (!success) { + printf("Failed to initialize the data stream.\n"); + } + else + { + printf("Waiting for fixation data to start streaming...\n"); + } + } + break; + + case TX_CONNECTIONSTATE_DISCONNECTED: + printf("The connection state is now DISCONNECTED (We are disconnected from the EyeX Engine)\n"); + break; + + case TX_CONNECTIONSTATE_TRYINGTOCONNECT: + printf("The connection state is now TRYINGTOCONNECT (We are trying to connect to the EyeX Engine)\n"); + break; + + case TX_CONNECTIONSTATE_SERVERVERSIONTOOLOW: + printf("The connection state is now SERVER_VERSION_TOO_LOW: this application requires a more recent version of the EyeX Engine to run.\n"); + break; + + case TX_CONNECTIONSTATE_SERVERVERSIONTOOHIGH: + printf("The connection state is now SERVER_VERSION_TOO_HIGH: this application requires an older version of the EyeX Engine to run.\n"); + break; + } +} + +/* + * Handles an event from the fixation data stream. + */ +void OnFixationDataEvent(TX_HANDLE hFixationDataBehavior) +{ + TX_FIXATIONDATAEVENTPARAMS eventParams; + TX_FIXATIONDATAEVENTTYPE eventType; + char* eventDescription; + + if (txGetFixationDataEventParams(hFixationDataBehavior, &eventParams) == TX_RESULT_OK) { + eventType = eventParams.EventType; + + eventDescription = (eventType == TX_FIXATIONDATAEVENTTYPE_DATA) ? "Data" + : ((eventType == TX_FIXATIONDATAEVENTTYPE_END) ? "End" + : "Begin"); + + printf("Fixation %s: (%.1f, %.1f) timestamp %.0f ms\n", eventDescription, eventParams.X, eventParams.Y, eventParams.Timestamp); + } else { + printf("Failed to interpret fixation data event packet.\n"); + } +} + +/* + * Callback function invoked when an event has been received from the EyeX Engine. + */ +void TX_CALLCONVENTION HandleEvent(TX_CONSTHANDLE hAsyncData, TX_USERPARAM userParam) +{ + TX_HANDLE hEvent = TX_EMPTY_HANDLE; + TX_HANDLE hBehavior = TX_EMPTY_HANDLE; + + txGetAsyncDataContent(hAsyncData, &hEvent); + + // NOTE. Uncomment the following line of code to view the event object. The same function can be used with any interaction object. + //OutputDebugStringA(txDebugObject(hEvent)); + + if (txGetEventBehavior(hEvent, &hBehavior, TX_BEHAVIORTYPE_FIXATIONDATA) == TX_RESULT_OK) { + OnFixationDataEvent(hBehavior); + txReleaseObject(&hBehavior); + } + + // NOTE since this is a very simple application with a single interactor and a single data stream, + // our event handling code can be very simple too. A more complex application would typically have to + // check for multiple behaviors and route events based on interactor IDs. + + txReleaseObject(&hEvent); +} + +/* + * 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; +} diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.vcxproj b/Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.vcxproj new file mode 100755 index 0000000..c341a56 --- /dev/null +++ b/Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.vcxproj @@ -0,0 +1,156 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {9345876F-09E3-4764-9B3C-6496152D523E} + Win32Proj + MinimalFixationStream + MinimalFixationDataStream + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include + + + Console + true + ..\..\lib\x86 + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include + + + Console + true + ..\..\lib\x64 + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include + + + Console + true + true + true + ..\..\lib\x86 + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + + + Console + true + true + true + ..\..\lib\x64 + + + + + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.vcxproj.filters b/Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.vcxproj.filters new file mode 100755 index 0000000..f22a6b0 --- /dev/null +++ b/Tobii EyeX/samples/MinimalFixationDataStream/MinimalFixationDataStream.vcxproj.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.command.1.tlog b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.command.1.tlog new file mode 100755 index 0000000..a5e9eba Binary files /dev/null and b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.read.1.tlog b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.read.1.tlog new file mode 100755 index 0000000..2e1fac2 Binary files /dev/null and b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.write.1.tlog b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.write.1.tlog new file mode 100755 index 0000000..5d60166 Binary files /dev/null and b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/CL.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/MinimalGazeDataStream.lastbuildstate b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/MinimalGazeDataStream.lastbuildstate new file mode 100755 index 0000000..5cd4c3b --- /dev/null +++ b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/MinimalGazeDataStream.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 +Debug|Win32|D:\dev\tobii\samples\| diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.command.1.tlog b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.command.1.tlog new file mode 100755 index 0000000..00cba87 Binary files /dev/null and b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.read.1.tlog b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.read.1.tlog new file mode 100755 index 0000000..ccbfc24 Binary files /dev/null and b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.write.1.tlog b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.write.1.tlog new file mode 100755 index 0000000..acf58be Binary files /dev/null and b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalG.CB99F84F.tlog/link.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalGazeDataStream.log b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalGazeDataStream.log new file mode 100755 index 0000000..08e8caa --- /dev/null +++ b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalGazeDataStream.log @@ -0,0 +1,2 @@ + MinimalGazeDataStream.c + MinimalGazeDataStream.vcxproj -> D:\dev\tobii\samples\Debug\MinimalGazeDataStream.exe diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalGazeDataStream.obj b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalGazeDataStream.obj new file mode 100755 index 0000000..21cef4f Binary files /dev/null and b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/MinimalGazeDataStream.obj differ diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/vc140.idb b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/vc140.idb new file mode 100755 index 0000000..7720ab5 Binary files /dev/null and b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/vc140.idb differ diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/Debug/vc140.pdb b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/vc140.pdb new file mode 100755 index 0000000..022bd91 Binary files /dev/null and b/Tobii EyeX/samples/MinimalGazeDataStream/Debug/vc140.pdb differ diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.c b/Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.c new file mode 100755 index 0000000..20b3eab --- /dev/null +++ b/Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.c @@ -0,0 +1,171 @@ +/* + * This is an example that demonstrates how to connect to the EyeX Engine and subscribe to the lightly filtered gaze data stream. + * + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + */ + +#include +#include +#include +#include +#include "eyex/EyeX.h" + +#pragma comment (lib, "Tobii.EyeX.Client.lib") + +// ID of the global interactor that provides our data stream; must be unique within the application. +static const TX_STRING InteractorId = "Twilight Sparkle"; + +// global variables +static TX_HANDLE g_hGlobalInteractorSnapshot = TX_EMPTY_HANDLE; + +/* + * Initializes g_hGlobalInteractorSnapshot with an interactor that has the Gaze Point behavior. + */ +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, ¶ms) == TX_RESULT_OK; + + txReleaseObject(&hInteractor); + + return success; +} + +/* + * Callback function invoked when a snapshot has been committed. + */ +void TX_CALLCONVENTION OnSnapshotCommitted(TX_CONSTHANDLE hAsyncData, TX_USERPARAM param) +{ + // check the result code using an assertion. + // this will catch validation errors and runtime errors in debug builds. in release builds it won't do anything. + + TX_RESULT result = TX_RESULT_UNKNOWN; + txGetAsyncDataResultCode(hAsyncData, &result); + assert(result == TX_RESULT_OK || result == TX_RESULT_CANCELLED); +} + +/* + * Callback function invoked when the status of the connection to the EyeX Engine has changed. + */ +void TX_CALLCONVENTION OnEngineConnectionStateChanged(TX_CONNECTIONSTATE connectionState, TX_USERPARAM userParam) +{ + switch (connectionState) { + case TX_CONNECTIONSTATE_CONNECTED: { + BOOL success; + printf("The connection state is now CONNECTED (We are connected to the EyeX Engine)\n"); + // commit the snapshot with the global interactor as soon as the connection to the engine is established. + // (it cannot be done earlier because committing means "send to the engine".) + success = txCommitSnapshotAsync(g_hGlobalInteractorSnapshot, OnSnapshotCommitted, NULL) == TX_RESULT_OK; + if (!success) { + printf("Failed to initialize the data stream.\n"); + } + else { + printf("Waiting for gaze data to start streaming...\n"); + } + } + break; + + case TX_CONNECTIONSTATE_DISCONNECTED: + printf("The connection state is now DISCONNECTED (We are disconnected from the EyeX Engine)\n"); + break; + + case TX_CONNECTIONSTATE_TRYINGTOCONNECT: + printf("The connection state is now TRYINGTOCONNECT (We are trying to connect to the EyeX Engine)\n"); + break; + + case TX_CONNECTIONSTATE_SERVERVERSIONTOOLOW: + printf("The connection state is now SERVER_VERSION_TOO_LOW: this application requires a more recent version of the EyeX Engine to run.\n"); + break; + + case TX_CONNECTIONSTATE_SERVERVERSIONTOOHIGH: + printf("The connection state is now SERVER_VERSION_TOO_HIGH: this application requires an older version of the EyeX Engine to run.\n"); + break; + } +} + +/* + * Handles an event from the Gaze Point data stream. + */ +void OnGazeDataEvent(TX_HANDLE hGazeDataBehavior) +{ + TX_GAZEPOINTDATAEVENTPARAMS eventParams; + if (txGetGazePointDataEventParams(hGazeDataBehavior, &eventParams) == TX_RESULT_OK) { + printf("Gaze Data: (%.1f, %.1f) timestamp %.0f ms\n", eventParams.X, eventParams.Y, eventParams.Timestamp); + } else { + printf("Failed to interpret gaze data event packet.\n"); + } +} + +/* + * Callback function invoked when an event has been received from the EyeX Engine. + */ +void TX_CALLCONVENTION HandleEvent(TX_CONSTHANDLE hAsyncData, TX_USERPARAM userParam) +{ + TX_HANDLE hEvent = TX_EMPTY_HANDLE; + TX_HANDLE hBehavior = TX_EMPTY_HANDLE; + + txGetAsyncDataContent(hAsyncData, &hEvent); + + // NOTE. Uncomment the following line of code to view the event object. The same function can be used with any interaction object. + //OutputDebugStringA(txDebugObject(hEvent)); + + if (txGetEventBehavior(hEvent, &hBehavior, TX_BEHAVIORTYPE_GAZEPOINTDATA) == TX_RESULT_OK) { + OnGazeDataEvent(hBehavior); + txReleaseObject(&hBehavior); + } + + // NOTE since this is a very simple application with a single interactor and a single data stream, + // our event handling code can be very simple too. A more complex application would typically have to + // check for multiple behaviors and route events based on interactor IDs. + + txReleaseObject(&hEvent); +} + +/* + * 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; +} diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.vcxproj b/Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.vcxproj new file mode 100755 index 0000000..efd3412 --- /dev/null +++ b/Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.vcxproj @@ -0,0 +1,160 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + + + + {CB99F84F-43D5-4F18-A2A9-79E4669A300E} + Win32Proj + MinimalGazeDataStream + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + ..\..\lib\x86 + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + ..\..\lib\x64 + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + true + true + ..\..\lib\x86 + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + true + true + ..\..\lib\x64 + + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.vcxproj.filters b/Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.vcxproj.filters new file mode 100755 index 0000000..7d650f2 --- /dev/null +++ b/Tobii EyeX/samples/MinimalGazeDataStream/MinimalGazeDataStream.vcxproj.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.command.1.tlog b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.command.1.tlog new file mode 100755 index 0000000..200a5ed Binary files /dev/null and b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.read.1.tlog b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.read.1.tlog new file mode 100755 index 0000000..4844ea7 Binary files /dev/null and b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.write.1.tlog b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.write.1.tlog new file mode 100755 index 0000000..616875d Binary files /dev/null and b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/CL.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/MinimalStatusNotifications.lastbuildstate b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/MinimalStatusNotifications.lastbuildstate new file mode 100755 index 0000000..5cd4c3b --- /dev/null +++ b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/MinimalStatusNotifications.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 +Debug|Win32|D:\dev\tobii\samples\| diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.command.1.tlog b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.command.1.tlog new file mode 100755 index 0000000..6472281 Binary files /dev/null and b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.read.1.tlog b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.read.1.tlog new file mode 100755 index 0000000..8855258 Binary files /dev/null and b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.write.1.tlog b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.write.1.tlog new file mode 100755 index 0000000..5bd757b Binary files /dev/null and b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalS.30C25EF3.tlog/link.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalStatusNotifications.log b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalStatusNotifications.log new file mode 100755 index 0000000..ce35307 --- /dev/null +++ b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalStatusNotifications.log @@ -0,0 +1,2 @@ + MinimalStatusNotifications.c + MinimalStatusNotifications.vcxproj -> D:\dev\tobii\samples\Debug\MinimalStatusNotifications.exe diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalStatusNotifications.obj b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalStatusNotifications.obj new file mode 100755 index 0000000..d7cb8b6 Binary files /dev/null and b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/MinimalStatusNotifications.obj differ diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/vc140.idb b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/vc140.idb new file mode 100755 index 0000000..cf7c720 Binary files /dev/null and b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/vc140.idb differ diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/Debug/vc140.pdb b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/vc140.pdb new file mode 100755 index 0000000..64cd628 Binary files /dev/null and b/Tobii EyeX/samples/MinimalStatusNotifications/Debug/vc140.pdb differ diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.c b/Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.c new file mode 100755 index 0000000..1d7ce26 --- /dev/null +++ b/Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.c @@ -0,0 +1,186 @@ +/* + * This is an example that demonstrates two ways of getting status information from the EyeX Engine. + * + * Copyright 2013-2014 Tobii Technology AB. All rights reserved. + */ + +#include +#include +#include +#include +#include "eyex/EyeX.h" + +#pragma comment (lib, "Tobii.EyeX.Client.lib") + +// global variables +static TX_CONTEXTHANDLE g_hContext = TX_EMPTY_HANDLE; + +/* + * Handles a state-changed notification, or the response from a get-state operation. + */ +void OnStateReceived(TX_HANDLE hStateBag) +{ + TX_BOOL success; + TX_INTEGER eyeTrackingState; + TX_SIZE2 displaySize; + TX_SIZE2 screenBounds; + TX_SIZE stringSize = 0; + TX_STRING currentProfileName; + TX_INTEGER presenceData; + TX_INTEGER gazeTracking; + + 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); + } + } + + success = (txGetStateValueAsSize2(hStateBag, TX_STATEPATH_EYETRACKINGDISPLAYSIZE, &displaySize) == TX_RESULT_OK); + if (success) { + printf("Display Size: %5.2f x %5.2f mm\n", displaySize.Width, displaySize.Height); + } + + success = (txGetStateValueAsSize2(hStateBag, TX_STATEPATH_EYETRACKINGSCREENBOUNDS, &screenBounds) == TX_RESULT_OK); + if (success) { + printf("Screen Bounds: %5.0f x %5.0f pixels\n\n", screenBounds.Width, screenBounds.Height); + } + + success = (txGetStateValueAsInteger(hStateBag, TX_STATEPATH_USERPRESENCE, &presenceData) == TX_RESULT_OK); + if (success) { + if (presenceData != TX_USERPRESENCE_UNKNOWN) { + printf("User is %s\n", presenceData == TX_USERPRESENCE_PRESENT ? "present" : "NOT present" ); + } + } + + // The following state requires EyeX Engine 1.3.0 or later: + success = (txGetStateValueAsString(hStateBag, TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME, NULL, &stringSize) == TX_RESULT_OK); + if (success) { + currentProfileName = (TX_STRING)malloc(stringSize*sizeof(char)); + success = (txGetStateValueAsString(hStateBag, TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME, currentProfileName, &stringSize) == TX_RESULT_OK); + if (success) { + printf("Current user profile name is: %s\n", currentProfileName); + } + free(currentProfileName); + } + + // The following state requires EyeX Engine 1.4.0 or later: + success = (txGetStateValueAsInteger(hStateBag, TX_STATEPATH_GAZETRACKING, &gazeTracking) == TX_RESULT_OK); + if (success) { + printf("User's eye-gaze is %s\n", gazeTracking == TX_GAZETRACKING_GAZETRACKED ? "tracked" : "NOT tracked"); + } +} + +/* + * Handles engine state change notifications. + */ +void TX_CALLCONVENTION OnEngineStateChanged(TX_CONSTHANDLE hAsyncData, TX_USERPARAM userParam) +{ + TX_RESULT result = TX_RESULT_UNKNOWN; + TX_HANDLE hStateBag = TX_EMPTY_HANDLE; + + if (txGetAsyncDataResultCode(hAsyncData, &result) == TX_RESULT_OK && + txGetAsyncDataContent(hAsyncData, &hStateBag) == TX_RESULT_OK) { + OnStateReceived(hStateBag); + txReleaseObject(&hStateBag); + } +} + +/* + * Callback function invoked when the status of the connection to the EyeX Engine has changed. + */ +void TX_CALLCONVENTION OnEngineConnectionStateChanged(TX_CONNECTIONSTATE connectionState, TX_USERPARAM userParam) +{ + if (connectionState == TX_CONNECTIONSTATE_CONNECTED) { + printf("We're now connected to the EyeX Engine!\n"); + printf("Now that we're connected: get the current eye tracking device status, display size and screen bounds...\n\n"); + + // NOTE. A request for the TX_STATEPATH_EYETRACKING state path (which expands to + // "eyeTracking") will also query for all sub-paths ("eyeTracking.whatever") -- which + // explains why this request provides data for the eye tracking device status etc. + txGetStateAsync(g_hContext, TX_STATEPATH_EYETRACKING, OnEngineStateChanged, NULL); + } +} + +/* + * Application entry point. + */ +int main(int argc, char* argv[]) +{ + TX_TICKET hConnectionStateChangedTicket = TX_INVALID_TICKET; + TX_TICKET hPresenceStateChangedTicket = TX_INVALID_TICKET; + TX_TICKET hGazeTrackingStateChangedTicket = TX_INVALID_TICKET; + TX_BOOL success; + TX_EYEXAVAILABILITY availability; + + printf( + "===============================================================================\n\n" + "This sample illustrates two different ways of getting status information from\n" + "the EyeX Engine.\n\n" + "- First we try and connect to the EyeX Engine. When we get a connection we read\n" + " and print the current values of the eye tracking device status, the display\n" + " size and the screen bounds. This is done once per connection to the EyeX\n" + " Engine.\n\n" + "- When we have a connection to the Engine, we set up a listener for changes of\n" + " the user presence state. When the user's eyes are found the user is\n" + " considered present, when the eyes cannot be found, the user is considered not\n" + " present. Try blocking and unblocking the eye tracker's view of your eyes to\n" + " see the changes in the user presence state.\n\n" + "===============================================================================\n\n"); + + if (txGetEyeXAvailability(&availability) == TX_RESULT_OK) { + if (availability == TX_EYEXAVAILABILITY_NOTAVAILABLE) { + printf( + "This sample requires the EyeX Engine, but it isn't available.\n" + "Please install the EyeX Engine and try again.\n"); + exit(-1); + } + else if (availability == TX_EYEXAVAILABILITY_NOTRUNNING) { + printf( + "This sample requires the EyeX Engine, but it isn't running.\n" + "Please make sure that the EyeX Engine is started.\n"); + } + } + + // initialize and enable the context that is our link to the EyeX Engine. + // register observers on the connection state, TX_STATEPATH_USERPRESENCE and the TX_STATEPATH_GAZETRACKING engine state. + success = txInitializeEyeX(TX_EYEXCOMPONENTOVERRIDEFLAG_NONE, NULL, NULL, NULL, NULL) == TX_RESULT_OK; + success &= txCreateContext(&g_hContext, TX_FALSE) == TX_RESULT_OK; + success &= txRegisterConnectionStateChangedHandler(g_hContext, &hConnectionStateChangedTicket, OnEngineConnectionStateChanged, NULL) == TX_RESULT_OK; + success &= txRegisterStateChangedHandler(g_hContext, &hPresenceStateChangedTicket, TX_STATEPATH_USERPRESENCE, OnEngineStateChanged, NULL) == TX_RESULT_OK; + success &= txRegisterStateChangedHandler(g_hContext, &hGazeTrackingStateChangedTicket, TX_STATEPATH_GAZETRACKING, OnEngineStateChanged, NULL) == TX_RESULT_OK; + success &= txEnableConnection(g_hContext) == TX_RESULT_OK; + + // let the events flow until a key is pressed. + if (success) { + printf("Initialization was successful.\n"); + printf("We are waiting for a connection to the EyeX Engine...\n\n"); + } else { + printf("Initialization failed.\n\n"); + } + + printf("Press any key to exit...\n\n"); + _getch(); + printf("Exiting.\n"); + + // unregister handlers and delete the context. + txUnregisterConnectionStateChangedHandler(g_hContext, hConnectionStateChangedTicket); + txUnregisterStateChangedHandler(g_hContext, hPresenceStateChangedTicket); + txUnregisterStateChangedHandler(g_hContext, hGazeTrackingStateChangedTicket); + success = txShutdownContext(g_hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE) == TX_RESULT_OK; + success &= txReleaseContext(&g_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; +} diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.vcxproj b/Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.vcxproj new file mode 100755 index 0000000..7dbcced --- /dev/null +++ b/Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.vcxproj @@ -0,0 +1,156 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76} + Win32Proj + MinimalStatusNotifications + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + ..\..\lib\x86 + + + + + NotUsing + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + ..\..\lib\x64 + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + true + true + ..\..\lib\x86 + + + + + Level3 + NotUsing + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + true + ..\..\include + + + Console + true + true + true + ..\..\lib\x64 + + + + + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.vcxproj.filters b/Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.vcxproj.filters new file mode 100755 index 0000000..9e567fb --- /dev/null +++ b/Tobii EyeX/samples/MinimalStatusNotifications/MinimalStatusNotifications.vcxproj.filters @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.command.1.tlog b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.command.1.tlog new file mode 100755 index 0000000..ca3124c Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.read.1.tlog b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.read.1.tlog new file mode 100755 index 0000000..b9b14b8 Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.write.1.tlog b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.write.1.tlog new file mode 100755 index 0000000..c26f1a7 Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/CL.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/MinimalUserProfiles.lastbuildstate b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/MinimalUserProfiles.lastbuildstate new file mode 100755 index 0000000..5cd4c3b --- /dev/null +++ b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/MinimalUserProfiles.lastbuildstate @@ -0,0 +1,2 @@ +#TargetFrameworkVersion=v4.0:PlatformToolSet=v140:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=8.1 +Debug|Win32|D:\dev\tobii\samples\| diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.command.1.tlog b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.command.1.tlog new file mode 100755 index 0000000..586a19e Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.command.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.read.1.tlog b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.read.1.tlog new file mode 100755 index 0000000..1b2f2e9 Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.read.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.write.1.tlog b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.write.1.tlog new file mode 100755 index 0000000..4add4c6 Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalU.7644167B.tlog/link.write.1.tlog differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalUserProfiles.log b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalUserProfiles.log new file mode 100755 index 0000000..2a34286 --- /dev/null +++ b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalUserProfiles.log @@ -0,0 +1,4 @@ + stdafx.cpp + MinimalUserProfiles.cpp + Generating Code... + MinimalUserProfiles.vcxproj -> D:\dev\tobii\samples\Debug\MinimalUserProfiles.exe diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalUserProfiles.obj b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalUserProfiles.obj new file mode 100755 index 0000000..1a00765 Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/MinimalUserProfiles.obj differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/stdafx.obj b/Tobii EyeX/samples/MinimalUserProfiles/Debug/stdafx.obj new file mode 100755 index 0000000..ea32af6 Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/stdafx.obj differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/vc140.idb b/Tobii EyeX/samples/MinimalUserProfiles/Debug/vc140.idb new file mode 100755 index 0000000..b32eb42 Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/vc140.idb differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/Debug/vc140.pdb b/Tobii EyeX/samples/MinimalUserProfiles/Debug/vc140.pdb new file mode 100755 index 0000000..3ce102d Binary files /dev/null and b/Tobii EyeX/samples/MinimalUserProfiles/Debug/vc140.pdb differ diff --git a/Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.cpp b/Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.cpp new file mode 100755 index 0000000..022486b --- /dev/null +++ b/Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.cpp @@ -0,0 +1,269 @@ +/* + * MinimalUserProfiles sample: + * This is an example that demontrates how to retrieve and listen to changes to + * the states Current Profile Name and Profiles, and how to change the Current + * Profile. + * + * (It is written in mostly very C-style C++, to make it similar to the other + * minimal samples but still make use of std::vector and std::string. Using those + * makes the implementation more straightforward when handling the Profile state + * which is very dynamic in nature: an unknown number of profile name entries of + * unknown size.) + * + * Known limitation: this sample only works correctly for up to 10 profiles. It + * will list all profiles, but the input will only read one digit, so 9 will be + * the highest selectable index. + * + * Copyright 2015 Tobii AB (publ). All rights reserved. + */ + +#include +#include +#include +#include "stdafx.h" +#include "eyex\EyeX.h" + +#pragma comment (lib, "Tobii.EyeX.Client.lib") + +static const UINT32 MIN_SIZE = 1; +static const TX_STRING MIN_ENGINE_VERSION = "1.3.0"; + +// global variables +static TX_CONTEXTHANDLE g_hContext = TX_EMPTY_HANDLE; +static std::string g_currentProfileName = ""; +static std::vector g_profiles; + +/* + * Prints info about the current user profile, all available profiles and how + * to change to another profile. + */ +void PrintInfo() +{ + if (g_currentProfileName.length() < MIN_SIZE || g_profiles.size() < MIN_SIZE) { + return; + } + + printf("\n-------------------------------------------------------------------------\n"); + printf("\n Current user profile: %s\n", g_currentProfileName.c_str()); + printf("\n All user profiles:\n"); + int index = 0; + for (std::string profile : g_profiles) { + printf(" %i. %s\n", index++, profile.c_str()); + } + printf("\n-------------------------------------------------------------------------\n"); + printf("\nEnter the number of the profile you want to change to (or 'q' to quit): "); +} + +/* + * Tries to extract an array of strings for the given state bag and state path. + * Returns TX_TRUE if successful, TX_FALSE otherwise. + * If successful, the arrayOfStrings parameter will be populated with the strings. + * + * This can be used to "unpack" a state bag with a TX_STATEPATH_EYETRACKINGPROFILES + * state's multiple null-terminated string to a more manageable format. + */ +TX_BOOL GetStateValueAsArrayOfStrings(TX_CONSTHANDLE hStateBag, TX_CONSTSTRING valuePath, std::vector *arrayOfStrings) +{ + TX_SIZE stringSize = 0; + TX_BOOL success; + + success = (txGetStateValueAsString(hStateBag, valuePath, nullptr, &stringSize)) == TX_RESULT_OK; + if (!success) + { + return TX_FALSE; + } + + TX_STRING stringValue = new TX_CHAR[stringSize]; + success = (txGetStateValueAsString(hStateBag, valuePath, stringValue, &stringSize) == TX_RESULT_OK); + if (!success) + { + delete[] stringValue; + return TX_FALSE; + } + + TX_STRING stringPtr = stringValue; + while (*stringPtr != '\0') + { + TX_STRING startPoint = stringPtr; + while (*stringPtr != '\0') + { + stringPtr++; + } + + std::string str = std::string(startPoint, stringPtr - startPoint); + arrayOfStrings->push_back(str); + stringPtr++; + } + + return TX_TRUE; +} + +/* + * Handles a state-changed notification, or the response from a get-state operation. + */ +void OnStateReceived(TX_HANDLE hStateBag) +{ + TX_BOOL success; + TX_SIZE stringSize = 0; + TX_STRING engineVersion; + TX_STRING profileName; + std::vector profiles; + + success = (txGetStateValueAsString(hStateBag, TX_STATEPATH_ENGINEINFOVERSION, NULL, &stringSize) == TX_RESULT_OK); + if (success) { + engineVersion = (TX_STRING)malloc(stringSize*sizeof(char)); + if (txGetStateValueAsString(hStateBag, TX_STATEPATH_ENGINEINFOVERSION, engineVersion, &stringSize) == TX_RESULT_OK) { + printf("\nEyeX Engine version: %s. This sample requires EyeX Engine %s or higher.\n", engineVersion, MIN_ENGINE_VERSION); + } + free(engineVersion); + } + + success = (txGetStateValueAsString(hStateBag, TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME, NULL, &stringSize) == TX_RESULT_OK); + if (success) { + profileName = (TX_STRING)malloc(stringSize*sizeof(char)); + if (txGetStateValueAsString(hStateBag, TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME, profileName, &stringSize) == TX_RESULT_OK) { + g_currentProfileName = profileName; + } + free(profileName); + } + + success = GetStateValueAsArrayOfStrings(hStateBag, TX_STATEPATH_EYETRACKINGPROFILES, &profiles); + if (success) { + g_profiles = profiles; + } + + PrintInfo(); +} + +/* + * Handles engine state change notifications. + */ +void TX_CALLCONVENTION OnEngineStateChanged(TX_CONSTHANDLE hAsyncData, TX_USERPARAM userParam) +{ + TX_RESULT result = TX_RESULT_UNKNOWN; + TX_HANDLE hStateBag = TX_EMPTY_HANDLE; + + if (txGetAsyncDataResultCode(hAsyncData, &result) == TX_RESULT_OK && + txGetAsyncDataContent(hAsyncData, &hStateBag) == TX_RESULT_OK) { + OnStateReceived(hStateBag); + txReleaseObject(&hStateBag); + } +} + +/* + * Callback function invoked when the status of the connection to the EyeX Engine has changed. + */ +void TX_CALLCONVENTION OnEngineConnectionStateChanged(TX_CONNECTIONSTATE connectionState, TX_USERPARAM userParam) +{ + if (connectionState == TX_CONNECTIONSTATE_CONNECTED) { + printf("We're now connected to the EyeX Engine!\n"); + printf("Now that we're connected: get the user profiles...\n\n"); + + // the two states below requires EyeX Engine 1.3.0, so check engine version as well + txGetStateAsync(g_hContext, TX_STATEPATH_ENGINEINFOVERSION, OnEngineStateChanged, NULL); + txGetStateAsync(g_hContext, TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME, OnEngineStateChanged, NULL); + txGetStateAsync(g_hContext, TX_STATEPATH_EYETRACKINGPROFILES, OnEngineStateChanged, NULL); + } +} + +/* + * Callback function invoked when the async call to set current profile is completed. + */ +void TX_CALLCONVENTION OnSetCurrentProfileCompleted(TX_CONSTHANDLE hAsyncData, TX_USERPARAM userParam) +{ + TX_BOOL success; + TX_RESULT result = TX_RESULT_UNKNOWN; + success = (txGetAsyncDataResultCode(hAsyncData, &result) == TX_RESULT_OK && result == TX_RESULT_OK); + if (success == TX_FALSE) { + printf("\nSomething went wrong when trying to change the current profile.\n"); + } +} + +/* + * Change profile to the profile with index profileIndex as listed by the application's PrintInfo function. + */ +void ChangeProfileTo(int profileIndex) +{ + TX_CONSTSTRING profileName = (TX_CONSTSTRING)g_profiles[profileIndex].c_str(); + if (profileName == g_currentProfileName) { + printf("\nYou selected the current profile. Try again: "); + } else { + printf("\nChanging user profile to '%s'.\n", profileName); + txSetCurrentProfile(g_hContext, profileName, OnSetCurrentProfileCompleted, NULL); + } +} + +int _tmain(int argc, _TCHAR* argv[]) +{ + printf("Press 'q' to quit the application.\n\n"); + + TX_TICKET hConnectionStateChangedTicket = TX_INVALID_TICKET; + TX_TICKET hCurrentProfileNameChangedTicket = TX_INVALID_TICKET; + TX_TICKET hEyeTrackingProfilesChangedTicket = TX_INVALID_TICKET; + TX_BOOL success; + TX_EYEXAVAILABILITY availability; + + if (txGetEyeXAvailability(&availability) == TX_RESULT_OK) { + if (availability == TX_EYEXAVAILABILITY_NOTAVAILABLE) { + printf( + "This sample requires the EyeX Engine, but it isn't available.\n" + "Please install the EyeX Engine and try again.\n"); + exit(-1); + } + else if (availability == TX_EYEXAVAILABILITY_NOTRUNNING) { + printf( + "This sample requires the EyeX Engine, but it isn't running.\n" + "Please make sure that the EyeX Engine is started.\n"); + } + } + + // initialize and enable the context that is our link to the EyeX Engine. + // register observers on the connection state, current profile name state, and profiles state. + success = txInitializeEyeX(TX_EYEXCOMPONENTOVERRIDEFLAG_NONE, NULL, NULL, NULL, NULL) == TX_RESULT_OK; + success &= txCreateContext(&g_hContext, TX_FALSE) == TX_RESULT_OK; + success &= txRegisterConnectionStateChangedHandler(g_hContext, &hConnectionStateChangedTicket, OnEngineConnectionStateChanged, NULL) == TX_RESULT_OK; + success &= txRegisterStateChangedHandler(g_hContext, &hCurrentProfileNameChangedTicket, TX_STATEPATH_EYETRACKINGCURRENTPROFILENAME, OnEngineStateChanged, NULL) == TX_RESULT_OK; + success &= txRegisterStateChangedHandler(g_hContext, &hEyeTrackingProfilesChangedTicket, TX_STATEPATH_EYETRACKINGPROFILES, OnEngineStateChanged, NULL) == TX_RESULT_OK; + success &= txEnableConnection(g_hContext) == TX_RESULT_OK; + + if (success) { + printf("Initialization was successful.\n"); + printf("We are waiting for a connection to the EyeX Engine...\n\n"); + } else { + printf("Initialization failed.\n\n"); + } + + // read profile index entered by user, if valid: change profile. + // keep reading input until 'q' is read and application should exit. + // known limitation: only reads one character, meaning 9 will be the highest + // selectable profile index. + auto keepRunning = true; + while(keepRunning) { + int input = _getch(); + char inputChar = input; + printf("%c\n", inputChar); + int profileIndex = input - '0'; + if (input == 'q') { + printf("\nExiting.\n"); + keepRunning = false; + } else if (isdigit(input) && ((unsigned int)profileIndex < g_profiles.size())) { + ChangeProfileTo(profileIndex); + } else { + printf("\nIllegal profile index: '%c'. Try again: ", inputChar); + } + } + + // unregister handlers and delete the context. + txUnregisterConnectionStateChangedHandler(g_hContext, hConnectionStateChangedTicket); + txUnregisterStateChangedHandler(g_hContext, hCurrentProfileNameChangedTicket); + txUnregisterStateChangedHandler(g_hContext, hEyeTrackingProfilesChangedTicket); + success = txShutdownContext(g_hContext, TX_CLEANUPTIMEOUT_DEFAULT, TX_FALSE) == TX_RESULT_OK; + success &= txReleaseContext(&g_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; +} + diff --git a/Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.vcxproj b/Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.vcxproj new file mode 100755 index 0000000..3481b69 --- /dev/null +++ b/Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.vcxproj @@ -0,0 +1,163 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {7644167B-708E-4D09-A523-FB0F59871D82} + Win32Proj + MinimalUserProfiles + + + + Application + true + v140 + Unicode + + + Application + true + v140 + Unicode + + + Application + false + v140 + true + Unicode + + + Application + false + v140 + true + Unicode + + + + + + + + + + + + + + + + + + + true + + + true + + + false + + + false + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include + + + Console + true + ..\..\lib\x86 + + + + + + + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include + + + Console + true + ..\..\lib\x64 + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include + + + Console + true + true + true + ..\..\lib\x86 + + + + + Level3 + + + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions) + ..\..\include + + + Console + true + true + true + ..\..\lib\x64 + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.vcxproj.filters b/Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.vcxproj.filters new file mode 100755 index 0000000..614e5c9 --- /dev/null +++ b/Tobii EyeX/samples/MinimalUserProfiles/MinimalUserProfiles.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/Tobii EyeX/samples/MinimalUserProfiles/ReadMe.txt b/Tobii EyeX/samples/MinimalUserProfiles/ReadMe.txt new file mode 100755 index 0000000..4171f7a --- /dev/null +++ b/Tobii EyeX/samples/MinimalUserProfiles/ReadMe.txt @@ -0,0 +1,40 @@ +======================================================================== + CONSOLE APPLICATION : MinimalUserProfiles Project Overview +======================================================================== + +AppWizard has created this MinimalUserProfiles application for you. + +This file contains a summary of what you will find in each of the files that +make up your MinimalUserProfiles application. + + +MinimalUserProfiles.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +MinimalUserProfiles.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +MinimalUserProfiles.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named MinimalUserProfiles.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/Tobii EyeX/samples/MinimalUserProfiles/stdafx.cpp b/Tobii EyeX/samples/MinimalUserProfiles/stdafx.cpp new file mode 100755 index 0000000..92e931f --- /dev/null +++ b/Tobii EyeX/samples/MinimalUserProfiles/stdafx.cpp @@ -0,0 +1,3 @@ +// stdafx.cpp : source file that includes just the standard includes + +#include "stdafx.h" diff --git a/Tobii EyeX/samples/MinimalUserProfiles/stdafx.h b/Tobii EyeX/samples/MinimalUserProfiles/stdafx.h new file mode 100755 index 0000000..cb987d8 --- /dev/null +++ b/Tobii EyeX/samples/MinimalUserProfiles/stdafx.h @@ -0,0 +1,13 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +#include +#include diff --git a/Tobii EyeX/samples/MinimalUserProfiles/targetver.h b/Tobii EyeX/samples/MinimalUserProfiles/targetver.h new file mode 100755 index 0000000..90e767b --- /dev/null +++ b/Tobii EyeX/samples/MinimalUserProfiles/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/Tobii EyeX/samples/Samples.VC.db b/Tobii EyeX/samples/Samples.VC.db new file mode 100755 index 0000000..64613ae Binary files /dev/null and b/Tobii EyeX/samples/Samples.VC.db differ diff --git a/Tobii EyeX/samples/Samples.sln b/Tobii EyeX/samples/Samples.sln new file mode 100755 index 0000000..58c7450 --- /dev/null +++ b/Tobii EyeX/samples/Samples.sln @@ -0,0 +1,85 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ActivatableBoardGame", "ActivatableBoardGame\ActivatableBoardGame.vcxproj", "{2732E876-973B-4453-AA9F-D306EFB11922}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinimalStatusNotifications", "MinimalStatusNotifications\MinimalStatusNotifications.vcxproj", "{30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinimalGazeDataStream", "MinimalGazeDataStream\MinimalGazeDataStream.vcxproj", "{CB99F84F-43D5-4F18-A2A9-79E4669A300E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ActivatableButtons", "ActivatableButtons\ActivatableButtons.vcxproj", "{3E2A1867-D554-4655-8F03-B6A4C06D4967}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinimalFixationDataStream", "MinimalFixationDataStream\MinimalFixationDataStream.vcxproj", "{9345876F-09E3-4764-9B3C-6496152D523E}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinimalEyePositionDataStream", "MinimalEyePositionDataStream\MinimalEyePositionDataStream.vcxproj", "{6D2CFFFE-00E9-41C8-B389-059DA9AABDFC}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MinimalUserProfiles", "MinimalUserProfiles\MinimalUserProfiles.vcxproj", "{7644167B-708E-4D09-A523-FB0F59871D82}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {2732E876-973B-4453-AA9F-D306EFB11922}.Debug|Win32.ActiveCfg = Debug|Win32 + {2732E876-973B-4453-AA9F-D306EFB11922}.Debug|Win32.Build.0 = Debug|Win32 + {2732E876-973B-4453-AA9F-D306EFB11922}.Debug|x64.ActiveCfg = Debug|x64 + {2732E876-973B-4453-AA9F-D306EFB11922}.Debug|x64.Build.0 = Debug|x64 + {2732E876-973B-4453-AA9F-D306EFB11922}.Release|Win32.ActiveCfg = Release|Win32 + {2732E876-973B-4453-AA9F-D306EFB11922}.Release|Win32.Build.0 = Release|Win32 + {2732E876-973B-4453-AA9F-D306EFB11922}.Release|x64.ActiveCfg = Release|x64 + {2732E876-973B-4453-AA9F-D306EFB11922}.Release|x64.Build.0 = Release|x64 + {30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76}.Debug|Win32.ActiveCfg = Debug|Win32 + {30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76}.Debug|Win32.Build.0 = Debug|Win32 + {30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76}.Debug|x64.ActiveCfg = Debug|x64 + {30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76}.Debug|x64.Build.0 = Debug|x64 + {30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76}.Release|Win32.ActiveCfg = Release|Win32 + {30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76}.Release|Win32.Build.0 = Release|Win32 + {30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76}.Release|x64.ActiveCfg = Release|x64 + {30C25EF3-4FB1-425F-82FA-B4D3B3DAAD76}.Release|x64.Build.0 = Release|x64 + {CB99F84F-43D5-4F18-A2A9-79E4669A300E}.Debug|Win32.ActiveCfg = Debug|Win32 + {CB99F84F-43D5-4F18-A2A9-79E4669A300E}.Debug|Win32.Build.0 = Debug|Win32 + {CB99F84F-43D5-4F18-A2A9-79E4669A300E}.Debug|x64.ActiveCfg = Debug|x64 + {CB99F84F-43D5-4F18-A2A9-79E4669A300E}.Debug|x64.Build.0 = Debug|x64 + {CB99F84F-43D5-4F18-A2A9-79E4669A300E}.Release|Win32.ActiveCfg = Release|Win32 + {CB99F84F-43D5-4F18-A2A9-79E4669A300E}.Release|Win32.Build.0 = Release|Win32 + {CB99F84F-43D5-4F18-A2A9-79E4669A300E}.Release|x64.ActiveCfg = Release|x64 + {CB99F84F-43D5-4F18-A2A9-79E4669A300E}.Release|x64.Build.0 = Release|x64 + {3E2A1867-D554-4655-8F03-B6A4C06D4967}.Debug|Win32.ActiveCfg = Debug|Win32 + {3E2A1867-D554-4655-8F03-B6A4C06D4967}.Debug|Win32.Build.0 = Debug|Win32 + {3E2A1867-D554-4655-8F03-B6A4C06D4967}.Debug|x64.ActiveCfg = Debug|x64 + {3E2A1867-D554-4655-8F03-B6A4C06D4967}.Debug|x64.Build.0 = Debug|x64 + {3E2A1867-D554-4655-8F03-B6A4C06D4967}.Release|Win32.ActiveCfg = Release|Win32 + {3E2A1867-D554-4655-8F03-B6A4C06D4967}.Release|Win32.Build.0 = Release|Win32 + {3E2A1867-D554-4655-8F03-B6A4C06D4967}.Release|x64.ActiveCfg = Release|x64 + {3E2A1867-D554-4655-8F03-B6A4C06D4967}.Release|x64.Build.0 = Release|x64 + {9345876F-09E3-4764-9B3C-6496152D523E}.Debug|Win32.ActiveCfg = Debug|Win32 + {9345876F-09E3-4764-9B3C-6496152D523E}.Debug|Win32.Build.0 = Debug|Win32 + {9345876F-09E3-4764-9B3C-6496152D523E}.Debug|x64.ActiveCfg = Debug|x64 + {9345876F-09E3-4764-9B3C-6496152D523E}.Debug|x64.Build.0 = Debug|x64 + {9345876F-09E3-4764-9B3C-6496152D523E}.Release|Win32.ActiveCfg = Release|Win32 + {9345876F-09E3-4764-9B3C-6496152D523E}.Release|Win32.Build.0 = Release|Win32 + {9345876F-09E3-4764-9B3C-6496152D523E}.Release|x64.ActiveCfg = Release|x64 + {9345876F-09E3-4764-9B3C-6496152D523E}.Release|x64.Build.0 = Release|x64 + {6D2CFFFE-00E9-41C8-B389-059DA9AABDFC}.Debug|Win32.ActiveCfg = Debug|Win32 + {6D2CFFFE-00E9-41C8-B389-059DA9AABDFC}.Debug|Win32.Build.0 = Debug|Win32 + {6D2CFFFE-00E9-41C8-B389-059DA9AABDFC}.Debug|x64.ActiveCfg = Debug|x64 + {6D2CFFFE-00E9-41C8-B389-059DA9AABDFC}.Debug|x64.Build.0 = Debug|x64 + {6D2CFFFE-00E9-41C8-B389-059DA9AABDFC}.Release|Win32.ActiveCfg = Release|Win32 + {6D2CFFFE-00E9-41C8-B389-059DA9AABDFC}.Release|Win32.Build.0 = Release|Win32 + {6D2CFFFE-00E9-41C8-B389-059DA9AABDFC}.Release|x64.ActiveCfg = Release|x64 + {6D2CFFFE-00E9-41C8-B389-059DA9AABDFC}.Release|x64.Build.0 = Release|x64 + {7644167B-708E-4D09-A523-FB0F59871D82}.Debug|Win32.ActiveCfg = Debug|Win32 + {7644167B-708E-4D09-A523-FB0F59871D82}.Debug|Win32.Build.0 = Debug|Win32 + {7644167B-708E-4D09-A523-FB0F59871D82}.Debug|x64.ActiveCfg = Debug|x64 + {7644167B-708E-4D09-A523-FB0F59871D82}.Debug|x64.Build.0 = Debug|x64 + {7644167B-708E-4D09-A523-FB0F59871D82}.Release|Win32.ActiveCfg = Release|Win32 + {7644167B-708E-4D09-A523-FB0F59871D82}.Release|Win32.Build.0 = Release|Win32 + {7644167B-708E-4D09-A523-FB0F59871D82}.Release|x64.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal -- cgit v1.2.3