A class that manages Sixense devices, such as the Razer Hydra.
More...
#include <SurgSim/Devices/Sixense/SixenseScaffold.h>
A class that manages Sixense devices, such as the Razer Hydra.
- See also
- SurgSim::Devices::SixenseDevice
§ ~SixenseScaffold()
SurgSim::Devices::SixenseScaffold::~SixenseScaffold |
( |
| ) |
|
§ SixenseScaffold()
SurgSim::Devices::SixenseScaffold::SixenseScaffold |
( |
| ) |
|
|
private |
§ buildDeviceInputData()
Builds the data layout for the application input (i.e. device output).
§ createThread()
bool SurgSim::Devices::SixenseScaffold::createThread |
( |
| ) |
|
|
private |
Creates the input loop thread.
- Returns
- true on success.
§ destroyThread()
bool SurgSim::Devices::SixenseScaffold::destroyThread |
( |
| ) |
|
|
private |
Destroys the input loop thread.
Should be called while NOT holding the internal device list mutex, to prevent deadlock.
- Returns
- true on success.
§ finalizeSdk()
bool SurgSim::Devices::SixenseScaffold::finalizeSdk |
( |
| ) |
|
|
private |
Finalizes (de-initializes) the Sixense SDK.
- Returns
- true on success.
§ findUnusedDeviceAndRegister()
bool SurgSim::Devices::SixenseScaffold::findUnusedDeviceAndRegister |
( |
SixenseDevice * |
device, |
|
|
int * |
numUsedDevicesSeen, |
|
|
bool * |
fatalError |
|
) |
| |
|
private |
Scans controllers that are present in the system, and if an unused one is found, register a device for it.
- Parameters
-
| device | The device object to register if an unused device is found. |
[out] | numUsedDevicesSeen | The number of devices that were found during the scan but were already in use. Can be used if the scan fails to determine the error message that should be displayed. |
[out] | fatalError | Set to true if an error (such as a duplicate device name) prevented device registration such that retrying will not help; false otherwise. |
- Returns
- true on success.
§ getOrCreateSharedInstance()
std::shared_ptr< SixenseScaffold > SurgSim::Devices::SixenseScaffold::getOrCreateSharedInstance |
( |
| ) |
|
|
static |
Gets or creates the scaffold shared by all SixenseDevice instances.
The scaffold is managed using a SharedInstance object, so it will be destroyed when all devices are released.
- Returns
- the scaffold object.
§ initializeSdk()
bool SurgSim::Devices::SixenseScaffold::initializeSdk |
( |
| ) |
|
|
private |
Initializes the Sixense SDK.
- Returns
- true on success.
§ registerDevice()
bool SurgSim::Devices::SixenseScaffold::registerDevice |
( |
SixenseDevice * |
device | ) |
|
|
private |
Registers the specified device object.
If successful, the device object will become connected to an unused controller.
- Parameters
-
device | The device object to be used, which should have a unique name. |
- Returns
- True if the initialization succeeds, false if it fails.
§ registerIfUnused()
bool SurgSim::Devices::SixenseScaffold::registerIfUnused |
( |
int |
baseIndex, |
|
|
int |
controllerIndex, |
|
|
SixenseDevice * |
device, |
|
|
int * |
numUsedDevicesSeen |
|
) |
| |
|
private |
Register a device object given a (baseIndex, controllerIndex) pair, if the same pair is not already in use.
- Parameters
-
| baseIndex | Index of the base unit. |
| controllerIndex | Index of the controller within the base unit. |
| device | The device object to register if the index pair is in fact unused. |
[in,out] | numUsedDevicesSeen | The number of devices that were found during the scan but were already in use; incremented when an unused device is seen. |
- Returns
- true on success.
§ runInputFrame()
bool SurgSim::Devices::SixenseScaffold::runInputFrame |
( |
| ) |
|
|
private |
Executes the operations for a single input frame.
Should only be called from the context of the input loop thread.
- Returns
- true on success.
§ unregisterDevice()
bool SurgSim::Devices::SixenseScaffold::unregisterDevice |
( |
const SixenseDevice * |
device | ) |
|
|
private |
Unregisters the specified device object.
The corresponding controller will become unused, and can be re-registered later.
- Parameters
-
- Returns
- true on success, false on failure.
§ updateDevice()
bool SurgSim::Devices::SixenseScaffold::updateDevice |
( |
const DeviceData & |
info | ) |
|
|
private |
Updates the device information for a single device.
- Returns
- true on success.
§ SixenseDevice
§ SixenseThread
§ StateData
§ m_logger
Logger used by the scaffold and all devices.
§ m_startupDelayMilliseconds
int SurgSim::Devices::SixenseScaffold::m_startupDelayMilliseconds = 6000 |
|
staticprivate |
How long we're willing to wait for devices to be detected, in milliseconds.
§ m_startupRetryIntervalMilliseconds
int SurgSim::Devices::SixenseScaffold::m_startupRetryIntervalMilliseconds = 100 |
|
staticprivate |
How long to wait between trying to detect devices, in milliseconds.
§ m_state
std::unique_ptr<StateData> SurgSim::Devices::SixenseScaffold::m_state |
|
private |
The documentation for this class was generated from the following files: