Eyetracker |

Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
pygaze._eyetracker.pytribe.connection Class Reference

## Public Member Functions
| __init__ (self, host='localhost', port=6555)
| request (self, category, request, values)
| create_json (self, category, request, values)
| parse_json (self, jsonmsg)
| revive (self)
| close (self)

## Public Attributes
| host = host
| port = port
bool | DEBUG = False
float | response_timeout = 1.0
| sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

## Protected Member Functions
| _get_responses (self)

## Protected Attributes
dict | _responses
| _request_lock = Lock()
| _debugfile = open('DEBUG_output.txt', 'w')
| _debuglock = Lock()
bool | _listening = True
| _listenthread = Thread(target=self._get_responses, args=[])

## Detailed Description

    class for connections with the EyeTribe tracker

## Constructor & Destructor Documentation

## ◆ __init__()

pygaze._eyetracker.pytribe.connection.__init__ | ( |  | self,
|  |  | host = 'localhost',
|  |  | port = 6555 )

    Initializes the connection with the EyeTribe tracker

            keyword arguments

            host        --  a string indicating the host IP, NOTE: currently only
                        'localhost' is supported (default = 'localhost')
            port        --  an integer indicating the port number, NOTE: currently
                        only 6555 is supported (default = 6555)

## Member Function Documentation

## ◆ _get_responses()

pygaze._eyetracker.pytribe.connection._get_responses | ( |  | self | ) |
| protected

    INTERNAL USE ONLY. This method is run in a sub-Thread, to listen
            to the EyeTribe, and to process all its responses. Responses are
            stored in a

## ◆ close()

pygaze._eyetracker.pytribe.connection.close | ( |  | self | ) |

    Closes the connection to the EyeTribe tracker

## ◆ create_json()

pygaze._eyetracker.pytribe.connection.create_json | ( |  | self,
|  |  | category,
|  |  | request,
|  |  | values )

    Creates a new json message, in the format that is required by the
            EyeTribe tracker; these messages consist of a categort, a request and
            a (list of) value(s), which can be thought of as class.method.value
            (for more info, see: http://dev.theeyetribe.com/api/)

            arguments

            category    --  query category (string), e.g. 'tracker',
                        'calibration', or 'heartbeat'
            request --  the request message (string), e.g. 'get' for the
                        'tracker' category
            values  --  a dict of parameters and their values, e.g.
                        {"push":True, "version":1}
                        OR:
                        a list of parameters, e.g. ['push','iscalibrated']
                        OR:
                        None to pass no values at all

            keyword arguments

            None

            returns

            jsonmsg --  a string in json format, that can be directly sent to
                        the EyeTribe tracker

## ◆ parse_json()

pygaze._eyetracker.pytribe.connection.parse_json | ( |  | self,
|  |  | jsonmsg )

    Parses a json message as those that are usually returned by the
            EyeTribe tracker
            (for more info, see: http://dev.theeyetribe.com/api/)

            arguments

            jsonmsg --  a string in json format

            keyword arguments

            None

            returns

            msg     --  a dict containing the information in the json message;
                        this dict has the following content:
                            {   "category": "tracker",
                                "request":  "get",
                                "statuscode":   200,
                                "values":   {   "push":True,
                                            "iscalibrated":True
                                            }
                                }

## ◆ request()

pygaze._eyetracker.pytribe.connection.request | ( |  | self,
|  |  | category,
|  |  | request,
|  |  | values )

    Send a message over the connection

            arguments

            category    --  string indicating the query category
            request --  string indicating the actual request of the message
            values  --  dict or list containing parameters of the request

## ◆ revive()

pygaze._eyetracker.pytribe.connection.revive | ( |  | self | ) |

    Re-establishes a connection

## Member Data Documentation

## ◆ _debugfile

pygaze._eyetracker.pytribe.connection._debugfile = open('DEBUG_output.txt', 'w')
| protected

## ◆ _debuglock

pygaze._eyetracker.pytribe.connection._debuglock = Lock()
| protected

## ◆ _listening

bool pygaze._eyetracker.pytribe.connection._listening = True
| protected

## ◆ _listenthread

pygaze._eyetracker.pytribe.connection._listenthread = Thread(target=self._get_responses, args=[])
| protected

## ◆ _request_lock

pygaze._eyetracker.pytribe.connection._request_lock = Lock()
| protected

## ◆ _responses

dict pygaze._eyetracker.pytribe.connection._responses
| protected

## ◆ DEBUG

bool pygaze._eyetracker.pytribe.connection.DEBUG = False

## ◆ host

pygaze._eyetracker.pytribe.connection.host = host

## ◆ port

pygaze._eyetracker.pytribe.connection.port = port

## ◆ response_timeout

float pygaze._eyetracker.pytribe.connection.response_timeout = 1.0

## ◆ sock

pygaze._eyetracker.pytribe.connection.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)

The documentation for this class was generated from the following file:

- C:/Users/lurax/eyetrackingTobii/pygaze/_eyetracker/pytribe.py