Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6DE3217D1E for ; Wed, 1 Apr 2015 14:23:05 +0000 (UTC) Received: (qmail 87009 invoked by uid 500); 1 Apr 2015 14:22:29 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 86962 invoked by uid 500); 1 Apr 2015 14:22:29 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 85302 invoked by uid 99); 1 Apr 2015 14:22:28 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 01 Apr 2015 14:22:28 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 6A451E2F32; Wed, 1 Apr 2015 14:22:28 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: zalun@apache.org To: commits@cordova.apache.org Date: Wed, 01 Apr 2015 14:22:57 -0000 Message-Id: <0b57f0d24da248fbae6bbed0e4c78554@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [30/52] [abbrv] [partial] cordova-firefoxos git commit: CB-4548 Install new node-firefox-* dependencies in node_modules http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/client.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/client.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/client.js new file mode 100644 index 0000000..abfc40e --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/client.js @@ -0,0 +1,552 @@ +(function() { + var ClearCommand, Client, Connection, ForwardCommand, FrameBufferCommand, GetDevicePathCommand, GetFeaturesCommand, GetPackagesCommand, GetPropertiesCommand, GetSerialNoCommand, GetStateCommand, HostConnectCommand, HostDevicesCommand, HostDevicesWithPathsCommand, HostDisconnectCommand, HostKillCommand, HostTrackDevicesCommand, HostTransportCommand, HostVersionCommand, InstallCommand, IsInstalledCommand, ListForwardsCommand, LocalCommand, LogCommand, Logcat, LogcatCommand, Monkey, MonkeyCommand, Parser, ProcStat, Promise, RebootCommand, RemountCommand, ScreencapCommand, ShellCommand, StartActivityCommand, StartServiceCommand, Sync, SyncCommand, TcpCommand, TcpIpCommand, TcpUsbServer, TrackJdwpCommand, UninstallCommand, UsbCommand, WaitBootCompleteCommand, WaitForDeviceCommand, debug; + + Monkey = require('adbkit-monkey'); + + Logcat = require('adbkit-logcat'); + + Promise = require('bluebird'); + + debug = require('debug')('adb:client'); + + Connection = require('./connection'); + + Sync = require('./sync'); + + Parser = require('./parser'); + + ProcStat = require('./proc/stat'); + + HostVersionCommand = require('./command/host/version'); + + HostConnectCommand = require('./command/host/connect'); + + HostDevicesCommand = require('./command/host/devices'); + + HostDevicesWithPathsCommand = require('./command/host/deviceswithpaths'); + + HostDisconnectCommand = require('./command/host/disconnect'); + + HostTrackDevicesCommand = require('./command/host/trackdevices'); + + HostKillCommand = require('./command/host/kill'); + + HostTransportCommand = require('./command/host/transport'); + + ClearCommand = require('./command/host-transport/clear'); + + FrameBufferCommand = require('./command/host-transport/framebuffer'); + + GetFeaturesCommand = require('./command/host-transport/getfeatures'); + + GetPackagesCommand = require('./command/host-transport/getpackages'); + + GetPropertiesCommand = require('./command/host-transport/getproperties'); + + InstallCommand = require('./command/host-transport/install'); + + IsInstalledCommand = require('./command/host-transport/isinstalled'); + + LocalCommand = require('./command/host-transport/local'); + + LogcatCommand = require('./command/host-transport/logcat'); + + LogCommand = require('./command/host-transport/log'); + + MonkeyCommand = require('./command/host-transport/monkey'); + + RebootCommand = require('./command/host-transport/reboot'); + + RemountCommand = require('./command/host-transport/remount'); + + ScreencapCommand = require('./command/host-transport/screencap'); + + ShellCommand = require('./command/host-transport/shell'); + + StartActivityCommand = require('./command/host-transport/startactivity'); + + StartServiceCommand = require('./command/host-transport/startservice'); + + SyncCommand = require('./command/host-transport/sync'); + + TcpCommand = require('./command/host-transport/tcp'); + + TcpIpCommand = require('./command/host-transport/tcpip'); + + TrackJdwpCommand = require('./command/host-transport/trackjdwp'); + + UninstallCommand = require('./command/host-transport/uninstall'); + + UsbCommand = require('./command/host-transport/usb'); + + WaitBootCompleteCommand = require('./command/host-transport/waitbootcomplete'); + + ForwardCommand = require('./command/host-serial/forward'); + + GetDevicePathCommand = require('./command/host-serial/getdevicepath'); + + GetSerialNoCommand = require('./command/host-serial/getserialno'); + + GetStateCommand = require('./command/host-serial/getstate'); + + ListForwardsCommand = require('./command/host-serial/listforwards'); + + WaitForDeviceCommand = require('./command/host-serial/waitfordevice'); + + TcpUsbServer = require('./tcpusb/server'); + + Client = (function() { + var NoUserOptionError; + + function Client(options) { + var _base, _base1; + this.options = options != null ? options : {}; + (_base = this.options).port || (_base.port = 5037); + (_base1 = this.options).bin || (_base1.bin = 'adb'); + } + + Client.prototype.createTcpUsbBridge = function(serial, options) { + return new TcpUsbServer(this, serial, options); + }; + + Client.prototype.connection = function() { + var conn, connectListener, errorListener, resolver; + resolver = Promise.defer(); + conn = new Connection(this.options).on('error', errorListener = function(err) { + return resolver.reject(err); + }).on('connect', connectListener = function() { + return resolver.resolve(conn); + }).connect(); + return resolver.promise["finally"](function() { + conn.removeListener('error', errorListener); + return conn.removeListener('connect', connectListener); + }); + }; + + Client.prototype.version = function(callback) { + return this.connection().then(function(conn) { + return new HostVersionCommand(conn).execute(); + }).nodeify(callback); + }; + + Client.prototype.connect = function(host, port, callback) { + var _ref; + if (port == null) { + port = 5555; + } + if (typeof port === 'function') { + callback = port; + port = 5555; + } + if (host.indexOf(':') !== -1) { + _ref = host.split(':', 2), host = _ref[0], port = _ref[1]; + } + return this.connection().then(function(conn) { + return new HostConnectCommand(conn).execute(host, port); + }).nodeify(callback); + }; + + Client.prototype.disconnect = function(host, port, callback) { + var _ref; + if (port == null) { + port = 5555; + } + if (typeof port === 'function') { + callback = port; + port = 5555; + } + if (host.indexOf(':') !== -1) { + _ref = host.split(':', 2), host = _ref[0], port = _ref[1]; + } + return this.connection().then(function(conn) { + return new HostDisconnectCommand(conn).execute(host, port); + }).nodeify(callback); + }; + + Client.prototype.listDevices = function(callback) { + return this.connection().then(function(conn) { + return new HostDevicesCommand(conn).execute(); + }).nodeify(callback); + }; + + Client.prototype.listDevicesWithPaths = function(callback) { + return this.connection().then(function(conn) { + return new HostDevicesWithPathsCommand(conn).execute(); + }).nodeify(callback); + }; + + Client.prototype.trackDevices = function(callback) { + return this.connection().then(function(conn) { + return new HostTrackDevicesCommand(conn).execute(); + }).nodeify(callback); + }; + + Client.prototype.kill = function(callback) { + return this.connection().then(function(conn) { + return new HostKillCommand(conn).execute(); + }).nodeify(callback); + }; + + Client.prototype.getSerialNo = function(serial, callback) { + return this.connection().then(function(conn) { + return new GetSerialNoCommand(conn).execute(serial); + }).nodeify(callback); + }; + + Client.prototype.getDevicePath = function(serial, callback) { + return this.connection().then(function(conn) { + return new GetDevicePathCommand(conn).execute(serial); + }).nodeify(callback); + }; + + Client.prototype.getState = function(serial, callback) { + return this.connection().then(function(conn) { + return new GetStateCommand(conn).execute(serial); + }).nodeify(callback); + }; + + Client.prototype.getProperties = function(serial, callback) { + return this.transport(serial).then(function(transport) { + return new GetPropertiesCommand(transport).execute(); + }).nodeify(callback); + }; + + Client.prototype.getFeatures = function(serial, callback) { + return this.transport(serial).then(function(transport) { + return new GetFeaturesCommand(transport).execute(); + }).nodeify(callback); + }; + + Client.prototype.getPackages = function(serial, callback) { + return this.transport(serial).then(function(transport) { + return new GetPackagesCommand(transport).execute(); + }).nodeify(callback); + }; + + Client.prototype.getDHCPIpAddress = function(serial, iface, callback) { + if (iface == null) { + iface = 'wlan0'; + } + if (typeof iface === 'function') { + callback = iface; + iface = 'wlan0'; + } + return this.getProperties(serial).then(function(properties) { + var ip; + if (ip = properties["dhcp." + iface + ".ipaddress"]) { + return ip; + } + throw new Error("Unable to find ipaddress for '" + iface + "'"); + }); + }; + + Client.prototype.forward = function(serial, local, remote, callback) { + return this.connection().then(function(conn) { + return new ForwardCommand(conn).execute(serial, local, remote); + }).nodeify(callback); + }; + + Client.prototype.listForwards = function(serial, callback) { + return this.connection().then(function(conn) { + return new ListForwardsCommand(conn).execute(serial); + }).nodeify(callback); + }; + + Client.prototype.transport = function(serial, callback) { + return this.connection().then(function(conn) { + return new HostTransportCommand(conn).execute(serial)["return"](conn); + }).nodeify(callback); + }; + + Client.prototype.shell = function(serial, command, callback) { + return this.transport(serial).then(function(transport) { + return new ShellCommand(transport).execute(command); + }).nodeify(callback); + }; + + Client.prototype.reboot = function(serial, callback) { + return this.transport(serial).then(function(transport) { + return new RebootCommand(transport).execute(); + }).nodeify(callback); + }; + + Client.prototype.remount = function(serial, callback) { + return this.transport(serial).then(function(transport) { + return new RemountCommand(transport).execute(); + }).nodeify(callback); + }; + + Client.prototype.trackJdwp = function(serial, callback) { + return this.transport(serial).then(function(transport) { + return new TrackJdwpCommand(transport).execute(); + }).nodeify(callback); + }; + + Client.prototype.framebuffer = function(serial, format, callback) { + if (format == null) { + format = 'raw'; + } + if (typeof format === 'function') { + callback = format; + format = 'raw'; + } + return this.transport(serial).then(function(transport) { + return new FrameBufferCommand(transport).execute(format); + }).nodeify(callback); + }; + + Client.prototype.screencap = function(serial, callback) { + return this.transport(serial).then((function(_this) { + return function(transport) { + return new ScreencapCommand(transport).execute()["catch"](function(err) { + debug("Emulating screencap command due to '" + err + "'"); + return _this.framebuffer(serial, 'png'); + }); + }; + })(this)).nodeify(callback); + }; + + Client.prototype.openLocal = function(serial, path, callback) { + return this.transport(serial).then(function(transport) { + return new LocalCommand(transport).execute(path); + }).nodeify(callback); + }; + + Client.prototype.openLog = function(serial, name, callback) { + return this.transport(serial).then(function(transport) { + return new LogCommand(transport).execute(name); + }).nodeify(callback); + }; + + Client.prototype.openTcp = function(serial, port, host, callback) { + if (typeof host === 'function') { + callback = host; + host = void 0; + } + return this.transport(serial).then(function(transport) { + return new TcpCommand(transport).execute(port, host); + }).nodeify(callback); + }; + + Client.prototype.openMonkey = function(serial, port, callback) { + var tryConnect; + if (port == null) { + port = 1080; + } + if (typeof port === 'function') { + callback = port; + port = 1080; + } + tryConnect = (function(_this) { + return function(times) { + return _this.openTcp(serial, port).then(function(stream) { + return Monkey.connectStream(stream); + })["catch"](function(err) { + if (times -= 1) { + debug("Monkey can't be reached, trying " + times + " more times"); + return Promise.delay(100).then(function() { + return tryConnect(times); + }); + } else { + throw err; + } + }); + }; + })(this); + return tryConnect(1)["catch"]((function(_this) { + return function(err) { + return _this.transport(serial).then(function(transport) { + return new MonkeyCommand(transport).execute(port); + }).then(function(out) { + return tryConnect(20).then(function(monkey) { + return monkey.once('end', function() { + return out.end(); + }); + }); + }); + }; + })(this)).nodeify(callback); + }; + + Client.prototype.openLogcat = function(serial, options, callback) { + if (typeof options === 'function') { + callback = options; + options = {}; + } + return this.transport(serial).then(function(transport) { + return new LogcatCommand(transport).execute(options); + }).then(function(stream) { + return Logcat.readStream(stream, { + fixLineFeeds: false + }); + }).nodeify(callback); + }; + + Client.prototype.openProcStat = function(serial, callback) { + return this.syncService(serial).then(function(sync) { + return new ProcStat(sync); + }).nodeify(callback); + }; + + Client.prototype.clear = function(serial, pkg, callback) { + return this.transport(serial).then(function(transport) { + return new ClearCommand(transport).execute(pkg); + }).nodeify(callback); + }; + + Client.prototype.install = function(serial, apk, callback) { + var temp; + temp = Sync.temp(typeof apk === 'string' ? apk : '_stream.apk'); + return this.push(serial, apk, temp).then((function(_this) { + return function(transfer) { + var endListener, errorListener, resolver; + resolver = Promise.defer(); + transfer.on('error', errorListener = function(err) { + return resolver.reject(err); + }); + transfer.on('end', endListener = function() { + return resolver.resolve(_this.installRemote(serial, temp)); + }); + return resolver.promise["finally"](function() { + transfer.removeListener('error', errorListener); + return transfer.removeListener('end', endListener); + }); + }; + })(this)).nodeify(callback); + }; + + Client.prototype.installRemote = function(serial, apk, callback) { + return this.transport(serial).then((function(_this) { + return function(transport) { + return new InstallCommand(transport).execute(apk).then(function() { + return _this.shell(serial, ['rm', '-f', apk]); + }).then(function(stream) { + return new Parser(stream).readAll(); + }).then(function(out) { + return true; + }); + }; + })(this)).nodeify(callback); + }; + + Client.prototype.uninstall = function(serial, pkg, callback) { + return this.transport(serial).then(function(transport) { + return new UninstallCommand(transport).execute(pkg); + }).nodeify(callback); + }; + + Client.prototype.isInstalled = function(serial, pkg, callback) { + return this.transport(serial).then(function(transport) { + return new IsInstalledCommand(transport).execute(pkg); + }).nodeify(callback); + }; + + Client.prototype.startActivity = function(serial, options, callback) { + return this.transport(serial).then(function(transport) { + return new StartActivityCommand(transport).execute(options); + })["catch"](NoUserOptionError, (function(_this) { + return function() { + options.user = null; + return _this.startActivity(serial, options); + }; + })(this)).nodeify(callback); + }; + + Client.prototype.startService = function(serial, options, callback) { + return this.transport(serial).then(function(transport) { + if (!(options.user || options.user === null)) { + options.user = 0; + } + return new StartServiceCommand(transport).execute(options); + })["catch"](NoUserOptionError, (function(_this) { + return function() { + options.user = null; + return _this.startService(serial, options); + }; + })(this)).nodeify(callback); + }; + + Client.prototype.syncService = function(serial, callback) { + return this.transport(serial).then(function(transport) { + return new SyncCommand(transport).execute(); + }).nodeify(callback); + }; + + Client.prototype.stat = function(serial, path, callback) { + return this.syncService(serial).then(function(sync) { + return sync.stat(path)["finally"](function() { + return sync.end(); + }); + }).nodeify(callback); + }; + + Client.prototype.readdir = function(serial, path, callback) { + return this.syncService(serial).then(function(sync) { + return sync.readdir(path)["finally"](function() { + return sync.end(); + }); + }).nodeify(callback); + }; + + Client.prototype.pull = function(serial, path, callback) { + return this.syncService(serial).then(function(sync) { + return sync.pull(path).on('end', function() { + return sync.end(); + }); + }).nodeify(callback); + }; + + Client.prototype.push = function(serial, contents, path, mode, callback) { + if (typeof mode === 'function') { + callback = mode; + mode = void 0; + } + return this.syncService(serial).then(function(sync) { + return sync.push(contents, path, mode).on('end', function() { + return sync.end(); + }); + }).nodeify(callback); + }; + + Client.prototype.tcpip = function(serial, port, callback) { + if (port == null) { + port = 5555; + } + if (typeof port === 'function') { + callback = port; + port = 5555; + } + return this.transport(serial).then(function(transport) { + return new TcpIpCommand(transport).execute(port); + }).nodeify(callback); + }; + + Client.prototype.usb = function(serial, callback) { + return this.transport(serial).then(function(transport) { + return new UsbCommand(transport).execute(); + }).nodeify(callback); + }; + + Client.prototype.waitBootComplete = function(serial, callback) { + return this.transport(serial).then(function(transport) { + return new WaitBootCompleteCommand(transport).execute(); + }).nodeify(callback); + }; + + Client.prototype.waitForDevice = function(serial, callback) { + return this.connection().then(function(conn) { + return new WaitForDeviceCommand(conn).execute(serial); + }).nodeify(callback); + }; + + NoUserOptionError = function(err) { + return err.message.indexOf('--user') !== -1; + }; + + return Client; + + })(); + + module.exports = Client; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command.js new file mode 100644 index 0000000..a01f7d3 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command.js @@ -0,0 +1,48 @@ +(function() { + var Command, Parser, Protocol, debug; + + debug = require('debug')('adb:command'); + + Parser = require('./parser'); + + Protocol = require('./protocol'); + + Command = (function() { + var RE_SQUOT; + + RE_SQUOT = /'/g; + + function Command(connection) { + this.connection = connection; + this.parser = this.connection.parser; + this.protocol = Protocol; + } + + Command.prototype.execute = function() { + throw new Exception('Missing implementation'); + }; + + Command.prototype._send = function(data) { + var encoded; + encoded = Protocol.encodeData(data); + debug("Send '" + encoded + "'"); + this.connection.write(encoded); + return this; + }; + + Command.prototype._escape = function(arg) { + switch (typeof arg) { + case 'number': + return arg; + default: + return "'" + arg.toString().replace(RE_SQUOT, "'\"'\"'") + "'"; + } + }; + + return Command; + + })(); + + module.exports = Command; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/forward.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/forward.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/forward.js new file mode 100644 index 0000000..597d37f --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/forward.js @@ -0,0 +1,48 @@ +(function() { + var Command, ForwardCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + ForwardCommand = (function(_super) { + __extends(ForwardCommand, _super); + + function ForwardCommand() { + return ForwardCommand.__super__.constructor.apply(this, arguments); + } + + ForwardCommand.prototype.execute = function(serial, local, remote) { + this._send("host-serial:" + serial + ":forward:" + local + ";" + remote); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readAscii(4).then(function(reply) { + switch (reply) { + case Protocol.OKAY: + return true; + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return ForwardCommand; + + })(Command); + + module.exports = ForwardCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getdevicepath.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getdevicepath.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getdevicepath.js new file mode 100644 index 0000000..b171cae --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getdevicepath.js @@ -0,0 +1,41 @@ +(function() { + var Command, GetDevicePathCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + GetDevicePathCommand = (function(_super) { + __extends(GetDevicePathCommand, _super); + + function GetDevicePathCommand() { + return GetDevicePathCommand.__super__.constructor.apply(this, arguments); + } + + GetDevicePathCommand.prototype.execute = function(serial) { + this._send("host-serial:" + serial + ":get-devpath"); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readValue().then(function(value) { + return value.toString(); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return GetDevicePathCommand; + + })(Command); + + module.exports = GetDevicePathCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getserialno.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getserialno.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getserialno.js new file mode 100644 index 0000000..28f858e --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getserialno.js @@ -0,0 +1,41 @@ +(function() { + var Command, GetSerialNoCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + GetSerialNoCommand = (function(_super) { + __extends(GetSerialNoCommand, _super); + + function GetSerialNoCommand() { + return GetSerialNoCommand.__super__.constructor.apply(this, arguments); + } + + GetSerialNoCommand.prototype.execute = function(serial) { + this._send("host-serial:" + serial + ":get-serialno"); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readValue().then(function(value) { + return value.toString(); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return GetSerialNoCommand; + + })(Command); + + module.exports = GetSerialNoCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getstate.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getstate.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getstate.js new file mode 100644 index 0000000..fa6378f --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/getstate.js @@ -0,0 +1,41 @@ +(function() { + var Command, GetStateCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + GetStateCommand = (function(_super) { + __extends(GetStateCommand, _super); + + function GetStateCommand() { + return GetStateCommand.__super__.constructor.apply(this, arguments); + } + + GetStateCommand.prototype.execute = function(serial) { + this._send("host-serial:" + serial + ":get-state"); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readValue().then(function(value) { + return value.toString(); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return GetStateCommand; + + })(Command); + + module.exports = GetStateCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/listforwards.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/listforwards.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/listforwards.js new file mode 100644 index 0000000..e426d9d --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/listforwards.js @@ -0,0 +1,59 @@ +(function() { + var Command, ListForwardsCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + ListForwardsCommand = (function(_super) { + __extends(ListForwardsCommand, _super); + + function ListForwardsCommand() { + return ListForwardsCommand.__super__.constructor.apply(this, arguments); + } + + ListForwardsCommand.prototype.execute = function(serial) { + this._send("host-serial:" + serial + ":list-forward"); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readValue().then(function(value) { + return _this._parseForwards(value); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + ListForwardsCommand.prototype._parseForwards = function(value) { + var forward, forwards, local, remote, serial, _i, _len, _ref, _ref1; + forwards = []; + _ref = value.toString().split('\n'); + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + forward = _ref[_i]; + if (forward) { + _ref1 = forward.split(/\s+/), serial = _ref1[0], local = _ref1[1], remote = _ref1[2]; + forwards.push({ + serial: serial, + local: local, + remote: remote + }); + } + } + return forwards; + }; + + return ListForwardsCommand; + + })(Command); + + module.exports = ListForwardsCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/waitfordevice.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/waitfordevice.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/waitfordevice.js new file mode 100644 index 0000000..efa1a0b --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-serial/waitfordevice.js @@ -0,0 +1,48 @@ +(function() { + var Command, Protocol, WaitForDeviceCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + WaitForDeviceCommand = (function(_super) { + __extends(WaitForDeviceCommand, _super); + + function WaitForDeviceCommand() { + return WaitForDeviceCommand.__super__.constructor.apply(this, arguments); + } + + WaitForDeviceCommand.prototype.execute = function(serial) { + this._send("host-serial:" + serial + ":wait-for-any"); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readAscii(4).then(function(reply) { + switch (reply) { + case Protocol.OKAY: + return serial; + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return WaitForDeviceCommand; + + })(Command); + + module.exports = WaitForDeviceCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/clear.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/clear.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/clear.js new file mode 100644 index 0000000..7a8acb0 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/clear.js @@ -0,0 +1,47 @@ +(function() { + var ClearCommand, Command, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + ClearCommand = (function(_super) { + __extends(ClearCommand, _super); + + function ClearCommand() { + return ClearCommand.__super__.constructor.apply(this, arguments); + } + + ClearCommand.prototype.execute = function(pkg) { + this._send("shell:pm clear " + pkg); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.searchLine(/^(Success|Failed)$/).then(function(result) { + switch (result[0]) { + case 'Success': + return true; + case 'Failed': + _this.connection.end(); + throw new Error("Package '" + pkg + "' could not be cleared"); + } + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return ClearCommand; + + })(Command); + + module.exports = ClearCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/framebuffer.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/framebuffer.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/framebuffer.js new file mode 100644 index 0000000..5689f3c --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/framebuffer.js @@ -0,0 +1,117 @@ +(function() { + var Assert, Command, FrameBufferCommand, Protocol, RgbTransform, debug, spawn, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Assert = require('assert'); + + spawn = require('child_process').spawn; + + debug = require('debug')('adb:command:framebuffer'); + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + RgbTransform = require('../../framebuffer/rgbtransform'); + + FrameBufferCommand = (function(_super) { + __extends(FrameBufferCommand, _super); + + function FrameBufferCommand() { + return FrameBufferCommand.__super__.constructor.apply(this, arguments); + } + + FrameBufferCommand.prototype.execute = function(format) { + this._send('framebuffer:'); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readBytes(52).then(function(header) { + var meta, stream; + meta = _this._parseHeader(header); + switch (format) { + case 'raw': + stream = _this.parser.raw(); + stream.meta = meta; + return stream; + default: + stream = _this._convert(meta); + stream.meta = meta; + return stream; + } + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + FrameBufferCommand.prototype._convert = function(meta, format, raw) { + var proc, transform; + debug("Converting raw framebuffer stream into " + (format.toUpperCase())); + switch (meta.format) { + case 'rgb': + case 'rgba': + break; + default: + debug("Silently transforming '" + meta.format + "' into 'rgb' for `gm`"); + transform = new RgbTransform(meta); + meta.format = 'rgb'; + raw = this.parser.raw().pipe(transform); + } + proc = spawn('gm', ['convert', '-size', "" + meta.width + "x" + meta.height, "" + meta.format + ":-", "" + format + ":-"]); + raw.pipe(proc.stdin); + return proc.stdout; + }; + + FrameBufferCommand.prototype._parseHeader = function(header) { + var meta, offset; + meta = {}; + offset = 0; + meta.version = header.readUInt32LE(offset); + if (meta.version === 16) { + throw new Error('Old-style raw images are not supported'); + } + offset += 4; + meta.bpp = header.readUInt32LE(offset); + offset += 4; + meta.size = header.readUInt32LE(offset); + offset += 4; + meta.width = header.readUInt32LE(offset); + offset += 4; + meta.height = header.readUInt32LE(offset); + offset += 4; + meta.red_offset = header.readUInt32LE(offset); + offset += 4; + meta.red_length = header.readUInt32LE(offset); + offset += 4; + meta.blue_offset = header.readUInt32LE(offset); + offset += 4; + meta.blue_length = header.readUInt32LE(offset); + offset += 4; + meta.green_offset = header.readUInt32LE(offset); + offset += 4; + meta.green_length = header.readUInt32LE(offset); + offset += 4; + meta.alpha_offset = header.readUInt32LE(offset); + offset += 4; + meta.alpha_length = header.readUInt32LE(offset); + meta.format = meta.blue_offset === 0 ? 'bgr' : 'rgb'; + if (meta.bpp === 32 || meta.alpha_length) { + meta.format += 'a'; + } + return meta; + }; + + return FrameBufferCommand; + + })(Command); + + module.exports = FrameBufferCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getfeatures.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getfeatures.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getfeatures.js new file mode 100644 index 0000000..be6083d --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getfeatures.js @@ -0,0 +1,54 @@ +(function() { + var Command, GetFeaturesCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + GetFeaturesCommand = (function(_super) { + var RE_FEATURE; + + __extends(GetFeaturesCommand, _super); + + function GetFeaturesCommand() { + return GetFeaturesCommand.__super__.constructor.apply(this, arguments); + } + + RE_FEATURE = /^feature:(.*?)(?:=(.*?))?\r?$/gm; + + GetFeaturesCommand.prototype.execute = function() { + this._send('shell:pm list features 2>/dev/null'); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readAll().then(function(data) { + return _this._parseFeatures(data.toString()); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + GetFeaturesCommand.prototype._parseFeatures = function(value) { + var features, match; + features = {}; + while (match = RE_FEATURE.exec(value)) { + features[match[1]] = match[2] || true; + } + return features; + }; + + return GetFeaturesCommand; + + })(Command); + + module.exports = GetFeaturesCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getpackages.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getpackages.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getpackages.js new file mode 100644 index 0000000..6e98fdf --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getpackages.js @@ -0,0 +1,54 @@ +(function() { + var Command, GetPackagesCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + GetPackagesCommand = (function(_super) { + var RE_PACKAGE; + + __extends(GetPackagesCommand, _super); + + function GetPackagesCommand() { + return GetPackagesCommand.__super__.constructor.apply(this, arguments); + } + + RE_PACKAGE = /^package:(.*?)\r?$/gm; + + GetPackagesCommand.prototype.execute = function() { + this._send('shell:pm list packages 2>/dev/null'); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readAll().then(function(data) { + return _this._parsePackages(data.toString()); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + GetPackagesCommand.prototype._parsePackages = function(value) { + var features, match; + features = []; + while (match = RE_PACKAGE.exec(value)) { + features.push(match[1]); + } + return features; + }; + + return GetPackagesCommand; + + })(Command); + + module.exports = GetPackagesCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getproperties.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getproperties.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getproperties.js new file mode 100644 index 0000000..1c3756b --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/getproperties.js @@ -0,0 +1,56 @@ +(function() { + var Command, GetPropertiesCommand, LineTransform, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + LineTransform = require('../../linetransform'); + + GetPropertiesCommand = (function(_super) { + var RE_KEYVAL; + + __extends(GetPropertiesCommand, _super); + + function GetPropertiesCommand() { + return GetPropertiesCommand.__super__.constructor.apply(this, arguments); + } + + RE_KEYVAL = /^\[([\s\S]*?)\]: \[([\s\S]*?)\]\r?$/gm; + + GetPropertiesCommand.prototype.execute = function() { + this._send('shell:getprop'); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readAll().then(function(data) { + return _this._parseProperties(data.toString()); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + GetPropertiesCommand.prototype._parseProperties = function(value) { + var match, properties; + properties = {}; + while (match = RE_KEYVAL.exec(value)) { + properties[match[1]] = match[2]; + } + return properties; + }; + + return GetPropertiesCommand; + + })(Command); + + module.exports = GetPropertiesCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/install.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/install.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/install.js new file mode 100644 index 0000000..634dbab --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/install.js @@ -0,0 +1,51 @@ +(function() { + var Command, InstallCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + InstallCommand = (function(_super) { + __extends(InstallCommand, _super); + + function InstallCommand() { + return InstallCommand.__super__.constructor.apply(this, arguments); + } + + InstallCommand.prototype.execute = function(apk) { + this._send("shell:pm install -r '" + apk + "'"); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.searchLine(/^(Success|Failure \[(.*?)\])$/).then(function(match) { + var code, err; + if (match[1] === 'Success') { + return true; + } else { + code = match[2]; + err = new Error("" + apk + " could not be installed [" + code + "]"); + err.code = code; + throw err; + } + })["finally"](function() { + return _this.parser.readAll(); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return InstallCommand; + + })(Command); + + module.exports = InstallCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/isinstalled.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/isinstalled.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/isinstalled.js new file mode 100644 index 0000000..463c0f9 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/isinstalled.js @@ -0,0 +1,50 @@ +(function() { + var Command, IsInstalledCommand, Parser, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + Parser = require('../../parser'); + + IsInstalledCommand = (function(_super) { + __extends(IsInstalledCommand, _super); + + function IsInstalledCommand() { + return IsInstalledCommand.__super__.constructor.apply(this, arguments); + } + + IsInstalledCommand.prototype.execute = function(pkg) { + this._send("shell:pm path " + pkg + " 2>/dev/null"); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readAscii(8).then(function(reply) { + switch (reply) { + case 'package:': + return true; + default: + return _this.parser.unexpected(reply, "'package:'"); + } + })["catch"](Parser.PrematureEOFError, function(err) { + return false; + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return IsInstalledCommand; + + })(Command); + + module.exports = IsInstalledCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/local.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/local.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/local.js new file mode 100644 index 0000000..fc764a1 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/local.js @@ -0,0 +1,39 @@ +(function() { + var Command, LocalCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + LocalCommand = (function(_super) { + __extends(LocalCommand, _super); + + function LocalCommand() { + return LocalCommand.__super__.constructor.apply(this, arguments); + } + + LocalCommand.prototype.execute = function(path) { + this._send(/:/.test(path) ? path : "localfilesystem:" + path); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.raw(); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return LocalCommand; + + })(Command); + + module.exports = LocalCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/log.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/log.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/log.js new file mode 100644 index 0000000..1e8ddc9 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/log.js @@ -0,0 +1,39 @@ +(function() { + var Command, LogCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + LogCommand = (function(_super) { + __extends(LogCommand, _super); + + function LogCommand() { + return LogCommand.__super__.constructor.apply(this, arguments); + } + + LogCommand.prototype.execute = function(name) { + this._send("log:" + name); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.raw(); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return LogCommand; + + })(Command); + + module.exports = LogCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/logcat.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/logcat.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/logcat.js new file mode 100644 index 0000000..778ec34 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/logcat.js @@ -0,0 +1,49 @@ +(function() { + var Command, LineTransform, LogcatCommand, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + LineTransform = require('../../linetransform'); + + LogcatCommand = (function(_super) { + __extends(LogcatCommand, _super); + + function LogcatCommand() { + return LogcatCommand.__super__.constructor.apply(this, arguments); + } + + LogcatCommand.prototype.execute = function(options) { + var cmd; + if (options == null) { + options = {}; + } + cmd = 'logcat -B *:I 2>/dev/null'; + if (options.clear) { + cmd = "logcat -c 2>/dev/null && " + cmd; + } + this._send("shell:" + cmd); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.raw().pipe(new LineTransform); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return LogcatCommand; + + })(Command); + + module.exports = LogcatCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/monkey.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/monkey.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/monkey.js new file mode 100644 index 0000000..d913e9e --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/monkey.js @@ -0,0 +1,45 @@ +(function() { + var Command, MonkeyCommand, Promise, Protocol, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Promise = require('bluebird'); + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + MonkeyCommand = (function(_super) { + __extends(MonkeyCommand, _super); + + function MonkeyCommand() { + return MonkeyCommand.__super__.constructor.apply(this, arguments); + } + + MonkeyCommand.prototype.execute = function(port) { + this._send("shell:EXTERNAL_STORAGE=/data/local/tmp monkey --port " + port + " -v"); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.searchLine(/^:Monkey:/).timeout(1000).then(function() { + return _this.parser.raw(); + })["catch"](Promise.TimeoutError, function(err) { + return _this.parser.raw(); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return MonkeyCommand; + + })(Command); + + module.exports = MonkeyCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/reboot.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/reboot.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/reboot.js new file mode 100644 index 0000000..57a8b51 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/reboot.js @@ -0,0 +1,39 @@ +(function() { + var Command, Protocol, RebootCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + RebootCommand = (function(_super) { + __extends(RebootCommand, _super); + + function RebootCommand() { + return RebootCommand.__super__.constructor.apply(this, arguments); + } + + RebootCommand.prototype.execute = function() { + this._send('reboot:'); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readAll()["return"](true); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return RebootCommand; + + })(Command); + + module.exports = RebootCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/remount.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/remount.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/remount.js new file mode 100644 index 0000000..173f45d --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/remount.js @@ -0,0 +1,39 @@ +(function() { + var Command, Protocol, RemountCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + RemountCommand = (function(_super) { + __extends(RemountCommand, _super); + + function RemountCommand() { + return RemountCommand.__super__.constructor.apply(this, arguments); + } + + RemountCommand.prototype.execute = function() { + this._send('remount:'); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return true; + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return RemountCommand; + + })(Command); + + module.exports = RemountCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/screencap.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/screencap.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/screencap.js new file mode 100644 index 0000000..30098c2 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/screencap.js @@ -0,0 +1,57 @@ +(function() { + var Command, LineTransform, Parser, Promise, Protocol, ScreencapCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Promise = require('bluebird'); + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + Parser = require('../../parser'); + + LineTransform = require('../../linetransform'); + + ScreencapCommand = (function(_super) { + __extends(ScreencapCommand, _super); + + function ScreencapCommand() { + return ScreencapCommand.__super__.constructor.apply(this, arguments); + } + + ScreencapCommand.prototype.execute = function() { + this._send('shell:screencap -p 2>/dev/null'); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + var endListener, out, readableListener, resolver; + switch (reply) { + case Protocol.OKAY: + resolver = Promise.defer(); + out = _this.parser.raw().pipe(new LineTransform); + out.on('readable', readableListener = function() { + return resolver.resolve(out); + }); + out.on('end', endListener = function() { + return resolver.reject(new Error('Unable to run screencap command')); + }); + return resolver.promise["finally"](function() { + out.removeListener('end', endListener); + return out.removeListener('readable', readableListener); + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return ScreencapCommand; + + })(Command); + + module.exports = ScreencapCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/shell.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/shell.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/shell.js new file mode 100644 index 0000000..4ac2074 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/shell.js @@ -0,0 +1,42 @@ +(function() { + var Command, Protocol, ShellCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + ShellCommand = (function(_super) { + __extends(ShellCommand, _super); + + function ShellCommand() { + return ShellCommand.__super__.constructor.apply(this, arguments); + } + + ShellCommand.prototype.execute = function(command) { + if (Array.isArray(command)) { + command = command.map(this._escape).join(' '); + } + this._send("shell:" + command); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.raw(); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return ShellCommand; + + })(Command); + + module.exports = ShellCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/startactivity.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/startactivity.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/startactivity.js new file mode 100644 index 0000000..572abda --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/startactivity.js @@ -0,0 +1,187 @@ +(function() { + var Command, Parser, Protocol, StartActivityCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + Parser = require('../../parser'); + + StartActivityCommand = (function(_super) { + var EXTRA_TYPES, RE_ERROR; + + __extends(StartActivityCommand, _super); + + function StartActivityCommand() { + return StartActivityCommand.__super__.constructor.apply(this, arguments); + } + + RE_ERROR = /^Error: (.*)$/; + + EXTRA_TYPES = { + string: 's', + "null": 'sn', + bool: 'z', + int: 'i', + long: 'l', + float: 'l', + uri: 'u', + component: 'cn' + }; + + StartActivityCommand.prototype.execute = function(options) { + var args; + args = this._intentArgs(options); + if (options.debug) { + args.push('-D'); + } + if (options.wait) { + args.push('-W'); + } + if (options.user || options.user === 0) { + args.push('--user', this._escape(options.user)); + } + return this._run('start', args); + }; + + StartActivityCommand.prototype._run = function(command, args) { + this._send("shell:am " + command + " " + (args.join(' '))); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.searchLine(RE_ERROR)["finally"](function() { + return _this.connection.end(); + }).then(function(match) { + throw new Error(match[1]); + })["catch"](Parser.PrematureEOFError, function(err) { + return true; + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + StartActivityCommand.prototype._intentArgs = function(options) { + var args; + args = []; + if (options.extras) { + args.push.apply(args, this._formatExtras(options.extras)); + } + if (options.action) { + args.push('-a', this._escape(options.action)); + } + if (options.data) { + args.push('-d', this._escape(options.data)); + } + if (options.mimeType) { + args.push('-t', this._escape(options.mimeType)); + } + if (options.category) { + if (Array.isArray(options.category)) { + options.category.forEach((function(_this) { + return function(category) { + return args.push('-c', _this._escape(category)); + }; + })(this)); + } else { + args.push('-c', this._escape(options.category)); + } + } + if (options.component) { + args.push('-n', this._escape(options.component)); + } + if (options.flags) { + args.push('-f', this._escape(options.flags)); + } + return args; + }; + + StartActivityCommand.prototype._formatExtras = function(extras) { + if (!extras) { + return []; + } + if (Array.isArray(extras)) { + return extras.reduce((function(_this) { + return function(all, extra) { + return all.concat(_this._formatLongExtra(extra)); + }; + })(this), []); + } else { + return Object.keys(extras).reduce((function(_this) { + return function(all, key) { + return all.concat(_this._formatShortExtra(key, extras[key])); + }; + })(this), []); + } + }; + + StartActivityCommand.prototype._formatShortExtra = function(key, value) { + var sugared; + sugared = { + key: key + }; + if (value === null) { + sugared.type = 'null'; + } else if (Array.isArray(value)) { + throw new Error("Refusing to format array value '" + key + "' using short syntax; empty array would cause unpredictable results due to unknown type. Please use long syntax instead."); + } else { + switch (typeof value) { + case 'string': + sugared.type = 'string'; + sugared.value = value; + break; + case 'boolean': + sugared.type = 'bool'; + sugared.value = value; + break; + case 'number': + sugared.type = 'int'; + sugared.value = value; + break; + case 'object': + sugared = value; + sugared.key = key; + } + } + return this._formatLongExtra(sugared); + }; + + StartActivityCommand.prototype._formatLongExtra = function(extra) { + var args, type; + args = []; + if (!extra.type) { + extra.type = 'string'; + } + type = EXTRA_TYPES[extra.type]; + if (!type) { + throw new Error("Unsupported type '" + extra.type + "' for extra '" + extra.key + "'"); + } + if (extra.type === 'null') { + args.push("--e" + type); + args.push(this._escape(extra.key)); + } else if (Array.isArray(extra.value)) { + args.push("--e" + type + "a"); + args.push(this._escape(extra.key)); + args.push(this._escape(extra.value.join(','))); + } else { + args.push("--e" + type); + args.push(this._escape(extra.key)); + args.push(this._escape(extra.value)); + } + return args; + }; + + return StartActivityCommand; + + })(Command); + + module.exports = StartActivityCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/startservice.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/startservice.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/startservice.js new file mode 100644 index 0000000..a119a36 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/startservice.js @@ -0,0 +1,36 @@ +(function() { + var Command, Parser, Protocol, StartActivityCommand, StartServiceCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + Parser = require('../../parser'); + + StartActivityCommand = require('./startactivity'); + + StartServiceCommand = (function(_super) { + __extends(StartServiceCommand, _super); + + function StartServiceCommand() { + return StartServiceCommand.__super__.constructor.apply(this, arguments); + } + + StartServiceCommand.prototype.execute = function(options) { + var args; + args = this._intentArgs(options); + if (options.user || options.user === 0) { + args.push('--user', this._escape(options.user)); + } + return this._run('startservice', args); + }; + + return StartServiceCommand; + + })(StartActivityCommand); + + module.exports = StartServiceCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/sync.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/sync.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/sync.js new file mode 100644 index 0000000..638cc6e --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/sync.js @@ -0,0 +1,41 @@ +(function() { + var Command, Protocol, Sync, SyncCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + Sync = require('../../sync'); + + SyncCommand = (function(_super) { + __extends(SyncCommand, _super); + + function SyncCommand() { + return SyncCommand.__super__.constructor.apply(this, arguments); + } + + SyncCommand.prototype.execute = function() { + this._send('sync:'); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return new Sync(_this.connection); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return SyncCommand; + + })(Command); + + module.exports = SyncCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/tcp.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/tcp.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/tcp.js new file mode 100644 index 0000000..05c7ec2 --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/tcp.js @@ -0,0 +1,39 @@ +(function() { + var Command, Protocol, TcpCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + TcpCommand = (function(_super) { + __extends(TcpCommand, _super); + + function TcpCommand() { + return TcpCommand.__super__.constructor.apply(this, arguments); + } + + TcpCommand.prototype.execute = function(port, host) { + this._send(("tcp:" + port) + (host ? ":" + host : '')); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.raw(); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return TcpCommand; + + })(Command); + + module.exports = TcpCommand; + +}).call(this); http://git-wip-us.apache.org/repos/asf/cordova-firefoxos/blob/b2b43200/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/tcpip.js ---------------------------------------------------------------------- diff --git a/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/tcpip.js b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/tcpip.js new file mode 100644 index 0000000..821b5fa --- /dev/null +++ b/node_modules/node-firefox-find-devices/node_modules/adbkit/lib/adb/command/host-transport/tcpip.js @@ -0,0 +1,51 @@ +(function() { + var Command, LineTransform, Protocol, TcpIpCommand, + __hasProp = {}.hasOwnProperty, + __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; + + Command = require('../../command'); + + Protocol = require('../../protocol'); + + LineTransform = require('../../linetransform'); + + TcpIpCommand = (function(_super) { + var RE_OK; + + __extends(TcpIpCommand, _super); + + function TcpIpCommand() { + return TcpIpCommand.__super__.constructor.apply(this, arguments); + } + + RE_OK = /restarting in/; + + TcpIpCommand.prototype.execute = function(port) { + this._send("tcpip:" + port); + return this.parser.readAscii(4).then((function(_this) { + return function(reply) { + switch (reply) { + case Protocol.OKAY: + return _this.parser.readAll().then(function(value) { + if (RE_OK.test(value)) { + return port; + } else { + throw new Error(value.toString().trim()); + } + }); + case Protocol.FAIL: + return _this.parser.readError(); + default: + return _this.parser.unexpected(reply, 'OKAY or FAIL'); + } + }; + })(this)); + }; + + return TcpIpCommand; + + })(Command); + + module.exports = TcpIpCommand; + +}).call(this); --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org For additional commands, e-mail: commits-help@cordova.apache.org