最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

kotlin - Is it possible for an Android device to act as both GATT Server and GATT Client simultaneously? - Stack Overflow

programmeradmin1浏览0评论

I'm developing an Android application that uses Bluetooth Low Energy (BLE) for communication.
I want to know if it is possible for a single device to function as both a GATT Server and a GATT Client.

For example, if I install the app on two devices, Device A and Device B, can both devices continuously run BLE advertising, BLE scanning, and act as GATT servers?
When they detect each other, can one device connect to the other as a GATT Client?
Additionally, if this is possible, can both devices establish a mutual relationship where each acts as a client to the other's server?

I created a demo application, and while I was able to successfully detect both devices, when I execute device.connectGatt(), there is no response in the GattClientService. Instead, the following logs appear on the GattServerService side.

As you can see, once the device connects to the GATT server, it gets disconnected, and the onConnectionStateChange() callback is invoked.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论