栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 面试经验 > 面试问答

BlueZ:如何从命令行设置GATT服务器

面试问答 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

BlueZ:如何从命令行设置GATT服务器

因此,现在可以使用新的 bluetoothctl 工具进行处理。可以使用此工具按以下方式设置gatt表:-

#bluetoothctl[bluetoothctl] menu gatt[bluetoothctl] register-service 0xFFFF # (Choose yes when asked if primary service)[bluetoothctl] register-characteristic 0xAAAA read       # (Select a value of 1 when prompted)[bluetoothctl] register-characteristic 0xBBBB read,write # (Select a value of 0 when prompted)[bluetoothctl] register-characteristic 0xCCCC read       # (Select a value of 2 when prompted)[bluetoothctl] register-application # (This commits the services/characteristics and registers the profile)[bluetoothctl] back[bluetoothctl] advertise on

我已经尝试了几种服务/功能组合,并且能够使其正常工作。默认情况下,GAP(0x1800)和GATT(0x1801)服务可用,并且在您做广告时将成为GATT表的一部分。您也可以使用以下命令查看可用的服务:

[bluetoothctl] showController 00:AA:BB:CC:DD:EE (public)    Name: MyMachine    Alias: MyMachine    Class: 0x000c0000    Powered: yes    Discoverable: no    Pairable: yes    UUID: Headset AG     (00001112-0000-1000-8000-00805f9b34fb)    UUID: Generic Attribute Profile (00001801-0000-1000-8000-00805f9b34fb)    UUID: A/V Remote Control        (0000110e-0000-1000-8000-00805f9b34fb)    UUID: Generic Access Profile    (00001800-0000-1000-8000-00805f9b34fb)    UUID: PnP Information(00001200-0000-1000-8000-00805f9b34fb)    UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)    UUID: Audio Source   (0000110a-0000-1000-8000-00805f9b34fb)    UUID: Audio Sink     (0000110b-0000-1000-8000-00805f9b34fb)    **UUID: Unknown        (0000ffff-0000-1000-8000-00805f9b34fb)**    UUID: Headset        (00001108-0000-1000-8000-00805f9b34fb)    Modalias: usb:v1D6Bp0246d0532    Discovering: no


转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/408754.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号