File tree Expand file tree Collapse file tree 2 files changed +17
-12
lines changed
Expand file tree Collapse file tree 2 files changed +17
-12
lines changed Original file line number Diff line number Diff line change 1717OMNIPY_LOGGER = "OMNIPY"
1818OMNIPY_LOGFILE = "omnipy"
1919
20-
2120OMNIPY_PACKET_LOGGER = "OMNIPACKET"
2221OMNIPY_PACKET_LOGFILE = "packet"
2322
23+ OMNIPY_DATABASE = "omni.db"
24+
2425API_VERSION_MAJOR = 1
2526API_VERSION_MINOR = 3
26- API_VERSION_REVISION = 5
27- API_VERSION_BUILD = 19163
27+ API_VERSION_REVISION = 6
28+ API_VERSION_BUILD = 19170
2829
2930REST_URL_PING = "/omnipy/ping"
3031REST_URL_OMNIPY_SHUTDOWN = "/omnipy/shutdown"
Original file line number Diff line number Diff line change 11#! /usr/bin/env bash
22
33pair_bt_device () {
4+ echo " Enabling bluetooth discovery"
45 sudo btmgmt power off
56 sudo btmgmt ssp on
67 sudo btmgmt connectable on
78 sudo btmgmt pairable on
89 sudo btmgmt discov on
910 sudo btmgmt power on
10- bt_device=
11- while [[ -z " ${bt_device} " ]]
12- do
13- sleep 1
14- bt_device= ` sudo bt-device -l | grep -e \( . * \) `
11+ echo " Waiting for a connection "
12+ while : ; do
13+ sleep 2
14+ sudo bt-device -l > /dev/null 2>& 1
15+ [[ ! $? -eq 0 ]] || break
1516 done
1617
18+ echo " Pairing completed"
1719 sudo btmgmt discov off
18- echo " Paired with ${bt_device} "
20+ sleep 15
1921}
2022
2123while true ;
2224do
23- killall -9 bt-network > /dev/null 2>&1
2425 sudo btmgmt power off
2526 sudo btmgmt power on
2627 paired_devices=` bt-device -l | grep -e \( .* \) --color=never -o| cut -d' (' -f2 | cut -d' )' -f1`
27- if [[ ! -z ${paired_devices} ]]; then
28+ if [[ ! -z " ${paired_devices} " ]]; then
2829 while read -r mac_address;
2930 do
30- /usr/bin/bt-network -c ${mac_address} nap > /dev/null 2>&1
31+ echo " Connecting to ${mac_address} "
32+ killall -9 bt-network > /dev/null 2>&1
33+ /usr/bin/bt-network -c ${mac_address} nap
34+ echo " Disconnected from ${mac_address} (or connection failed)"
3135 done <<< " ${paired_devices}"
3236 sleep 15
3337 else
You can’t perform that action at this time.
0 commit comments