UNPKG

@hangtime/grip-connect

Version:

Griptonite Motherboard, Tindeq Progressor, PitchSix Force Board, WHC-06, Entralpi, Climbro, mySmartBoard: Bluetooth API Force-Sensing strength analysis for climbers

110 lines 4.55 kB
import { Device } from "../device.model.js"; import type { IMotherboard } from "../../interfaces/device/motherboard.interface.js"; /** * Represents a Griptonite Motherboard device. * {@link https://griptonite.io} */ export declare class Motherboard extends Device implements IMotherboard { /** * Length of the packet received from the device. * @type {number} * @static * @readonly * @constant */ private static readonly packetLength; /** * Number of samples contained in the data packet. * @type {number} * @static * @readonly * @constant */ private static readonly samplesNumber; /** * Buffer to store received data from the device. * @type {number[]} * @private */ private receiveBuffer; /** * Calibration data for each sensor of the device. * @type {number[][][]} * @private */ private calibrationData; constructor(); /** * Applies calibration to a sample value. * @param {number} sample - The sample value to calibrate. * @param {number[][]} calibration - The calibration data. * @returns {number} The calibrated sample value. */ private applyCalibration; /** * Retrieves battery or voltage information from the device. * @returns {Promise<string | undefined>} A Promise that resolves with the battery or voltage information, */ battery: () => Promise<string | undefined>; /** * Writes a command to get calibration data from the device. * @returns {Promise<void>} A Promise that resolves when the command is successfully sent. */ calibration: () => Promise<void>; /** * Retrieves firmware version from the device. * @returns {Promise<string>} A Promise that resolves with the firmware version, */ firmware: () => Promise<string | undefined>; /** * Handles data received from the Motherboard device. Processes hex-encoded streaming packets * to extract samples, calibrate masses, and update running averages of mass data. * If the received data is not a valid hex packet, it returns the unprocessed data. * * @param {DataView} value - The notification event. */ handleNotifications: (value: DataView) => void; /** * Retrieves hardware version from the device. * @returns {Promise<string>} A Promise that resolves with the hardware version, */ hardware: () => Promise<string | undefined>; /** * Sets the LED color based on a single color option. Defaults to turning the LEDs off if no configuration is provided. * @param {"green" | "red" | "orange"} [config] - Optional color or array of climb placements for the LEDs. Ignored if placements are provided. * @returns {Promise<number[] | undefined>} A promise that resolves with the payload array for the Kilter Board if LED settings were applied, or `undefined` if no action was taken or for the Motherboard. */ led: (config?: "green" | "red" | "orange") => Promise<number[] | undefined>; /** * Retrieves manufacturer information from the device. * @returns {Promise<string>} A Promise that resolves with the manufacturer information, */ manufacturer: () => Promise<string | undefined>; /** * Retrieves serial number from the device. * @returns {Promise<string>} A Promise that resolves with the serial number, */ serial: () => Promise<string | undefined>; /** * Stops the data stream on the specified device. * @returns {Promise<void>} A promise that resolves when the stream is stopped. */ stop: () => Promise<void>; /** * Starts streaming data from the specified device. * @param {number} [duration=0] - The duration of the stream in milliseconds. If set to 0, stream will continue indefinitely. * @returns {Promise<void>} A promise that resolves when the streaming operation is completed. */ stream: (duration?: number) => Promise<void>; /** * Retrieves the entire 320 bytes of non-volatile memory from the device. * * The memory consists of 10 segments, each 32 bytes long. If any segment was previously written, * the corresponding data will appear in the response. Unused portions of the memory are * padded with whitespace. * * @returns {Promise<string>} A Promise that resolves with the 320-byte memory content as a string, */ text: () => Promise<string | undefined>; } //# sourceMappingURL=motherboard.model.d.ts.map