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

BLE "User Data" Service

Hi

I am evaluating this profile:

www.bluetooth.com/.../viewer

Is it availabile an implementation in nordic sdk of this profile? Or something similar to have a reference...

Thanks in advance

  • We do not have an example that implements this service.

    I'm not sure if we have something similar, but I would recommend starting with for example Heart Rate Application.

  • I know, it's been a while since the question was asked, but I've just happened to add user data service to my project.

    static ble_gatts_char_handles_t fname_handles;
    static ble_gatts_char_handles_t lname_handles;
    uint16_t uds_handle;
    
    static void add_userdata_service (void)
    {
        ret_code_t      err_code;
        ble_uuid_t      ble_uuid;
    
        /* Add User Data Service */
    
        BLE_UUID_BLE_ASSIGN (ble_uuid, 0x181C);
    
        err_code = sd_ble_gatts_service_add (BLE_GATTS_SRVC_TYPE_PRIMARY,
                                             &ble_uuid,
                                             &uds_handle);
        APP_ERROR_CHECK (err_code);
    
        /* Add First Name characteristic */
    
        char * fname = "Vadim";
        ble_add_char_params_t fname_char_params = {
            .uuid               = 0x2A8A,
            .max_len            = strlen (fname),
            .init_len           = strlen (fname),
            .p_init_value       = (uint8_t *) fname,
            .char_props.read    = 1u,
            .read_access        = SEC_OPEN
        };
    
        err_code = characteristic_add (uds_handle,
                                       &fname_char_params,
                                       &fname_handles);
        APP_ERROR_CHECK (err_code);
    
        /* Add Last Name characteristic */
    
        char * lname = "Barshaw";
        ble_add_char_params_t lname_char_params = {
            .uuid               = 0x2A90,
            .max_len            = strlen (lname),
            .init_len           = strlen (lname),
            .p_init_value       = (uint8_t *) lname,
            .char_props.read    = 1u,
            .read_access        = SEC_OPEN
        };
    
        err_code = characteristic_add (uds_handle,
                                       &lname_char_params,
                                       &lname_handles);
        APP_ERROR_CHECK (err_code);
    }
    

    Hope this helps.

        Vadim

Related