Performing loopback test

Hello!

I am currently developing my own custom service with two nrf 52840 development kits where one acts as the Client and one acts as the Server.

I have managed to set up the service and the service is discoverable and the client can subscribe to notifications from the server.
The next step is to perform a loopback test where I want to take the data sent from the Server ---> Client and send it back with my Write without response attributes.

So my questions are:

1: Is there some sample code on how to write from Client --> Server? What do I need to do on both ends? My Client code is inserted below.

2: Once the writing is set up properly, is it possible to just loop the data back to the Server or is there something I need to think about?

3: When the loopback test is set up, is the nrf sniffer a viable way of testing throughput or are there some pot holes I should be careful about?

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <stddef.h>
#include <errno.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/printk.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/bluetooth/bluetooth.h>
#include <zephyr/bluetooth/hci.h>
#include <zephyr/bluetooth/conn.h>
#include <zephyr/bluetooth/uuid.h>
#include <zephyr/bluetooth/gatt.h>
/* --------------------- START OF FROG UUID:s ---------------- */
#define FROG_SERVICE BT_UUID_128_ENCODE(0x2016ec20, 0xb2eb, 0x11e5, 0xa307, 0x0002a5d5c51b)
// Notify characteristics
#define FROG_TXDATA_UUID BT_UUID_128_ENCODE(0x388706a0, 0xb2eb, 0x11e5, 0xa790, 0x0002a5d5c51b)
#define FROG_RXCREDIT BT_UUID_128_ENCODE(0x43802b40, 0xb2eb, 0x11e5, 0xb6e5, 0x0002a5d5c51b)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX



Regards,
B