hap-controller
Version:
Library to implement a HAP (HomeKit) controller
69 lines • 1.95 kB
TypeScript
import type { Peripheral } from '@stoprocent/noble';
/**
* Convert a proper UUID to noble's format.
*
* @param {string} uuid - UUID to convert
* @returns {string} UUID
*/
export declare function uuidToNobleUuid(uuid: string): string;
/**
* Convert a UUID in noble's format to a proper UUID.
*
* @param {string} uuid - UUID to convert
* @returns {string} UUID
*/
export declare function nobleUuidToUuid(uuid: string): string;
/**
* Unpack a HAP value from a buffer.
*
* @param {Buffer} buffer - Buffer to unpack
* @param {string} format - HAP data format
* @returns {*} Unpacked value.
*/
export declare function bufferToValue(buffer: Buffer, format: string): unknown;
/**
* Pack a HAP value into a buffer.
*
* @param {*} value - Value to pack
* @param {string} format - HAP data format
* @returns {Buffer} Packed buffer
*/
export declare function valueToBuffer(value: unknown, format: string): Buffer;
/**
* This should be used when doing any communication with a BLE device, since
* noble doesn't provide any timeout functionality.
*/
export declare class Watcher<T> {
rejected: boolean;
stopped: boolean;
private peripheral;
private rejectFn?;
private reject;
private timer?;
private promise;
/**
* Initialize the Watcher object.
*
* @param {Object} peripheral - The noble peripheral object
* @param {Promise} watch - The Promise to set a timeout on
* @param {number?} timeout - Timeout
*/
constructor(peripheral: Peripheral, watch: Promise<T>, timeout?: number);
/**
* Get the promise associated with this watcher.
*
* @returns {Promise} The promise.
*/
getPromise(): Promise<T>;
/**
* Call the reject function with the provided reason.
*
* @param {string?} reason - Reject reason
*/
private _reject;
/**
* Stop the watcher.
*/
stop(): void;
}
//# sourceMappingURL=gatt-utils.d.ts.map