Data transfer from sensor connected with I2C over Bluetooth NUS.

Hi everyone, 

I am working with the nRF SDK v2.0.4 for VsCode and with the nRF52840 DK. 

I want to develop an application that transfer in real time the data collected by a sensor. I managed to implement the I2C logic and print the value collected by the sensor to the serial terminal but I have trouble understanding the logic of the NUS protocol.

I followed the course Bluetooth Low Energy Fundamentals – Nordic Developer Academy (nordicsemi.com) but it didn't helped me much. 

I also took a look at the peripheral_uart example provide by Zephyr, but I don't really see where in the code I could send the data. Those data are stored into 6 uint6_t variables but managing to send only one of them would already be a huge step for me :). I'd also like to know if the data transmission is limited to a certain type of data, like could I send text and values in the same time ? Or if there is a way to send directly a file containing the said data. 

Thanks in advance, 

Best regards.

This the code used in the peripheral_uart example : 

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2018 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
/** @file
* @brief Nordic UART Bridge Service (NUS) sample
*/
#include "uart_async_adapter.h"
#include <zephyr/types.h>
#include <zephyr/kernel.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/usb/usb_device.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <soc.h>
#include <zephyr/bluetooth/bluetooth.h>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX