> ## Documentation Index
> Fetch the complete documentation index at: https://devdocs.xbox.com/llms.txt
> Use this file to discover all available pages before exploring further.

# RegisterLampArrayStatusCallback

> RegisterLampArrayStatusCallback

# RegisterLampArrayStatusCallback

LampArray 상태가 변경될 때마다 호출되는 콜백 함수를 등록합니다.

## 구문

```cpp theme={null}
STDAPI RegisterLampArrayStatusCallback(
    _In_ LampArrayStatusCallback callbackFunc,
    LampArrayEnumerationKind enumerationKind,
    _In_opt_ void * context,
    _Out_ _Result_zeroonfailure_ LampArrayCallbackToken * callbackToken);
```

### 매개변수

*callbackFunc*   \_In\_
형식: [LampArrayStatusCallback](/reference/lighting/lamparray/functions/lamparraystatuscallback)

등록할 호출자 정의 함수입니다. LampArray 상태가 변경될 때 호출됩니다.

*enumerationKind*\
형식: [LampArrayEnumerationKind](/reference/lighting/lamparray/enums/lamparrayenumerationkind)

[LampArrayStatusCallback](/reference/lighting/lamparray/functions/lamparraystatuscallback) 함수에 대해 원하는 장치 열거 동작을 지정합니다.

*context*   \_In\_opt\_\
형식: void\*

콜백 함수에 관련된 정보를 포함하는 개체에 대한 포인터입니다. 일반적으로 이는 호출 개체입니다.

*callbackToken*   \_Out\_ \_Result\_zeroonfailure\_
형식: LampArrayCallbackToken\*

나중에 콜백 함수 등록을 해제하는 데 사용할 수 있는 토큰 값입니다.

### 반환값

형식: HRESULT

함수 결과입니다.

## 설명

LampArrayEnumerationKind 매개변수를 통해 호출자는 이 호출 시점에 연결된 LampArray 장치에 대한 콜백을 어떻게 수신할지 지정할 수 있습니다. [LampArrayEnumerationKind::Blocking](/reference/lighting/lamparray/enums/lamparrayenumerationkind)이 선택된 경우 [RegisterLampArrayStatusCallback](/reference/lighting/lamparray/functions/registerlamparraystatuscallback) 함수는 연결된 각 장치에 대해 콜백이 호출될 때까지 블록됩니다. 즉, 콜백은 호출 스레드에서 실행됩니다.

첫 번째 콜백이 등록되면 LampArray API는 ILampArray 장치 상태 알림을 처리하기 위한 워커 스레드를 시작합니다. 이러한 이벤트는 자주 발생하지 않으며, 그 외에는 워커 스레드가 대기 상태로 유지됩니다. 등록 호출이 반환된 이후에는 모든 후속 LampArrayStatusCallbacks가 이 워커 스레드에서 순차적으로 호출됩니다.

[LampArrayEnumerationKind::Async](/reference/lighting/lamparray/enums/lamparrayenumerationkind)가 지정되면, 이 호출은 즉시 반환되며, 호출 시점에 연결되어 있는 LampArrays는 앞서 언급한 LampArray 콜백 워커 스레드에서 열거됩니다.

다음 코드는 [LampArrayStatusCallback](/reference/lighting/lamparray/functions/lamparraystatuscallback) 함수를 등록하고 등록 해제하는 예제입니다.

```c++ theme={null}
void MyLampArrayStatusCallback(
    _In_opt_ void* context,
    LampArrayStatus currentStatus,
    LampArrayStatus previousStatus,
    _In_ ILampArray* lampArray)
{
    // Application-specific code to handle LampArray status changes
}

void MonitorLampArrays(
    _In_ volatile bool & cancelMonitoring) noexcept
{
    LampArrayCallbackToken token = LAMPARRAY_INVALID_CALLBACK_TOKEN_VALUE;
    if (SUCCEEDED(RegisterLampArrayStatusCallback(
        MyLampArrayStatusCallback,
        LampArrayEnumerationKind::Async,
        nullptr /* context */,
        &token)))
    {
        while (!cancelMonitoring)
        {
            Sleep(100);
        }

        UnregisterLampArrayCallback(token, 5000);
    }
}
```

## 요구 사항

**헤더:** LampArray.h

**라이브러리:** xgameplatform.lib

**지원되는 플랫폼:** XBOX One 계열 콘솔 및 XBOX Series 콘솔

## 함께 보기

[Lighting API 개요](/build/core-features/common/lighting/gc-lighting-toc)\
[Lighting 기본 사항](/build/core-features/common/lighting/lighting-basics)\
[LampArrayStatusCallback](/reference/lighting/lamparray/functions/lamparraystatuscallback)\
[UnregisterLampArrayCallback](/reference/lighting/lamparray/functions/unregisterlamparraycallback)\
[LampArrayEnumerationKind](/reference/lighting/lamparray/enums/lamparrayenumerationkind)


## Related topics

- [LampArrayStatusCallback](/ko/reference/lighting/lamparray/functions/lamparraystatuscallback.md)
- [LampArrayEnumerationKind 열거형](/ko/reference/lighting/lamparray/enums/lamparrayenumerationkind.md)
- [Lighting API 참고 자료](/ko/reference/lighting/gc-reference-lighting-toc.md)
- [RegisterLampArrayCallback](/ko/reference/lighting/lamparray/functions/registerlamparraycallback.md)
- [LampArray](/ko/reference/lighting/lamparray/lamparray_members.md)
