UNPKG

@u4/adbkit

Version:

A Typescript client for the Android Debug Bridge.

27 lines 1.04 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const command_1 = __importDefault(require("../../command")); const protocol_1 = __importDefault(require("../../protocol")); class HostVersionCommand extends command_1.default { async execute() { await this._send('host:version'); const reply = await this.parser.readAscii(4); switch (reply) { case protocol_1.default.OKAY: const value = await this.parser.readValue('utf8'); return this._parseVersion(value); case protocol_1.default.FAIL: throw await this.parser.readError(); default: return this._parseVersion(reply); } } _parseVersion(version) { return parseInt(version, 16); } } exports.default = HostVersionCommand; //# sourceMappingURL=HostVersionCommand.js.map