OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
DeviceInterfaceC.h File Reference

Header. More...

#include <osvr/PluginKit/Export.h>
#include <osvr/PluginKit/CommonC.h>
#include <osvr/Util/DeviceCallbackTypesC.h>
#include <osvr/Util/AnnotationMacrosC.h>
#include <osvr/Util/TimeValueC.h>
#include <stddef.h>

Go to the source code of this file.

Typedefs

typedef struct
OSVR_DeviceTokenObject * 
OSVR_DeviceToken
 Opaque type of a registered device token within the core library. More...
 
typedef struct
OSVR_MessageTypeObject * 
OSVR_MessageType
 Opaque type of a registered message type within the core library. More...
 
typedef struct
OSVR_DeviceInitObject * 
OSVR_DeviceInitOptions
 Opaque type of a device initialization object. More...
 

Functions

OSVR_DeviceInitOptions osvrDeviceCreateInitOptions (OSVR_PluginRegContext ctx)
 Create a OSVR_DeviceInitOptions object. More...
 
OSVR_ReturnCode osvrDeviceRegisterMessageType (OSVR_PluginRegContext ctx, const char *name, OSVR_MessageType *msgtype)
 Register (or recall) a message type by name. More...
 
OSVR_ReturnCode osvrDeviceSendData (OSVR_DeviceToken dev, OSVR_MessageType msg, const char *bytestream, size_t len)
 Send a raw bytestream from your device. More...
 
OSVR_ReturnCode osvrDeviceSendTimestampedData (OSVR_DeviceToken dev, const OSVR_TimeValue *timestamp, OSVR_MessageType msg, const char *bytestream, size_t len)
 Send a raw bytestream from your device, with a known timestamp. More...
 
OSVR_ReturnCode osvrDeviceSendJsonDescriptor (OSVR_DeviceToken dev, const char *json, size_t len)
 Submit a JSON self-descriptor string for the device. More...
 
OSVR_ReturnCode osvrDeviceRegisterUpdateCallback (OSVR_DeviceToken dev, OSVR_DeviceUpdateCallback updateCallback, void *userData=NULL)
 Register the update callback of a device. More...
 
OSVR_ReturnCode osvrDeviceMicrosleep (uint64_t microseconds)
 Request a thread sleep for at least the given number of microseconds. DO NOT use within a Sync plugin! More...
 
Synchronous Devices

Devices declaring themselves to be synchronous must abide by strict rules. Their update method is run regularly in the main thread of the device system, without the overhead of locking. In exchange, however, the following restrictions apply:

  • The update method must complete as quickly as reasonably possible, since it adds to overall latency.
  • No data may be sent through the library outside of the update method, and the update method should only be called by the core library (not by the plugin)
OSVR_ReturnCode osvrDeviceSyncInit (OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceToken *device)
 Initialize a synchronous device token. More...
 
OSVR_ReturnCode osvrDeviceSyncInitWithOptions (OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceInitOptions options, OSVR_DeviceToken *device)
 Initialize a synchronous device token. More...
 
Asynchronous Devices

These devices are more event-based: either it's convenient for your driver to block until full data arrives, or you can't be sure your driver can get in and out of an update function very rapidly.

As a result, devices registered as async have their update method run in a thread of its own, repeatedly as long as the device exists. Calls sending data from an async device are automatically made thread-safe.

OSVR_ReturnCode osvrDeviceAsyncInit (OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceToken *device)
 Initialize an asynchronous device token. More...
 
OSVR_ReturnCode osvrDeviceAsyncInitWithOptions (OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceInitOptions options, OSVR_DeviceToken *device)
 Initialize an asynchronous device token. More...
 

Detailed Description

Header.

Must be c-safe!

Date
2014
Author
Sensics, Inc. http://sensics.com/osvr

Definition in file DeviceInterfaceC.h.