Skip to content

Commit

Permalink
clean-up some long line lint issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ukBaz committed Jun 15, 2022
1 parent b3341d7 commit 1649014
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions bluezero/observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
EddyURL = namedtuple('EddyURL', ['url', 'tx_pwr', 'rssi'])
EddyUID = namedtuple('EddyUID', ['namespace', 'instance', 'tx_pwr', 'rssi'])
EddyTLM = namedtuple('EddyTLM',
['version', 'battery', 'temperature', 'count', 'uptime', 'tx_pwr', 'rssi'])
['version', 'battery', 'temperature', 'count', 'uptime',
'tx_pwr', 'rssi'])
iBeacon = namedtuple('iBeacon', # pylint: disable=invalid-name
['UUID', 'major', 'minor', 'tx_pwr', 'rssi'])
AltBeacon = namedtuple('AltBeacon',
Expand Down Expand Up @@ -109,13 +110,20 @@ def process_eddystone(cls, data, rssi):
version = int(data[1])
# Only support plain beacons ATM
if version == 0:
voltage = int.from_bytes(data[2:4], byteorder='big', signed=False)
temperature = int.from_bytes(data[4:6], byteorder='big', signed=True)/256.0
count = int.from_bytes(data[6:10], byteorder='big', signed=False)
time = int.from_bytes(data[10:], byteorder='big', signed=False) / 10
logger.info('\t\tEddystone TLM: %s, %s mV, %s C, %s, %s s \u2197 %s \u2198 %s',
version, voltage, temperature, count, time, tx_pwr, rssi)
data = EddyTLM(version, voltage, temperature, count, time, tx_pwr, rssi)
voltage = int.from_bytes(
data[2:4], byteorder='big', signed=False)
temperature = int.from_bytes(
data[4:6], byteorder='big', signed=True)/256.0
count = int.from_bytes(
data[6:10], byteorder='big', signed=False)
time = int.from_bytes(
data[10:], byteorder='big', signed=False) / 10
logger.info('\t\tEddystone TLM: %s, %s mV, %s C, %s, %s s '
'\u2197 %s \u2198 %s',
version, voltage, temperature, count, time,
tx_pwr, rssi)
data = EddyTLM(version, voltage, temperature, count, time,
tx_pwr, rssi)
if cls.on_eddystone_tlm:
cls.on_eddystone_tlm(data)

Expand Down Expand Up @@ -200,7 +208,8 @@ def start_beacon_scan(cls,
- Eddystone URL = ['url', 'tx_pwr', 'rssi']
- Eddystone UID = ['namespace', 'instance', 'tx_pwr', 'rssi']
- Eddystone TLM = ['version', 'voltage', 'temperature', 'count', 'time', 'tx_pwr', 'rssi']
- Eddystone TLM = ['version', 'voltage', 'temperature', 'count',
'time', 'tx_pwr', 'rssi']
- iBeacon = ['UUID', 'major', 'minor', 'tx_pwr', 'rssi']
- AltBeacon = ['UUID', 'major', 'minor', 'tx_pwr', 'rssi']
Expand Down

0 comments on commit 1649014

Please sign in to comment.