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

sd_ble_gatts_rw_authorize_reply() return SUCCESS by long-length parameter

When create 128byte length's CHARACTERISTIC and read with NRFCONNECT on Android.
NRFCONNECT returns GATT_READ_NOT_PERMIT even though sd_ble_gatts_rw_authorize_reply() completes normally.

code is folowing,

Why sd_ble_gatts_rw_authorize_reply return SUCCESS?

#define	BUFFER_LENGTH				(128)

attr_md.vloc    = BLE_GATTS_VLOC_STACK;
attr_md.rd_auth = 1;
attr_md.wr_auth = 1;
attr_md.vlen    = 0;
memset(&attr_char_value, 0, sizeof(attr_char_value));
attr_char_value.p_uuid    = uuid;
attr_char_value.p_attr_md = &attr_md;
attr_char_value.init_offs = 0;
attr_char_value.init_len  = BUFFER_LENGTH;
attr_char_value.max_len   = BUFFER_LENGTH;
attr_char_value.p_value   = nullptr;
APP_ERROR_CHECK(sd_ble_gatts_characteristic_add(service_handle,
                          &char_md,
                          &attr_char_value,
                          char_param->p_handle));
...........
...........
case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
if ( p_ble_evt->evt.gatts_evt.params.authorize_request.type == BLE_GATTS_AUTHORIZE_TYPE_READ ) {
    reply.params.read.len = BUFFER_LENGTH;
    reply.params.read.offset = 0;
    reply.params.read.p_data = buffer;
	reply.params.read.update = 1;
	reply.params.read.gatt_status = BLE_GATT_STATUS_SUCCESS;
    APP_ERROR_CHECK(sd_ble_gatts_rw_authorize_reply(m_conn_handle, &reply));
}

Parents Reply
  • I do,
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.read_perm);
    BLE_GAP_CONN_SEC_MODE_SET_OPEN(&attr_md.write_perm);

    When I set BUFFER_LENGTH to 20 for confirmation, NRFCONNECT on Android was able to read normally.

    What I'm wander about is that sd_ble_gatts_rw_authorize_reply can set a len larger than ATT_MTU.

    The ultimate goal is to send data longer than ATT_MTU from the GATT server.

    Am I misled?
    Is sd_ble_gatts_rw_authorize_reply len independent of ATT_MTU?

    Problem is NRFCONNECT?

Children
Related