Skip to content

Commit

Permalink
fix: add XKeys.writeData() method, used for testing and development
Browse files Browse the repository at this point in the history
  • Loading branch information
nytamin committed Dec 12, 2021
1 parent 3825237 commit fba879c
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion packages/core/src/xkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -429,7 +429,8 @@ export class XKeys extends EventEmitter {
}
/**
* Sets the backlightintensity of the device
* @param intensity 0-255
* @param blueIntensity 0-255
* @param redIntensity 0-255
*/
public setBacklightIntensity(blueIntensity: number, redIntensity?: number): void {
this.ensureInitialized()
Expand Down Expand Up @@ -524,6 +525,16 @@ export class XKeys extends EventEmitter {
this._write(byteVals)
}

/**
* Writes a Buffer of data bytes to the X-keys device
* Used to send custom messages to X-keys for testing and development
* @param buffer The buffer written to the device
* @returns undefined
*/
public writeData(message: HIDMessage): void {
this._write(message)
}

/** (Internal function) Called when there has been detected that the device has been disconnected */
public async _handleDeviceDisconnected(): Promise<void> {
if (!this._disconnected) {
Expand Down

0 comments on commit fba879c

Please sign in to comment.