This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Whether to use OTS or NUS for 500 bytes for every 80 ms

Hi, 

I'm having doubts about whether to use NUS or OTS to transfer 500 bytes of data from the peripheral device to the smartphone. Regarding OTS, I've tried using the ble_ots_central and ble_ots_peripheral example using two nrf52840 devices. It transferred 100 bytes from central and peripheral. At central they used the fill_array function to fill the numbers as shown in snippet. My doubt is how can I use the same method to send the data from peripheral to central. 

 

static void fill_array(uint8_t * data, uint32_t len)
{
    for (uint32_t i = 0; i < len; i++)
    {
        data[i] = (uint8_t)i;
    }
}


/**
 * @brief Function for filling our object with numbers before sending it.
 */
static void fill_current_object(void)
{
    fill_array(m_object, OBJECT_SIZE);
}


/**
 * @brief initialization.
 */
static void ots_c_init(void)
{
    fill_current_object();

    nrf_ble_ots_c_init_t init;

    init.evt_handler  = ots_c_evt_handler;
    init.err_handler  = ots_c_service_handler;
    init.p_gatt_queue = &m_ble_gatt_queue;

    ret_code_t err_code = nrf_ble_ots_c_init(&m_ots_c, &init);
    APP_ERROR_CHECK(err_code);
}

Parents Reply Children
Related