Monado OpenXR Runtime
daydream_device.c File Reference

Daydream controller code. More...

#include "xrt/xrt_prober.h"
#include "xrt/xrt_tracking.h"
#include "os/os_time.h"
#include "math/m_api.h"
#include "tracking/t_imu.h"
#include "util/u_var.h"
#include "util/u_time.h"
#include "util/u_misc.h"
#include "util/u_debug.h"
#include "util/u_device.h"
#include "util/u_bitwise.h"
#include "daydream_device.h"
#include <stdio.h>
#include <math.h>
#include <assert.h>
Include dependency graph for daydream_device.c:

Data Structures

struct  daydream_input_packet
 Input package for Daydream. More...
 

Enumerations

enum  daydream_input_index {
  DAYDREAM_TOUCHPAD_CLICK , DAYDREAM_BAR_CLICK , DAYDREAM_CIRCLE_CLICK , DAYDREAM_VOLUP_CLICK ,
  DAYDREAM_VOLDN_CLICK , DAYDREAM_TOUCHPAD
}
 Indices where each input is in the input list. More...
 

Functions

static struct daydream_devicedaydream_device (struct xrt_device *xdev)
 
static void daydream_update_input_click (struct daydream_device *daydream, int index, int64_t now, uint32_t bit)
 
static void update_fusion (struct daydream_device *dd, struct daydream_parsed_sample *sample, timepoint_ns timestamp_ns, time_duration_ns delta_ns)
 
static int daydream_parse_input (struct daydream_device *daydream, void *data, struct daydream_parsed_input *input)
 
static bool daydream_read_one_packet (struct daydream_device *daydream, uint8_t *buffer, size_t size)
 Reads one packet from the device,handles locking and checking if the thread has been told to shut down. More...
 
static void * daydream_run_thread (void *ptr)
 
static int daydream_get_calibration (struct daydream_device *daydream)
 
static void daydream_get_fusion_pose (struct daydream_device *daydream, enum xrt_input_name name, struct xrt_space_relation *out_relation)
 
static void daydream_device_destroy (struct xrt_device *xdev)
 
static xrt_result_t daydream_device_update_inputs (struct xrt_device *xdev)
 
static xrt_result_t daydream_device_get_tracked_pose (struct xrt_device *xdev, enum xrt_input_name name, int64_t at_timestamp_ns, struct xrt_space_relation *out_relation)
 
struct daydream_devicedaydream_device_create (struct os_ble_device *ble)
 

Variables

static struct xrt_binding_input_pair simple_inputs [4]
 
static struct xrt_binding_profile binding_profiles [1]
 

Detailed Description

Enumeration Type Documentation

◆ daydream_input_index

Indices where each input is in the input list.

Function Documentation

◆ daydream_get_fusion_pose()

static void daydream_get_fusion_pose ( struct daydream_device daydream,
enum xrt_input_name  name,
struct xrt_space_relation out_relation 
)
static
Todo:
assuming that orientation is actually currently tracked.

References m_imu_3dof::rot.

◆ daydream_read_one_packet()

static bool daydream_read_one_packet ( struct daydream_device daydream,
uint8_t *  buffer,
size_t  size 
)
static

Reads one packet from the device,handles locking and checking if the thread has been told to shut down.

References os_ble_read(), os_thread_helper::os_thread_helper_is_running_locked(), os_thread_helper::os_thread_helper_lock(), os_thread_helper::os_thread_helper_unlock(), and U_LOG_W.

◆ daydream_run_thread()

static void * daydream_run_thread ( void *  ptr)
static
Todo:
this should be injected at construction time

Variable Documentation

◆ binding_profiles

struct xrt_binding_profile binding_profiles[1]
static
Initial value:
= {
{
.name = XRT_DEVICE_SIMPLE_CONTROLLER,
.inputs = simple_inputs,
.input_count = ARRAY_SIZE(simple_inputs),
.outputs = NULL,
.output_count = 0,
},
}
#define ARRAY_SIZE(a)
Array size helper.
Definition: xrt_compiler.h:30

◆ simple_inputs

struct xrt_binding_input_pair simple_inputs[4]
static
Initial value:
= {
{XRT_INPUT_SIMPLE_SELECT_CLICK, XRT_INPUT_DAYDREAM_BAR_CLICK},
{XRT_INPUT_SIMPLE_MENU_CLICK, XRT_INPUT_DAYDREAM_CIRCLE_CLICK},
{XRT_INPUT_SIMPLE_GRIP_POSE, XRT_INPUT_DAYDREAM_POSE},
{XRT_INPUT_SIMPLE_AIM_POSE, XRT_INPUT_DAYDREAM_POSE},
}