Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if iface != defs.DEVICE_INTERFACE:
return
msg_path = message.path
# the PropertiesChanged signal only sends changed properties, so we
# need to get remaining properties from cached_devices. However, we
# don't want to add all cached_devices to the devices dict since
# they may not actually be nearby or powered on.
if msg_path not in devices and msg_path in cached_devices:
devices[msg_path] = cached_devices[msg_path]
devices[msg_path] = (
{**devices[msg_path], **changed} if msg_path in devices else changed
)
elif (
message.member == "InterfacesRemoved"
and message.body[1][0] == defs.BATTERY_INTERFACE
):
logger.info(
"{0}, {1} ({2}): {3}".format(
message.member, message.interface, message.path, message.body
)
)
return
else:
msg_path = message.path
logger.info(
"{0}, {1} ({2}): {3}".format(
message.member, message.interface, message.path, message.body
)
)
logger.info(
This method should generally not be needed by end user, since it is a DBus specific method.
Args:
_uuid: The characteristic to get properties for.
Returns:
(dict) Properties dictionary
"""
characteristic = self.services.get_characteristic(str(_uuid))
out = await self._bus.callRemote(
characteristic.path,
"GetAll",
interface=defs.PROPERTIES_INTERFACE,
destination=defs.BLUEZ_SERVICE,
signature="s",
body=[defs.GATT_CHARACTERISTIC_INTERFACE],
returnSignature="a{sv}",
).asFuture(self.loop)
return out