component/bt: Fix bug: Respond with the Error Response when receiving a request that it does not support

This commit is contained in:
baohongde 2018-06-21 20:20:21 +08:00
parent 4df08f9815
commit 012415c9f8
2 changed files with 10 additions and 4 deletions

View file

@ -979,7 +979,12 @@ void gatt_data_process (tGATT_TCB *p_tcb, BT_HDR *p_buf)
}
}
} else {
GATT_TRACE_ERROR ("ATT - Rcvd L2CAP data, unknown cmd: 0x%x\n", op_code);
if (op_code & GATT_COMMAND_FLAG) {
GATT_TRACE_ERROR ("ATT - Rcvd L2CAP data, unknown cmd: 0x%x\n", op_code);
} else {
GATT_TRACE_ERROR ("ATT - Rcvd L2CAP data, unknown req: 0x%x\n", op_code);
gatt_send_error_rsp (p_tcb, GATT_REQ_NOT_SUPPORTED, op_code, 0, FALSE);
}
}
} else {
GATT_TRACE_ERROR ("invalid data length, ignore\n");

View file

@ -111,6 +111,7 @@ typedef UINT8 tGATT_STATUS;
#define GATT_SIGN_CMD_WRITE 0xD2 /* changed in V4.0 1101-0010 (signed write) see write cmd above*/
#define GATT_OP_CODE_MAX GATT_HANDLE_VALUE_CONF + 1 /* 0x1E = 30 + 1 = 31*/
#define GATT_COMMAND_FLAG 0x40 /* Command Flag: set to one means commond */
#define GATT_HANDLE_IS_VALID(x) ((x) != 0)