BLE service connect to client

Hi
As title, I need for BLE host(service) connect to client, get the info from client, all in arduino example and source code is client connect to service. do you have any source code(.cpp) for BLE service connect to client, call form arduino IDE ?Thanks.

Hi @yithwe,

May I know which Ameba board you are using?

Can I understand that you would like your board to serve as a BLE Service (Peripheral)?

You can consider looking at BLEDevice.cpp ,
Depending on what is the role of your Ameba board, you can read up these API,

  • addService()
  • beginPeripheral() - Starts the BLE stack to operate as a peripheral device (service)
  • beginCentral() - Starts the BLE stack to operate as a central device (client)

Some of the examples that you can take a look,
This example is to obtain battery level data.

Furthermore, you can also take a look at the API documents (Ameba ARDUINO – Realtek IoT/Wi-Fi MCU Solutions) and take a look at the image below to learn more about it. :slight_smile:

Hope it helps!

1 Like

Hi
I use RTL8722, board need to serve as BLE Service (central), for service is no connected API, all in BLE example is central device (client) connect to peripheral device (service), Thanks.

Hi @yithwe,

May I know what is serving as your client?

Usually peripheral devices advertise their services and characteristics to central devices (Service), while central devices scan for available peripherals and initiate connections (Client).

If you would like your board to connect to the service, you can consider configuring both your devices by swapping their roles: your board as the client and another device as the service. Now, another device will be able to connect to the board.

To configure your board as a client, you can refer to the following example:

BLEBatteryClient

BLEUartClient