/// /// import { AxiosInstance, AxiosResponse } from "axios"; import * as udp from "node:dgram"; import { Frame } from "./frame.js"; import { Movie } from "./movie.js"; import { rgbColor, hsvColor, deviceMode, timer } from "./interfaces.js"; /** * Represents a Twinkly device * @public * */ export declare class Light { ipaddr: string; challenge: string; net: AxiosInstance; token: AuthenticationToken | undefined; activeLoginCall: boolean; nleds: number | undefined; udpClient: udp.Socket; /** * Creates an instance of Light. * * @constructor * @param {string} ipaddr IP Address of the Twinkly device */ constructor(ipaddr: string, timeout?: number); autoEndLoginCall(): Promise; /** * Sends a login request * * @returns {*} */ login(): Promise; /** * Check that we are logged in to the device */ verify(): Promise; /** * Ensure that we are logged into to the device, and if not initiate a login request */ ensureLoggedIn(): Promise; /** * Gets details about the device * * @returns {Promise} Results vary, see https://xled-docs.readthedocs.io/en/latest/rest_api.html#device-details */ getDeviceDetails(): Promise; /** * Turns the device off * * @returns {unknown} */ setOff(): Promise; /** * Sets the state * @experimental * @param {boolean} state - Set on/off */ setState(state: boolean): Promise; /** * Get the name of the device * * @returns {Promise} Name of device */ getName(): Promise; /** * Sets the name of the device * * @param {string} name Desired device name, max 32 charachters * @returns {Promise} */ setName(name: string): Promise; /** * Gets time when lights will turn on and off * * @returns {Promise} */ getTimer(): Promise; /** * Sets the brightness level * * @param {number} value * @param {string} [mode="enabled"] * @param {string} [type="A"] * @returns {} */ setBrightness(value: number, mode?: string, type?: string): Promise; /** * Gets the current brightness level * * @returns {number} Current brightness in range 0..100 */ getBrightness(): Promise; /** * Gets the current color in HSV */ getHSVColor(): Promise; /** * Gets the current color in RGB */ getRGBColor(): Promise; /** * Sets the color in RGB when in color mode * * @param {rgbColor} color A RGB color */ setRGBColor(color: rgbColor): Promise; setRGBColorRealTime(color: rgbColor): Promise; /** * Sets the color in HSV when in color mode * * @param {hsvColor} color A HSV color */ setHSVColor(color: hsvColor): Promise; /** * Gets the LED operation mode * * @returns {deviceMode} mode */ getMode(): Promise; /** * Sets the LED operation mode * * @param {deviceMode} mode */ setMode(mode: deviceMode): Promise; /** * Sends a POST request to the device, appending the required tokens * * @param {string} url * @param {object} params */ sendPostRequest(url: string, data: any, contentType?: string): Promise; /** * Sends a GET request to the device, appending the required tokens * * @param {string} url * @param {object} params */ sendGetRequest(url: string, params?: object, requiresToken?: boolean): Promise; sendMovieConfig(movie: Movie): Promise; sendMovieToDevice(movie: Movie): Promise; sendRealTimeFrame(frame: Frame): Promise; sendRealTimeFrameUDP(frame: Frame): Promise; getListOfMovies(): Promise; addMovie(movie: Movie): Promise; getLayout(): Promise; getNLeds(): Promise; } /** * Represents an authentication token used to login to an xled instance * @internal */ export declare class AuthenticationToken { token: string; expiry: Date; challengeResponse: string; /** * Creates an instance of AuthenticationToken. * * @constructor * @param {AxiosResponse} res Response from POST request */ constructor(res: AxiosResponse); /** * * @returns Token as string */ getToken(): string; /** * * @returns Token as buffer, for UDP use */ getTokenDecoded(): Buffer; /** * * @returns Challenge response generated by the XLED instance */ getChallengeResponse(): string; } /** * Easy way to create an entire frame of one color * * @export * @class OneColorFrame * @typedef {OneColorFrame} * @extends {Frame} */ export declare class OneColorFrame extends Frame { /** * Creates an instance of OneColorFrame. * * @constructor * @param {rgbColor} rgb * @param {number} nleds Number of LEDs to include in this frame (probably the number of LEDs in the string) */ constructor(rgb: rgbColor, nleds: number); }