• Home
  • Raw
  • Download

Lines Matching refs:p_clcb

52 void gatt_send_prepare_write(tGATT_TCB& tcb, tGATT_CLCB* p_clcb);
81 void gatt_act_discovery(tGATT_CLCB* p_clcb) { in gatt_act_discovery() argument
82 uint8_t op_code = disc_type_to_att_opcode[p_clcb->op_subtype]; in gatt_act_discovery()
84 if (p_clcb->s_handle > p_clcb->e_handle || p_clcb->s_handle == 0) { in gatt_act_discovery()
86 gatt_end_operation(p_clcb, GATT_SUCCESS, NULL); in gatt_act_discovery()
93 cl_req.browse.s_handle = p_clcb->s_handle; in gatt_act_discovery()
94 cl_req.browse.e_handle = p_clcb->e_handle; in gatt_act_discovery()
96 if (disc_type_to_uuid[p_clcb->op_subtype] != 0) { in gatt_act_discovery()
98 bluetooth::Uuid::From16Bit(disc_type_to_uuid[p_clcb->op_subtype]); in gatt_act_discovery()
101 if (p_clcb->op_subtype == in gatt_act_discovery()
105 bluetooth::Uuid::From16Bit(disc_type_to_uuid[p_clcb->op_subtype]); in gatt_act_discovery()
106 cl_req.find_type_value.s_handle = p_clcb->s_handle; in gatt_act_discovery()
107 cl_req.find_type_value.e_handle = p_clcb->e_handle; in gatt_act_discovery()
109 size_t size = p_clcb->uuid.GetShortestRepresentationSize(); in gatt_act_discovery()
113 UINT16_TO_STREAM(p, p_clcb->uuid.As16Bit()); in gatt_act_discovery()
116 memcpy(cl_req.find_type_value.value, p_clcb->uuid.To128BitLE().data(), in gatt_act_discovery()
120 memcpy(cl_req.find_type_value.value, p_clcb->uuid.To128BitLE().data(), in gatt_act_discovery()
124 tGATT_STATUS st = attp_send_cl_msg(*p_clcb->p_tcb, p_clcb, op_code, &cl_req); in gatt_act_discovery()
126 gatt_end_operation(p_clcb, GATT_ERROR, NULL); in gatt_act_discovery()
139 void gatt_act_read(tGATT_CLCB* p_clcb, uint16_t offset) { in gatt_act_read() argument
140 tGATT_TCB& tcb = *p_clcb->p_tcb; in gatt_act_read()
147 switch (p_clcb->op_subtype) { in gatt_act_read()
151 msg.browse.s_handle = p_clcb->s_handle; in gatt_act_read()
152 msg.browse.e_handle = p_clcb->e_handle; in gatt_act_read()
153 if (p_clcb->op_subtype == GATT_READ_BY_TYPE) in gatt_act_read()
154 msg.browse.uuid = p_clcb->uuid; in gatt_act_read()
162 if (!p_clcb->counter) { in gatt_act_read()
164 msg.handle = p_clcb->s_handle; in gatt_act_read()
166 if (!p_clcb->first_read_blob_after_read) in gatt_act_read()
167 p_clcb->first_read_blob_after_read = true; in gatt_act_read()
169 p_clcb->first_read_blob_after_read = false; in gatt_act_read()
172 << p_clcb->first_read_blob_after_read; in gatt_act_read()
175 msg.read_blob.handle = p_clcb->s_handle; in gatt_act_read()
177 p_clcb->op_subtype &= ~0x80; in gatt_act_read()
182 msg.read_blob.handle = p_clcb->s_handle; in gatt_act_read()
188 memcpy(&msg.read_multi, p_clcb->p_attr_buf, sizeof(tGATT_READ_MULTI)); in gatt_act_read()
193 msg.handle = p_clcb->s_handle; in gatt_act_read()
194 p_clcb->op_subtype &= ~0x90; in gatt_act_read()
198 LOG(ERROR) << "Unknown read type:" << +p_clcb->op_subtype; in gatt_act_read()
202 if (op_code != 0) rt = attp_send_cl_msg(tcb, p_clcb, op_code, &msg); in gatt_act_read()
205 gatt_end_operation(p_clcb, rt, NULL); in gatt_act_read()
210 void gatt_act_write(tGATT_CLCB* p_clcb, uint8_t sec_act) { in gatt_act_write() argument
211 tGATT_TCB& tcb = *p_clcb->p_tcb; in gatt_act_write()
213 CHECK(p_clcb->p_attr_buf); in gatt_act_write()
214 tGATT_VALUE& attr = *((tGATT_VALUE*)p_clcb->p_attr_buf); in gatt_act_write()
216 switch (p_clcb->op_subtype) { in gatt_act_write()
218 p_clcb->s_handle = attr.handle; in gatt_act_write()
221 uint8_t rt = gatt_send_write_msg(tcb, p_clcb, op_code, attr.handle, in gatt_act_write()
228 gatt_end_operation(p_clcb, rt, NULL); in gatt_act_write()
235 p_clcb->s_handle = attr.handle; in gatt_act_write()
237 uint8_t rt = gatt_send_write_msg(tcb, p_clcb, GATT_REQ_WRITE, in gatt_act_write()
246 gatt_end_operation(p_clcb, rt, NULL); in gatt_act_write()
251 gatt_send_prepare_write(tcb, p_clcb); in gatt_act_write()
257 gatt_send_prepare_write(tcb, p_clcb); in gatt_act_write()
261 CHECK(false) << "Unknown write type" << p_clcb->op_subtype; in gatt_act_write()
274 void gatt_send_queue_write_cancel(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, in gatt_send_queue_write_cancel() argument
282 rt = attp_send_cl_msg(tcb, p_clcb, GATT_REQ_EXEC_WRITE, &gatt_cl_msg); in gatt_send_queue_write_cancel()
285 gatt_end_operation(p_clcb, rt, NULL); in gatt_send_queue_write_cancel()
297 bool gatt_check_write_long_terminate(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, in gatt_check_write_long_terminate() argument
299 tGATT_VALUE* p_attr = (tGATT_VALUE*)p_clcb->p_attr_buf; in gatt_check_write_long_terminate()
307 p_rsp_value->len != p_clcb->counter || in gatt_check_write_long_terminate()
311 p_clcb->status = GATT_ERROR; in gatt_check_write_long_terminate()
316 p_clcb->status = GATT_SUCCESS; in gatt_check_write_long_terminate()
321 if (terminate && p_clcb->op_subtype != GATT_WRITE_PREPARE) { in gatt_check_write_long_terminate()
322 gatt_send_queue_write_cancel(tcb, p_clcb, flag); in gatt_check_write_long_terminate()
328 void gatt_send_prepare_write(tGATT_TCB& tcb, tGATT_CLCB* p_clcb) { in gatt_send_prepare_write() argument
329 tGATT_VALUE* p_attr = (tGATT_VALUE*)p_clcb->p_attr_buf; in gatt_send_prepare_write()
330 uint8_t type = p_clcb->op_subtype; in gatt_send_prepare_write()
339 p_clcb->s_handle = p_attr->handle; in gatt_send_prepare_write()
343 offset += p_clcb->start_offset; in gatt_send_prepare_write()
348 uint8_t rt = gatt_send_write_msg(tcb, p_clcb, GATT_REQ_PREPARE_WRITE, in gatt_send_prepare_write()
354 p_clcb->counter = to_send; in gatt_send_prepare_write()
357 gatt_end_operation(p_clcb, rt, NULL); in gatt_send_prepare_write()
372 tGATT_CLCB* p_clcb, uint16_t len, in gatt_process_find_type_value_rsp() argument
379 if (p_clcb->operation != GATTC_OPTYPE_DISCOVERY || in gatt_process_find_type_value_rsp()
380 p_clcb->op_subtype != GATT_DISC_SRVC_BY_UUID) in gatt_process_find_type_value_rsp()
390 result.value.group_value.service_type = p_clcb->uuid; in gatt_process_find_type_value_rsp()
394 if (p_clcb->p_reg->app_cb.p_disc_res_cb) in gatt_process_find_type_value_rsp()
395 (*p_clcb->p_reg->app_cb.p_disc_res_cb)(p_clcb->conn_id, in gatt_process_find_type_value_rsp()
396 p_clcb->op_subtype, &result); in gatt_process_find_type_value_rsp()
400 p_clcb->s_handle = (result.value.group_value.e_handle == 0) in gatt_process_find_type_value_rsp()
404 gatt_act_discovery(p_clcb); in gatt_process_find_type_value_rsp()
417 void gatt_process_read_info_rsp(UNUSED_ATTR tGATT_TCB& tcb, tGATT_CLCB* p_clcb, in gatt_process_read_info_rsp() argument
425 gatt_end_operation(p_clcb, GATT_INVALID_PDU, NULL); in gatt_process_read_info_rsp()
429 if (p_clcb->operation != GATTC_OPTYPE_DISCOVERY || in gatt_process_read_info_rsp()
430 p_clcb->op_subtype != GATT_DISC_CHAR_DSCPT) in gatt_process_read_info_rsp()
447 result.type = p_clcb->uuid; in gatt_process_read_info_rsp()
451 if (p_clcb->p_reg->app_cb.p_disc_res_cb) in gatt_process_read_info_rsp()
452 (*p_clcb->p_reg->app_cb.p_disc_res_cb)(p_clcb->conn_id, in gatt_process_read_info_rsp()
453 p_clcb->op_subtype, &result); in gatt_process_read_info_rsp()
456 p_clcb->s_handle = (result.handle == 0) ? 0 : (result.handle + 1); in gatt_process_read_info_rsp()
458 gatt_act_discovery(p_clcb); in gatt_process_read_info_rsp()
470 void gatt_proc_disc_error_rsp(UNUSED_ATTR tGATT_TCB& tcb, tGATT_CLCB* p_clcb, in gatt_proc_disc_error_rsp() argument
493 gatt_end_operation(p_clcb, status, NULL); in gatt_proc_disc_error_rsp()
506 void gatt_process_error_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, in gatt_process_error_rsp() argument
511 tGATT_VALUE* p_attr = (tGATT_VALUE*)p_clcb->p_attr_buf; in gatt_process_error_rsp()
533 if (p_clcb->operation == GATTC_OPTYPE_DISCOVERY) { in gatt_process_error_rsp()
534 gatt_proc_disc_error_rsp(tcb, p_clcb, opcode, handle, reason); in gatt_process_error_rsp()
536 if ((p_clcb->operation == GATTC_OPTYPE_WRITE) && in gatt_process_error_rsp()
537 (p_clcb->op_subtype == GATT_WRITE) && in gatt_process_error_rsp()
540 p_clcb->status = reason; in gatt_process_error_rsp()
541 gatt_send_queue_write_cancel(tcb, p_clcb, GATT_PREP_WRITE_CANCEL); in gatt_process_error_rsp()
542 } else if ((p_clcb->operation == GATTC_OPTYPE_READ) && in gatt_process_error_rsp()
543 ((p_clcb->op_subtype == GATT_READ_CHAR_VALUE_HDL) || in gatt_process_error_rsp()
544 (p_clcb->op_subtype == GATT_READ_BY_HANDLE)) && in gatt_process_error_rsp()
546 p_clcb->first_read_blob_after_read && in gatt_process_error_rsp()
548 gatt_end_operation(p_clcb, GATT_SUCCESS, (void*)p_clcb->p_attr_buf); in gatt_process_error_rsp()
550 gatt_end_operation(p_clcb, reason, NULL); in gatt_process_error_rsp()
563 void gatt_process_prep_write_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, in gatt_process_prep_write_rsp() argument
569 .conn_id = p_clcb->conn_id, .auth_req = GATT_AUTH_REQ_NONE, in gatt_process_prep_write_rsp()
577 gatt_end_operation(p_clcb, GATT_INVALID_PDU, &value); in gatt_process_prep_write_rsp()
588 if (!gatt_check_write_long_terminate(tcb, p_clcb, &value)) { in gatt_process_prep_write_rsp()
589 gatt_send_prepare_write(tcb, p_clcb); in gatt_process_prep_write_rsp()
593 if (p_clcb->op_subtype == GATT_WRITE_PREPARE) { in gatt_process_prep_write_rsp()
596 gatt_end_operation(p_clcb, p_clcb->status, &value); in gatt_process_prep_write_rsp()
699 void gatt_process_read_by_type_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, in gatt_process_read_by_type_rsp() argument
708 if (((!p_clcb->p_reg) || (!p_clcb->p_reg->app_cb.p_disc_res_cb)) && in gatt_process_read_by_type_rsp()
709 (p_clcb->operation == GATTC_OPTYPE_DISCOVERY)) in gatt_process_read_by_type_rsp()
714 gatt_end_operation(p_clcb, GATT_INVALID_PDU, NULL); in gatt_process_read_by_type_rsp()
729 gatt_end_operation(p_clcb, GATT_ERROR, NULL); in gatt_process_read_by_type_rsp()
742 gatt_end_operation(p_clcb, GATT_INVALID_HANDLE, NULL); in gatt_process_read_by_type_rsp()
751 bluetooth::Uuid::From16Bit(disc_type_to_uuid[p_clcb->op_subtype]); in gatt_process_read_by_type_rsp()
754 if (p_clcb->operation == GATTC_OPTYPE_DISCOVERY && in gatt_process_read_by_type_rsp()
755 p_clcb->op_subtype == GATT_DISC_SRVC_ALL && in gatt_process_read_by_type_rsp()
760 gatt_end_operation(p_clcb, GATT_INVALID_HANDLE, NULL); in gatt_process_read_by_type_rsp()
772 else if (p_clcb->operation == GATTC_OPTYPE_DISCOVERY && in gatt_process_read_by_type_rsp()
773 p_clcb->op_subtype == GATT_DISC_INC_SRVC) { in gatt_process_read_by_type_rsp()
777 gatt_end_operation(p_clcb, GATT_INVALID_PDU, NULL); in gatt_process_read_by_type_rsp()
785 gatt_end_operation(p_clcb, GATT_INVALID_HANDLE, NULL); in gatt_process_read_by_type_rsp()
795 p_clcb->s_handle = record_value.incl_service.s_handle; in gatt_process_read_by_type_rsp()
796 p_clcb->read_uuid128.wait_for_read_rsp = true; in gatt_process_read_by_type_rsp()
797 p_clcb->read_uuid128.next_disc_start_hdl = handle + 1; in gatt_process_read_by_type_rsp()
798 memcpy(&p_clcb->read_uuid128.result, &result, sizeof(result)); in gatt_process_read_by_type_rsp()
799 memcpy(&p_clcb->read_uuid128.result.value, &record_value, in gatt_process_read_by_type_rsp()
801 p_clcb->op_subtype |= 0x90; in gatt_process_read_by_type_rsp()
802 gatt_act_read(p_clcb, 0); in gatt_process_read_by_type_rsp()
808 gatt_end_operation(p_clcb, GATT_INVALID_PDU, (void*)p); in gatt_process_read_by_type_rsp()
813 else if (p_clcb->operation == GATTC_OPTYPE_READ && in gatt_process_read_by_type_rsp()
814 p_clcb->op_subtype == GATT_READ_BY_TYPE) { in gatt_process_read_by_type_rsp()
815 p_clcb->counter = len - 2; in gatt_process_read_by_type_rsp()
816 p_clcb->s_handle = handle; in gatt_process_read_by_type_rsp()
817 if (p_clcb->counter == (p_clcb->p_tcb->payload_size - 4)) { in gatt_process_read_by_type_rsp()
818 p_clcb->op_subtype = GATT_READ_BY_HANDLE; in gatt_process_read_by_type_rsp()
819 if (!p_clcb->p_attr_buf) in gatt_process_read_by_type_rsp()
820 p_clcb->p_attr_buf = (uint8_t*)osi_malloc(GATT_MAX_ATTR_LEN); in gatt_process_read_by_type_rsp()
821 if (p_clcb->counter <= GATT_MAX_ATTR_LEN) { in gatt_process_read_by_type_rsp()
822 memcpy(p_clcb->p_attr_buf, p, p_clcb->counter); in gatt_process_read_by_type_rsp()
823 gatt_act_read(p_clcb, p_clcb->counter); in gatt_process_read_by_type_rsp()
825 gatt_end_operation(p_clcb, GATT_INTERNAL_ERROR, (void*)p); in gatt_process_read_by_type_rsp()
828 gatt_end_operation(p_clcb, GATT_SUCCESS, (void*)p); in gatt_process_read_by_type_rsp()
836 gatt_end_operation(p_clcb, GATT_INVALID_PDU, NULL); in gatt_process_read_by_type_rsp()
842 gatt_end_operation(p_clcb, GATT_INVALID_HANDLE, NULL); in gatt_process_read_by_type_rsp()
847 gatt_end_operation(p_clcb, GATT_SUCCESS, NULL); in gatt_process_read_by_type_rsp()
853 if (!p_clcb->uuid.IsEmpty() && in gatt_process_read_by_type_rsp()
855 record_value.dclr_value.char_uuid != p_clcb->uuid) { in gatt_process_read_by_type_rsp()
860 if (p_clcb->operation == GATTC_OPTYPE_READ) in gatt_process_read_by_type_rsp()
865 p_clcb->s_handle = record_value.dclr_value.val_handle; in gatt_process_read_by_type_rsp()
866 p_clcb->op_subtype |= 0x80; in gatt_process_read_by_type_rsp()
867 gatt_act_read(p_clcb, 0); in gatt_process_read_by_type_rsp()
877 if (p_clcb->operation == GATTC_OPTYPE_DISCOVERY && in gatt_process_read_by_type_rsp()
878 p_clcb->p_reg->app_cb.p_disc_res_cb) in gatt_process_read_by_type_rsp()
879 (*p_clcb->p_reg->app_cb.p_disc_res_cb)(p_clcb->conn_id, in gatt_process_read_by_type_rsp()
880 p_clcb->op_subtype, &result); in gatt_process_read_by_type_rsp()
883 p_clcb->s_handle = (handle == 0) ? 0 : (handle + 1); in gatt_process_read_by_type_rsp()
885 if (p_clcb->operation == GATTC_OPTYPE_DISCOVERY) { in gatt_process_read_by_type_rsp()
887 gatt_act_discovery(p_clcb); in gatt_process_read_by_type_rsp()
890 gatt_act_read(p_clcb, 0); in gatt_process_read_by_type_rsp()
904 void gatt_process_read_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, in gatt_process_read_rsp() argument
907 uint16_t offset = p_clcb->counter; in gatt_process_read_rsp()
910 if (p_clcb->operation == GATTC_OPTYPE_READ) { in gatt_process_read_rsp()
911 if (p_clcb->op_subtype != GATT_READ_BY_HANDLE) { in gatt_process_read_rsp()
912 p_clcb->counter = len; in gatt_process_read_rsp()
913 gatt_end_operation(p_clcb, GATT_SUCCESS, (void*)p); in gatt_process_read_rsp()
916 if (!p_clcb->p_attr_buf) in gatt_process_read_rsp()
917 p_clcb->p_attr_buf = (uint8_t*)osi_malloc(GATT_MAX_ATTR_LEN); in gatt_process_read_rsp()
924 p_clcb->counter += len; in gatt_process_read_rsp()
926 memcpy(p_clcb->p_attr_buf + offset, p, len); in gatt_process_read_rsp()
936 offset, len, p_clcb->counter); in gatt_process_read_rsp()
937 gatt_act_read(p_clcb, p_clcb->counter); in gatt_process_read_rsp()
940 gatt_end_operation(p_clcb, GATT_SUCCESS, (void*)p_clcb->p_attr_buf); in gatt_process_read_rsp()
945 << " p_attr_buf = " << p_clcb->p_attr_buf; in gatt_process_read_rsp()
946 gatt_end_operation(p_clcb, GATT_NO_RESOURCES, in gatt_process_read_rsp()
947 (void*)p_clcb->p_attr_buf); in gatt_process_read_rsp()
951 if (p_clcb->operation == GATTC_OPTYPE_DISCOVERY && in gatt_process_read_rsp()
952 p_clcb->op_subtype == GATT_DISC_INC_SRVC && in gatt_process_read_rsp()
953 p_clcb->read_uuid128.wait_for_read_rsp) { in gatt_process_read_rsp()
954 p_clcb->s_handle = p_clcb->read_uuid128.next_disc_start_hdl; in gatt_process_read_rsp()
955 p_clcb->read_uuid128.wait_for_read_rsp = false; in gatt_process_read_rsp()
957 p_clcb->read_uuid128.result.value.incl_service.service_type = in gatt_process_read_rsp()
959 if (p_clcb->p_reg->app_cb.p_disc_res_cb) in gatt_process_read_rsp()
960 (*p_clcb->p_reg->app_cb.p_disc_res_cb)(p_clcb->conn_id, in gatt_process_read_rsp()
961 p_clcb->op_subtype, in gatt_process_read_rsp()
962 &p_clcb->read_uuid128.result); in gatt_process_read_rsp()
963 gatt_act_discovery(p_clcb); in gatt_process_read_rsp()
965 gatt_end_operation(p_clcb, GATT_INVALID_PDU, (void*)p); in gatt_process_read_rsp()
981 void gatt_process_handle_rsp(tGATT_CLCB* p_clcb) { in gatt_process_handle_rsp() argument
982 gatt_end_operation(p_clcb, GATT_SUCCESS, NULL); in gatt_process_handle_rsp()
994 void gatt_process_mtu_rsp(tGATT_TCB& tcb, tGATT_CLCB* p_clcb, uint16_t len, in gatt_process_mtu_rsp() argument
1011 gatt_end_operation(p_clcb, status, NULL); in gatt_process_mtu_rsp()
1051 tGATT_CLCB* p_clcb = gatt_cmd_dequeue(tcb, &rsp_code); in gatt_cl_send_next_cmd_inq() local
1054 gatt_end_operation(p_clcb, att_ret, NULL); in gatt_cl_send_next_cmd_inq()
1062 gatt_start_rsp_timer(cmd.p_clcb); in gatt_cl_send_next_cmd_inq()
1085 tGATT_CLCB* p_clcb = gatt_cmd_dequeue(tcb, &cmd_code); in gatt_client_handle_server_rsp() local
1087 if (!p_clcb || (rsp_code != op_code && op_code != GATT_RSP_ERROR)) { in gatt_client_handle_server_rsp()
1094 if (!p_clcb->in_use) { in gatt_client_handle_server_rsp()
1100 alarm_cancel(p_clcb->gatt_rsp_timer_ent); in gatt_client_handle_server_rsp()
1101 p_clcb->retry_count = 0; in gatt_client_handle_server_rsp()
1110 gatt_end_operation(p_clcb, GATT_ERROR, NULL); in gatt_client_handle_server_rsp()
1114 gatt_process_error_rsp(tcb, p_clcb, op_code, len, p_data); in gatt_client_handle_server_rsp()
1118 gatt_process_mtu_rsp(tcb, p_clcb, len, p_data); in gatt_client_handle_server_rsp()
1122 gatt_process_read_info_rsp(tcb, p_clcb, op_code, len, p_data); in gatt_client_handle_server_rsp()
1127 gatt_process_read_by_type_rsp(tcb, p_clcb, op_code, len, p_data); in gatt_client_handle_server_rsp()
1133 gatt_process_read_rsp(tcb, p_clcb, op_code, len, p_data); in gatt_client_handle_server_rsp()
1137 gatt_process_find_type_value_rsp(tcb, p_clcb, len, p_data); in gatt_client_handle_server_rsp()
1141 gatt_process_handle_rsp(p_clcb); in gatt_client_handle_server_rsp()
1145 gatt_process_prep_write_rsp(tcb, p_clcb, op_code, len, p_data); in gatt_client_handle_server_rsp()
1149 gatt_end_operation(p_clcb, p_clcb->status, NULL); in gatt_client_handle_server_rsp()