Browse Source

Connect to Device on page-load

master
Nero Ignis 5 years ago
parent
commit
9ed17c1305
  1. 1
      ADBService.php
  2. 3
      execute.php
  3. 11
      index.php
  4. 5
      remote.css

1
ADBService.php

@ -4,6 +4,7 @@ include_once 'ADBKeyCodes.php';
class ADBService class ADBService
{ {
const DEFAULT_HOST = '192.168.1.132';
private $host; private $host;
public function __construct($host) public function __construct($host)

3
execute.php

@ -3,9 +3,8 @@
$axiosRequest = json_decode(file_get_contents('php://input')); $axiosRequest = json_decode(file_get_contents('php://input'));
include_once 'ADBService.php'; include_once 'ADBService.php';
const HOST = '192.168.1.132';
$service = new ADBService(HOST); $service = new ADBService(ADBService::DEFAULT_HOST);
$service->connect(); $service->connect();
echo json_encode([$service->sendKey($axiosRequest->keyCode)]); echo json_encode([$service->sendKey($axiosRequest->keyCode)]);

11
index.html → index.php

@ -1,3 +1,10 @@
<?php
include_once 'ADBService.php';
$service = new ADBService(ADBService::DEFAULT_HOST);
?>
<!doctype html> <!doctype html>
<html lang="de"> <html lang="de">
<head> <head>
@ -37,6 +44,10 @@
<a class="col-4"></a> <a class="col-4"></a>
<a class="col-4"></a> <a class="col-4"></a>
<a class="col-4"></a> <a class="col-4"></a>
<div class="alert alert-info connected-info">
<?= str_replace('already ', '', $service->connect()) ?>
</div>
</div> </div>
</div> </div>

5
remote.css

@ -6,3 +6,8 @@
.fa-1c5x { .fa-1c5x {
font-size: 1.5em; font-size: 1.5em;
} }
.connected-info {
width: 100%;
margin-top: 2em;
}
Loading…
Cancel
Save