相关疑难解决方法(0)

什么是iBeacon蓝牙配置文件

我想用一些蓝牙低能量开发套件创建我自己的iBeacon.Apple还没有发布iBeacons规范,但是一些硬件开发商已经反向使用AirLocate示例代码设计iBeacon并开始销售iBeacon开发套件.

那么iBeacon蓝牙配置文件是什么?

Bluetooth Low Energy使用GATT进行LE配置文件服务发现.所以我认为我们需要知道属性句柄,属性类型,属性值,以及iBeacon属性的属性权限.那么,对于UUID为E2C56DB5-DFFB-48D2-B060-D0F5A71096E0的iBeacon,主要值为1,次要值为1,蓝牙GATT配置文件服务是什么?

这是我在Apple论坛和文档讨论中做出的一些假设.

  1. 您只需要查看蓝牙外围设备的配置文件服务(GATT)即可知道它是iBeacon.

  2. Major和Minor键在此配置文件服务中的某处编码

有些公司使用iBeacon Dev Kits似乎已经有了这个数字:

希望我们能及时在Bluetooth.org上发布这样的个人资料:https://www.bluetooth.org/en-us/specification/adopted-specifications

reverse-engineering bluetooth ios bluetooth-lowenergy ibeacon

149
推荐指数
4
解决办法
11万
查看次数

Bluez:做广告服务/ gatt服务器的例子?

目标

我正在开发一个运行Linux的简单设备.它具有BLE功能,我目前正在使用bluez 5.8.

我想使用iPhone触发此设备上的操作.

什么有效:

  • 我可以让iPhone"看到"该设备.
  • iPhone也连接到设备.

我在linux上设置了这样的蓝牙设备(感谢这个问题):

# activate bluetooth
hciconfig hci0 up                                             
# set advertise data: "hello world"
hcitool -i hci0 cmd 0x08 0x0008 48 45 4c 4c 4f 57 4f 52 4c 44
# start advertising as connectable
hciconfig hci0 leadv 0
Run Code Online (Sandbox Code Playgroud)

iOS代码很简单:

- (int) scanForPeripherals
{
    if (self->centralManager.state != CBCentralManagerStatePoweredOn) {
        return -1;
    }
    NSDictionary *options = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:NO], CBCentralManagerScanOptionAllowDuplicatesKey, nil];
    [self.centralManager scanForPeripheralsWithServices:nil options:options];
    return 0;
}

