Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Registers a callback function to be invoked each time the LampArray status changes.
Syntax
STDAPI RegisterLampArrayStatusCallback(
_In_ LampArrayStatusCallback callbackFunc,
LampArrayEnumerationKind enumerationKind,
_In_opt_ void * context,
_Out_ _Result_zeroonfailure_ LampArrayCallbackToken * callbackToken);
Parameters
callbackFunc _In_ Type: LampArrayStatusCallback
A caller-defined function to register. It will be invoked when LampArray status changes.
enumerationKind
Type: LampArrayEnumerationKind
Specifies the desired device enumeration behavior of the LampArrayStatusCallback function.
context _In_opt_
Type: void*
A pointer to an object containing relevant information for the callback function. Typically, this is the calling object.
callbackToken _Out_ _Result_zeroonfailure_ Type: LampArrayCallbackToken*
A token value that can be used to unregister the callback function at a later time.
Return value
Type: HRESULT
Function result.
Remarks
The LampArrayEnumerationKind parameter allows the caller to specify how it should receive callbacks for any LampArray devices that are attached at the time of this call. If LampArrayEnumerationKind::Blocking is selected, the RegisterLampArrayStatusCallback function will block until that callback is invoked for each attached device (meaning the callback will be invoked on the calling thread).
When the first callback is registered, the LampArray API starts a worker thread to handle ILampArray device status notifications. These events are infrequent, and the worker thread otherwise remains in a wait state. After the registration call returns, all subsequent LampArrayStatusCallbacks will be invoked sequentially on this worker thread.
If LampArrayEnumerationKind::Async is specified, this call will return immediately, and any LampArrays connected at the time of the call will be enumerated on the aforementioned LampArray callback worker thread.
The following code is an example of registering and unregistering a LampArrayStatusCallback function:
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);
}
}
Requirements
Header: LampArray.h
Library: xgameplatform.lib
Supported platforms: Xbox One family consoles and Xbox Series consoles
See also
Lighting API Overview
Lighting Basics
LampArrayStatusCallback
UnregisterLampArrayCallback
LampArrayEnumerationKind