### Client.bin Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Client.html Gets or sets the path to the ADB binary. This is used to start the ADB server locally if the initial connection fails. Defaults to 'adb'. ```APIDOC ## bin ### Description Gets or sets the path to the ADB binary. This is used to start the ADB server locally if the initial connection fails. Defaults to 'adb'. ### Returns - **string** - The path to the ADB binary. ``` -------------------------------- ### minicap Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Prepares a minicap server. This server must be started using its `start()` method. ```APIDOC ## minicap(options?: Partial) ### Description Prepare a minicap server. This server must be started with the start() method. ### Method Not specified (likely a method call on a DeviceClient instance) ### Parameters #### Path Parameters * **options** (Partial) - Optional - Configuration options for the minicap server. ### Returns #### Success Response * **Minicap** - A Minicap instance. ### Response Example ```json { "example": "MinicapInstance" } ``` ``` -------------------------------- ### Install APK from URL Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Installs an APK from a given URL to the device. Requires the 'request' module and handles stream wrapping. Note that this example does not include error handling. ```typescript import Adb from '@u4/adbkit'; import request from 'request'; import { Readable } from 'stream'; const client = Adb.createClient(); const test = async () => { // The request module implements old-style streams, so we have to wrap it. try { // request is deprecated const device = client.getClient(''); await device.install(new Readable().wrap(request('http://example.org/app.apk') as any) as any) console.log('Installed') } catch (err) { console.error('Something went wrong:', err.stack) } } ``` -------------------------------- ### startActivity Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Starts the configured activity on the device, analogous to `adb shell am start `. ```APIDOC ## startActivity ### Description Starts the configured activity on the device. Roughly analogous to `adb shell am start `. ### Method Not specified (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **options**: [StartActivityOptions](../interfaces/StartActivityOptions.html) - The activity configuration. ### Returns Promise ### Response Example { "stderr": "...", "stdout": "..." } ``` -------------------------------- ### STFService Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Prepares and returns an STFService instance. This service must be started using the start() method. ```APIDOC ## STFService ### Description Prepares and returns an STFService instance. This service must be started using the start() method. ### Method POST ### Endpoint /device/stfservice ### Parameters #### Query Parameters - **options** (Partial) - Optional - Configuration options for the STFService. ### Returns [STFService](STFService.html) ### Response Example { "example": "STFService object" } ``` -------------------------------- ### start Source: https://github.com/urielch/adbkit/blob/master/docs/classes/STFService.html Starts the STF service. This is typically called to initialize the service. ```APIDOC ## start ### Description Starts the STF service. ### Method POST ### Endpoint /stfservice/start ### Response #### Success Response (200) - **service** (STFService) - An instance of the STFService upon successful start. ``` -------------------------------- ### start Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Minicap.html Initiates the connection to the local abstract:minicap service. ```APIDOC ## start ### Description Starts the Minicap service and resolves once the local abstract:minicap is connected. ### Method `start(): Promise` ### Returns Promise<[Minicap](Minicap.html)> - A promise that resolves when the minicap service is connected. ``` -------------------------------- ### install Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Installs an APK on the device, replacing any previously installed version. ```APIDOC ## install ### Description Installs the APK on the device, replacing any previously installed version. This is roughly analogous to `adb install -r `. Note that if the call seems to stall, you may have to accept a dialog on the phone first. ### Method POST (or equivalent SDK method) ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **apk** (string | ReadStream) - Required - When `String`, interpreted as a path to an APK file. When `Stream`, installs directly from the stream, which must be a valid APK. ### Request Example ```javascript // Example using a file path await deviceClient.install('path/to/your/app.apk'); // Example using a stream const fs = require('fs'); await deviceClient.install(fs.createReadStream('path/to/your/app.apk')); ``` ### Returns Promise - Returns true if the installation was successful. ### Response Example ```json true ``` ``` -------------------------------- ### scrcpy Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Prepares a Scrcpy server. This server must be started with the start() method. ```APIDOC ## scrcpy ### Description Prepare a Scrcpy server. This server must be started with the start() method. ### Method Not specified (likely a method call on a client object) ### Parameters #### Query Parameters * **options** (Partial) - Optional - Options for the Scrcpy server. ### Returns #### Success Response * **Scrcpy** - An object representing the Scrcpy server. ### Returns Scrcpy ``` -------------------------------- ### Start Activity on Device Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Starts a configured activity on the Android device. This is analogous to `adb shell am start `. ```javascript await device.getClient().startActivity(options); ``` -------------------------------- ### Install APK to All Devices Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Installs a local APK file to all connected devices. Iterates through listed devices and installs the specified APK. ```typescript import Adb from '@u4/adbkit'; const client = Adb.createClient(); const apk = 'vendor/app.apk'; const test = async () => { try { const devices = await client.listDevices(); for (const device of devices) { await device.getClient().install(apk); console.log(`Installed ${apk} on all connected devices`); } } catch (err) { console.error('Something went wrong:', err.stack); } }; ``` -------------------------------- ### Start ADB Server Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Connection.html Starts the ADB server process. Returns a Promise that resolves with the server's stdout and stderr output. ```javascript server.startServer().then(({ stdout, stderr }) => { console.log(stdout); console.error(stderr); }); ``` -------------------------------- ### Install adbkit via NPM Source: https://github.com/urielch/adbkit/blob/master/README.md Install the adbkit library using npm. This is the first step to using adbkit in your Node.js project. ```bash npm install --save @u4/adbkit ``` -------------------------------- ### startService Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Starts the configured service on the device, analogous to `adb shell am startservice `. ```APIDOC ## startService ### Description Starts the configured service on the device. Roughly analogous to `adb shell am startservice `. ### Method Not specified (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **options**: [StartServiceOptions](../interfaces/StartServiceOptions.html) - The activity configuration. ### Returns Promise`. ```javascript await device.getClient().startService(options); ``` -------------------------------- ### listen Source: https://github.com/urielch/adbkit/blob/master/docs/classes/TcpUsbServer.html Starts the TCP USB server, optionally with a listening listener callback. ```APIDOC ## listen ### Description Starts the TCP USB server, optionally with a listening listener callback. ### Method (Implicitly defined in TcpUsbServer) ### Parameters * **handle**: any - The handle to listen on. * **listeningListener?**: (() => void) - An optional callback function to be executed when the server starts listening. ``` -------------------------------- ### Example of eventNames() usage Source: https://github.com/urielch/adbkit/blob/master/docs/classes/ProcStat.html Demonstrates how to get an array of all events for which the emitter has registered listeners. This is inherited from EventEmitter. ```javascript const EventEmitter = require('events'); const myEE = new EventEmitter(); myEE.on('foo', () => {}); myEE.on('bar', () => {}); const sym = Symbol('symbol'); myEE.on(sym, () => {}); console.log(myEE.eventNames()); // Prints: [ 'foo', 'bar', Symbol(symbol) ] ``` -------------------------------- ### installRemote Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Installs an APK file that is already on the device's file system. ```APIDOC ## installRemote ### Description Installs an APK file which must already be located on the device file system, and replaces any previously installed version. Useful if you've previously pushed the file to the device for some reason. This is roughly analogous to `adb shell pm install -r ` followed by `adb shell rm -f `. Note that if the call seems to stall, you may have to accept a dialog on the phone first. ### Method POST (or equivalent SDK method) ### Endpoint N/A (SDK method) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body * **apk** (string) - Required - The path to the APK file on the device. The file will be removed when the command completes. ### Request Example ```javascript await deviceClient.installRemote('/data/local/tmp/app.apk'); ``` ### Returns Promise - Returns true if the installation was successful. ### Response Example ```json true ``` ``` -------------------------------- ### Start Minicap video stream Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Minicap.html Starts the video stream from Minicap using a provided video socket. This method returns a promise that resolves when the stream is ready. ```typescript await minicap.startStream(videoSocket); ``` -------------------------------- ### Start Minicap connection Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Minicap.html Initiates the connection to the localabstract:minicap service. The promise resolves once the connection is established. ```typescript await minicap.start(); ``` -------------------------------- ### checkVersion Source: https://github.com/urielch/adbkit/blob/master/docs/classes/STFService.html Checks the installed Agent version. Returns 'OK' if the version matches, 'MISMATCH' if it differs, or 'MISSING' if not installed. ```APIDOC ## checkVersion(version: string) ### Description Get the current installed Agent version number. ### Parameters #### Path Parameters - **version** (string) - Description of the version parameter. ### Returns Promise<"OK" | "MISMATCH" | "MISSING"> 'MISSING' if not installed, 'OK' if expected, 'MISMATCH' if version differ. ``` -------------------------------- ### DevicePackage.name Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DevicePackage.html Gets the name of the package. ```APIDOC ## name ### Description Gets the name of the package. ### Returns * string - The name of the package. ``` -------------------------------- ### openMonkey Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Starts the built-in `monkey` utility on the device and connects to it, allowing for the creation of touch and key events. ```APIDOC ## openMonkey ### Description Starts the built-in `monkey` utility on the device, connects to it using `client.openTcp()` and hands the connection to adbkit-monkey, a pure Node.js Monkey client. This allows you to create touch and key events, among other things. ### Method openMonkey ### Parameters #### Query Parameters * **port** (number) - Optional - The device port where you'd like Monkey to run at. Defaults to `1080`. ### Returns #### Success Response - **monkeyClient** (default) - The Monkey client. Please see the adbkit-monkey documentation for details. ### Returns Promise ``` -------------------------------- ### StartActivityOptions Interface Source: https://github.com/urielch/adbkit/blob/master/docs/interfaces/StartActivityOptions.html Defines the structure for options when starting an Android activity via adbkit. ```APIDOC ## Interface: StartActivityOptions ### Description This interface specifies the optional parameters that can be provided when initiating an Android activity using the adbkit library. These options allow for fine-grained control over how the activity is launched. ### Properties #### action (string, optional) - Description: The action to perform (e.g., `"android.intent.action.VIEW"`). #### category (string, optional) - Description: The category for the intent (e.g., `"android.intent.category.BROWSABLE"`). #### component (string, optional) - Description: The specific component name to launch (e.g., `"com.example.app/.MainActivity"`). #### data (string, optional) - Description: The data URI for the intent (e.g., `"http://example.com"`). #### debug (boolean, optional) - Description: If true, enables debugging for the activity launch. #### extras (object, optional) - Description: A key-value map of extra data to pass to the activity. #### flags (number, optional) - Description: Flags to set on the intent. #### mimeType (string, optional) - Description: The MIME type for the data. #### user (string, optional) - Description: The user ID to run the activity under. #### wait (boolean, optional) - Description: If true, the command will wait for the activity to be ready. ``` -------------------------------- ### getState Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Gets the current state of the device. ```APIDOC ## getState ### Description Gets the state of the device identified by the given serial number. ### Method GET (or equivalent SDK method) ### Endpoint N/A (SDK method) ### Returns Promise - The device state. ### Returns Example ```json "device" ``` ``` -------------------------------- ### listPackages Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Lists all installed packages on the device, with an option to filter for third-party applications. ```APIDOC ## listPackages(options?: { thirdparty?: boolean }) ### Description List packages installed on the device. ### Method Not specified (likely a method call on a DeviceClient instance) ### Parameters #### Query Parameters * **options** (object) - Optional - Configuration options. * **thirdparty** (boolean) - Optional - If true, only lists third-party apps. ### Returns #### Success Response * **Array** - An array of DevicePackage objects. ### Response Example ```json { "example": [ { "name": "com.example.app", "path": "/data/app/com.example.app" } ] } ``` ``` -------------------------------- ### Listen on TcpUsbServer Source: https://github.com/urielch/adbkit/blob/master/docs/classes/TcpUsbServer.html Starts the TcpUsbServer to listen for incoming connections. This method is specific to TcpUsbServer. ```typescript listen(...args: [handle: any, listeningListener?: (() => void)]): [TcpUsbServer](TcpUsbServer.html) ``` -------------------------------- ### Get Filtered List of Packages Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Retrieves a filtered list of packages based on provided flags. For example, to get only disabled packages. ```javascript client.getPackages("-d") ``` -------------------------------- ### Example of listeners() usage Source: https://github.com/urielch/adbkit/blob/master/docs/classes/JdwpTracker.html Shows how to retrieve a copy of the array of listeners for a specific event. This is useful for inspecting which functions are attached to an event. ```javascript server.on('connection', (stream) => { console.log('someone connected!'); }); console.log(util.inspect(server.listeners('connection'))); // Prints: [ [Function] ] ``` -------------------------------- ### Initialize ADB Client and List Devices Source: https://github.com/urielch/adbkit/blob/master/docs/index.html This example demonstrates how to create an ADB client instance and retrieve a list of connected Android devices. It includes basic error handling for when no devices are found. ```javascript import { createClient } from '@u4/adbkit'; const main = async () => { const adbClient = createClient(); const devices = await adbClient.listDevices(); if (!devices.length) { console.error('Need at least one connected android device'); return; } // deviceClient is a DeviceClient const deviceClient = devices[0].getClient(); // your device is ready to use // check all DeviceClient functions // print Hello Word in a shell and get the echo back const hello = await deviceClient.execOut('echo Hello Word', 'utf8'); console.log(hello) } ``` -------------------------------- ### Basic adbkit Usage Sample Source: https://github.com/urielch/adbkit/blob/master/README.md A sample TypeScript script demonstrating how to create an ADB client, list connected devices, and execute a simple shell command ('echo Hello Word') on the first available device. Ensure at least one Android device is connected. ```typescript import { createClient } from '@u4/adbkit'; const main = async () => { const adbClient = createClient(); const devices = await adbClient.listDevices(); if (!devices.length) { console.error('Need at least one connected android device'); return; } // deviceClient is a DeviceClient const deviceClient = devices[0].getClient(); // your device is ready to use // check all DeviceClient functions // print Hello Word in a shell and get the echo back const hello = await deviceClient.execOut('echo Hello Word', 'utf8'); console.log(hello) } ``` -------------------------------- ### Client Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Client.html Initializes a new instance of the Client class. This is the entry point for establishing a connection to ADB. ```APIDOC ## constructor Client(options) ### Description Initializes a new instance of the Client class. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Parameters * **options** (object) - Optional - Configuration options for the client. ``` -------------------------------- ### start Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Scrcpy.html Initiates a connection to the Android device, deploys and runs the scrcpy server, and returns device information including name, width, and height. Subsequent data will be emitted as 'data' events. ```APIDOC ## start ### Description Connects to the Android device, sends and runs the server, and returns deviceName, width, and height. After that data will be offered as a 'data' event. ### Method `start()` ### Returns Promise ### Defined in `src/adb/thirdparty/scrcpy/Scrcpy.ts:304` ``` -------------------------------- ### sudo Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Returns a new DeviceClient instance with root privileges. ```APIDOC ## sudo ### Description Returns a new DeviceClient instance with root privileges. ### Method `sudo(): DeviceClient[]` ### Returns A new [DeviceClient](DeviceClient.html) instance with root privileges. ``` -------------------------------- ### Check STF Agent Version Source: https://github.com/urielch/adbkit/blob/master/docs/classes/STFService.html Checks the version of the installed STF agent. Returns 'OK' if the version matches, 'MISMATCH' if it differs, or 'MISSING' if the agent is not installed. ```typescript checkVersion(version: string): Promise<"OK" | "MISMATCH" | "MISSING"> ``` -------------------------------- ### Client Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Client.html Initializes a new instance of the Client class. It can optionally take ClientOptions to configure the connection, such as the ADB host and binary path. ```APIDOC ## constructor Client(options?) ### Description Initializes a new instance of the Client class. ### Parameters #### Path Parameters - **options** (ClientOptions) - Optional - Configuration options for the client, including host and binary path. ### Returns - **Client** - A new instance of the Client class. ``` -------------------------------- ### Start Scrcpy Service Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Scrcpy.html Connects to an Android device, runs the scrcpy server, and returns device information. Once started, data is available via a 'data' event. ```typescript start(): Promise ``` -------------------------------- ### DeviceClientExtra Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClientExtra.html Initializes a new instance of the DeviceClientExtra class. ```APIDOC ## constructor DeviceClientExtra() ### Description Initializes a new instance of the DeviceClientExtra class. ### Method constructor ### Parameters This constructor does not take any parameters. ``` -------------------------------- ### Minicap Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Minicap.html Initializes a new instance of the Minicap class. It takes a DeviceClient instance and optional configuration options. ```APIDOC ## new Minicap(client, config) ### Description Initializes a new instance of the Minicap class. ### Parameters #### Parameters - **client** ([DeviceClient](DeviceClient.html)) - The DeviceClient instance to use for communication. - **config** (Partial<[MinicapOptions](../interfaces/MinicapOptions.html) angle) - Optional configuration options for Minicap. #### Returns [Minicap](Minicap.html) - A new instance of the Minicap class. ``` -------------------------------- ### waitForEnd Source: https://github.com/urielch/adbkit/blob/master/docs/classes/PullTransfer.html Get end notification using a Promise. ```APIDOC ## waitForEnd(): Promise ### Description Provides a Promise that resolves when the stream has ended, allowing for asynchronous handling of stream completion. ### Method (Implicitly part of the PullTransfer class) ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Request Example ```javascript async function processStream(pullTransfer) { try { await pullTransfer.waitForEnd(); console.log('Stream has ended.'); } catch (error) { console.error('An error occurred:', error); } } ``` ### Response #### Success Response (200) Promise #### Response Example (A Promise that resolves with no value upon stream end) ### Since (Not specified in source, but likely related to modern Promise usage) ``` -------------------------------- ### StartServiceOptions Interface Source: https://github.com/urielch/adbkit/blob/master/docs/interfaces/StartServiceOptions.html Defines the options available for starting a service. These options correspond to parameters used in the adb shell 'am start-service' command. ```APIDOC ## Interface: StartServiceOptions ### Description This interface defines the configuration options for starting a service via adb. It allows specifying various parameters that control how the service is initiated, including actions, data, components, and extras. ### Properties #### `action` (string, optional) The action to perform. Corresponds to the `-a` parameter in the `am start-service` command. #### `category` (string | string[], optional) The category for the service. Can be a single category string or an array of strings for multiple categories. Corresponds to the `-c` parameter. #### `component` (string, optional) The component name of the service to start. Corresponds to the `-n` parameter. #### `data` (string, optional) The data URI to associate with the service. Corresponds to the `-d` parameter. #### `extras` (ExtraObject | Extra[], optional) Additional key-value pairs to pass as extras to the service. This can be a single `ExtraObject` or an array of `Extra` objects. #### `flags` (number | number[], optional) Numeric flags to set for the service. Can be a single flag or an array of flags. Corresponds to the `-f` parameter. #### `mimeType` (string, optional) The MIME type for the data. Corresponds to the `-rt` parameter. #### `user` (number, optional) The user ID under which to run the service. If unsupported by the device, the command will be retried without this option. ``` -------------------------------- ### STFService.width Source: https://github.com/urielch/adbkit/blob/master/docs/classes/STFService.html Gets the current width value from the STFService. ```APIDOC ## width ### Description Gets the current width value. ### Method get width(): Promise ### Returns Promise ``` -------------------------------- ### STFService.height Source: https://github.com/urielch/adbkit/blob/master/docs/classes/STFService.html Gets the current height value from the STFService. ```APIDOC ## height ### Description Gets the current height value. ### Method get height(): Promise ### Returns Promise ``` -------------------------------- ### GetWifiStatusRequest Source: https://github.com/urielch/adbkit/blob/master/docs/interfaces/STFServiceModel.GetWifiStatusRequest.html Represents a request to get the current Wi-Fi status. ```APIDOC ## Interface: GetWifiStatusRequest ### Description This interface defines the structure for a request to retrieve the Wi-Fi status of a device. ### Usage This interface is part of the STFServiceModel and is used when making calls to query Wi-Fi status. ### Source * Defined in [src/adb/thirdparty/STFService/STFServiceModel.ts:241](https://github.com/UrielCh/adbkit/blob/6fc804b/src/adb/thirdparty/STFService/STFServiceModel.ts#L241) ``` -------------------------------- ### STFService.maxPressure Source: https://github.com/urielch/adbkit/blob/master/docs/classes/STFService.html Gets the current maximum pressure value from the STFService. ```APIDOC ## maxPressure ### Description Gets the current maximum pressure value. ### Method get maxPressure(): Promise ### Returns Promise ``` -------------------------------- ### createClient Source: https://github.com/urielch/adbkit/blob/master/docs/variables/Adb.html Creates a client instance with the provided options. The connection is established only when necessary. ```APIDOC ## createClient ### Description Creates a client instance with the provided options. Note that this will not automatically establish a connection, it will only be done when necessary. ### Method createClient ### Parameters #### options - **options** (AdbOptions) - Optional - An object compatible with Net.connect's options: **port** The port where the ADB server is listening. Defaults to `5037`. **host** The host of the ADB server. Defaults to `'127.0.0.1'`. **bin** As the sole exception, this option provides the path to the `adb` binary, used for starting the server locally if initial connection fails. Defaults to `'adb'`. ### Returns - **Client** - The client instance. ### Example ```javascript import { createClient } from "@u4/adbkit"; const client = createClient(); ``` ``` -------------------------------- ### Minicap Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Minicap.html Initializes a new instance of the Minicap class. This is the entry point for interacting with the minicap service. ```APIDOC ## constructor ### Description Initializes a new instance of the Minicap class. ### Parameters * **client** (Client) - Required - The ADB client instance. * **config** (object) - Optional - Configuration options for Minicap. * **width** (number) - Optional - The desired width of the captured screen. * **height** (number) - Optional - The desired height of the captured screen. * **bitflags** (number) - Optional - Flags to control minicap behavior. * **rotation** (number) - Optional - The rotation of the screen (0, 90, 180, 270). * **format** (string) - Optional - The image format (e.g., 'png', 'jpeg'). * **quality** (number) - Optional - The quality of the image (0-100). ``` -------------------------------- ### STFService.maxContact Source: https://github.com/urielch/adbkit/blob/master/docs/classes/STFService.html Gets the current maximum contact value from the STFService. ```APIDOC ## maxContact ### Description Gets the current maximum contact value. ### Method get maxContact(): Promise ### Returns Promise ``` -------------------------------- ### createClient Source: https://github.com/urielch/adbkit/blob/master/docs/modules.html Creates a new ADB client instance. This is the primary entry point for interacting with ADB. ```APIDOC ## createClient ### Description Creates a new ADB client instance. This is the primary entry point for interacting with ADB. ### Method createClient ### Parameters This function does not take any parameters. ### Request Example ```javascript const adb = require('adbkit') const client = adb.createClient() ``` ### Response Returns an instance of the `Client` class. ``` -------------------------------- ### Import and Create Adb Client Source: https://github.com/urielch/adbkit/blob/master/docs/variables/Adb.html Import the createClient function from @u4/adbkit and use it to create a new ADB client instance. This is the first function you should call when starting to use the library. ```typescript import { createClient } from "@u4/adbkit" const client = createClient(); ``` -------------------------------- ### getDevicePath Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Gets the device path of the device identified by the given serial number. ```APIDOC ## getDevicePath ### Description Gets the device path of the device identified by the given serial number. ### Method GET ### Endpoint /device/path ### Parameters #### Path Parameters None #### Query Parameters * **serial** (string) - Required - The serial number of the device. #### Request Body None ### Request Example ``` GET /device/path?serial=emulator-5554 ``` ### Response #### Success Response (200) * **string** - The device path. This corresponds to the device path in `client.listDevicesWithPaths()`. #### Response Example ```json "/dev/socket/adb" ``` ``` -------------------------------- ### Service Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Service.html Initializes a new instance of the Service class. It requires a Client instance, serial number, local and remote IDs, and a socket connection. ```APIDOC ## constructor Service ### Description Initializes a new instance of the Service class. ### Parameters * **client** (Client) - The client instance. * **serial** (string) - The serial number of the device. * **localId** (number) - The local ID for the connection. * **remoteId** (number) - The remote ID for the connection. * **socket** (Socket) - The socket connection. ### Returns * Service - A new instance of the Service class. ``` -------------------------------- ### get extra Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DeviceClient.html Retrieves extra information or functionalities associated with the device client. ```APIDOC ## get extra ### Description Retrieves extra information or functionalities associated with the device client. ### Method GET ### Endpoint /device/extra ### Returns [DeviceClientExtra](DeviceClientExtra.html) ### Response Example { "example": "DeviceClientExtra object" } ``` -------------------------------- ### Track Devices with ADB Kit Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Client.html Use this snippet to start tracking device connections and listen for 'add' and 'remove' events. Ensure the tracker is ended when no longer needed. ```javascript import Adb from '@u4/adbkit'; const client = Adb.createClient(); const test = async () => { try { const tracker = await client.trackDevices(); tracker.on('add', (device) => console.log('Device %s was plugged in', device.id)); tracker.on('remove', (device) => console.log('Device %s was unplugged', device.id)); tracker.on('end', () => console.log('Tracking stopped')); } catch (err) { console.error('Something went wrong:', err.stack); } }; ``` -------------------------------- ### Node.js EventEmitter once() Example Source: https://github.com/urielch/adbkit/blob/master/docs/classes/JdwpTracker.html Demonstrates waiting for an event ('myevent') and handling potential errors on an EventEmitter. It shows how to resolve with emitted arguments and catch errors. ```javascript const { once, EventEmitter } = require('events'); async function run() { const ee = new EventEmitter(); process.nextTick(() => { ee.emit('myevent', 42); }); const [value] = await once(ee, 'myevent'); console.log(value); const err = new Error('kaboom'); process.nextTick(() => { ee.emit('error', err); }); try { await once(ee, 'myevent'); } catch (err) { console.log('error happened', err); } } run(); ``` -------------------------------- ### Pushtransfer.defaultMaxListeners Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Pushtransfer.html Gets or sets the default maximum number of listeners for all Pushtransfer instances. ```APIDOC ## defaultMaxListeners Pushtransfer.defaultMaxListeners ### Description Gets or sets the default maximum number of listeners for all Pushtransfer instances. ### Method defaultMaxListeners ### Parameters None ``` -------------------------------- ### Sync Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Sync.html Initializes a new instance of the Sync class. It requires an active ADB connection. ```APIDOC ## constructor Sync ### Description Initializes a new instance of the Sync class. ### Parameters #### Path Parameters - **connection** (Connection) - Required - An active ADB connection object. ### Returns - **Sync** - A new Sync instance. ``` -------------------------------- ### Establish Connection Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Connection.html Initiates a connection to the ADB server and returns a Promise that resolves with the Connection instance. ```typescript connect(): Promise ``` -------------------------------- ### Connection Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Connection.html Initializes a new Connection instance. It requires a parent Client instance to manage the connection. ```APIDOC ## constructor ### Description Initializes a new Connection instance. ### Parameters #### Path Parameters - **_parent** (Client) - Required - The parent Client instance managing this connection. ### Returns - [Connection](Connection.html) ``` -------------------------------- ### Get Parent Client Instance Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Connection.html Retrieves the parent Client instance associated with this connection. ```typescript parent(): Client ``` -------------------------------- ### Client Methods Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Client.html Exposes methods for interacting with ADB, such as connecting, disconnecting, listing devices, and managing connections. ```APIDOC ## Client Methods ### Description Methods available on the Client class for ADB operations. ### Methods * **addListener(eventName, listener)**: Adds a listener for a given event. * **connect(options)**: Establishes a connection to the ADB server. * **connection(id)**: Gets a connection by its ID. * **createTcpUsbBridge(device, options)**: Creates a TCP USB bridge for a device. * **disconnect()**: Disconnects from the ADB server. * **emit(eventName, ...args)**: Emits an event. * **eventNames()**: Returns an array of event names. * **getDevice(id)**: Gets a device by its ID. * **getMaxListeners()**: Returns the current maximum number of listeners. * **kill(pid)**: Kills a process on the device. * **listDevices()**: Lists all connected devices. * **listDevicesWithPaths()**: Lists all connected devices with their paths. * **listenerCount(eventName)**: Returns the number of listeners for a given event. * **listeners(eventName)**: Returns an array of listeners for a given event. * **off(eventName, listener)**: Removes a listener for a given event. * **on(eventName, listener)**: Adds a listener for a given event. * **once(eventName, listener)**: Adds a one-time listener for a given event. * **prependListener(eventName, listener)**: Adds a listener to the beginning of the listeners array. * **prependOnceListener(eventName, listener)**: Adds a one-time listener to the beginning of the listeners array. * **rawListeners(eventName)**: Returns an array of raw listeners for a given event. * **removeAllListeners(eventName)**: Removes all listeners for a given event. * **removeListener(eventName, listener)**: Removes a listener for a given event. * **setMaxListeners(n)**: Sets the maximum number of listeners for any event. * **trackDevices()**: Starts tracking device connections and disconnections. * **version()**: Gets the ADB server version. ``` -------------------------------- ### GetPropertiesRequest Interface Source: https://github.com/urielch/adbkit/blob/master/docs/interfaces/STFServiceModel.GetPropertiesRequest.html Represents a request to get properties. It contains an array of strings for property names. ```APIDOC ## Interface: GetPropertiesRequest ### Description This interface defines the structure for a request to retrieve properties. It is part of the STFServiceModel. ### Properties #### properties - **properties** (string[]) - An array of strings, where each string is a property name to be retrieved. ### Defined in - src/adb/thirdparty/STFService/STFServiceModel.ts:169 ``` -------------------------------- ### Service Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Service.html Initializes a new instance of the Service class. This is the primary way to create a Service object. ```APIDOC ## constructor Service ### Description Initializes a new instance of the Service class. ### Method constructor ### Parameters This method does not take any parameters. ``` -------------------------------- ### Socket Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Socket.html Initializes a new Socket instance. It takes the client, device serial, the underlying socket, and optional configuration options. ```APIDOC ## constructor ### Description Initializes a new Socket instance. ### Parameters * **client** (Client) - The ADBKit client instance. * **serial** (string) - The serial number of the device. * **socket** (Socket) - The underlying network socket. * **options** (SocketOptions) - Optional configuration for the socket. ### Returns Socket - A new Socket instance. ``` -------------------------------- ### Get Minicap Version Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Minicap.html Retrieves the version of the minicap tool. This is useful for compatibility checks or logging. ```typescript get version(): Promise ``` -------------------------------- ### STFServiceBuf.get() Source: https://github.com/urielch/adbkit/blob/master/docs/classes/STFServiceBuf.html Static method to get an instance of STFServiceBuf. It returns a Promise that resolves to an STFServiceBuf object. ```APIDOC ## Static get() ### Description Retrieves an instance of STFServiceBuf. ### Method Static ### Returns Promise ### Example ```typescript STFServiceBuf.get().then(service => { // Use the service instance }); ``` ``` -------------------------------- ### BrowserPackageEvent Interface Source: https://github.com/urielch/adbkit/blob/master/docs/interfaces/STFServiceModel.BrowserPackageEvent.html Represents a package event in the browser, containing information about installed applications and selection status. ```APIDOC ## Interface: BrowserPackageEvent ### Description Represents a package event in the browser. It contains a list of applications and a boolean indicating if an item is selected. ### Properties * **selected** (boolean) - Indicates whether an item is selected. * **apps** (BrowserApp[]) - An array of BrowserApp objects representing the applications. ### Defined In `src/adb/thirdparty/STFService/STFServiceModel.ts:66` ``` -------------------------------- ### STFService Constructor Source: https://github.com/urielch/adbkit/blob/master/docs/classes/STFService.html Initializes a new instance of the STFService class. It requires a DeviceClient instance and optionally accepts STFServiceOptions. ```APIDOC ## new STFService(client, options) ### Description Initializes a new instance of the STFService class. ### Parameters #### client - **client** (DeviceClient) - Required - The DeviceClient instance to use. #### options - **options** (Partial) - Optional - Configuration options for the STFService. ### Returns - **STFService** - An instance of the STFService class. ``` -------------------------------- ### Scrcpy Methods Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Scrcpy.html Provides methods for interacting with the scrcpy instance, including starting and managing the scrcpy process. ```APIDOC ## addListener ### Description Alias for `emitter.on(eventName, listener)`. Installs a listener for a specific event. ### Method POST ### Endpoint /scrcpy/addListener ### Parameters #### Request Body * **eventName** (string | symbol) - Required - The name of the event to listen for. * **listener** ((...args: any[]) => void) - Required - The callback function to execute when the event is triggered. ### Returns * Scrcpy ## collapsePannels ### Description Collapses the scrcpy panels. ### Method POST ### Endpoint /scrcpy/collapsePannels ### Returns * Promise ``` -------------------------------- ### DevicePackage.getInfo Source: https://github.com/urielch/adbkit/blob/master/docs/classes/DevicePackage.html Retrieves information about the package. ```APIDOC ## getInfo ### Description Retrieves information about the package. ### Returns * Promise<[PackageInfo](../interfaces/PackageInfo.html)> - A promise that resolves with the package information. ``` -------------------------------- ### adbkit API Reference Source: https://github.com/urielch/adbkit/blob/master/docs/index.html This section lists the primary entry points and core components of the adbkit library that are available for direct use. ```APIDOC ## Modules * [@u4/adbkit](modules.html) * [STFServiceModel](modules/STFServiceModel.html) ## Functions * [createClient](modules.html#createClient) * [default](modules.html#default) ## Enums * [DeviceMessageType](enums/DeviceMessageType.html) * [KeyCodes](enums/KeyCodes.html) * [KeyEvent](enums/KeyEvent.html) * [KeyEventMeta](enums/KeyEventMeta.html) * [MotionEvent](enums/MotionEvent.html) * [Orientation](enums/Orientation.html) * [SurfaceControl](enums/SurfaceControl.html) ## Classes * [AdbError](classes/AdbError.html) * [AdbFailError](classes/AdbFailError.html) * [AdbPrematureEOFError](classes/AdbPrematureEOFError.html) * [AdbUnexpectedDataError](classes/AdbUnexpectedDataError.html) * [AuthError](classes/AuthError.html) * [ChecksumError](classes/ChecksumError.html) * [Client](classes/Client.html) * [Connection](classes/Connection.html) * [DeviceClient](classes/DeviceClient.html) * [DeviceClientExtra](classes/DeviceClientExtra.html) * [DevicePackage](classes/DevicePackage.html) * [Entry](classes/Entry.html) * [Entry64](classes/Entry64.html) * [IpRouteEntry](classes/IpRouteEntry.html) * [IpRuleEntry](classes/IpRuleEntry.html) * [JdwpTracker](classes/JdwpTracker.html) * [LateTransportError](classes/LateTransportError.html) * [MagicError](classes/MagicError.html) * [Minicap](classes/Minicap.html) * [Packet](classes/Packet.html) * [PacketReader](classes/PacketReader.html) * [ParcelReader](classes/ParcelReader.html) * [Parser](classes/Parser.html) * [PrematurePacketError](classes/PrematurePacketError.html) * [ProcStat](classes/ProcStat.html) * [PullTransfer](classes/PullTransfer.html) * [Pushtransfer](classes/Pushtransfer.html) * [RollingCounter](classes/RollingCounter.html) * [STFService](classes/STFService.html) * [STFServiceBuf](classes/STFServiceBuf.html) * [Scrcpy](classes/Scrcpy.html) * [Service](classes/Service.html) * [ServiceCallCommand](classes/ServiceCallCommand.html) * [ServiceMap](classes/ServiceMap.html) * [ShellCommand](classes/ShellCommand.html) * [Socket](classes/Socket.html) * [Stats](classes/Stats.html) * [Stats64](classes/Stats64.html) * [Sync](classes/Sync.html) * [TcpUsbServer](classes/TcpUsbServer.html) * [Tracker](classes/Tracker.html) * [UnauthorizedError](classes/UnauthorizedError.html) * [Utils](classes/Utils.html) ## Interfaces * [AdbOptions](interfaces/AdbOptions.html) * [AdbServiceInfo](interfaces/AdbServiceInfo.html) * [ClientOptions](interfaces/ClientOptions.html) * [CpuStats](interfaces/CpuStats.html) * [CpuStatsWithLine](interfaces/CpuStatsWithLine.html) * [Device](interfaces/Device.html) * [DeviceClientOptions](interfaces/DeviceClientOptions.html) * [DeviceWithPath](interfaces/DeviceWithPath.html) * [ExtendedPublicKey](interfaces/ExtendedPublicKey.html) * [Extra](interfaces/Extra.html) * [ExtraObject](interfaces/ExtraObject.html) * [Forward](interfaces/Forward.html) * [FramebufferMeta](interfaces/FramebufferMeta.html) * [FramebufferStreamWithMeta](interfaces/FramebufferStreamWithMeta.html) * [H264Configuration](interfaces/H264Configuration.html) * [KeyEventRequest](interfaces/KeyEventRequest.html) * [Loads](interfaces/Loads.html) * [LoadsWithLine](interfaces/LoadsWithLine.html) * [MinicapOptions](interfaces/MinicapOptions.html) * [PackageInfo](interfaces/PackageInfo.html) * [Point](interfaces/Point.html) * [PsEntry](interfaces/PsEntry.html) * [Reverse](interfaces/Reverse.html) * [STFServiceOptions](interfaces/STFServiceOptions.html) * [ScrcpyOptions](interfaces/ScrcpyOptions.html) * [ServiceCallArgNull](interfaces/ServiceCallArgNull.html) * [ServiceCallArgNumber](interfaces/ServiceCallArgNumber.html) * [ServiceCallArgString](interfaces/ServiceCallArgString.html) * [SocketOptions](interfaces/SocketOptions.html) * [StartActivityOptions](interfaces/StartActivityOptions.html) * [StartServiceOptions](interfaces/StartServiceOptions.html) * [TrackerChangeSet](interfaces/TrackerChangeSet.html) * [VideoStreamFramePacket](interfaces/VideoStreamFramePacket.html) * [WithToString](interfaces/WithToString.html) ## Types * [ColorFormat](types/ColorFormat.html) * [DeviceType](types/DeviceType.html) * [ExtraValue](types/ExtraValue.html) * [Features](types/Features.html) * [MyMessage](types/MyMessage.html) * [ProcStats](types/ProcStats.html) * [ProcessState](types/ProcessState.html) * [Properties](types/Properties.html) * [RebootType](types/RebootType.html) * [ServiceCallArg](types/ServiceCallArg.html) ## Variables * [Adb](variables/Adb.html) Generated using [TypeDoc](https://typedoc.org/) ``` -------------------------------- ### Tracker.defaultMaxListeners Source: https://github.com/urielch/adbkit/blob/master/docs/classes/Tracker.html Sets or gets the default maximum number of listeners for all Trackers. This is part of the Node.js EventEmitter API. ```APIDOC ## defaultMaxListeners Tracker.defaultMaxListeners ### Description Sets or gets the default maximum number of listeners for all Trackers. This is part of the Node.js EventEmitter API. ### Method get/set ### Parameters None ### Response The default maximum number of listeners. ```