Overview
TheIProtocol interface is the base class for all protocol plugins. Protocols are responsible for transmitting tracking data from OpenTrack to games and applications using various communication methods.
Interface Definition
Methods
initialize()
module_status
Returns
status_ok() on success, or error(message) on failure.- Called once when the protocol is started
- Open network connections, shared memory, or other resources
- Validate configuration settings
- Register with game interfaces
- Return error if initialization fails
pose()
const double*
Filtered pose data as array:
[TX, TY, TZ, Yaw, Pitch, Roll] in degrees/cmconst double*
Raw pose data (before filtering) in same format as
pose- Called at 250Hz from the tracking pipeline thread
- Transform data to target format
- Send data via network, shared memory, or other IPC
- Use background threads for expensive operations
- Don’t block the calling thread
pose[TX]/raw[TX]: X translation in centimeterspose[TY]/raw[TY]: Y translation in centimeterspose[TZ]/raw[TZ]: Z translation in centimeterspose[Yaw]/raw[Yaw]: Yaw rotation in degreespose[Pitch]/raw[Pitch]: Pitch rotation in degreespose[Roll]/raw[Roll]: Roll rotation in degrees
game_name()
QString
Name of connected game, or placeholder text if none detected
- Called periodically from UI thread
- Return actual game name if detected
- Return generic text like “Game” if unknown
- Use mutex protection if name is updated from
pose()
Dialog Interface
register_protocol()
IProtocol*
Pointer to the running protocol instance
- Called from UI thread when protocol starts
- Store pointer for runtime interaction (optional)
- Can query protocol state or display status
- Often implemented as empty function
unregister_protocol()
- Clear any stored protocol pointers
- Stop accessing protocol data
- Clean up any UI state
Complete Example
Communication Patterns
UDP Network
UDP Network
Simple datagram-based protocol for network transmission.
Virtual Device
Virtual Device
Emulate joystick or other input device.
Performance Considerations
Best Practices
-
Use non-blocking I/O
-
Minimize allocations
-
Batch updates if needed
-
Use atomic operations for shared memory
See Also
- Tracker Interface - Capture tracking data
- Filter Interface - Process tracking data
- Metadata - Plugin metadata requirements