OSVR-Core  0.6-1962-g59773924
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
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 
60 typedef struct OSVR_DeviceTokenObject *OSVR_DeviceToken;
61 
67 typedef struct OSVR_MessageTypeObject *OSVR_MessageType;
68 
75 typedef struct OSVR_DeviceInitObject *OSVR_DeviceInitOptions;
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
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
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
OSVR_ReturnCode osvrDeviceAsyncInit(OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceToken *device)
Initialize an asynchronous device token.
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.
OSVR_ReturnCode osvrDeviceAsyncInitWithOptions(OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceInitOptions options, OSVR_DeviceToken *device)
Initialize an asynchronous device token.
OSVR_ReturnCode osvrDeviceRegisterUpdateCallback(OSVR_DeviceToken dev, OSVR_DeviceUpdateCallback updateCallback, void *userData=NULL)
Register the update callback of a device.
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...
struct OSVR_DeviceTokenObject * OSVR_DeviceToken
Opaque type of a registered device token within the core library.
struct OSVR_MessageTypeObject * OSVR_MessageType
Opaque type of a registered message type within the core library.
Header declaring device callback types.
struct OSVR_DeviceInitObject * OSVR_DeviceInitOptions
Opaque type of a device initialization object.
OSVR_ReturnCode osvrDeviceSendData(OSVR_DeviceToken dev, OSVR_MessageType msg, const char *bytestream, size_t len)
Send a raw bytestream from your device.
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.
Header containing macros for source-level annotation.
Header defining a dependency-free, cross-platform substitute for struct timeval.
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...
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Definition: TimeValueC.h:81
OSVR_ReturnCode(* OSVR_DeviceUpdateCallback)(void *userData)
Function type of a Device Update callback.
OSVR_ReturnCode osvrDeviceSyncInit(OSVR_PluginRegContext ctx, const char *name, OSVR_DeviceToken *device)
Initialize a synchronous device token.
Header shared between multiple C API headers.
OSVR_ReturnCode osvrDeviceRegisterMessageType(OSVR_PluginRegContext ctx, const char *name, OSVR_MessageType *msgtype)
Register (or recall) a message type by name.