> For the complete documentation index, see [llms.txt](https://lfdocs.lookingglassfactory.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lfdocs.lookingglassfactory.com/legacy/legacy-software/core-sdk/index-1/index/general-query-functions.md).

# 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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://lfdocs.lookingglassfactory.com/legacy/legacy-software/core-sdk/index-1/index/general-query-functions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
