General-Query-Functions

The following are helper functions to query information from the state message, meaning that they will only return valid information following the invocation of [hpc_InitializeApp()](./State-Functions.md#hpc_InitializeApp()), and only return new information after hpc_RefreshState().

hpc_GetStateAsJSON

size_t hpc_GetStateAsJSON(char *out_buf, size_t out_buf_sz)

Returns

The current state message, serialized into a char buffer as JSON.

Args

char *out_buf, size_t out_buf_sz

Description

Mostly useful for debugging - custom message queries can be constructed without an external JSON serializer, using the helper functions in libHoloPlayCore.h.

hpc_GetHoloPlayServiceVersion

size_t hpc_GetHoloPlayServiceVersion(char *out_buf, size_t out_buf_sz)

Returns

Current version of HoloPlay Service, as a string.

Args

char *out_buf, size_t out_buf_sz

hpc_GetNumDevices

int hpc_GetNumDevices(void)

Returns

Number of Looking Glass devices connected with valid calibrations.

Args

None

hpc_GetDeviceHDMIName

size_t hpc_GetDeviceHDMIName(int dev_index, char *out_buf, size_t out_buf_sz)

Returns

Looking Glass device name retrieved from EDID.

Args

int dev_index, char *out_buf, size_t out_buf_sz

hpc_GetDeviceSerial

size_t hpc_GetDeviceSerial(int dev_index, char *out_buf, size_t out_buf_sz)

Returns

Serial number of device (same as the one printed on label).

Args

int dev_index, char *out_buf, size_t out_buf_sz

hpc_GetDeviceType

size_t hpc_GetDeviceType(int dev_index, char *out_buf, size_t out_buf_sz)

Returns

Device type as string. Currently one of the following:

  • "standard": the legacy 8.9" display

  • "large": the first generation 15.6" device

  • "pro": the legacy 15.6" Pro Workstation device

  • "8k": the first generation 8K device

  • "portrait": the Looking Glass Portrait

  • "4k_gen2": the second generation 16"

  • "8k_gen2": the second generation 32"

Args

int dev_index, char *out_buf, size_t out_buf_sz

*Note on String Return Functions

Any function of the form "size_t hpc_DoThing(..., char* out_buf, size_t out_buf_sz)" copies a string into a preallocated buffer of size out_buf_sz. The buffer is allocated and owned by the caller.

These functions return 0 if out_buf_sz was sufficient, or the actual size of string if out_buf_sz was too small.

This makes it much easier to pass strings into managed memory (i.e. for .NET bindings). Most of the strings returned by these functions are quite small.

Last updated