# State Functions

The following functions are used to manage the lifecycle of the HoloPlay Core application.

## hpc\_InitializeApp

`hpc_client_error hpc_InitializeApp(const char *app_name, hpc_license_type app_type)`

**Returns**

Error code returned from HoloPlay Service request.

**Args**

Name of application (will be registered by HoloPlay Service) and application commercial licensing type (see [hpc\_license\_type](https://lfdocs.lookingglassfactory.com/legacy/legacy-software/core-sdk/libholoplaycore#hpc_license_type)).

**Description**

Registers a client app with HoloPlay Service, and updates the global state variable. If you intend to register an app under a specific name, this **must** be the first function call you make.

## hpc\_RefreshState

`hpc_client_error hpc_RefreshState(void)`

**Returns**

void

**Args**

none

**Description**

Send a new message to HoloPlayService requesting updated device information; overwrite the state variable storing that information. hpc\_InitializeApp will initially populate this variable. Call this function again to update that variable.

## hpc\_CloseApp

`int hpc_CloseApp(void)`

**Returns**

error code returned from HoloPlay Service request.

**Args**

none

**Description**

Closes connection to HoloPlay Service. This should *always* be called before your app exits.

## hpc\_GetHoloPlayCoreVersion

`size_t hpc_GetHoloPlayCoreVersion(char *out_buf, size_t out_buf_sz)`

**Returns**

Current version of HoloPlay Core, as a string.

**Args**

none
