mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
uxplay-beacon HCI: cosmetic improvements
This commit is contained in:
@@ -11,7 +11,6 @@
|
|||||||
# %hciusers ALL=(ALL) NOPASSWD: /usr/sbin/hccontrol
|
# %hciusers ALL=(ALL) NOPASSWD: /usr/sbin/hccontrol
|
||||||
# (3) add the users who will run uxplay-beacon.py to the group hciusers
|
# (3) add the users who will run uxplay-beacon.py to the group hciusers
|
||||||
|
|
||||||
|
|
||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
import re
|
import re
|
||||||
@@ -102,7 +101,7 @@ def setup_beacon(ipv4_str: str, port: int, advmin: int, advmax: int, index: Lite
|
|||||||
try:
|
try:
|
||||||
result = le_cmd(hcicmd, args)
|
result = le_cmd(hcicmd, args)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f'beacon_on error (set_advertisng_parameters):', e.stderr, e.stdout)
|
print(f'beacon_on error (set_advertising_parameters):', e.stderr, e.stdout)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# setup Advertising Data
|
# setup Advertising Data
|
||||||
@@ -132,6 +131,8 @@ def setup_beacon(ipv4_str: str, port: int, advmin: int, advmax: int, index: Lite
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
def beacon_on() -> Optional[int]:
|
def beacon_on() -> Optional[int]:
|
||||||
|
global advertised_port
|
||||||
|
global advertised_address
|
||||||
if linux:
|
if linux:
|
||||||
hcicmd = '0x000a'
|
hcicmd = '0x000a'
|
||||||
args = ['0x01']
|
args = ['0x01']
|
||||||
@@ -142,15 +143,15 @@ def beacon_on() -> Optional[int]:
|
|||||||
le_cmd(hcicmd, args)
|
le_cmd(hcicmd, args)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f'beacon_on error:', e.stderr, e.stdout)
|
print(f'beacon_on error:', e.stderr, e.stdout)
|
||||||
global advertised_port
|
|
||||||
global advertised_address
|
|
||||||
advertised_port = None
|
advertised_port = None
|
||||||
advertised_address = None
|
advertised_address = None
|
||||||
return None
|
return None
|
||||||
print(f'AirPlay Service-Discovery beacon transmission started')
|
print(f'AirPlay Service-Discovery beacon transmission started {advertised_address}:{advertised_port}')
|
||||||
return advertised_port
|
return advertised_port
|
||||||
|
|
||||||
def beacon_off():
|
def beacon_off():
|
||||||
|
global advertised_port
|
||||||
|
global advertised_address
|
||||||
if linux:
|
if linux:
|
||||||
hcicmd = '0x000a'
|
hcicmd = '0x000a'
|
||||||
args = ['0x00']
|
args = ['0x00']
|
||||||
|
|||||||
Reference in New Issue
Block a user