All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Classes | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes | Friends | List of all members
SurgSim::Device::LabJackScaffold Class Reference

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

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

Collaboration diagram for SurgSim::Device::LabJackScaffold:
Collaboration graph
[legend]

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...
 
std::shared_ptr
< SurgSim::Framework::Logger
getLogger () const
 Gets the logger used by this object and the devices it manages. More...
 
bool 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
SurgSim::DataStructures::DataGroup 
buildDeviceInputData ()
 Builds the data layout for the application input (i.e. device output). More...
 

Private Attributes

std::shared_ptr
< SurgSim::Framework::Logger
m_logger
 Logger used by the scaffold and all devices. More...
 
std::unique_ptr< StateDatam_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::Device::LabJackDevice

Constructor & Destructor Documentation

SurgSim::Device::LabJackScaffold::LabJackScaffold ( )

Constructor.

SurgSim::Device::LabJackScaffold::~LabJackScaffold ( )

Destructor.

Member Function Documentation

SurgSim::DataStructures::DataGroup SurgSim::Device::LabJackScaffold::buildDeviceInputData ( )
staticprivate

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

bool SurgSim::Device::LabJackScaffold::configureAnalog ( DeviceData deviceData)
private

One-time configuration of the analog inputs.

Parameters
deviceDataThe internal device data.
Returns
False if any errors.
bool SurgSim::Device::LabJackScaffold::configureClock ( DeviceData deviceData)
private

One-time configuration of the clock.

Parameters
deviceDataThe internal device data.
Returns
False if any errors.
bool SurgSim::Device::LabJackScaffold::configureClockAndTimers ( DeviceData deviceData)
private

One-time configuration of the clock and timers.

Parameters
deviceDataThe internal device data.
Returns
False if any errors.
bool SurgSim::Device::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
deviceThe internal device data.
Returns
False if any errors.
bool SurgSim::Device::LabJackScaffold::configureDigital ( DeviceData deviceData)
private

One-time configuration of the digital inputs and outputs.

Parameters
deviceDataThe internal device data.
Returns
False if any errors.
bool SurgSim::Device::LabJackScaffold::configureNumberOfTimers ( DeviceData deviceData)
private

One-time configuration of the number of timers.

Parameters
deviceDataThe internal device data.
Returns
False if any errors.
bool SurgSim::Device::LabJackScaffold::configureTimers ( DeviceData deviceData)
private

One-time configuration of the timers.

Parameters
deviceDataThe internal device data.
Returns
False if any errors.
bool SurgSim::Device::LabJackScaffold::destroyPerDeviceThread ( DeviceData data)
private

Destroys the input loop thread.

Parameters
dataThe internal device data.
Returns
true on success.
std::shared_ptr< SurgSim::Framework::Logger > SurgSim::Device::LabJackScaffold::getLogger ( ) const

Gets the logger used by this object and the devices it manages.

Returns
The logger.
std::shared_ptr< LabJackScaffold > SurgSim::Device::LabJackScaffold::getOrCreateSharedInstance ( )
static

Gets or creates the scaffold shared by all LabJackDevice instances.

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

Returns
the scaffold object.
bool SurgSim::Device::LabJackScaffold::registerDevice ( LabJackDevice device)
private

Registers the specified device object.

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

Parameters
deviceThe device object to be used, which should have a unique name.
Returns
True if the initialization succeeds, false if it fails.
bool SurgSim::Device::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
infoThe internal device data.
Returns
True to keep the LabJackThread running.
bool SurgSim::Device::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
deviceThe device object.
Returns
true on success, false on failure.
bool SurgSim::Device::LabJackScaffold::updateDevice ( LabJackScaffold::DeviceData info)
private

Updates the device information for a single device.

Parameters
infoThe internal device data.
Returns
true on success.

Friends And Related Function Documentation

friend class LabJackDevice
friend
friend class LabJackThread
friend
friend struct StateData
friend

Member Data Documentation

std::shared_ptr<SurgSim::Framework::Logger> SurgSim::Device::LabJackScaffold::m_logger
private

Logger used by the scaffold and all devices.

std::unique_ptr<StateData> SurgSim::Device::LabJackScaffold::m_state
private

Internal scaffold state.


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