TEST(BasicJointClientKitWithInterface, ConstructDestruct) {
    auto options = osvrJointClientCreateOptions();
    ASSERT_NE(nullptr, options);

    ASSERT_EQ(OSVR_RETURN_SUCCESS,
      osvrJointClientOptionsLoadPlugin(options, "com_osvr_example_AnalogSync"));

    ASSERT_EQ(OSVR_RETURN_SUCCESS,
      osvrJointClientOptionsTriggerHardwareDetect(options));

    auto ctx = osvrJointClientInit("org.osvr.test.jointclientkit", options);
    ASSERT_NE(nullptr, ctx);
    ASSERT_EQ(OSVR_RETURN_SUCCESS,
      osvrClientUpdate(ctx));

    OSVR_ClientInterface eye = nullptr;
    ASSERT_EQ(OSVR_RETURN_SUCCESS,
      osvrClientGetInterface(ctx, "/com_osvr_example_AnalogSync/MySyncDevice/analog/0", &eye));

    ASSERT_EQ(OSVR_RETURN_SUCCESS,
      osvrRegisterAnalogCallback(eye, &myAnalogCallback, nullptr));

    ASSERT_EQ(OSVR_RETURN_SUCCESS,
      osvrClientUpdate(ctx));

    ASSERT_EQ(true, reportReceived);

    ASSERT_EQ(OSVR_RETURN_SUCCESS,
      osvrClientShutdown(ctx));
}
示例#2
0
/**
* Destructor.
***/
OSVR_Tracker::~OSVR_Tracker()
{
	if (m_psOSVR_ClientInterface)
		osvrClientFreeInterface(m_psOSVR_ClientContext, m_psOSVR_ClientInterface);
	if (m_psOSVR_ClientContext)
		osvrClientShutdown(m_psOSVR_ClientContext);
}
示例#3
0
OSVREntryPoint::~OSVREntryPoint()
{
	InterfaceCollection = nullptr;

#if OSVR_ENABLED
	osvrClientShutdown(osvrClientContext);
#endif // OSVR_ENABLED
}
OSVREntryPoint::~OSVREntryPoint()
{
    FScopeLock lock(this->GetClientContextMutex());

#if OSVR_DEPRECATED_BLUEPRINT_API_ENABLED
    InterfaceCollection = nullptr;
#endif

    if (osvrClientContext)
    {
       osvrClientShutdown(osvrClientContext);
    }

    osvrClientReleaseAutoStartedServer();
}
示例#5
0
int main() {
    OSVR_ClientContext ctx =
        osvrClientInit("com.osvr.exampleclients.MinimalInit", 0);
    printf("OK, library initialized.\n");

    /* Pretend that this is your application's mainloop. */
    int i;
    for (i = 0; i < 1000000; ++i) {
        osvrClientUpdate(ctx);
    }

    osvrClientShutdown(ctx);
    printf("Library shut down, exiting.\n");
    return 0;
}
示例#6
0
int main() {
    OSVR_ClientContext ctx =
        osvrClientInit("com.osvr.exampleclients.ButtonCallback", 0);

    OSVR_ClientInterface button1 = NULL;
    /* This is just one of the paths: specifically, the Hydra's left
     * controller's button labelled "1". More are in the docs and/or listed on
     * startup
     */
    osvrClientGetInterface(ctx, "/controller/left/1", &button1);

    osvrRegisterButtonCallback(button1, &myButtonCallback, NULL);

    /* Pretend that this is your application's mainloop. */
    int i;
    for (i = 0; i < 1000000; ++i) {
        osvrClientUpdate(ctx);
    }

    osvrClientShutdown(ctx);
    printf("Library shut down, exiting.\n");
    return 0;
}