【问题标题】:SensorTag, detect pressed buttons using gatttoolSensorTag,使用 gatttool 检测按下的按钮
【发布时间】:2014-05-08 14:31:12
【问题描述】:

我想检测是否使用 gatttool 在我的 SensorTag 上按下了按钮,但我无法做到。

http://processors.wiki.ti.com/index.php/SensorTag_User_GuideTI 报告中,为了读取按下的按钮,您应该:

1) 通过将值 0x80 写入 AA62 (CONFIGURATION) 属性来启用测试模式。

我用命令做到了:

[CON][BC:6A:29:AE:CD:E5][LE]> char-write-req 0x67 80
[CON][BC:6A:29:AE:CD:E5][LE]> Characteristic value was written successfully

现在我应该处于测试模式,并且:

2) 启用简单按键通知

看着http://processors.wiki.ti.com/index.php/File:BLE_SensorTag_GATT_Server.pdfbluepy lib 看来我必须在 0x60 中写 0100 才能做到这一点。但是

 [CON][BC:6A:29:AE:CD:E5][LE]> char-write-req 0x60 0100
 [CON][BC:6A:29:AE:CD:E5][LE]> Characteristic Write Request failed: Attribute can't be written

我观察到 0x61 是可写的并接受值 0100,但我仍然无法 检测是否按下了某个键。

有什么建议吗?

【问题讨论】:

    标签: bluetooth bluetooth-lowenergy sensors texas-instruments


    【解决方案1】:

    该 PDF 文档可能已过期...我刚刚尝试在我的 SensorTag 上使用 gatttool 并通过以下命令获得按钮通知:char-write-req 0x6c 0100

    我会坚持使用 TI wiki for the SensorTag,因为它可能更可能保持最新。 wiki 说,如果您想在按下侧边按钮时收到通知,您只需要执行“测试模式”步骤(因为通常它只会激活广告)。

    此外,您可能必须弄清楚在您的特定设备上使用什么手柄,因为每个固件都会导致手柄四处移动。固件之间不应该改变的是 UUID。试试 gatttool 中的primarycharacteristics 命令来获取设备上服务的详细信息。

    我的primary 显示了这个:

    attr handle: 0x005e, end grp handle: 0x0068 uuid: f000aa50-0451-4000-b000-000000000000
    attr handle: 0x0069, end grp handle: 0x006d uuid: 0000ffe0-0000-1000-8000-00805f9b34fb
    attr handle: 0x006e, end grp handle: 0x0074 uuid: f000aa60-0451-4000-b000-000000000000
    

    ffe0 是简单密钥服务的 UUID(虽然 wiki 说它是 f000ffe0,但它不在我的身上)。所以,你要查看的所有句柄都是从 0x69 到 0x6d

    char-read-uuid 0x2902 0x69 0x6d 将显示该范围内的所有 CCC(客户端特征配置):

    handle: 0x006c   value: 01 00 
    

    将该句柄设置为 0100 将打开该服务的通知。

    【讨论】:

    • 你从哪里得到char-read-uuid 命令中的0x2902?应该改为ffe0 吗?
    • 啊抱歉,2902 是客户端特征配置的 uuid
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-04-12
    • 2021-03-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多