Android 4.3 BTLE as server: How to start advertisements?

后端 未结 4 537
悲哀的现实
悲哀的现实 2021-02-01 06:31

I am trying to implement a BTLE SERVER on the Nexus 7 with the new BTLE API in 4.3. I am running into several problems. First there are no examples with the SDK. The only exampl

4条回答
  •  夕颜
    夕颜 (楼主)
    2021-02-01 06:56

    As I understand, the Android implementation can only act as a central device, and not as a peripheral device. In Bluetooth Low Energy, only the peripheral can advertise. The central device can scan for advertisements from peripherals, and send connect requests as replies to (some kinds of) advertisements, to create a connection to the peripheral.

    In BLE, there is a distinction between the concepts Central/Peripheral and Server/Client:

    • Central/Peripheral is relating to the network architecture, where the central is the hub in a star, with one or more peripherals connected to it. It will typically be a phone, tablet or computer. A peripheral device can only connect to one central at a time.

    • Server/Client (GATT server/client) is a higher level concept, related to the data that are kept in the devices and possibly communicated over the connection. Both central and peripheral devices can implement a GATT server and a GATT client, but is not required to have both.

    So to answer your question: You cannot invoke advertisements. You will have to start scanning for peripheral devices to be able to make a connection to one or more of them.

    Hope this helps.

提交回复
热议问题