25 #ifndef INCLUDED_DeviceToken_h_GUID_428B015C_19A2_46B0_CFE6_CC100763D387
26 #define INCLUDED_DeviceToken_h_GUID_428B015C_19A2_46B0_CFE6_CC100763D387
42 #include <boost/noncopyable.hpp>
49 namespace connection {
50 typedef std::function<OSVR_ReturnCode()> DeviceUpdateCallback;
63 OSVR_CONNECTION_EXPORT
static osvr::connection::DeviceTokenPtr
67 OSVR_CONNECTION_EXPORT
static osvr::connection::DeviceTokenPtr
72 OSVR_CONNECTION_EXPORT
static osvr::connection::DeviceTokenPtr
77 using EventFunction = std::function<void()>;
83 OSVR_CONNECTION_EXPORT std::string
const &
getName()
const;
86 OSVR_CONNECTION_EXPORT
void
91 OSVR_CONNECTION_EXPORT
void
103 const char *bytestream,
size_t len);
110 OSVR_CONNECTION_EXPORT
void
115 OSVR_CONNECTION_EXPORT osvr::util::GuardPtr getSendGuard();
125 OSVR_CONNECTION_EXPORT
void
131 return m_ownedObjects.
acquire(obj);
145 m_setUpdateCallback(osvr::connection::DeviceUpdateCallback
const &cb) = 0;
148 const char *bytestream,
size_t len) = 0;
149 virtual osvr::util::GuardPtr m_getSendGuard() = 0;
150 virtual void m_connectionInteract() = 0;
151 virtual void m_stopThreads();
155 std::string
const m_name;
158 osvr::connection::ServerInterfaceList m_serverInterfaces;
159 EventFunction m_preConnectionInteract;
163 #endif // INCLUDED_DeviceToken_h_GUID_428B015C_19A2_46B0_CFE6_CC100763D387
Header forward declaring MessageType and specifying a smart pointer.
void setUpdateCallback(osvr::connection::DeviceUpdateCallback const &cb)
Sets the update/wait callback.
A DeviceToken connects the generic device interaction code in PluginKit's C API with the workings of ...
void * acquire(T ptr)
Adds an object held by a smart pointer to our ownership, returning its void * usable to release it be...
Header forward-declaring ConnectionDevice and specifying the desired pointer to hold a ConnectionDevi...
Automatically-generated export header - do not edit!
shared_ptr< Connection > ConnectionPtr
How one must hold a Connection.
void stopThreads()
Stop any threads spawned and owned by this DeviceToken.
Structure used internally to construct the desired type of device.
Base class for connection-specific message type registration.
Holds on to smart pointers by value, and lets you free them by providing the corresponding void *...
void connectionInteract()
Interact with connection. Only legal to end up in ConnectionDevice::sendData from within here somehow...
Header declaring device callback types.
bool releaseObject(void *obj)
Frees some object whose lifetime is controlled by the client context.
void setDeviceDescriptor(std::string const &jsonString)
Send a new or updated device descriptor for this device.
Header providing a C++ wrapper around TimeValueC.h.
void setPreConnectionInteract(EventFunction const &f)
Sets a function to be executed at the beginning of connectionInteract()
shared_ptr< ConnectionDevice > ConnectionDevicePtr
How to hold on to a ConnectionDevice.
void * acquireObject(T obj)
Pass (smart-pointer) ownership of some object to the client context.
void sendData(osvr::connection::MessageType *type, const char *bytestream, size_t len)
Send data.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
std::string const & getName() const
Accessor for name property.
static osvr::connection::DeviceTokenPtr createSyncDevice(osvr::connection::DeviceInitObject &init)
Creates a device token (and underlying ConnectionDevice) that has an update method that runs in the s...
static osvr::connection::DeviceTokenPtr createVirtualDevice(std::string const &name, osvr::connection::ConnectionPtr const &conn)
Creates a device token (and underlying ConnectionDevice) without a traditional, built-in update metho...
virtual ~OSVR_DeviceTokenObject()
Destructor.
Header forward-declaring Connection and specifying the smart pointer to hold a Connection in...