void gatt_process_prep_write_rsp (tGATT_TCB *p_tcb, tGATT_CLCB *p_clcb, UINT8 op_code,
UINT16 len, UINT8 *p_data)
{
- tGATT_VALUE value = {0};
- UINT8 *p= p_data;
+ UINT8 *p = p_data;
+
+ tGATT_VALUE value = {
+ .conn_id = p_clcb->conn_id,
+ .auth_req = GATT_AUTH_REQ_NONE,
+ };
GATT_TRACE_ERROR("value resp op_code = %s len = %d", gatt_dbg_op_name(op_code), len);
void gatt_process_notification(tGATT_TCB *p_tcb, UINT8 op_code,
UINT16 len, UINT8 *p_data)
{
- tGATT_VALUE value = {0};
+ tGATT_VALUE value;
tGATT_REG *p_reg;
UINT16 conn_id;
tGATT_STATUS encrypt_status;
return;
}
- STREAM_TO_UINT16 (value.handle, p);
+ memset(&value, 0, sizeof(value));
+ STREAM_TO_UINT16(value.handle, p);
value.len = len - 2;
memcpy (value.value, p, value.len);
{
p_clcb->op_subtype = GATT_READ_BY_HANDLE;
if (!p_clcb->p_attr_buf)
- p_clcb->p_attr_buf = (UINT8 *)osi_getbuf(GATT_MAX_ATTR_LEN);
- if (p_clcb->p_attr_buf && p_clcb->counter <= GATT_MAX_ATTR_LEN)
- {
+ p_clcb->p_attr_buf = (UINT8 *)osi_malloc(GATT_MAX_ATTR_LEN);
+ if (p_clcb->counter <= GATT_MAX_ATTR_LEN) {
memcpy(p_clcb->p_attr_buf, p, p_clcb->counter);
gatt_act_read(p_clcb, p_clcb->counter);
+ } else {
+ gatt_end_operation(p_clcb, GATT_INTERNAL_ERROR, (void *)p);
}
- else
- gatt_end_operation(p_clcb, GATT_INTERNAL_ERROR, (void *)p);
}
else
{
/* allocate GKI buffer holding up long attribute value */
if (!p_clcb->p_attr_buf)
- p_clcb->p_attr_buf = (UINT8 *)osi_getbuf(GATT_MAX_ATTR_LEN);
+ p_clcb->p_attr_buf = (UINT8 *)osi_malloc(GATT_MAX_ATTR_LEN);
/* copy attrobute value into cb buffer */
- if (p_clcb->p_attr_buf && offset < GATT_MAX_ATTR_LEN)
- {
+ if (offset < GATT_MAX_ATTR_LEN) {
if ((len + offset) > GATT_MAX_ATTR_LEN)
len = GATT_MAX_ATTR_LEN - offset;
}
else
{
- btu_stop_timer (&p_clcb->rsp_timer_ent);
+ alarm_cancel(p_clcb->gatt_rsp_timer_ent);
p_clcb->retry_count = 0;
}
}