Public Member Functions | Private Attributes | Friends | List of all members
SurgSim::Device::KeyboardDevice Class Reference

A class implementing the communication with a keyboard. More...

#include <SurgSim/Devices/Keyboard/KeyboardDevice.h>

Inheritance diagram for SurgSim::Device::KeyboardDevice:
SurgSim::Input::CommonDevice SurgSim::Input::DeviceInterface

Public Member Functions

 KeyboardDevice (const std::string &deviceName)
 Constructor. More...
 
virtual ~KeyboardDevice ()
 Destructor. More...
 
virtual bool initialize () override
 Initialize this device and register it with corresponding scaffold. More...
 
virtual bool finalize () override
 "De"-initialize this device and unregister from the scaffold. More...
 
bool isInitialized () const
 Check if the scaffold of this device is initialized. More...
 
OsgKeyboardHandlergetKeyboardHandler () const
 Get keyboard handler. More...
 
- Public Member Functions inherited from SurgSim::Input::CommonDevice
 CommonDevice (const std::string &name)
 Constructor. More...
 
 CommonDevice (const std::string &name, const SurgSim::DataStructures::DataGroup &inputData)
 Constructor. More...
 
 CommonDevice (const std::string &name, SurgSim::DataStructures::DataGroup &&inputData)
 Constructor. More...
 
virtual ~CommonDevice ()
 Destructor. More...
 
virtual std::string getName () const override
 Return a (hopefully unique) device name. More...
 
void setNameForCallback (const std::string &name)
 Set the name used for calling the input consumers and output producer. More...
 
std::string getNameForCallback () const
 Get the name used for calling the input consumers and output producer. More...
 
virtual bool addInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer) override
 Connect this device to an InputConsumerInterface, which will receive the data that comes from this device. More...
 
virtual bool removeInputConsumer (std::shared_ptr< InputConsumerInterface > inputConsumer) override
 Disconnect this device from an InputConsumerInterface, which will no longer receive data from this device. More...
 
virtual bool setOutputProducer (std::shared_ptr< OutputProducerInterface > outputProducer) override
 Connect this device to an OutputProducerInterface, which will send data to this device. More...
 
virtual bool removeOutputProducer (std::shared_ptr< OutputProducerInterface > outputProducer) override
 Disconnect this device from an OutputProducerInterface, which will no longer send data to this device. More...
 
virtual bool hasOutputProducer () override
 Getter for whether or not this device is connected with an OutputProducerInterface. More...
 
- Public Member Functions inherited from SurgSim::Input::DeviceInterface
virtual ~DeviceInterface ()
 Virtual destructor (empty). More...
 

Private Attributes

std::shared_ptr< KeyboardScaffoldm_scaffold
 Communication with hardware is handled by scaffold. More...
 

Friends

class KeyboardScaffold
 
class KeyboardDeviceTest
 

Additional Inherited Members

- Protected Member Functions inherited from SurgSim::Input::CommonDevice
virtual void pushInput ()
 Push application input to consumers. More...
 
virtual bool pullOutput ()
 Pull application output from a producer. More...
 
SurgSim::DataStructures::DataGroupgetInputData ()
 Getter for the input data DataGroup. More...
 
const SurgSim::DataStructures::DataGroupgetOutputData () const
 Getter for the output data DataGroup. More...
 

Detailed Description

A class implementing the communication with a keyboard.

Application input provided from the device:
type name
int "key" Key code for the pressed key, if any. Default: -1
int "modifierMask" Mask for the pressed modifier, if any. Default: 0
Application output used by the device:
NONE
Note
Key 'Fn' is not currently captured (No key code is assigned to it).
See also
SurgSim::Input::CommonDevice, SurgSim::Input::DeviceInterface

Constructor & Destructor Documentation

SurgSim::Device::KeyboardDevice::KeyboardDevice ( const std::string deviceName)
explicit

Constructor.

Parameters
deviceNameName for keyboard device
SurgSim::Device::KeyboardDevice::~KeyboardDevice ( )
virtual

Destructor.

Member Function Documentation

bool SurgSim::Device::KeyboardDevice::finalize ( )
overridevirtual

"De"-initialize this device and unregister from the scaffold.

Returns
True on success; false, otherwise.

Implements SurgSim::Input::DeviceInterface.

OsgKeyboardHandler * SurgSim::Device::KeyboardDevice::getKeyboardHandler ( ) const

Get keyboard handler.

Returns
The keyboard handler associated with this device
bool SurgSim::Device::KeyboardDevice::initialize ( )
overridevirtual

Initialize this device and register it with corresponding scaffold.

Returns
True on success; false otherwise.

Implements SurgSim::Input::DeviceInterface.

bool SurgSim::Device::KeyboardDevice::isInitialized ( ) const

Check if the scaffold of this device is initialized.

Returns
True if this the scaffold of this device is initialized; Otherwise, false.

Friends And Related Function Documentation

friend class KeyboardDeviceTest
friend
friend class KeyboardScaffold
friend

Member Data Documentation

std::shared_ptr<KeyboardScaffold> SurgSim::Device::KeyboardDevice::m_scaffold
private

Communication with hardware is handled by scaffold.


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