36 unsigned int reportNumber = 0;
39 const OSVR_ImagingReport *report) {
44 if (reportNumber == 0) {
45 printf(
"Got first report: image is %d width and %d height.\n",
46 report->state.metadata.width, report->state.metadata.height);
49 printf(
"Got report number %d\n", reportNumber);
54 printf(
"Error, osvrClientFreeImage call failed.\n");
62 printf(
"Error, could not initialize client context. The server may not be running.\n");
68 printf(
"Error, could not get the camera interface at /camera.\n");
74 printf(
"Error, could not register image callback.");
80 for (i = 0; i < 1000000; ++i) {
82 printf(
"Error, while updating the client context.");
87 printf(
"Library shut down, exiting.\n");
OSVR_ReturnCode osvrClientGetInterface(OSVR_ClientContext ctx, const char path[], OSVR_ClientInterface *iface)
Get the interface associated with the given path.
OSVR_EXTERN_C_BEGIN OSVR_ReturnCode osvrClientFreeImage(OSVR_ClientContext ctx, OSVR_ImageBufferElement *buf)
Free an image buffer returned from a callback.
OSVR_ClientContext osvrClientInit(const char applicationIdentifier[], uint32_t flags=0)
Initialize the library.
OSVR_ReturnCode osvrClientShutdown(OSVR_ClientContext ctx)
Shutdown the library.
#define OSVR_RETURN_SUCCESS
The "success" value for an OSVR_ReturnCode.
struct OSVR_ClientContextObject * OSVR_ClientContext
Opaque handle that should be retained by your application. You need only and exactly one...
OSVR_ReturnCode osvrClientUpdate(OSVR_ClientContext ctx)
Updates the state of the context - call regularly in your mainloop.
void imagingCallback(void *userdata, osvr::util::time::TimeValue const ×tamp, osvr::clientkit::ImagingReport report)
struct OSVR_ClientInterfaceObject * OSVR_ClientInterface
Opaque handle to an interface used for registering callbacks and getting status.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
OSVR_ReturnCode osvrRegisterImagingCallback(OSVR_ClientInterface iface, OSVR_ImagingCallback cb, void *userdata)
Register a callback for Imaging reports on an interface.