mirror of
https://github.com/gnh1201/welsonjs.git
synced 2025-02-11 17:34:58 +00:00
Update adb.js
This commit is contained in:
parent
83bc9a4b58
commit
fd18d9d150
26
lib/adb.js
26
lib/adb.js
|
@ -1,22 +1,22 @@
|
||||||
////////////////////////////////////////////////////////////////////////
|
|
||||||
// Android Debug Bridge API
|
// Android Debug Bridge API
|
||||||
///////////////////////////////////////////////////////////////////////
|
// Namhyeon Go (Catswords Research) <abuse@catswords.net>
|
||||||
|
// https://github.com/gnh1201/welsonjs
|
||||||
var SHELL = require("lib/shell");
|
var SHELL = require("lib/shell");
|
||||||
var SYS = require("lib/system");
|
var SYS = require("lib/system");
|
||||||
|
|
||||||
// A common Android devices
|
// A common Android devices
|
||||||
function ADBObject() {
|
function ADBObject() {
|
||||||
this.binPath = "bin\\platform-tools_r33.0.0-windows\\platform-tools\\adb.exe";
|
var _interface = SHELL.create();
|
||||||
|
|
||||||
this.setBinPath = function(binPath) {
|
this.setBinPath = function(binPath) {
|
||||||
this.binPath = binPath;
|
this.binPath = binPath;
|
||||||
|
_interface.setPrefix(this.binPath);
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.getDevices = function() {
|
this.getDevices = function() {
|
||||||
var devices = [];
|
var devices = [];
|
||||||
var result = SHELL.exec([this.binPath, "devices"]);
|
var result = _interface.exec(["devices"]);
|
||||||
|
|
||||||
splitLn(result).forEach(function(line) {
|
splitLn(result).forEach(function(line) {
|
||||||
var row = line.split(/\s+/);
|
var row = line.split(/\s+/);
|
||||||
|
@ -63,28 +63,32 @@ function ADBObject() {
|
||||||
|
|
||||||
// download a file from target device
|
// download a file from target device
|
||||||
this.pull = function(id, path) {
|
this.pull = function(id, path) {
|
||||||
return SHELL.exec([this.binPath, "-s", id, "pull", path, "data\\"]);
|
return _interface.exec(["-s", id, "pull", path, "data\\"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
// upload a file to target device
|
// upload a file to target device
|
||||||
this.push = function(id, filename, path) {
|
this.push = function(id, filename, path) {
|
||||||
return SHELL.exec([this.binPath, "-s", id, "push", "data\\" + filename, path]);
|
return _interface.exec(["-s", id, "push", "data\\" + filename, path]);
|
||||||
};
|
};
|
||||||
|
|
||||||
// install APK file
|
// install APK file
|
||||||
this.install = function(id, filename) {
|
this.install = function(id, filename) {
|
||||||
return SHELL.exec([this.binPath, "-s", id, "install", "data\\" + filename]);
|
return _interface.exec(["-s", id, "install", "data\\" + filename]);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Uninstall the App
|
// Uninstall the App
|
||||||
this.uninstall = function(id, appname) {
|
this.uninstall = function(id, appname) {
|
||||||
return SHELL.exec([this.binPath, "-s", id, "uninstall", appname]);
|
return _interface.exec(["-s", id, "uninstall", appname]);
|
||||||
};
|
};
|
||||||
|
|
||||||
// reboot device
|
// reboot device
|
||||||
this.reboot = function(id) {
|
this.reboot = function(id) {
|
||||||
return SHELL.exec([this.binPath, "-s", id, "reboot"]);
|
return _interface.exec(["-s", id, "reboot"]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// set the binary path
|
||||||
|
this.binPath = "bin\\platform-tools_r33.0.0-windows\\platform-tools\\adb.exe";
|
||||||
|
_interface.setPrefix(this.binPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
// An Android Emulator
|
// An Android Emulator
|
||||||
|
@ -125,7 +129,7 @@ exports.createEmulator = function(binPath) {
|
||||||
return new EmulatorObject(binPath);
|
return new EmulatorObject(binPath);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.VERSIONINFO = "Android Debug Bridge Interface (adb.js) version 0.2.1";
|
exports.VERSIONINFO = "Android Debug Bridge Interface (adb.js) version 0.2.2";
|
||||||
exports.AUTHOR = "abuse@catswords.net";
|
exports.AUTHOR = "abuse@catswords.net";
|
||||||
exports.global = global;
|
exports.global = global;
|
||||||
exports.require = global.require;
|
exports.require = global.require;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user