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

Trying to add two extra characteristics to my service

Folks,

I have had a custom service with two characteristics up and running for a while.

I'm trying to add (well in fact HAVE added) two more characteristics to the service.

I can:

1. See them with my phone and indeed write to the new writeable characteristic

2. See them with a Qt app running on machine that runs BT4.0 (not tried writing to them).

What I just cannot do is even SEE the two new characteristics from a computer with BT5.0

Bluez (the Linux BT stack) sees two characteristics, one of the old ones and one of the new ones.

Are there any common gotchas for adding extra characteristics I might have forgotten?

I did have a thing before where I upped the characteristic size and my phone kind of worked, but the Qt app didn't at all when talking/connecting to it and I learnt I had to up the maximum MTU size, so I'm wondering whether there's anything similar when upping number of characteristics.

I have:

#define NRF_SDH_BLE_VS_UUID_COUNT 5

One of the service and four for the characteristics. Is that correct? There is the 0x1801 characteristic too of course.

I am slightly concerned that when I added the new characteristics, one of which is 247 bytes long, it didn't seem to want me to changed the RAM start value by that much. I think it was only 16 bytes extra,

My code for adding the characteristics is below.  I can post the functions it calls if that helps,

uint32_t ble_mk_test_service_init(struct ble_mk_test_service_s *p_mk_test_service, const struct ble_mk_test_service_init_s *p_mk_test_service_init)
{
    uint32_t   err_code;
    ble_uuid_t ble_uuid;

    // Initialize service structure
    p_mk_test_service->conn_handle = BLE_CONN_HANDLE_INVALID;
    p_mk_test_service->evt_handler = p_mk_test_service_init->evt_handler;
    
    // Add service
    ble_uuid128_t base_uuid = {BLE_UUID_MK_TEST_SERVICE_BASE_UUID};
    err_code = sd_ble_uuid_vs_add(&base_uuid, &p_mk_test_service->uuid_type);
    if (err_code != NRF_SUCCESS)        
        return err_code;        
    
    ble_uuid.type = p_mk_test_service->uuid_type;
    ble_uuid.uuid = BLE_UUID_MK_TEST_SERVICE_UUID;

    err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY, &ble_uuid, &p_mk_test_service->service_handle);
    if (err_code != NRF_SUCCESS)        
        return err_code;        
    
    err_code = data_io_char_add(p_mk_test_service, p_mk_test_service_init);
    if (err_code != NRF_SUCCESS)        
        return err_code;        
    
    err_code = data_io2_char_add(p_mk_test_service, p_mk_test_service_init);
    if (err_code != NRF_SUCCESS)        
        return err_code;        
    
    err_code = data_chunk_to_pc_char_add(p_mk_test_service, p_mk_test_service_init); // This characteristic sends a 240 byte chunk to the computer
    if (err_code != NRF_SUCCESS)        
        return err_code;        
    
    err_code = next_data_chunk_to_pc_request_char_add(p_mk_test_service, p_mk_test_service_init); // This characteristic sends a 240 byte chunk to the computer
    if (err_code != NRF_SUCCESS)        
        return err_code;  

    return NRF_SUCCESS;
}

Oh and this is in my header file:

/**@brief Service structure. This contains various status information for the service. */
struct ble_mk_test_service_s
{
    uint16_t                    service_handle;
    ble_gatts_char_handles_t    data_io_char_handles;
    ble_gatts_char_handles_t    data_io2_char_handles;
    ble_gatts_char_handles_t    DataPayloadToPCHandle;
    ble_gatts_char_handles_t    RequestMoreDataFromPCHandle;

    uint8_t                     uuid_type;
    uint16_t                    conn_handle;
    ble_mk_test_evt_handler_t   evt_handler;
};

Related