25 #ifndef INCLUDED_DeviceInitObject_h_GUID_6B7D1689_CE30_4A9F_4B59_36773D1F0064
26 #define INCLUDED_DeviceInitObject_h_GUID_6B7D1689_CE30_4A9F_4B59_36773D1F0064
42 #include <boost/noncopyable.hpp>
43 #include <boost/optional.hpp>
47 #include <type_traits>
51 namespace connection {
52 class AnalogServerInterface;
53 class ButtonServerInterface;
54 class TrackerServerInterface;
63 OSVR_CONNECTION_EXPORT
explicit OSVR_DeviceInitObject(
67 OSVR_CONNECTION_EXPORT
void setName(std::string
const &n);
70 OSVR_CONNECTION_EXPORT
void
78 OSVR_CONNECTION_EXPORT
void
86 OSVR_CONNECTION_EXPORT
void
91 OSVR_CONNECTION_EXPORT
void
96 OSVR_CONNECTION_EXPORT
void
97 addComponent(osvr::common::DeviceComponentPtr
const &comp);
103 std::is_base_of<osvr::connection::DeviceInterfaceBase, T>::value,
104 "Your interface object must derive from "
105 "DeviceInterfaceBase to use this handy wrapper!");
114 if (
nullptr != devPtr) {
115 m_tokenInterest.push_back(devPtr);
119 if (
nullptr != ifaceObj) {
120 m_deviceInterfaces.push_back(ifaceObj);
126 for (
auto interest : m_tokenInterest) {
129 for (
auto ifaceObj : m_deviceInterfaces) {
130 ifaceObj->setDeviceToken(*dev);
148 boost::optional<OSVR_ChannelCount> getAnalogs()
const {
return m_analogs; }
149 boost::optional<OSVR_ChannelCount> getButtons()
const {
return m_buttons; }
150 bool getTracker()
const {
return m_tracker; }
151 osvr::connection::ServerInterfaceList
const &getServerInterfaces()
const {
152 return m_serverInterfaces;
155 osvr::common::DeviceComponentList
const &getComponents()
const {
163 std::string m_qualifiedName;
164 boost::optional<OSVR_ChannelCount> m_analogs;
166 boost::optional<OSVR_ChannelCount> m_buttons;
170 osvr::connection::ServerInterfaceList m_serverInterfaces;
171 osvr::common::DeviceComponentList m_components;
172 std::vector<OSVR_DeviceTokenObject **> m_tokenInterest;
174 std::vector<osvr::connection::DeviceInterfaceBase *> m_deviceInterfaces;
177 #endif // INCLUDED_DeviceInitObject_h_GUID_6B7D1689_CE30_4A9F_4B59_36773D1F0064
T * makeInterfaceObject()
A helper method to make a "device interface object" of user-designated type and apppropriate lifetime...
uint32_t OSVR_ChannelCount
The integer type specifying a number of channels/sensors or a channel/sensor index.
osvr::connection::ConnectionPtr getConnection()
Retrieve the connection pointer.
void addTokenInterest(OSVR_DeviceTokenObject **devPtr)
Add an observer that we'll eventually inform about the device token.
A DeviceToken connects the generic device interaction code in PluginKit's C API with the workings of ...
Interface for external access to generating tracker reports.
void returnTrackerInterface(osvr::connection::TrackerServerInterface &iface)
Returns a tracker interface through the pointer-pointer.
Automatically-generated export header - do not edit!
Header wrapping the C99 standard stdint header.
std::string getQualifiedName() const
Get device name qualified by plugin name.
Class providing the external interface of a registration context backing a single plugin...
shared_ptr< Connection > ConnectionPtr
How one must hold a Connection.
Header to bring unique_ptr into the osvr namespace.
void setName(std::string const &n)
Set the (unqualified) name of the device to create.
Structure used internally to construct the desired type of device.
Interface for external access to generating analog reports.
void returnAnalogInterface(osvr::connection::AnalogServerInterface &iface)
Returns an analog interface through the pointer-pointer.
void notifyToken(OSVR_DeviceTokenObject *dev)
Notify all those interested what the device token is.
void setAnalogs(OSVR_ChannelCount num, osvr::connection::AnalogServerInterface **iface)
Set analogs: clears the boost::optional if 0 is passed.
Header declaring the opaque plugin registration context type.
void addServerInterface(osvr::connection::ServerInterfacePtr const &iface)
Add a server interface pointer to our list, which will get registered when the device is created...
void addComponent(osvr::common::DeviceComponentPtr const &comp)
Add a device component to our list, which will get added to the device when created.
T * registerDataWithGenericDelete(T *data)
Register data allocated with new to be deleted on plugin unload.
OSVR_EXTERN_C_BEGIN typedef void * OSVR_PluginRegContext
A context pointer passed in to your plugin's entry point and other locations of control flow transfer...
void returnButtonInterface(osvr::connection::ButtonServerInterface &iface)
Returns a button interface through the pointer-pointer.
Base class for the DeviceInterfaceObjects retrieved by plugins to let them send data on an interface...
osvr::pluginhost::PluginSpecificRegistrationContext * getContext()
Retrieves the plugin context.
Header forward-declaring Connection and specifying the smart pointer to hold a Connection in...
void setButtons(OSVR_ChannelCount num, osvr::connection::ButtonServerInterface **iface)
Set buttons: clears the boost::optional if 0 is passed.
void setTracker(osvr::connection::TrackerServerInterface **iface)
Enables tracker interface.