59 #ifndef _ART_DTRACKSDK_HPP_ 60 #define _ART_DTRACKSDK_HPP_ 62 #include "DTrackDataTypes.hpp" 63 #include "DTrackNet.hpp" 64 #include "DTrackParser.hpp" 70 #define DTRACK_PROT_MAXLEN DTrackSDK::DTRACK2_PROT_MAXLEN 112 DTrackSDK(
const std::string& connection );
138 DTrackSDK(
const std::string& server_host,
unsigned short data_port);
147 DTrackSDK(
const std::string& server_host,
unsigned short server_port,
unsigned short data_port);
160 DTrackSDK(
const std::string& server_host,
161 unsigned short server_port,
162 unsigned short data_port,
164 int data_bufsize = 0,
165 int data_timeout_us = 0,
166 int srv_timeout_us = 0
325 std::string
getBuf()
const;
418 bool setParam(
const std::string& category,
const std::string& name,
const std::string& value);
426 bool setParam(
const std::string& parameter);
436 bool getParam(
const std::string& category,
const std::string& name, std::string& value);
445 bool getParam(
const std::string& parameter, std::string& value);
507 bool tactileFinger(
int handId,
int fingerId,
double strength );
521 bool tactileHand(
int handId,
const std::vector< double >& strength );
547 bool flystickBeep(
int flystickId,
double durationMs,
double frequencyHz );
564 static const unsigned short DTRACK2_PORT_COMMAND = 50105;
565 static const unsigned short DTRACK2_PORT_UDPSENDER = 50107;
566 static const unsigned short DTRACK2_PORT_FEEDBACK = 50110;
568 static const int DEFAULT_TCP_TIMEOUT = 10000000;
569 static const int DEFAULT_UDP_TIMEOUT = 1000000;
570 static const int DEFAULT_UDP_BUFSIZE = 32768;
578 void setLastDTrackError(
int newError = 0,
const std::string& newErrorString =
"");
588 void init(
const std::string& server_host,
unsigned short server_port,
unsigned short data_port,
598 bool sendStatefulFirewallPacket();
606 bool sendFeedbackCommand(
const std::string& command );
613 std::string lastDTrackErrorString;
619 unsigned int d_remoteIp;
620 unsigned short d_remoteDT1Port;
622 unsigned int d_udpSenderIp;
623 unsigned short d_udpSenderPort;
628 std::string d_message_origin;
629 std::string d_message_status;
630 unsigned int d_message_framenr;
631 unsigned int d_message_errorid;
632 std::string d_message_msg;
636 #endif // _ART_DTRACKSDK_HPP_ bool setDataBufferSize(int bufSize)
Set UDP buffer size for receiving tracking data.
std::string getBuf() const
Get content of the UDP buffer.
bool receive()
Receive and process one tracking data packet.
unsigned short getDataPort() const
Get UDP data port where tracking data is received.
bool isCommandInterfaceFullAccess()
Returns if TCP connection has full access for DTrack2/DTRACK3 commands.
bool setParam(const std::string &category, const std::string &name, const std::string &value)
Set DTrack2/DTRACK3 parameter.
bool setControllerTimeoutUS(int timeout)
Alias for setCommandTimeoutUS(). DEPRECATED.
std::string getMessageOrigin() const
Get origin of last DTrack2/DTRACK3 event message.
DTrackSDK(const std::string &connection)
Universal constructor. Can be used for any mode. Recommended for new applications.
bool enableStatefulFirewallConnection(const std::string &senderHost, unsigned short senderPort=DTRACK2_PORT_UDPSENDER)
Enable UDP connection through a stateful firewall.
bool setDataTimeoutUS(int timeout)
Set UDP timeout for receiving tracking data.
bool isTCPValid() const
Alias for isCommandInterfaceValid(). DEPRECATED.
std::string getLastDTrackErrorDescription() const
Get last DTrack2/DTRACK3 command error description.
unsigned int getMessageErrorId() const
Get error id of last DTrack2/DTRACK3 event message.
RemoteSystemType getRemoteSystemType() const
Get current remote system type (e.g. DTrack1, DTrack2/DTRACK3).
bool tactileFinger(int handId, int fingerId, double strength)
Send tactile FINGERTRACKING command to set feedback on a specific finger of a specific hand...
bool isUDPValid() const
Alias for isDataInterfaceValid(). DEPRECATED.
bool getParam(const std::string &category, const std::string &name, std::string &value)
Get DTrack2/DTRACK3 parameter.
unsigned int getMessageFrameNr() const
Get frame counter of last DTrack2/DTRACK3 event message.
DTrack SDK main class derived from DTrackParser.
std::string getMessageStatus() const
Get status of last DTrack2/DTRACK3 event message.
bool processPacket(const std::string &data)
Process one tracking packet manually.
static const int DTRACK2_PROT_MAXLEN
max. length of 'dtrack2' command
Errors getLastServerError() const
Get last error at exchanging commands with Controller (command transmission).
bool isCommandInterfaceValid() const
Returns if TCP connection for DTrack2/DTRACK3 commands is active.
bool flystickVibration(int flystickId, int vibrationPattern)
Send Flystick feedback command to start a vibration pattern on a specific Flystick.
bool sendDTrack1Command(const std::string &command)
Send DTrack1 command via UDP.
std::string getMessageMsg() const
Get message text of last DTrack2/DTRACK3 event message.
bool flystickBeep(int flystickId, double durationMs, double frequencyHz)
Send Flystick feedback command to start a beep on a specific Flystick.
bool sendCommand(const std::string &command)
Alias for sendDTrack1Command(). DEPRECATED.
RemoteSystemType
Compatibility modes for older DTrack systems.
Error while parsing command.
bool isDataInterfaceValid() const
Returns if UDP socket is open to receive tracking data on local machine.
bool getMessage()
Get DTrack2/DTRACK3 event message from the Controller.
Errors getLastDataError() const
Get last error at receiving tracking data (data transmission).
bool tactileHandOff(int handId, int numFinger)
Send tactile FINGERTRACKING command to turn off tactile feedback on all fingers of a specific hand...
bool stopMeasurement()
Stop measurement.
bool startMeasurement()
Start measurement.
bool isLocalDataPortValid() const
Alias for isDataInterfaceValid(). DEPRECATED.
int getLastDTrackError() const
Get last DTrack2/DTRACK3 command error code.
bool setCommandTimeoutUS(int timeout)
Set TCP timeout for exchanging commands with Controller.
int sendDTrack2Command(const std::string &command, std::string *answer=NULL)
Send DTrack2/DTRACK3 command to DTrack and receive answer (TCP command interface).
bool isValid()
Returns if constructor was successful due to the wanted mode.
bool tactileHand(int handId, const std::vector< double > &strength)
Send tactile FINGERTRACKING command to set tactile feedback on all fingers of a specific hand...