Monado OpenXR Runtime
u_config_json.c File Reference

Code to manage the settings file. More...

#include <xrt/xrt_device.h>
#include "xrt/xrt_settings.h"
#include "xrt/xrt_config.h"
#include "util/u_file.h"
#include "util/u_json.h"
#include "util/u_debug.h"
#include "u_config_json.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include "bindings/b_generated_bindings.h"
#include <assert.h>
Include dependency graph for u_config_json.c:

Macros

#define CONFIG_FILE_NAME   "config_v0.json"
 
#define GUI_STATE_FILE_NAME   "gui_state_v0.json"
 

Functions

void u_config_json_close (struct u_config_json *json)
 
static void u_config_json_open_or_create_file (struct u_config_json *json, const char *filename)
 
void u_config_json_open_or_create_main_file (struct u_config_json *json)
 Load the JSON config file. More...
 
static cJSON * get_obj (cJSON *json, const char *name)
 
static XRT_MAYBE_UNUSED bool get_obj_bool (cJSON *json, const char *name, bool *out_bool)
 
static bool get_obj_int (cJSON *json, const char *name, int *out_int)
 
static bool get_obj_float (cJSON *json, const char *name, float *out_float)
 
static bool get_obj_str (cJSON *json, const char *name, char *array, size_t array_size)
 
static bool is_json_ok (struct u_config_json *json)
 
static void u_config_json_assign_schema (struct u_config_json *json)
 
static bool parse_active (const char *str, const char *from, enum u_config_json_active_config *out_active)
 
void u_config_json_get_active (struct u_config_json *json, enum u_config_json_active_config *out_active)
 Read from the JSON loaded json config file and returns the active config, can be overridden by P_OVERRIDE_ACTIVE_CONFIG envirmental variable. More...
 
bool u_config_json_get_remote_settings (struct u_config_json *json, int *out_port, uint32_t *out_view_count)
 Extract remote settings from the JSON. More...
 
static cJSON * open_tracking_settings (struct u_config_json *json)
 
bool u_config_json_get_tracking_overrides (struct u_config_json *json, struct xrt_tracking_override *out_overrides, size_t *out_override_count)
 Extract tracking override settings from the JSON. More...
 
bool u_config_json_get_tracking_settings (struct u_config_json *json, struct xrt_settings_tracking *s)
 Extract tracking settings from the JSON. More...
 
static void u_config_json_make_default_root (struct u_config_json *json)
 
static void u_config_write (struct u_config_json *json, const char *filename)
 
void u_config_json_save_calibration (struct u_config_json *json, struct xrt_settings_tracking *settings)
 Writes back calibration settings to the main config file. More...
 
static cJSON * make_pose (struct xrt_pose *pose)
 
void u_config_json_save_overrides (struct u_config_json *json, struct xrt_tracking_override *overrides, size_t override_count)
 Writes back tracking override settings to the main config file. More...
 
void u_gui_state_open_file (struct u_config_json *json)
 
static const char * u_gui_state_scene_to_string (enum u_gui_state_scene scene)
 
struct cJSON * u_gui_state_get_scene (struct u_config_json *json, enum u_gui_state_scene scene)
 
void u_gui_state_save_scene (struct u_config_json *json, enum u_gui_state_scene scene, struct cJSON *new_state)
 

Detailed Description

Code to manage the settings file.

Author
Jakob Bornecrantz jakob.nosp@m.@col.nosp@m.labor.nosp@m.a.co.nosp@m.m