replaced l2cap_le_create_connection_parameter_update_response with call to general l2cap signalng functions

This commit is contained in:
Matthias Ringwald 2015-08-12 13:54:06 +02:00
parent 99b3db5468
commit 75422ed973
3 changed files with 4 additions and 36 deletions

View File

@ -718,17 +718,11 @@ void l2cap_run(void){
result = -1;
break;
}
if (result < 0) break;
if (result < 0) continue;
if (!hci_can_send_acl_packet_now(connection->con_handle)) break;
hci_reserve_packet_buffer();
uint8_t *acl_buffer = hci_get_outgoing_packet_buffer();
connection->le_con_parameter_update_state = CON_PARAMETER_UPDATE_NONE;
uint16_t len = l2cap_le_create_connection_parameter_update_response(acl_buffer, connection->con_handle, connection->le_con_param_update_identifier, result);
hci_send_acl_packet_buffer(len);
if (result == 0){
connection->le_con_parameter_update_state = CON_PARAMETER_UPDATE_CHANGE_HCI_CON_PARAMETERS;
}
connection->le_con_parameter_update_state = (result == 0) ? CON_PARAMETER_UPDATE_CHANGE_HCI_CON_PARAMETERS : CON_PARAMETER_UPDATE_NONE;
l2cap_send_le_signaling_packet(connection->con_handle, CONNECTION_PARAMETER_UPDATE_RESPONSE, connection->le_con_param_update_identifier, result);
}
#endif

View File

@ -184,29 +184,4 @@ uint16_t l2cap_le_create_connection_parameter_update_request(uint8_t * acl_buffe
return pos;
}
uint16_t l2cap_le_create_connection_parameter_update_response(uint8_t * acl_buffer, uint16_t handle, uint8_t identifier, uint16_t response){
int pb = hci_non_flushable_packet_boundary_flag_supported() ? 0x00 : 0x02;
// 0 - Connection handle : PB=pb : BC=00
bt_store_16(acl_buffer, 0, handle | (pb << 12) | (0 << 14));
// 6 - L2CAP LE Signaling channel = 5
bt_store_16(acl_buffer, 6, 5);
// 8 - Code
acl_buffer[8] = CONNECTION_PARAMETER_UPDATE_RESPONSE;
// 9 - id
acl_buffer[9] = identifier;
uint16_t pos = 12;
bt_store_16(acl_buffer, pos, response);
pos += 2;
// 2 - ACL length
bt_store_16(acl_buffer, 2, pos - 4);
// 4 - L2CAP packet length
bt_store_16(acl_buffer, 4, pos - 6 - 2);
// 10 - L2CAP signaling parameter length
bt_store_16(acl_buffer, 10, pos - 12);
return pos;
}
#endif

View File

@ -77,7 +77,6 @@ typedef enum {
uint16_t l2cap_create_signaling_classic(uint8_t * acl_buffer,hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, va_list argptr);
uint16_t l2cap_create_signaling_le(uint8_t * acl_buffer, hci_con_handle_t handle, L2CAP_SIGNALING_COMMANDS cmd, uint8_t identifier, va_list argptr);
uint16_t l2cap_le_create_connection_parameter_update_request(uint8_t * acl_buffer, uint16_t handle, uint8_t identifier, uint16_t interval_min, uint16_t interval_max, uint16_t slave_latency, uint16_t timeout_multiplier);
uint16_t l2cap_le_create_connection_parameter_update_response(uint8_t * acl_buffer, uint16_t handle, uint8_t identifier, uint16_t response);
uint8_t l2cap_next_sig_id(void);
uint16_t l2cap_next_local_cid(void);