Exemplo n.º 1
0
OSVR_ReturnCode
osvrDeviceTrackerConfigure(OSVR_INOUT_PTR OSVR_DeviceInitOptions opts,
                           OSVR_OUT_PTR OSVR_TrackerDeviceInterface *iface) {
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT("osvrDeviceTrackerConfigure", opts);
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT("osvrDeviceTrackerConfigure", iface);
    OSVR_TrackerDeviceInterface ifaceObj =
        opts->makeInterfaceObject<OSVR_TrackerDeviceInterfaceObject>();
    *iface = ifaceObj;
    opts->setTracker(ifaceObj->tracker);
    return OSVR_RETURN_SUCCESS;
}
Exemplo n.º 2
0
OSVR_ReturnCode
osvrDeviceButtonConfigure(OSVR_IN_PTR OSVR_DeviceInitOptions opts,
                          OSVR_OUT_PTR OSVR_ButtonDeviceInterface *iface,
                          OSVR_IN OSVR_ChannelCount numChan) {
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT("osvrDeviceButtonConfigure", opts);
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT("osvrDeviceButtonConfigure", iface);
    OSVR_ButtonDeviceInterface ifaceObj = *iface =
        opts->getContext()->registerDataWithGenericDelete(
            new OSVR_ButtonDeviceInterfaceObject);
    opts->setButtons(numChan, ifaceObj->getContainerLocation());

    return OSVR_RETURN_SUCCESS;
}
Exemplo n.º 3
0
static inline OSVR_ReturnCode
osvrTrackerSend(const char method[], OSVR_DeviceToken,
                OSVR_TrackerDeviceInterface iface, StateType const *val,
                OSVR_ChannelCount chan, OSVR_TimeValue const *timestamp) {
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT(method, iface);
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT(method, timestamp);

    auto guard = iface->getSendGuard();
    if (guard->lock()) {
        iface->tracker->sendReport(*val, chan, *timestamp);
        return OSVR_RETURN_SUCCESS;
    }

    return OSVR_RETURN_FAILURE;
}
Exemplo n.º 4
0
OSVR_ReturnCode
osvrDeviceImagingConfigure(OSVR_INOUT_PTR OSVR_DeviceInitOptions opts,
                           OSVR_OUT_PTR OSVR_ImagingDeviceInterface *iface,
                           OSVR_IN OSVR_ChannelCount numSensors) {

    OSVR_PLUGIN_HANDLE_NULL_CONTEXT("osvrDeviceImagingConfigure", opts);
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT("osvrDeviceImagingConfigure", iface);
    OSVR_ImagingDeviceInterface ifaceObj =
        opts->getContext()->registerDataWithGenericDelete(
            new OSVR_ImagingDeviceInterfaceObject);
    *iface = ifaceObj;
    auto imaging = osvr::common::ImagingComponent::create(numSensors);
    ifaceObj->imaging = imaging.get();
    opts->addComponent(imaging);
    return OSVR_RETURN_SUCCESS;
}
Exemplo n.º 5
0
OSVR_ReturnCode osvrDeviceButtonSetValuesTimestamped(
    OSVR_IN_PTR OSVR_DeviceToken dev,
    OSVR_IN_PTR OSVR_ButtonDeviceInterface iface,
    OSVR_IN_PTR OSVR_ButtonState val[], OSVR_IN OSVR_ChannelCount chans,
    OSVR_IN_PTR OSVR_TimeValue const *timestamp) {
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT("osvrDeviceButtonSetValuesTimestamped",
                                    dev);
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT("osvrDeviceButtonSetValuesTimestamped",
                                    iface);
    OSVR_PLUGIN_HANDLE_NULL_CONTEXT("osvrDeviceButtonSetValuesTimestamped",
                                    timestamp);

    auto guard = dev->getSendGuard();
    if (guard->lock()) {
        (*iface)->setValues(val, chans, *timestamp);
        return OSVR_RETURN_SUCCESS;
    }
    return OSVR_RETURN_FAILURE;
}