37 #include "org_osvr_example_SampleCPlugin_json.h"
46 typedef struct MyDevice {
55 static OSVR_ReturnCode myDeviceUpdate(
void *userdata) {
56 MyDevice *mydev = (MyDevice *)userdata;
60 for (i = 0; i < 1000; ++i) {
64 mydev->myVal = (mydev->myVal + 0.1);
65 if (mydev->myVal > 10.) {
117 org_osvr_example_SampleCPlugin_json,
118 sizeof(org_osvr_example_SampleCPlugin_json));
127 static void myDeviceShutdown(
void *mydev) {
128 printf(
"Destroying sample device\n");
134 MyDevice *mydev = (MyDevice *)malloc(
sizeof(MyDevice));
142 myDeviceInit(ctx, mydev);
uint8_t OSVR_CBool
A pre-C99-safe bool type. Canonical values for true and false are provided. Interpretation of other v...
#define OSVR_FALSE
Canonical "false" value for OSVR_CBool.
Header providing a C-safe "bool" type, because we can't depend on Visual Studio providing proper C99 ...
struct OSVR_TrackerDeviceInterfaceObject * OSVR_TrackerDeviceInterface
Opaque type used in conjunction with a device token to send data on a tracker interface.
OSVR_ReturnCode osvrDeviceAnalogSetValue(OSVR_DeviceToken dev, OSVR_AnalogDeviceInterface iface, OSVR_AnalogState val, OSVR_ChannelCount chan)
Report the value of a single channel.
OSVR_ReturnCode osvrDeviceTrackerSendPose(OSVR_DeviceToken dev, OSVR_TrackerDeviceInterface iface, OSVR_PoseState const *val, OSVR_ChannelCount sensor)
Report the full rigid body pose of a sensor, automatically generating a timestamp.
#define OSVR_TRUE
Canonical "true" value for OSVR_CBool.
OSVR_ReturnCode osvrDeviceRegisterUpdateCallback(OSVR_DeviceToken dev, OSVR_DeviceUpdateCallback updateCallback, void *userData=NULL)
Register the update callback of a device.
Header including the full PluginKit C API.
struct OSVR_DeviceTokenObject * OSVR_DeviceToken
Opaque type of a registered device token within the core library.
struct OSVR_DeviceInitObject * OSVR_DeviceInitOptions
Opaque type of a device initialization object.
#define OSVR_RETURN_SUCCESS
The "success" value for an OSVR_ReturnCode.
OSVR_DeviceInitOptions osvrDeviceCreateInitOptions(OSVR_PluginRegContext ctx)
Create a OSVR_DeviceInitOptions object.
OSVR_ReturnCode osvrDeviceSendJsonDescriptor(OSVR_DeviceToken dev, const char *json, size_t len)
Submit a JSON self-descriptor string for the device.
OSVR_ReturnCode osvrDeviceSyncInitWithOptions(OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceInitOptions options, OSVR_DeviceToken *device)
Initialize a synchronous device token.
#define OSVR_BUTTON_NOT_PRESSED
OSVR_ButtonState value indicating "button up".
#define OSVR_PLUGIN(PLUGIN_NAME)
This macro begins the entry point function of your plugin.
#define OSVR_BUTTON_PRESSED
OSVR_ButtonState value indicating "button down".
OSVR_ReturnCode osvrPluginRegisterDataWithDeleteCallback(OSVR_PluginRegContext ctx, OSVR_PluginDataDeleteCallback deleteCallback, void *pluginData)
Register plugin data along with an appropriate deleter callback.
A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
struct OSVR_AnalogDeviceInterfaceObject * OSVR_AnalogDeviceInterface
Opaque type used in conjunction with a device token to send data on an analog interface.
OSVR_ReturnCode osvrDeviceTrackerConfigure(OSVR_DeviceInitOptions opts, OSVR_TrackerDeviceInterface *iface)
Specify that your device will implement the Tracker interface.
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 osvrPose3SetIdentity(OSVR_Pose3 *pose)
Set a pose to identity.
OSVR_ReturnCode osvrDeviceAnalogConfigure(OSVR_DeviceInitOptions opts, OSVR_AnalogDeviceInterface *iface, OSVR_ChannelCount numChan)
Specify that your device will implement the Analog interface.