python找不到idleble_使用python查找低功耗蓝牙

这篇博客介绍了一种使用Python进行低功耗蓝牙(BLE)扫描的方法,通过调用蓝牙库并设置参数来搜索BLE设备。内容包括创建套接字、设置扫描参数、过滤事件,并展示如何解析接收到的数据以获取MAC地址和RSSI。
摘要由CSDN通过智能技术生成

I can find devices like my phone and other bluetooth 4.0 devices, but not any BLE. If this cannot be modified, is it possible to run the hcitool lescan and pull the data from hci dump within python? I can use the tools to see the devices I am looking for and it gives an RSSI in hcidump, which is what my end goal is. To get a MAC address and RSSI from the BLE device.

Thanks!

解决方案

As I said in the comment, that library won't work with BLE.

Here's some example code to do a simple BLE scan:

import sys

import os

import struct

from ctypes import (CDLL, get_errno)

from ctypes.util import find_library

from socket import (

socket,

AF_BLUETOOTH,

SOCK_RAW,

BTPROTO_HCI,

SOL_HCI,

HCI_FILTER,

)

if not os.geteuid() == 0:

sys.exit("sc

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值