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

Long Attributes

Hi, I need to have long attributes. So I need 'Read Blob' operation for read and Queued writes ('Prepare Write' and 'Execute Write'). Does Soft Device for nrf51822 support mentioned commands?

Best regards, Artem Zemlyanukhin

Parents
  • Hi,

    I have an issue with Read Blob, could you help to solve it please?

    I have attribute 'att1' with 64 bytes length allocated in user ram (BLE_GATTS_VLOC_USER). I use authorized read.

    For example, 'att1' contains zeroes. Because MTU = 23, I need 3 ReadBlobRequests to read it.

    In BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event handler I must set parameters for 'sd_ble_gatts_rw_authorize_reply' and call it.

    At first, I used following parameters:

    auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
    auth_reply.params.read.offset = offset;
    auth_reply.params.read.p_data = data;
    auth_reply.params.read.update = 1;
    

    'data' and 'att1' is not the same (so I set update = 1). For example 'data' points to array that contains numbers from 0x00 to 0x3F.

    Here are the results from Master Control Panel:

    [17:15:26.5] Received Read Blob Response, offset 0, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15 [17:15:26.5] Received Read Blob Response, offset 22, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15 [17:15:26.5] Received Read Blob Response, offset 44, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13

    If you can see melody_offset does not matter...

    Then I changed parameters to:

    auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
    auth_reply.params.read.offset = 0;
    auth_reply.params.read.p_data = data + offset;
    auth_reply.params.read.update = 1;
    

    then:

    [17:17:37.2] Received Read Blob Response, offset 0, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15 [17:17:37.3] Received Read Blob Response, offset 22, value (0x): 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 [17:17:37.3] Received Read Blob Response, offset 44, value (0x): 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

    And at the end:

    auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
    auth_reply.params.read.offset = offset;
    auth_reply.params.read.p_data = data + offset;
    auth_reply.params.read.update = 1;
    

    And after that I got results that I need:

    [17:19:09.5] Received Read Blob Response, offset 0, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15 [17:19:09.6] Received Read Blob Response, offset 22, value (0x): 16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B [17:19:09.6] Received Read Blob Response, offset 44, value (0x): 2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F

    But why do I have to set p_data = data + offset? I already set offset..

    Also I tried to reset update field and assign to auth_reply.params.read.p_data pointer to 'att1'. In this case, all three are correct methods. So I guess if update = 0, p_data and offset values do not matter. But I need to use update = 1 because actually I have array strings (each of 64 bytes) and in different cases I want to point in 'sd_ble_gatts_rw_authorize_reply' different rows fo my array.

Reply
  • Hi,

    I have an issue with Read Blob, could you help to solve it please?

    I have attribute 'att1' with 64 bytes length allocated in user ram (BLE_GATTS_VLOC_USER). I use authorized read.

    For example, 'att1' contains zeroes. Because MTU = 23, I need 3 ReadBlobRequests to read it.

    In BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event handler I must set parameters for 'sd_ble_gatts_rw_authorize_reply' and call it.

    At first, I used following parameters:

    auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
    auth_reply.params.read.offset = offset;
    auth_reply.params.read.p_data = data;
    auth_reply.params.read.update = 1;
    

    'data' and 'att1' is not the same (so I set update = 1). For example 'data' points to array that contains numbers from 0x00 to 0x3F.

    Here are the results from Master Control Panel:

    [17:15:26.5] Received Read Blob Response, offset 0, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15 [17:15:26.5] Received Read Blob Response, offset 22, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15 [17:15:26.5] Received Read Blob Response, offset 44, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13

    If you can see melody_offset does not matter...

    Then I changed parameters to:

    auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
    auth_reply.params.read.offset = 0;
    auth_reply.params.read.p_data = data + offset;
    auth_reply.params.read.update = 1;
    

    then:

    [17:17:37.2] Received Read Blob Response, offset 0, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15 [17:17:37.3] Received Read Blob Response, offset 22, value (0x): 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 [17:17:37.3] Received Read Blob Response, offset 44, value (0x): 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00

    And at the end:

    auth_reply.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
    auth_reply.params.read.offset = offset;
    auth_reply.params.read.p_data = data + offset;
    auth_reply.params.read.update = 1;
    

    And after that I got results that I need:

    [17:19:09.5] Received Read Blob Response, offset 0, value (0x): 00-01-02-03-04-05-06-07-08-09-0A-0B-0C-0D-0E-0F-10-11-12-13-14-15 [17:19:09.6] Received Read Blob Response, offset 22, value (0x): 16-17-18-19-1A-1B-1C-1D-1E-1F-20-21-22-23-24-25-26-27-28-29-2A-2B [17:19:09.6] Received Read Blob Response, offset 44, value (0x): 2C-2D-2E-2F-30-31-32-33-34-35-36-37-38-39-3A-3B-3C-3D-3E-3F

    But why do I have to set p_data = data + offset? I already set offset..

    Also I tried to reset update field and assign to auth_reply.params.read.p_data pointer to 'att1'. In this case, all three are correct methods. So I guess if update = 0, p_data and offset values do not matter. But I need to use update = 1 because actually I have array strings (each of 64 bytes) and in different cases I want to point in 'sd_ble_gatts_rw_authorize_reply' different rows fo my array.

Children
No Data
Related