PEBL 2.2
Psychology Experiment Building Language - Cross-platform psychological experiment development system
PEyeTracker.h
Go to the documentation of this file.
1//* -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*- */
3// Name: src/devices/PEyeTracker.h
4// Purpose: Class for handling gazelib eyetracker device
5// (TheEyeTribe eyetracker)
6// Author: Shane T. Mueller, Ph.D.
7// Copyright: (c) 2016 Shane T. Mueller <smueller@obereed.net>
8// License: GPL 2
9//
10//
11//
12// This file is part of the PEBL project.
13//
14// PEBL is free software; you can redistribute it and/or modify
15// it under the terms of the GNU General Public License as published by
16// the Free Software Foundation; either version 2 of the License, or
17// (at your option) any later version.
18//
19// PEBL is distributed in the hope that it will be useful,
20// but WITHOUT ANY WARRANTY; without even the implied warranty of
21// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22// GNU General Public License for more details.
23//
24// You should have received a copy of the GNU General Public License
25// along with PEBL; if not, write to the Free Software
26// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28//
29// This class is targeted to gazelib developed by theeyetribe, a $100 eyetracker.
30
31
32#ifdef PEBL_GAZELIB
33
34
35#ifndef __PEYETRACKER_H__
36#define __PEYETRACKER_H__
37
38#include "../base/PEBLObject.h"
39#include "../utility/rc_ptrs.h"
40
41#include "../../libs/tet-cpp-client-master/include/gazeapi.h"
42
43#include "../base/Variant.h"
44
45
46
47//This creates a class to access GazeAPI.
48//This does not create a listener that might be used to automatically
49//handle the gaze via an event loop.
50
51class PEyeTracker: virtual public PEBLObjectBase
52{
53public:
54 PEyeTracker();
55 virtual ~PEyeTracker();
56 virtual gtl::GazeData * GetGazeFrame();
57
58
59 virtual Variant GetProperty(std::string)const;
60 virtual bool SetProperty(std::string name, Variant v);
61 virtual ObjectValidationError ValidateProperty(std::string, Variant v)const;
62 virtual ObjectValidationError ValidateProperty(std::string)const;
63private:
64 gtl::GazeApi m_api;
65};
66
67
68 Variant ConvertGazeData(const gtl::GazeData &gd);
69
70
71// --- Gaze handler definition. This is used to create a listener function controlled by
72//TET, rather than just pulling data when you want it.
73class PEBLGaze : public gtl::IGazeListener
74{
75public:
76 PEBLGaze(std::string functionname);
77 ~PEBLGaze();
78private:
79 // IGazeListener
80 void on_gaze_data( gtl::GazeData const & gaze_data );
81private:
82 gtl::GazeApi m_api;
83 std::string mFunctionName;
84};
85
86
87
88
89#endif
90
91#endif
ObjectValidationError
Definition PEBLObject.h:37
virtual bool SetProperty(std::string name, Variant v)
virtual ObjectValidationError ValidateProperty(std::string, Variant v) const
Variant GetProperty(std::string) const