您好, 欢迎来到 !    登录 | 注册 | | 设为首页 | 收藏本站

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

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

因此,现在可以使用新的 工具进行处理。可以使用此工具按以下方式设置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] show
Controller 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
其他 2022/1/1 18:23:31 有339人围观

撰写回答


你尚未登录,登录后可以

和开发者交流问题的细节

关注并接收问题和回答的更新提醒

参与内容的编辑和改进,让解决方法与时俱进

请先登录

推荐问题


联系我
置顶