SurgSim::Devices::LabJackScaffold Class Reference

A class that implements the behavior of LabJackDevice objects. More...

`#include <SurgSim/Devices/LabJack/LabJackScaffold.h>`

## Classes

struct | DeviceData
| The per-device data. More...
class | Handle
struct | StateData
| The per-scaffold data (in comparison to DeviceData the per-device data). More...

## Public Member Functions

| LabJackScaffold ()
| Constructor. More...
| ~LabJackScaffold ()
| Destructor. More...
void | configureDevice (DeviceData *device)
| Does one-time configuration of the LabJack for timers, counters, and analog inputs. More...

## Static Public Member Functions

static std::shared_ptr< LabJackScaffold > | getOrCreateSharedInstance ()
| Gets or creates the scaffold shared by all LabJackDevice instances. More...

## Private Member Functions

bool | registerDevice (LabJackDevice *device)
| Registers the specified device object. More...
bool | unregisterDevice (const LabJackDevice *device)
| Unregisters the specified device object. More...
bool | runInputFrame (DeviceData *info)
| Executes the operations for a single input frame for a single device. More...
bool | updateDevice (DeviceData *info)
| Updates the device information for a single device. More...
bool | destroyPerDeviceThread (DeviceData *data)
| Destroys the input loop thread. More...
bool | configureClockAndTimers (DeviceData *deviceData)
| One-time configuration of the clock and timers. More...
bool | configureNumberOfTimers (DeviceData *deviceData)
| One-time configuration of the number of timers. More...
bool | configureClock (DeviceData *deviceData)
| One-time configuration of the clock. More...
bool | configureTimers (DeviceData *deviceData)
| One-time configuration of the timers. More...
bool | configureDigital (DeviceData *deviceData)
| One-time configuration of the digital inputs and outputs. More...
bool | configureAnalog (DeviceData *deviceData)
| One-time configuration of the analog inputs. More...

## Static Private Member Functions

static DataStructures::DataGroup | buildDeviceInputData ()
| Builds the data layout for the application input (i.e. device output). More...

## Private Attributes

std::shared_ptr< Framework::Logger > | m_logger
| Logger used by the scaffold and all devices. More...
std::unique_ptr< StateData > | m_state
| Internal scaffold state. More...

## Friends

class | LabJackDevice
class | LabJackThread
struct | StateData

## Detailed Description

A class that implements the behavior of LabJackDevice objects.

See also
  SurgSim::Devices::LabJackDevice

## Constructor & Destructor Documentation

## LabJackScaffold()

SurgSim::Devices::LabJackScaffold::LabJackScaffold | ( |  | ) |

Constructor.

## ~LabJackScaffold()

SurgSim::Devices::LabJackScaffold::~LabJackScaffold | ( |  | ) |

Destructor.

## Member Function Documentation

## buildDeviceInputData()

SurgSim::DataStructures::DataGroup SurgSim::Devices::LabJackScaffold::buildDeviceInputData | ( |  | ) |

static private

Builds the data layout for the application input (i.e. device output).

## configureAnalog()

bool SurgSim::Devices::LabJackScaffold::configureAnalog | ( | DeviceData * | deviceData | ) |

private

One-time configuration of the analog inputs.

Parameters

  deviceData | The internal device data.

Returns
  False if any errors.

## configureClock()

bool SurgSim::Devices::LabJackScaffold::configureClock | ( | DeviceData * | deviceData | ) |

private

One-time configuration of the clock.

Parameters

  deviceData | The internal device data.

Returns
  False if any errors.

## configureClockAndTimers()

bool SurgSim::Devices::LabJackScaffold::configureClockAndTimers | ( | DeviceData * | deviceData | ) |

private

One-time configuration of the clock and timers.

Parameters

  deviceData | The internal device data.

Returns
  False if any errors.

## configureDevice()

void SurgSim::Devices::LabJackScaffold::configureDevice | ( | DeviceData * | device | ) |

Does one-time configuration of the LabJack for timers, counters, and analog inputs.

Must be called by the LabJackThread because the LabJack separates all commands by the calling thread.

Parameters

  device | The internal device data.

## configureDigital()

bool SurgSim::Devices::LabJackScaffold::configureDigital | ( | DeviceData * | deviceData | ) |

private

One-time configuration of the digital inputs and outputs.

Parameters

  deviceData | The internal device data.

Returns
  False if any errors.

## configureNumberOfTimers()

bool SurgSim::Devices::LabJackScaffold::configureNumberOfTimers | ( | DeviceData * | deviceData | ) |

private

One-time configuration of the number of timers.

Parameters

  deviceData | The internal device data.

Returns
  False if any errors.

## configureTimers()

bool SurgSim::Devices::LabJackScaffold::configureTimers | ( | DeviceData * | deviceData | ) |

private

One-time configuration of the timers.

Parameters

  deviceData | The internal device data.

Returns
  False if any errors.

## destroyPerDeviceThread()

bool SurgSim::Devices::LabJackScaffold::destroyPerDeviceThread | ( | DeviceData * | data | ) |

private

Destroys the input loop thread.

Parameters

  data | The internal device data.

Returns
  true on success.

## getOrCreateSharedInstance()

std::shared_ptr< LabJackScaffold > SurgSim::Devices::LabJackScaffold::getOrCreateSharedInstance | ( |  | ) |

static

Gets or creates the scaffold shared by all LabJackDevice instances.

The scaffold is managed using a SharedInstance object, so it will be destroyed when all devices are released.

Returns
  the scaffold object.

## registerDevice()

bool SurgSim::Devices::LabJackScaffold::registerDevice | ( | LabJackDevice * | device | ) |

private

Registers the specified device object.

If successful, the device object will become connected to an unused hardware device.

Parameters

  device | The device object to be used, which should have a unique name.

Returns
  True if the initialization succeeds, false if it fails.

## runInputFrame()

bool SurgSim::Devices::LabJackScaffold::runInputFrame | ( | LabJackScaffold::DeviceData * | info | ) |

private

Executes the operations for a single input frame for a single device.

Should only be called from the context of the input loop thread.

Parameters

  info | The internal device data.

Returns
  True to keep the LabJackThread running.

## unregisterDevice()

bool SurgSim::Devices::LabJackScaffold::unregisterDevice | ( | const LabJackDevice * | device | ) |

private

Unregisters the specified device object.

The corresponding hardware device will become unused, and can be re-registered later.

Parameters

  device | The device object.

Returns
  true on success, false on failure.

## updateDevice()

bool SurgSim::Devices::LabJackScaffold::updateDevice | ( | LabJackScaffold::DeviceData * | info | ) |

private

Updates the device information for a single device.

Parameters

  info | The internal device data.

Returns
  true on success.

## Friends And Related Function Documentation

## LabJackDevice

friend class LabJackDevice

friend

## LabJackThread

friend class LabJackThread

friend

## StateData

friend struct StateData

friend

## Member Data Documentation

## m_logger

std::shared_ptr<Framework::Logger> SurgSim::Devices::LabJackScaffold::m_logger

private

Logger used by the scaffold and all devices.

## m_state

std::unique_ptr<StateData> SurgSim::Devices::LabJackScaffold::m_state

private

Internal scaffold state.

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

- SurgSim/Devices/LabJack/LabJackScaffold.h
- SurgSim/Devices/LabJack/linux/LabJackScaffold.cpp