34 #include "../Connection/VrpnConnectionKind.h"
37 #include <vrpn_ConnectionPtr.h>
43 #define OSVR_VALIDATE_OUTPUT_PTR(X, DESC) \
44 OSVR_UTIL_MULTILINE_BEGIN \
45 if (nullptr == (X)) { \
46 OSVR_DEV_VERBOSE("Passed a null pointer for output parameter " #X \
48 return OSVR_RETURN_FAILURE; \
50 OSVR_UTIL_MULTILINE_END
52 class vrpn_Connection;
55 inline vrpn_Connection *
57 vrpn_Connection *ret =
nullptr;
59 osvr::connection::getVRPNConnectionKindID()) {
68 OSVR_IN_STRZ
const char *name,
73 OSVR_DEV_VERBOSE(
"osvrAnalysisSyncInit: can't use a null plugin "
74 "registration context.");
77 if (!name || !(name[0])) {
79 "osvrAnalysisSyncInit: can't use a null or empty device name.");
89 "osvrAnalysisSyncInit: couldn't create initial device token.");
94 auto osvrConn = osvr::connection::Connection::retrieveConnection(
97 auto vrpnConn = extractVrpnConnection(*osvrConn);
103 osvr::client::createAnalysisClientContext(
104 "org.osvr.analysisplugin" ,
"localhost" ,
105 vrpn_ConnectionPtr(vrpnConn)));
106 auto &dev = **device;
108 dev.acquireObject(clientCtxSmart);
111 dev.setPreConnectionInteract([=] { clientCtxSmart->update(); });
114 *clientCtx = clientCtxSmart.get();
A DeviceToken connects the generic device interaction code in PluginKit's C API with the workings of ...
virtual void * getUnderlyingObject()
Access implementation details.
Class wrapping a messaging transport (server or internal) connection.
Structure used internally to construct the desired type of device.
#define OSVR_RETURN_FAILURE
The "failure" value for an OSVR_ReturnCode.
ClientContextSharedPtr wrapSharedContext(T *context)
Wrap a client context pointer in a shared pointer with the correct custom deleter.
#define OSVR_VALIDATE_OUTPUT_PTR(X, DESC)
#define OSVR_RETURN_SUCCESS
The "success" value for an OSVR_ReturnCode.
OSVR_ReturnCode osvrDeviceSyncInitWithOptions(OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceInitOptions options, OSVR_DeviceToken *device)
Initialize a synchronous device token.
virtual const char * getConnectionKindID()
Returns some implementation-defined string based on the dynamic type of the connection.
Internal, configured header file for verbosity macros.
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...
OSVR_ReturnCode osvrAnalysisSyncInit(OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceInitOptions options, OSVR_DeviceToken *device, OSVR_ClientContext *clientCtx)
Initialize a synchronous analysis device token with the options specified, also returning the associa...
static PluginSpecificRegistrationContext & get(OSVR_PluginRegContext ctx)
Retrieve this interface from an OSVR_PluginRegContext opaque pointer.