Monado OpenXR Runtime
opengloves_device.c File Reference

OpenGloves device implementation. More...

#include <stdio.h>
#include "xrt/xrt_device.h"
#include "xrt/xrt_defines.h"
#include "math/m_space.h"
#include "util/u_device.h"
#include "util/u_debug.h"
#include "util/u_hand_tracking.h"
#include "util/u_logging.h"
#include "util/u_misc.h"
#include "util/u_var.h"
#include "opengloves_device.h"
#include "communication/opengloves_communication.h"
#include "encoding/alpha_encoding.h"
#include "os/os_threading.h"
#include "util/u_hand_simulation.h"
Include dependency graph for opengloves_device.c:

Data Structures

struct  opengloves_device
 

Macros

#define OPENGLOVES_TRACE(d, ...)   U_LOG_XDEV_IFL_T(&d->base, d->log_level, __VA_ARGS__)
 
#define OPENGLOVES_DEBUG(d, ...)   U_LOG_XDEV_IFL_D(&d->base, d->log_level, __VA_ARGS__)
 
#define OPENGLOVES_INFO(d, ...)   U_LOG_XDEV_IFL_I(&d->base, d->log_level, __VA_ARGS__)
 
#define OPENGLOVES_WARN(d, ...)   U_LOG_XDEV_IFL_W(&d->base, d->log_level, __VA_ARGS__)
 
#define OPENGLOVES_ERROR(d, ...)   U_LOG_XDEV_IFL_E(&d->base, d->log_level, __VA_ARGS__)
 

Enumerations

enum  opengloves_input_index {
  OPENGLOVES_INPUT_INDEX_HAND_TRACKING , OPENGLOVES_INPUT_INDEX_TRIGGER_CLICK , OPENGLOVES_INPUT_INDEX_TRIGGER_VALUE , OPENGLOVES_INPUT_INDEX_A_CLICK ,
  OPENGLOVES_INPUT_INDEX_B_CLICK , OPENGLOVES_INPUT_INDEX_JOYSTICK_MAIN , OPENGLOVES_INPUT_INDEX_JOYSTICK_MAIN_CLICK , OPENGLOVES_INPUT_INDEX_COUNT
}
 
enum  opengloves_output_index { OPENGLOVES_OUPUT_INDEX_FORCE_FEEDBACK , OPENGLOVES_OUTPUT_INDEX_COUNT }
 

Functions

static struct opengloves_deviceopengloves_device (struct xrt_device *xdev)
 
static void opengloves_device_get_hand_tracking (struct xrt_device *xdev, enum xrt_input_name name, int64_t requested_timestamp_ns, struct xrt_hand_joint_set *out_joint_set, int64_t *out_timestamp_ns)
 
static xrt_result_t opengloves_device_update_inputs (struct xrt_device *xdev)
 
static void opengloves_ffb_location_convert (const struct xrt_output_force_feedback *xrt_ffb, struct opengloves_output_force_feedback *out_ffb)
 
static void opengloves_device_set_output (struct xrt_device *xdev, enum xrt_output_name name, const union xrt_output_value *value)
 
static void opengloves_device_destroy (struct xrt_device *xdev)
 
static bool opengloves_read_next_packet (struct opengloves_device *od, char *buffer, int buffer_len)
 Reads the next packet from the device, finishing successfully when reaching a newline Returns true if finished at a newline, or false if there was an error. More...
 
static void * opengloves_run_thread (void *ptr)
 Main thread for reading data from the device. More...
 
struct xrt_deviceopengloves_device_create (struct opengloves_communication_device *ocd, enum xrt_hand hand)
 

Detailed Description

OpenGloves device implementation.

Author
Daniel Willmott web@d.nosp@m.an-w.nosp@m..com

Function Documentation

◆ opengloves_read_next_packet()

static bool opengloves_read_next_packet ( struct opengloves_device od,
char *  buffer,
int  buffer_len 
)
static

Reads the next packet from the device, finishing successfully when reaching a newline Returns true if finished at a newline, or false if there was an error.

References os_thread_helper::os_thread_helper_lock().

◆ opengloves_run_thread()

static void * opengloves_run_thread ( void *  ptr)
static

Main thread for reading data from the device.