Skip to content

3. Getting started

Davide De Tommaso edited this page May 13, 2021 · 4 revisions

TobiiGlassesController

The TobiiGlassesController class implements the methods for connecting to the device and for streaming and recording data. Once the TobiiClassesPyController is installed you can start using with Python.

Import the controller

python
>>> from tobiiglassesctrl import TobiiGlassesController

Connecting to the device (general case)

A discovery method is implemented in the controller in such a way, whenever the constructor is called without parameters, it automatically starts searching the device among all the network interfaces available in the host PC. Please be aware that the discovery process is slower than connecting knowing the address of the device, as explained later.

python
>>> from tobiiglassesctrl import TobiiGlassesController
>>> TobiiGlassesController()
[DEBUG]: Looking for a Tobii Pro Glasses 2 device ...
[DEBUG]: Discover request sent to ('ff02::1', 13006) on interface```

Once you know the address of the device is preferably to avoid using the discovery process for connecting.

Connecting to the device (IPv4 case)

If the IPv4 address of the device is 192.168.71.50 then you can connect with:

>>> TobiiGlassesController("192.168.71.50")
[DEBUG]: Connecting to the Tobii Pro Glasses 2 ...
[DEBUG]: Tobii Pro Glasses 2 successful connected!

Connecting to the device (IPv6 case)

If the IPv4 address of the device is fe80::76fe:48ff:ffff:ffff and the interface is eth0 then you can connect with:

>>> TobiiGlassesController("fe80::76fe:48ff:ffff:ffff%eth0")
[DEBUG]: Connecting to the Tobii Pro Glasses 2 ...
[DEBUG]: Tobii Pro Glasses 2 successful connected!

How to start a docker container

Firstly, you need to install Docker CE and docker-compose.

cd docker
docker-compose run tobiiglasses2