heos-api
Version:
🎵 A zero-dependency low level api-wrapper for communicating with HEOS devices 🎵
26 lines (25 loc) • 1.48 kB
TypeScript
import { HeosConnection } from './heosConnection';
export declare type DiscoverOptions = {
timeout?: number;
port?: number;
address?: string;
};
/**
* Tries to discover all available HEOS devices in the network.
* @param options Options for discovering devices.
* @param onDiscover Will trigger every time a HEOS device is discovered.
* @param onTimeout Will trigger when `timeout` has ellapsed.
*/
export declare function discoverDevices(options: DiscoverOptions | number, onDiscover: (address: string) => void, onTimeout?: (addresses: string[]) => void): () => void;
/**
* Finds one HEOS device in the network.
* @param options Options for discovering a device.
* @returns A promise that will resolve when the first device is found, or reject if no devices are found before `timeout` milliseconds have passed. If the function resolves it will resolve with the address of the HEOS device found.
*/
export declare function discoverOneDevice(options?: DiscoverOptions | number): Promise<string>;
/**
* Finds one HEOS device in the network, and connects to it.
* @param options Options for discovering a device.
* @returns A promise that will resolve when the first device is found, or reject if no devices are found before `timeout` milliseconds have passed. If the function resolves it will resolve with a HeosConnection.
*/
export declare function discoverAndConnect(options?: DiscoverOptions | number): Promise<HeosConnection>;