OSVR-Core
Public Types | Public Member Functions | Protected Member Functions | List of all members
osvr::connection::ConnectionDevice Class Referenceabstract

Base class for connection-specific device data, owned by a DeviceToken. More...

#include <ConnectionDevice.h>

Inheritance diagram for osvr::connection::ConnectionDevice:
osvr::connection::GenericConnectionDevice osvr::connection::VrpnConnectionDevice

Public Types

typedef std::vector< std::string > NameList
 

Public Member Functions

virtual OSVR_CONNECTION_EXPORT ~ConnectionDevice ()
 destructor
 
OSVR_CONNECTION_EXPORT std::string const & getName () const
 accessor for (primary) device name
 
NameList const & getNames () const
 accessor for device names
 
void process ()
 Process messages. More...
 
void sendData (util::time::TimeValue const &timestamp, MessageType *type, const char *bytestream, size_t len)
 Send message (as primary device name)
 
void setDeviceToken (DeviceToken &token)
 For use only by DeviceToken.
 
OSVR_CONNECTION_EXPORT void setDeviceDescriptor (std::string const &jsonString)
 Send new/updated JSON device descriptor. More...
 
OSVR_CONNECTION_EXPORT std::string const & getDeviceDescriptor () const
 Get the most current JSON device descriptor.
 

Protected Member Functions

bool m_hasDeviceToken () const
 Does this connection device have a device token? Should be true in nearly every case. More...
 
DeviceTokenm_getDeviceToken ()
 accessor for device token
 
virtual void m_process ()=0
 (Subclass implementation) Process messages. More...
 
virtual void m_sendData (util::time::TimeValue const &timestamp, MessageType *type, const char *bytestream, size_t len)=0
 (Subclass implementation) Send message.
 
OSVR_CONNECTION_EXPORT ConnectionDevice (std::string const &name)
 Constructor for use by derived classes only.
 
OSVR_CONNECTION_EXPORT ConnectionDevice (NameList const &names)
 Constructor for use by derived classes only.
 

Detailed Description

Base class for connection-specific device data, owned by a DeviceToken.

Member Function Documentation

§ m_hasDeviceToken()

bool osvr::connection::ConnectionDevice::m_hasDeviceToken ( ) const
protected

Does this connection device have a device token? Should be true in nearly every case.

§ m_process()

virtual void osvr::connection::ConnectionDevice::m_process ( )
protectedpure virtual

(Subclass implementation) Process messages.

This shouldn't block.

Implemented in osvr::connection::VrpnConnectionDevice, and osvr::connection::GenericConnectionDevice.

§ process()

void osvr::connection::ConnectionDevice::process ( )

Process messages.

This shouldn't block.

Someone needs to call this method frequently.

§ setDeviceDescriptor()

void osvr::connection::ConnectionDevice::setDeviceDescriptor ( std::string const &  jsonString)

Send new/updated JSON device descriptor.

Note: does not trigger the descriptor handlers in connection - those must be triggered by the caller!

Todo:
validate descriptor here

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