@blackmagic-controller/core
Version:
An npm module for interfacing with the Blackmagic usb/bluetooth controllers
28 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.DefaultPropertiesService = void 0;
const util_js_1 = require("../../util.js");
class DefaultPropertiesService {
#device;
#options;
constructor(device, options) {
this.#device = device;
this.#options = options;
}
async getBatteryLevel() {
const val = await this.#device.getFeatureReport(this.#options.batteryReportId, 3);
return val[2] / 100;
}
async getFirmwareVersion() {
const val = await this.#device.getFeatureReport(this.#options.firmwareReportId, 8);
const view = (0, util_js_1.uint8ArrayToDataView)(val);
// Generate a semver format string
return `${view.getUint8(5)}.${view.getUint8(6)}.${view.getUint8(7)}+${view.getUint32(1, true).toString(16)}`;
}
async getSerialNumber() {
const val = await this.#device.getFeatureReport(this.#options.serialReportId, 33);
return new TextDecoder('ascii').decode(val.subarray(1));
}
}
exports.DefaultPropertiesService = DefaultPropertiesService;
//# sourceMappingURL=default.js.map