GlassesSDK handles Tobii Glasses 2 communications. More...
#include <TobiiGlassesSDK.h>
Public Member Functions | |
| GlassesSDK (const char *glassesIPAddress="192.168.71.50", unsigned int bufferSize=10) | |
| Constructor will setup glasses. | |
| ~GlassesSDK () | |
| Destructor will clean and delete every instance. | |
| void | setVideoCallback (std::function< void(cv::Mat &, const int64_t) > func) |
| setVideoCallback | |
| void | setDataCallback (std::function< void(std::string &) >) |
| setDataCallback | |
| void | setDataFilledCallback (std::function< void(Data &data, unsigned int sizeBuffer, char flag)>) |
| setDataCallback | |
| bool | discovery (bool setSyncDate) |
| discovery | |
| void | livestream (int flag) |
| livestream | |
| void | showServices () |
| showServices | |
| std::string | listProjects () |
| listProjects | |
| std::string | createParticipant (const char *project_id) |
| createParticipant | |
| std::string | createCalibration (const char *project_id, const char *participant_id) |
| createCalibration | |
| std::string | startCalibration (const char *calibration_id) |
| startCalibration | |
| std::string | stopCalibration (const char *calibration_id) |
| stopCalibration | |
| std::string | wait_for_status (const std::string &api_action, const std::string &key, const std::vector< std::string > &refvals) |
| wait_for_status | |
| bool | calibrate (const std::string &calibration_id) |
| calibrate | |
| std::string | listRecordings () |
| listRecordings | |
| std::string | showRecording (const char *recording_id) |
| showRecording | |
| std::string | createRecording (const char *participant_id) |
| createRecording | |
| std::string | startRecording (const char *recording_id) |
| startRecording | |
| std::string | stopRecording (const char *recording_id) |
| stopRecording | |
| void | stopLiveStream () |
| stopLiveStream | |
Static Public Member Functions | |
| static uint64_t | getTimeStamp () |
| getTimeStamp | |
| static void | timestamp2date (uint64_t t, std::string &) |
| timestamp2date | |
| static void | date2timestamp (const std::string &datestr, uint64_t *t) |
| date2timestamp | |
| static void | JAULA_traverse (JAULA::Value *val, int level=0) |
| JAULA_traverse. | |
Static Public Attributes | |
| static const char | HTTP_HEADER_JSON = 0x01 |
GlassesSDK handles Tobii Glasses 2 communications.
It is working with Network API and Streamer API from the same package. This class provide some methods to easily retrieve information from the Tobii Glasses 2 using video callback and data callback functions for the livestream or simply http requests giving json responses from the Tobii.
| Tobii::GlassesSDK::GlassesSDK | ( | const char * | glassesIPAddress = "192.168.71.50", |
| unsigned int | bufferSize = 10 |
||
| ) |
Constructor will setup glasses.
| const | char * glasses's IP address. |
| unsigned | int the SDK buffer size. |
| bool Tobii::GlassesSDK::calibrate | ( | const std::string & | calibration_id | ) |
calibrate
Start a calibration and return if the calibration succeeded or not.
| calibration_id | the calibration we want to start. |
| std::string Tobii::GlassesSDK::createCalibration | ( | const char * | project_id, |
| const char * | participant_id | ||
| ) |
createCalibration
Create a calibration for a participant and a project id.
| project_id | The calibration will be created within the project with this id. |
| participant_id | The calibration will be linked with the participant with this id. |
| std::string Tobii::GlassesSDK::createParticipant | ( | const char * | project_id | ) |
createParticipant
Create a participant on the Tobii Glasses 2
| project_id | The participant will be created within the project with this id. |
| std::string Tobii::GlassesSDK::createRecording | ( | const char * | participant_id | ) |
createRecording
Create a recording on the Tobii Glasses 2
| participant_id | the recording will be created for this participant. |
| void Tobii::GlassesSDK::date2timestamp | ( | const std::string & | datestr, |
| uint64_t * | t | ||
| ) | [static] |
date2timestamp
Convert a string date to timestamp.
| date | : string date formatted. | |
| [out] | timestamp | : a timestamp in microseconds. |
| bool Tobii::GlassesSDK::discovery | ( | bool | setSyncDate | ) |
| uint64_t Tobii::GlassesSDK::getTimeStamp | ( | ) | [static] |
getTimeStamp
Give the timestamp since System Epoch.
| void Tobii::GlassesSDK::JAULA_traverse | ( | JAULA::Value * | val, |
| int | level = 0 |
||
| ) | [static] |
JAULA_traverse.
Will print to the stdout the content of the JAULA::Value which is json parsed with the JAULA parser.
| std::string Tobii::GlassesSDK::listProjects | ( | ) |
listProjects
Will list the projects on the Tobii Glasses 2
| std::string Tobii::GlassesSDK::listRecordings | ( | ) |
listRecordings
Will list the recordings on the Tobii Glasses 2
| void Tobii::GlassesSDK::livestream | ( | int | flag | ) |
livestream
Will livestream the glasses, this method will retrieve information from Tobii Glasses on livestream until the end.
| flag | : TOBII_LIVE_ON_WINDOW will call Streamer::run function, TOBII_LIVE_ON_OPENCV will call Streamer::runCV which is necessary to use the videoCallback for video frame retrieval. |
| void Tobii::GlassesSDK::setDataCallback | ( | std::function< void(std::string &) > | func | ) |
setDataCallback
Will set the data callback.
| func | : the function address. |
| void Tobii::GlassesSDK::setDataFilledCallback | ( | std::function< void(Data &data, unsigned int sizeBuffer, char flag)> | func | ) |
setDataCallback
Will set the data callback. This callback is called each time the buffer is filled with a complete data.
| func | : the function address. |
| void Tobii::GlassesSDK::setVideoCallback | ( | std::function< void(cv::Mat &, const int64_t) > | func | ) |
setVideoCallback
Will set the video callback by calling the setter of Streamer API instance.
| func | : the function address. |
| std::string Tobii::GlassesSDK::showRecording | ( | const char * | recording_id | ) |
showRecording
Will give the recording information.
| recording_id | the recording id. |
| void Tobii::GlassesSDK::showServices | ( | ) |
showServices
This method will print on the standard output the html document that will give the list of Tobii services.
| std::string Tobii::GlassesSDK::startCalibration | ( | const char * | calibration_id | ) |
startCalibration
Start the calibration
| calibration_id | The calibration with this id will be started. |
| std::string Tobii::GlassesSDK::startRecording | ( | const char * | recording_id | ) |
startRecording
Start a recording on the Tobii Glasses 2
| participant_id | the recording that will be started. |
| std::string Tobii::GlassesSDK::stopCalibration | ( | const char * | calibration_id | ) |
stopCalibration
Stop the calibration
| calibration_id | The calibration with this id will be stopped. |
| void Tobii::GlassesSDK::stopLiveStream | ( | ) |
stopLiveStream
Will stop the Tobii Glasses 2 SDK livestream. This one is highly recommended.
| std::string Tobii::GlassesSDK::stopRecording | ( | const char * | recording_id | ) |
stopRecording
Stop a recording on the Tobii Glasses 2
| participant_id | the recording that will be stopped. |
| void Tobii::GlassesSDK::timestamp2date | ( | uint64_t | t, |
| std::string & | date | ||
| ) | [static] |
timestamp2date
Convert a timestamp to string date format.
| timestamp | : a timestamp in microseconds. | |
| [out] | date | : string date formatted. |
| std::string Tobii::GlassesSDK::wait_for_status | ( | const std::string & | api_action, |
| const std::string & | key, | ||
| const std::vector< std::string > & | refvals | ||
| ) |
wait_for_status
Will launch requests until the values of field key in the response matches the refvals.
| api_action | the url for the post request (the service uri). |
| key | the key element to test in the JSON answer. |
| refvals | the reference values to match. |
const char Tobii::GlassesSDK::HTTP_HEADER_JSON = 0x01 [static] |
flag to set the application/json HTTP Header.
1.7.6.1