This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Reading Long characteristic

Hi Details: I want To send 40 bytes from GATT Server.My Requirement is same as in this link.I have added the code snippet in this link in my code.When I am sending 20 Bytes it is working fine.If i am sending more than 20 bytes it gives Error message which i attached.My codes are following Characteristics Declaration: attr_md.vloc = BLE_GATTS_VLOC_STACK; attr_md.rd_auth = 1; attr_md.wr_auth = 0; attr_md.vlen = 1; uint8_t data_buffer[40] = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20};

Characteristics Value Declaration: attr_char_value.p_uuid = &ble_uuid; attr_char_value.p_attr_md = &attr_md; attr_char_value.init_len = sizeof(uint8_t); attr_char_value.init_offs = 0; attr_char_value.max_len = 100; attr_char_value.p_value=data_buffer;

on_ble_evt Handler case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST: { ble_gatts_evt_rw_authorize_request_t *p_evt_rw_auth_req = &p_ble_evt->evt.gatts_evt.params.authorize_request;

        if(p_evt_rw_auth_req->type == BLE_GATTS_AUTHORIZE_TYPE_READ)
        {
            if (p_evt_rw_auth_req->request.read.handle == m_nus.rx_handles.value_handle)
            {
                sd_ble_gatts_value_get(m_conn_handle,m_nus.rx_handles.value_handle,get_value);
            	ble_gatts_rw_authorize_reply_params_t p_rw_authorize_reply_params;
                            p_rw_authorize_reply_params.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
            	            p_rw_authorize_reply_params.params.read.gatt_status = BLE_GATT_STATUS_SUCCESS;
            	            p_rw_authorize_reply_params.params.read.update = 1;
            	            p_rw_authorize_reply_params.params.read.len = get_value->len;
            	            p_rw_authorize_reply_params.params.read.offset = get_value->offset;
            	            p_rw_authorize_reply_params.params.read.p_data = get_value->p_value;
            	            err_code1= sd_ble_gatts_rw_authorize_reply(m_nus.conn_handle, &p_rw_authorize_reply_params);
            	            APP_ERROR_CHECK(err_code1);

            }

      }
    }break;

Looking For Your Help and Thanks in Advance. Master_Control_Panel_Error_Message.png

Related