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

characteritic read authorize reply what is the err

			case BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST:
			{	
				ble_gatts_evt_rw_authorize_request_t  *p_authorize_request;
				p_authorize_request = &p_ble_evt->evt.gatts_evt.params.authorize_request;
				
				if(p_authorize_request->type == BLE_GATTS_AUTHORIZE_TYPE_READ)
				{
					ble_gatts_rw_authorize_reply_params_t authorize_reply_para;
					
					authorize_reply_para.type = BLE_GATTS_AUTHORIZE_TYPE_READ;
					switch(p_authorize_request->request.read.context.char_uuid.uuid)
					{	
						case 0xfff3:
						{
							uint8_t reply[5];
							uint32_t ret;

							if (triggerHistoryDataCursor == triggerHistoryDataSize) {
								
								memset(reply,0,sizeof(reply));
							}
							else {
								uint32_t time = triggerEventData[triggerHistoryDataCursor].timestamp;
								reply[0] = triggerEventData[triggerHistoryDataCursor].trig;
								reply[1] = BREAK_UINT32(time, 3);
								reply[2] = BREAK_UINT32(time, 2);
								reply[3] = BREAK_UINT32(time, 1);
								reply[4] = BREAK_UINT32(time, 0);
								incrtriggerHistoryDataCursor();
							}
							
							authorize_reply_para.params.read.gatt_status = BLE_GATT_STATUS_SUCCESS;
							authorize_reply_para.params.read.update = 1;
							authorize_reply_para.params.read.p_data = reply;
							authorize_reply_para.params.read.len = TRIGGER_EVENT_DATA_LEN;
							ret = sd_ble_gatts_rw_authorize_reply(p_jawbone->conn_handle, &authorize_reply_para);
							printf("ret = %d\n", ret);
							break;
						}	

the ret vaule always 7,,what this the err in my code?

Parents
  • Always check the documentation of the function that returns the error.

    /**@brief Respond to a Read/Write authorization request.
     *
     * @note This call should only be used as a response to a @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event issued to the application.
     *
     * @param[in] conn_handle                 Connection handle.
     * @param[in] p_rw_authorize_reply_params Pointer to a structure with the attribute provided by the application.
     *
     * @retval ::NRF_SUCCESS               Successfully queued a response to the peer, and in the case of a write operation, Attribute Table updated.
     * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
     * @retval ::NRF_ERROR_INVALID_STATE   Invalid Connection State or no authorization request pending.
     * @retval ::NRF_ERROR_INVALID_PARAM   Authorization op invalid,
     *                                         or for Read Authorization reply: requested handles not replied with,
     *                                         or for Write Authorization reply: handle supplied does not match requested handle.
     * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time.
     */
    SVCALL(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, uint32_t, sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const *p_rw_authorize_reply_params));
    

    If you are using Keil, right click on NRF_ERROR_INVALID_PARAM and click "Go to Definition of..." and you see that this is 0x00000007. I'm not sure what parameter that is invalid though.

Reply
  • Always check the documentation of the function that returns the error.

    /**@brief Respond to a Read/Write authorization request.
     *
     * @note This call should only be used as a response to a @ref BLE_GATTS_EVT_RW_AUTHORIZE_REQUEST event issued to the application.
     *
     * @param[in] conn_handle                 Connection handle.
     * @param[in] p_rw_authorize_reply_params Pointer to a structure with the attribute provided by the application.
     *
     * @retval ::NRF_SUCCESS               Successfully queued a response to the peer, and in the case of a write operation, Attribute Table updated.
     * @retval ::BLE_ERROR_INVALID_CONN_HANDLE Invalid Connection Handle.
     * @retval ::NRF_ERROR_INVALID_STATE   Invalid Connection State or no authorization request pending.
     * @retval ::NRF_ERROR_INVALID_PARAM   Authorization op invalid,
     *                                         or for Read Authorization reply: requested handles not replied with,
     *                                         or for Write Authorization reply: handle supplied does not match requested handle.
     * @retval ::NRF_ERROR_BUSY The stack is busy. Retry at later time.
     */
    SVCALL(SD_BLE_GATTS_RW_AUTHORIZE_REPLY, uint32_t, sd_ble_gatts_rw_authorize_reply(uint16_t conn_handle, ble_gatts_rw_authorize_reply_params_t const *p_rw_authorize_reply_params));
    

    If you are using Keil, right click on NRF_ERROR_INVALID_PARAM and click "Go to Definition of..." and you see that this is 0x00000007. I'm not sure what parameter that is invalid though.

Children
No Data
Related