UNPKG

@logitech-mx-creative-console/core

Version:

An npm module for interfacing with the Logitech MX Creative Console

31 lines 1.2 kB
export class DefaultPropertiesService { #device; constructor(device) { this.#device = device; } async setBrightness(percentage) { if (percentage < 0 || percentage > 100) { throw new RangeError('Expected brightness percentage to be between 0 and 100'); } percentage = Math.max(percentage, 1); // 0 is not allowed, it resets the device // prettier-ignore const brightnessCommandBuffer = new Uint8Array([ 0x11, 0xff, 0x0f, 0x2b, 0x00, percentage, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]); await this.#device.sendReports([brightnessCommandBuffer]); } async resetToLogo() { // prettier-ignore const resetCommandBuffer = new Uint8Array([ 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 ]); await this.#device.sendFeatureReport(resetCommandBuffer); } } //# sourceMappingURL=default.js.map