-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathtest.php
More file actions
46 lines (37 loc) · 1.31 KB
/
Copy pathtest.php
File metadata and controls
46 lines (37 loc) · 1.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
use lecodeurdudimanche\PHPBluetooth\Manager;
require("vendor/autoload.php");
//Create new Bluetooth manager, set discoverable and pairable to true
echo "Lauching manager...";
$manager = new Manager(true, true);
//Initiate device scan
echo "\rScanning devices...";
$manager->scanDevices();
echo "\r Done \n";
$manager->setDiscoverable(true);
//Get paired devices, refresh btInfo until we get at least one
/*do {
$manager->updateBluetoothInfo();
$info = $manager->getBluetoothInfo();
} while(!$info->getPairedDevices());
$device = $info->getPairedDevices()[0];*/
/*echo "Connecting to paired device $device\n";
$manager->connect($device);
usleep(10000000);
echo "Disconnecting from device\n";
$manager->connect($device, false);
usleep(5000000);
echo "Blocking device\n";
$manager->blockDevice($device);
usleep(5000000);
echo "Unblocking device\n";
$manager->blockDevice($device, false);*/
while (true)
{
/*$data = $manager->consumeLogOutput();
foreach($data as $line) echo($line);*/
echo "Waiting...";
$manager->updateBluetoothInfo();
echo("\r####### DATA #######\n" . $manager->getBluetoothInfo() . "#############\n\n");
sleep(3);
}