component/bt : fix connection bug of Iphone7 10.0.2

This connection error caused by iPhone, it think that TX data length must large than 27 when slave support EXTEND_DATA_LENGTH. But this should be allow. Besides,  the problem cannot be found on higher version of Iphone7, apple seemed to have fixed it.
Actually maybe other BLE device have the same problem.
This commit is contained in:
Tian Hao 2017-02-16 14:10:44 +08:00
parent 34d0b0086e
commit 6648ff427c
3 changed files with 17 additions and 0 deletions

View file

@ -221,6 +221,10 @@ static void start_up(void)
} }
if (HCI_LE_DATA_LEN_EXT_SUPPORTED(features_ble.as_array)) { if (HCI_LE_DATA_LEN_EXT_SUPPORTED(features_ble.as_array)) {
/* set default tx data length to MAX 251 */
response = AWAIT_COMMAND(packet_factory->make_ble_write_suggested_default_data_length(BTM_BLE_DATA_SIZE_MAX, BTM_BLE_DATA_TX_TIME_MAX));
packet_parser->parse_generic_command_complete(response);
response = AWAIT_COMMAND(packet_factory->make_ble_read_suggested_default_data_length()); response = AWAIT_COMMAND(packet_factory->make_ble_read_suggested_default_data_length());
packet_parser->parse_ble_read_suggested_default_data_length_response( packet_parser->parse_ble_read_suggested_default_data_length_response(
response, response,

View file

@ -154,6 +154,17 @@ static BT_HDR *make_ble_read_suggested_default_data_length(void)
return make_command_no_params(HCI_BLE_READ_DEFAULT_DATA_LENGTH); return make_command_no_params(HCI_BLE_READ_DEFAULT_DATA_LENGTH);
} }
static BT_HDR *make_ble_write_suggested_default_data_length(uint16_t SuggestedMaxTxOctets, uint16_t SuggestedMaxTxTime)
{
uint8_t *stream;
uint8_t parameter_size = sizeof(uint16_t) + sizeof(uint16_t);
BT_HDR *packet = make_command(HCI_BLE_WRITE_DEFAULT_DATA_LENGTH, parameter_size, &stream);
UINT16_TO_STREAM(stream, SuggestedMaxTxOctets);
UINT16_TO_STREAM(stream, SuggestedMaxTxTime);
return packet;
}
static BT_HDR *make_ble_set_event_mask(const bt_event_mask_t *event_mask) static BT_HDR *make_ble_set_event_mask(const bt_event_mask_t *event_mask)
{ {
uint8_t *stream; uint8_t *stream;
@ -215,6 +226,7 @@ static const hci_packet_factory_t interface = {
make_ble_read_local_supported_features, make_ble_read_local_supported_features,
make_ble_read_resolving_list_size, make_ble_read_resolving_list_size,
make_ble_read_suggested_default_data_length, make_ble_read_suggested_default_data_length,
make_ble_write_suggested_default_data_length,
make_ble_set_event_mask make_ble_set_event_mask
}; };

View file

@ -40,6 +40,7 @@ typedef struct {
BT_HDR *(*make_ble_read_local_supported_features)(void); BT_HDR *(*make_ble_read_local_supported_features)(void);
BT_HDR *(*make_ble_read_resolving_list_size)(void); BT_HDR *(*make_ble_read_resolving_list_size)(void);
BT_HDR *(*make_ble_read_suggested_default_data_length)(void); BT_HDR *(*make_ble_read_suggested_default_data_length)(void);
BT_HDR *(*make_ble_write_suggested_default_data_length)(uint16_t SuggestedMaxTxOctets, uint16_t SuggestedMaxTxTime);
BT_HDR *(*make_ble_set_event_mask)(const bt_event_mask_t *event_mask); BT_HDR *(*make_ble_set_event_mask)(const bt_event_mask_t *event_mask);
} hci_packet_factory_t; } hci_packet_factory_t;