OSVR-Core
DeviceInterfaceC.h
Go to the documentation of this file.
1 
13 /*
14 // Copyright 2014 Sensics, Inc.
15 //
16 // Licensed under the Apache License, Version 2.0 (the "License");
17 // you may not use this file except in compliance with the License.
18 // You may obtain a copy of the License at
19 //
20 // http://www.apache.org/licenses/LICENSE-2.0
21 //
22 // Unless required by applicable law or agreed to in writing, software
23 // distributed under the License is distributed on an "AS IS" BASIS,
24 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 // See the License for the specific language governing permissions and
26 // limitations under the License.
27 */
28 
29 #ifndef INCLUDED_DeviceInterfaceC_h_GUID_8B82B108_1B20_4D80_9FE5_C31E424E3652
30 #define INCLUDED_DeviceInterfaceC_h_GUID_8B82B108_1B20_4D80_9FE5_C31E424E3652
31 
32 /* Internal Includes */
33 #include <osvr/PluginKit/Export.h>
34 #include <osvr/PluginKit/CommonC.h>
37 #include <osvr/Util/TimeValueC.h>
38 
39 /* Library/third-party includes */
40 /* none */
41 
42 /* Standard includes */
43 #include <stddef.h>
44 
45 OSVR_EXTERN_C_BEGIN
46 
61 
68 
76 
85 OSVR_PLUGINKIT_EXPORT OSVR_DeviceInitOptions
87  OSVR_FUNC_NONNULL((1));
88 
98 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode
100  OSVR_IN_STRZ const char *name,
101  OSVR_OUT_PTR OSVR_MessageType *msgtype)
102  OSVR_FUNC_NONNULL((1, 2, 3));
103 
109 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode
110 osvrDeviceSendData(OSVR_IN_PTR OSVR_DeviceToken dev,
111  OSVR_IN_PTR OSVR_MessageType msg,
112  OSVR_IN_READS(len) const char *bytestream,
113  OSVR_IN size_t len) OSVR_FUNC_NONNULL((1, 2));
114 
120 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode
121 osvrDeviceSendTimestampedData(OSVR_IN_PTR OSVR_DeviceToken dev,
122  OSVR_IN_PTR const OSVR_TimeValue *timestamp,
123  OSVR_IN_PTR OSVR_MessageType msg,
124  OSVR_IN_READS(len) const char *bytestream,
125  OSVR_IN size_t len) OSVR_FUNC_NONNULL((1, 2, 3));
126 
131 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode
132 osvrDeviceSendJsonDescriptor(OSVR_IN_PTR OSVR_DeviceToken dev,
133  OSVR_IN_READS(len) const char *json,
134  OSVR_IN size_t len) OSVR_FUNC_NONNULL((1, 2));
135 
152 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceRegisterUpdateCallback(
153  OSVR_IN_PTR OSVR_DeviceToken dev,
154  OSVR_IN OSVR_DeviceUpdateCallback updateCallback,
155  OSVR_IN_OPT void *userData OSVR_CPP_ONLY(= NULL)) OSVR_FUNC_NONNULL((1));
156 
183 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode
185  OSVR_IN_STRZ const char *name,
186  OSVR_OUT_PTR OSVR_DeviceToken *device)
187  OSVR_FUNC_NONNULL((1, 2, 3));
188 
196 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode
198  OSVR_IN_STRZ const char *name,
199  OSVR_IN_PTR OSVR_DeviceInitOptions options,
200  OSVR_OUT_PTR OSVR_DeviceToken *device)
201  OSVR_FUNC_NONNULL((1, 2, 3, 4));
202 
228 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode
230  OSVR_IN_STRZ const char *name,
231  OSVR_OUT_PTR OSVR_DeviceToken *device)
232  OSVR_FUNC_NONNULL((1, 2, 3));
233 
241 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode
243  OSVR_IN_STRZ const char *name,
244  OSVR_IN_PTR OSVR_DeviceInitOptions options,
245  OSVR_OUT_PTR OSVR_DeviceToken *device)
246  OSVR_FUNC_NONNULL((1, 2, 3, 4));
247 
257 OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode
258 osvrDeviceMicrosleep(OSVR_IN uint64_t microseconds);
259  /* end of group */
261 
262 OSVR_EXTERN_C_END
263 
264 #endif
#define OSVR_OUT_PTR
Indicates a required pointer (non-null) function parameter that serves only as output.
Definition: AnnotationMacrosC.h:151
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceRegisterMessageType(OSVR_IN_PTR OSVR_PluginRegContext ctx, OSVR_IN_STRZ const char *name, OSVR_OUT_PTR OSVR_MessageType *msgtype) OSVR_FUNC_NONNULL((1
Register (or recall) a message type by name.
#define OSVR_IN_STRZ
Indicates a null-terminated string function parameter that serves only as input.
Definition: AnnotationMacrosC.h:124
#define OSVR_IN_PTR
Indicates a required pointer (non-null) function parameter that serves only as input.
Definition: AnnotationMacrosC.h:108
#define OSVR_IN_OPT
Indicates a function parameter (pointer) that serves only as input, but is optional and might be NULL...
Definition: AnnotationMacrosC.h:116
A DeviceToken connects the generic device interaction code in PluginKit&#39;s C API with the workings of ...
Definition: DeviceToken.h:56
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceSyncInitWithOptions(OSVR_IN_PTR OSVR_PluginRegContext ctx, OSVR_IN_STRZ const char *name, OSVR_IN_PTR OSVR_DeviceInitOptions options, OSVR_OUT_PTR OSVR_DeviceToken *device) OSVR_FUNC_NONNULL((1
Initialize a synchronous device token.
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceSendTimestampedData(OSVR_IN_PTR OSVR_DeviceToken dev, OSVR_IN_PTR const OSVR_TimeValue *timestamp, OSVR_IN_PTR OSVR_MessageType msg, OSVR_IN_READS(len) const char *bytestream, OSVR_IN size_t len) OSVR_FUNC_NONNULL((1
Send a raw bytestream from your device, with a known timestamp.
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceMicrosleep(OSVR_IN uint64_t microseconds)
Request a thread sleep for at least the given number of microseconds.
Definition: DeviceInterfaceC.cpp:213
#define OSVR_FUNC_NONNULL(X)
Indicates the parameter(s) that must be non-null.
Definition: AnnotationMacrosC.h:202
Structure used internally to construct the desired type of device.
Definition: DeviceInitObject.h:59
#define OSVR_IN_READS(NUM_ELEMENTS)
Indicates a buffer containing input with the specified number of elements.
Definition: AnnotationMacrosC.h:134
Base class for connection-specific message type registration.
Definition: MessageType.h:38
struct OSVR_DeviceTokenObject * OSVR_DeviceToken
Opaque type of a registered device token within the core library.
Definition: DeviceInterfaceC.h:60
struct OSVR_MessageTypeObject * OSVR_MessageType
Opaque type of a registered message type within the core library.
Definition: DeviceInterfaceC.h:67
Header declaring device callback types.
struct OSVR_DeviceInitObject * OSVR_DeviceInitOptions
Opaque type of a device initialization object.
Definition: DeviceInterfaceC.h:75
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceRegisterUpdateCallback(OSVR_IN_PTR OSVR_DeviceToken dev, OSVR_IN OSVR_DeviceUpdateCallback updateCallback, OSVR_IN_OPT void *userData OSVR_CPP_ONLY(=NULL)) OSVR_FUNC_NONNULL((1))
Register the update callback of a device.
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceAsyncInitWithOptions(OSVR_IN_PTR OSVR_PluginRegContext ctx, OSVR_IN_STRZ const char *name, OSVR_IN_PTR OSVR_DeviceInitOptions options, OSVR_OUT_PTR OSVR_DeviceToken *device) OSVR_FUNC_NONNULL((1
Initialize an asynchronous device token.
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceAsyncInit(OSVR_IN_PTR OSVR_PluginRegContext ctx, OSVR_IN_STRZ const char *name, OSVR_OUT_PTR OSVR_DeviceToken *device) OSVR_FUNC_NONNULL((1
Initialize an asynchronous device token.
OSVR_ReturnCode(* OSVR_DeviceUpdateCallback)(void *userData)
Function type of a Device Update callback.
Definition: DeviceCallbackTypesC.h:48
Header containing macros for source-level annotation.
OSVR_PLUGINKIT_EXPORT OSVR_DeviceInitOptions osvrDeviceCreateInitOptions(OSVR_IN_PTR OSVR_PluginRegContext ctx) OSVR_FUNC_NONNULL((1))
Create a OSVR_DeviceInitOptions object.
Definition: DeviceInterfaceC.cpp:45
Header defining a dependency-free, cross-platform substitute for struct timeval.
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceSyncInit(OSVR_IN_PTR OSVR_PluginRegContext ctx, OSVR_IN_STRZ const char *name, OSVR_OUT_PTR OSVR_DeviceToken *device) OSVR_FUNC_NONNULL((1
Initialize a synchronous device token.
OSVR_EXTERN_C_BEGIN typedef void * OSVR_PluginRegContext
A context pointer passed in to your plugin&#39;s entry point and other locations of control flow transfer...
Definition: PluginRegContextC.h:47
#define OSVR_IN
Indicates a required function parameter that serves only as input.
Definition: AnnotationMacrosC.h:100
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceSendData(OSVR_IN_PTR OSVR_DeviceToken dev, OSVR_IN_PTR OSVR_MessageType msg, OSVR_IN_READS(len) const char *bytestream, OSVR_IN size_t len) OSVR_FUNC_NONNULL((1
Send a raw bytestream from your device.
Header shared between multiple C API headers.
OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode OSVR_PLUGINKIT_EXPORT OSVR_ReturnCode osvrDeviceSendJsonDescriptor(OSVR_IN_PTR OSVR_DeviceToken dev, OSVR_IN_READS(len) const char *json, OSVR_IN size_t len) OSVR_FUNC_NONNULL((1
Submit a JSON self-descriptor string for the device.