- (void)centralManagerDidUpdateState:(CBCentralManager *)central
{
    if (central.state …
Run Code Online (Sandbox Code Playgroud)

linux bluetooth core-bluetooth bluetooth-lowenergy bluez

25
推荐指数
1
解决办法
2万
查看次数

蓝牙低功耗:使用BlueZ堆栈作为外设(具有自定义服务和特性)

我正在尝试在Linux机器上使用BlueZ堆栈来创建具有自定义服务和特征的GATT服务器.最终目标是使用任何中央设备(例如iOS或Android设备)连接到GATT服务器,发现服务和特征,并操纵特征中的数据.

例:

  • 具有1项服务的外围设备,包含3个特征.
  • 服务uuid​​ = 0xFFFF
  • Char 1 uuid = 0xAAAA,属性=可读
  • Char 2 uuid = 0xBBBB,properties =可读写
  • Char 3 uuid = 0xCCCC,properties = notifiable

从中央设备,我应该看到外围设备,连接到它并发现一个服务(0xFFFF),它有三个特性(0xAAAA,0xBBBB,0xCCCC).然后,我应该能够读取0xAAAA的值,读取和写入0xBBBB的值,并启用0xCCCC上的通知.

请注意,我知道存在类似的问题,但它只解释了如何将外围设备用作广告客户.另一个解决的问题解释了如何创建GATT服务器,但没有解释如何使用特征的属性(例如可读,可通知等),或者我可能缺少某些东西.

先感谢您.

linux bluetooth bluetooth-lowenergy bluez gatt

11
推荐指数
1
解决办法
1万
查看次数

Raspberry Pi蓝牙4.0连接

我正在尝试使用CoreBluetooth(蓝牙4.0)通过iPhone连接到Raspberry Pi.我发现了设备并使用以下代码发送连接请求:

if (peripheral != self.foundPeripheral) {
    NSLog(@"Try to connect to %@", peripheral.name);
    self.foundPeripheral = peripheral;
    [self.centralManager stopScan];
    [self.centralManager connectPeripheral:peripheral options:nil];

}
Run Code Online (Sandbox Code Playgroud)

didConnectPeripheral或didFailedToConnectPeripheral都不会被调用.我还确保将RPi用于宣传蓝牙低功耗

sudo hciconfig hci0 leadv
Run Code Online (Sandbox Code Playgroud)

但是当我检查活动连接时

hcitool con
Run Code Online (Sandbox Code Playgroud)

没有活动的连接.我错过了为RPi设置的一些设置吗?外围设备上的名称变量也是空白的,是因为我还没有连接吗?

core-bluetooth raspberry-pi bluetooth-lowenergy bluez

8
推荐指数
1
解决办法
6979
查看次数

使用BlueZ堆栈作为外设时错误的有效负载

我试着按照davidgyoung在这个问题中提供的步骤.以下是我使用的命令:

hciconfig hci0 up
hciconfig hci0 noleadv
hcitool -i hci0 cmd 0x08 0x0008 48 45 4c 4c 4f 57 4f 52 4c 44
hciconfig hci0 leadv
Run Code Online (Sandbox Code Playgroud)

这给了我这个输出:

LE set advertise enable on hci0 returned status 12 
< HCI Command: ogf 0x08, ocf 0x0008, plen 10 
48 45 4C 4C 4F 57 4F 52 4C 44 
> HCI Event: 0x0e plen 4 
01 08 20 12 
Run Code Online (Sandbox Code Playgroud)

请注意,我不能使用advice命令,hciconfig hci0 leadv 0因为它会抛出错误Warning: unknown command - "0".

但是,当我尝试 …

linux bluetooth raspberry-pi bluetooth-lowenergy bluez

5
推荐指数
1
解决办法
4880
查看次数

BlueZ:从命令行发送 LE 定向广告

我正在尝试从命令行发送定向广告,但我不知道该怎么做。我已经检查了hciconfighcitoolbtmgmtbluetoothctl,但它们似乎都没有启用针对特定 BLE 设备的定向广告。当使用 hciconfig 检查我可以发送的广告类型时,我看到以下内容:-

leadv      [type]   Enable LE advertising
                0 - Connectable undirected advertising (default)
                3 - Non connectable undirected advertising
Run Code Online (Sandbox Code Playgroud)

有没有办法从命令行发送定向广告?

我使用的是在 Linux v4.15.0-36-generic 上运行的 BlueZ 版本 5.48,并连接了蓝牙 4.0 适配器。

linux bluetooth-lowenergy bluez

5
推荐指数
1
解决办法
2856
查看次数

低功耗蓝牙:被动扫描-但是不会永远循环吗?

参考这篇文章,我已经成功地获得了一个Linux设备(Raspberry Pi A +型)来将我的Bluetooth 4.0 USB软件狗切换到“广告”状态:

sudo hciconfig hci0 leadv 3
Run Code Online (Sandbox Code Playgroud)

要么

sudo hciconfig hci0 leadv 0
Run Code Online (Sandbox Code Playgroud)

我使用运行“ LightBlue Explorer”应用程序的iPod进行了验证。

到目前为止一切都很好。

从另一个具有蓝牙4.0加密狗的Linux盒(另一个Pi)中获取;我还可以使用以下命令查看设备:

sudo hcitool lescan --passive
Run Code Online (Sandbox Code Playgroud)

返回如下内容:

LE Scan ...
xx:xx:xx:xx:xx:xx (unknown)
yy:yy:yy:yy:yy:yy (unknown)
xx:xx:xx;xx:xx:xx (unknown)
Run Code Online (Sandbox Code Playgroud)

但是该命令会不断循环刷新设备列表。

所以我的主要问题是:是否可以运行该命令的变体,侦听(说)5秒;返回发现要播发的设备列表并退出?

我想构建一个简单的脚本(理想情况下为Python程序),该脚本将定期唤醒,(被动地)监听流量几秒钟,然后返回源设备列表。

另外:我不确定为什么该命令为找到的设备显示“未知”。(而LightBlue确实会标识名称)。

linux hci bluetooth-lowenergy

0
推荐指数
2
解决办法
7482
查看次数