mirror of
				https://github.com/gnh1201/welsonjs.git
				synced 2025-10-31 04:51:17 +00:00 
			
		
		
		
	Create adb.js
This commit is contained in:
		
							parent
							
								
									41aac72513
								
							
						
					
					
						commit
						36efb8bc07
					
				
							
								
								
									
										50
									
								
								lib/adb.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										50
									
								
								lib/adb.js
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,50 @@ | |||
| ////////////////////////////////////////////////////////////////////////
 | ||||
| // LDPlayer API
 | ||||
| ///////////////////////////////////////////////////////////////////////
 | ||||
| 
 | ||||
| var SHELL = require("lib/shell"); | ||||
| var SYS = require("lib/system"); | ||||
| 
 | ||||
| function ADBObject() { | ||||
|     this.binPath = "bin\\platform-tools_r33.0.0-windows\platform-tools\\adb.exe"; | ||||
| 
 | ||||
|     this.setBinPath = function(binPath) { | ||||
|         this.binPath = binPath; | ||||
|     }; | ||||
| 
 | ||||
|     this.getDevices = function() { | ||||
|         var devices = []; | ||||
|         var result = SHELL.exec([this.binPath, "devices"]); | ||||
| 
 | ||||
|         splitLn(result).forEach(function(line) { | ||||
|             var row = line.split(/\s+/); | ||||
|             if(row.length == 2) { | ||||
|                 devices.push({ | ||||
|                     id: row[0], | ||||
|                     hostname: this.getHostname(row[0]), | ||||
|                     type: row[1] | ||||
|                 }); | ||||
|             } | ||||
|         }); | ||||
|     }; | ||||
| 
 | ||||
|     this.getHostname = function(id) { | ||||
|        return SHELL.exec([this.binPath, "-s", id, "shell", "getprop", "net.hostname"]).trim(); | ||||
|     }; | ||||
|    | ||||
|     this.disableService = function(id, name) { | ||||
|        return SHELL.exec([this.binPath, "-s", id, "shell", "svc", name, "disable"]); | ||||
|     }; | ||||
| 
 | ||||
|     this.enableService = function(id, name) { | ||||
|        return SHELL.exec([this.binPath, "-s", id, "shell", "svc", name, "enable"]); | ||||
|     }; | ||||
| } | ||||
| 
 | ||||
| exports.VERSIONINFO = "Android Debug Bridge Interface (adb.js) version 0.1"; | ||||
| exports.global = global; | ||||
| exports.require = global.require; | ||||
| 
 | ||||
| exports.create = function() { | ||||
|     return new ADBObject(); | ||||
| }; | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 GitHub
							GitHub