Skip to main content

Display brightness service

The display brightness service provides an implementation for controlling the brightness of a kiosk display. When registered, the platform can read and adjust the display brightness.

Registration

export default async context => {
context.service.addService({
type: 'displayBrightnessService',
getDisplayBrightness: async () => {
// Return the current brightness as a value between 0 and 1
return currentBrightness;
},
setDisplayBrightness: async brightness => {
// Set the display brightness, value is between 0 and 1
},
});
};

Methods

getDisplayBrightness()

Returns a Promise<number> that resolves with the current display brightness as a number between 0 (lowest brightness level allowed) and 1 (maximum brightness).

setDisplayBrightness(brightness)

Sets the display brightness. The brightness parameter is a number between 0 (lowest brightness level allowed) and 1 (maximum brightness). Returns a Promise<void> that resolves when the brightness has been applied.