You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
34 lines
663 B
34 lines
663 B
|
5 years ago
|
<?php
|
||
|
|
|
||
|
|
include_once 'ADBKeyCodes.php';
|
||
|
|
|
||
|
|
class ADBService
|
||
|
|
{
|
||
|
|
private $host;
|
||
|
|
|
||
|
|
public function __construct($host)
|
||
|
|
{
|
||
|
|
$this->host = $host;
|
||
|
|
$this->connect();
|
||
|
|
}
|
||
|
|
|
||
|
|
public function connect()
|
||
|
|
{
|
||
|
|
return $this->executeCommand('connect ' . escapeshellarg($this->host));
|
||
|
|
}
|
||
|
|
|
||
|
|
public function disconnect()
|
||
|
|
{
|
||
|
|
return $this->executeCommand('disconnect');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function executeCommand($command)
|
||
|
|
{
|
||
|
|
return shell_exec('adb ' . $command);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function sendKey($keyIdentifier)
|
||
|
|
{
|
||
|
|
return $this->executeCommand(' shell input keyevent ' . ADB_KEYCODES[$keyIdentifier]);
|
||
|
|
}
|
||
|
|
}
|