bluezutils.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:OpenXCAccessory 作者: openxc 项目源码 文件源码
def find_adapter_in_objects(objects, pattern=None):
    bus = dbus.SystemBus()
    for path, ifaces in objects.iteritems():
        adapter = ifaces.get(ADAPTER_INTERFACE)
        if adapter is None:
            continue
        if not pattern or pattern == adapter["Address"] or \
                            path.endswith(pattern):
            obj = bus.get_object(SERVICE_NAME, path)
            return dbus.Interface(obj, ADAPTER_INTERFACE)
    raise Exception("Bluetooth adapter not found")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号