v2.0.0
Loading...
Searching...
No Matches
UTILSLIB::PolhemusConnection Class Reference

Polhemus digitizer connection (mock + serial-port backends). More...

#include <polhemus_connection.h>

Signals

void pointReceived (int station, const QVector3D &position, const QQuaternion &orientation)
void connectedChanged (bool isConnected)
void errorOccurred (const QString &message)
void penButtonPressed (int station, const QVector3D &position, const QQuaternion &orientation)

Public Member Functions

 PolhemusConnection (QObject *parent=nullptr)
 ~PolhemusConnection () override
bool open (const QString &portName, const PolhemusSerialConfig &cfg=PolhemusSerialConfig{})
void close ()
bool isConnected () const
QString backendName () const

Static Public Member Functions

static QStringList availablePorts ()
 Enumerate every serial port currently visible to the OS.
static QString autoDetectPortName ()
 Best-effort auto-detection of an attached Fastrak/FastSCAN.

Detailed Description

Polhemus digitizer connection (mock + serial-port backends).

Definition at line 84 of file polhemus_connection.h.

Inheritance diagram for UTILSLIB::PolhemusConnection:
Inheritance graph

Constructor & Destructor Documentation

◆ PolhemusConnection()

PolhemusConnection::PolhemusConnection ( QObject * parent = nullptr)
explicit

Definition at line 37 of file polhemus_connection.cpp.

◆ ~PolhemusConnection()

PolhemusConnection::~PolhemusConnection ( )
override

Definition at line 50 of file polhemus_connection.cpp.

Member Function Documentation

◆ autoDetectPortName()

QString PolhemusConnection::autoDetectPortName ( )
static

Best-effort auto-detection of an attached Fastrak/FastSCAN.

Polhemus Fastrak/FastSCAN units ship with an FTDI USB-serial bridge (vendor id 0x0F44 for newer Polhemus-branded units, 0x0403 for the generic FTDI chip used in older units). This scan returns the first matching port name, or an empty string if no candidate is found.

Definition at line 126 of file polhemus_connection.cpp.

◆ availablePorts()

QStringList PolhemusConnection::availablePorts ( )
static

Enumerate every serial port currently visible to the OS.

Convenience wrapper around QSerialPortInfo::availablePorts that returns just the system port names (e.g. /dev/cu.usbserial-AB0, COM3) so callers can populate a combo box without pulling in QSerialPortInfo themselves.

Definition at line 115 of file polhemus_connection.cpp.

◆ backendName()

QString PolhemusConnection::backendName ( ) const

Definition at line 106 of file polhemus_connection.cpp.

◆ close()

void PolhemusConnection::close ( )

Close the active connection. Safe to call when already closed.

Definition at line 84 of file polhemus_connection.cpp.

◆ connectedChanged

void UTILSLIB::PolhemusConnection::connectedChanged ( bool isConnected)
signal

Emitted whenever isConnected changes.

◆ errorOccurred

void UTILSLIB::PolhemusConnection::errorOccurred ( const QString & message)
signal

Non-fatal protocol/IO error (already logged by the backend).

◆ isConnected()

bool PolhemusConnection::isConnected ( ) const

Definition at line 101 of file polhemus_connection.cpp.

◆ open()

bool PolhemusConnection::open ( const QString & portName,
const PolhemusSerialConfig & cfg = PolhemusSerialConfig{} )

Open the connection.

Parameters
portNameEmpty → mock backend. Non-empty → hardware backend.
cfgSerial transport configuration; ignored by the mock backend.

Definition at line 57 of file polhemus_connection.cpp.

◆ penButtonPressed

void UTILSLIB::PolhemusConnection::penButtonPressed ( int station,
const QVector3D & position,
const QQuaternion & orientation )
signal

Emitted when the continuous stream pauses (pen button pressed). The last received position/orientation are provided so the caller can record the capture without a separate GUI button click.

After emitting, the connection automatically restarts the continuous stream so the live feed resumes on button release.

◆ pointReceived

void UTILSLIB::PolhemusConnection::pointReceived ( int station,
const QVector3D & position,
const QQuaternion & orientation )
signal
Parameters
stationPolhemus station id (1..4 for FastSCAN).
positionSample point in metres, sensor-frame.
orientationSensor orientation; identity if N/A.

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