UNPKG

appium-ios-device

Version:
105 lines 4.33 kB
export default Usbmux; export type SocketOptions = { /** * [/var/run/usbmuxd] The full path to the usbmuxd Unix socket */ socketPath: string | null; /** * [27015] The port number to connect to if running on Windows * or in WSL1 mode */ socketPort: number | null; /** * [127.0.0.1] The host name to connect to if running on Windows * or in WSL1 mode */ socketHost: string | null; /** * [5000] The number of milliseconds to wait until * the socket is connected */ timeout: number | null; }; export class Usbmux extends BaseServiceSocket { constructor(socketClient: any); _decoder: UsbmuxDecoder; _splitter: LengthBasedSplitter; _encoder: UsbmuxEncoder; _tag: number; _responseCallbacks: {}; _handleData(data: any): void; /** * Returns the BUID of the host computer from usbmuxd * @param {number} [timeout=5000] the timeout of receiving a response from usbmuxd * @returns {Promise<string>} */ readBUID(timeout?: number): Promise<string>; /** * Reads the pair record of a device. It will return null if it doesn't exists * @param {string} udid the udid of the device * @param {number} [timeout=5000] the timeout of receiving a response from usbmuxd * @returns {Promise<any?>} */ readPairRecord(udid: string, timeout?: number): Promise<any | null>; _sendPlist(json: any): void; _receivePlistPromise(timeout: number | undefined, responseCallback: any): { tag: number; receivePromise: B<any>; }; /** * Lists all devices connected to the host * @param {number} [timeout=5000] the timeout of receiving a response from usbmuxd * @returns {Promise<any[]>} */ listDevices(timeout?: number): Promise<any[]>; /** * Looks for a device with the passed udid. It will return undefined if the device is not found * @param {string} udid the udid of the device * @param {number} [timeout=5000] the timeout of receiving a response from usbmuxd * @returns {Promise<any?>} */ findDevice(udid: string, timeout?: number): Promise<any | null>; /** * Connects to the lockdownd on the device and returns a Lockdown client * @param {string} udid the udid of the device * @param {number} [timeout=5000] the timeout of receiving a response from usbmuxd * @returns {Promise<Lockdown>} */ connectLockdown(udid: string, timeout?: number): Promise<Lockdown>; /** * Connects to a certain port on the device * @param {string} deviceID the device id which can be retrieved from the properties of a device * @param {number} port the port number that wants to be connected * @param {number} [timeout=5000] the timeout of receiving a response from usbmuxd * @returns {Promise<net.Socket|Object>} The socket or the object returned in the callback if the callback function exists */ connect(deviceID: string, port: number, timeout?: number): Promise<net.Socket | any>; } /** * @typedef {Object} SocketOptions * @property {string?} socketPath [/var/run/usbmuxd] The full path to the usbmuxd Unix socket * @property {number?} socketPort [27015] The port number to connect to if running on Windows * or in WSL1 mode * @property {string?} socketHost [127.0.0.1] The host name to connect to if running on Windows * or in WSL1 mode * @property {number?} timeout [5000] The number of milliseconds to wait until * the socket is connected */ /** * Connects a socket to usbmuxd service * * @param {Partial<SocketOptions>} opts * @throws {Error} If there was an error while accessing the socket or * a connection error happened * @throws {B.TimeoutError} if connection timeout happened * @returns {Promise<NodeJS.Socket>} Connected socket instance */ export function getDefaultSocket(opts?: Partial<SocketOptions>): Promise<NodeJS.Socket>; import { BaseServiceSocket } from '../base-service'; import { UsbmuxDecoder } from './transformer/usbmux-decoder.js'; import { LengthBasedSplitter } from '../util/transformer/length-based-splitter'; import { UsbmuxEncoder } from './transformer/usbmux-encoder.js'; import B from 'bluebird'; import { Lockdown } from '../lockdown'; import net from 'net'; //# sourceMappingURL=index.d.ts.map