How to read the Value below for ATT with only Handle (0x002a) but no UUID

How to read the Value below for ATT with only Handle (0x002a) but no UUID,as shown in the following figure

  • Can you back-track a bit and give a high level overview of what you are doing and why? Why don't do a service discovery to find the handles? Or am I missing something else? Please elaborate.

  • Normally, the handle is found through the service. However, Central does not send data according to service characteristics, but only according to handles.
    The following is the data code sent by Central. I changed the handle to 0x002a, and now I can also receive data on the peripheral end. Of course, Wireshark did not capture UUID; Note that the UUID in the attached image is an old Central device from our company:

    uint32_t ble_lbs_rc_data_send(ble_lbs_c_t * p_ble_lbs_c, uint8_t *status,uint8_t statalen)
    {
        VERIFY_PARAM_NOT_NULL(p_ble_lbs_c);

        if (p_ble_lbs_c->conn_handle == BLE_CONN_HANDLE_INVALID)
        {
            return NRF_ERROR_INVALID_STATE;
        }

        NRF_LOG_DEBUG("Writing LED status 0x%x", status);

        nrf_ble_gq_req_t write_req;

        memset(&write_req, 0, sizeof(nrf_ble_gq_req_t));

        write_req.type                        = NRF_BLE_GQ_REQ_GATTC_WRITE;
        write_req.error_handler.cb            = gatt_error_handler;
        write_req.error_handler.p_ctx         = p_ble_lbs_c;
        write_req.params.gattc_write.handle   = 0x2a;//p_ble_lbs_c->peer_lbs_db.led_handle;
        write_req.params.gattc_write.len      = statalen;//sizeof(status);
        write_req.params.gattc_write.p_value  = status;
        write_req.params.gattc_write.offset   = 0;
        write_req.params.gattc_write.write_op = BLE_GATT_OP_WRITE_CMD;

        return nrf_ble_gq_item_add(p_ble_lbs_c->p_gatt_queue, &write_req, p_ble_lbs_c->conn_handle);
    }

  • Hi,

    bao008 said:
    Normally, the handle is found through the service. However, Central does not send data according to service characteristics, but only according to handles.

    It sounds like there is an issue with the central then? And that this should be fixed there?

    That said, you can specify the handle directly as you have indicated as long as you know it. (The service discovery procedure is only there to find the services and characteristics, and the corresponding handles. After that, only the handles are used). For that, you can refer to the thread I linked to in my first reply.

Related