{
@nullable ParcelFileDescriptor connectSocket(in BluetoothDevice device, int type, in @nullable ParcelUuid uuid, int port, int flag);
@nullable ParcelFileDescriptor createSocketChannel(int type, in @nullable String serviceName, in @nullable ParcelUuid uuid, int port, int flag);
+ void requestMaximumTxDataLength(in BluetoothDevice device);
}
#include "btif_sock_thread.h"
#include "btif_uid.h"
#include "btif_util.h"
+#include "device/include/controller.h"
#include "osi/include/thread.h"
using bluetooth::Uuid;
const Uuid* uuid, int channel, int* sock_fd,
int flags, int app_uid);
+static void btsock_request_max_tx_data_length(const RawAddress& bd_addr);
+
static void btsock_signaled(int fd, int type, int flags, uint32_t user_id);
static std::atomic_int thread_handle{-1};
static thread_t* thread;
const btsock_interface_t* btif_sock_get_interface(void) {
- static btsock_interface_t interface = {sizeof(interface), btsock_listen,
- btsock_connect};
+ static btsock_interface_t interface = {
+ sizeof(interface), btsock_listen, /* listen */
+ btsock_connect, /* connect */
+ btsock_request_max_tx_data_length /* request_max_tx_data_length */
+ };
return &interface;
}
return status;
}
+static void btsock_request_max_tx_data_length(const RawAddress& remote_device) {
+ const controller_t* controller = controller_get_interface();
+ uint16_t max_len = controller->get_ble_maximum_tx_data_length();
+
+ DVLOG(2) << __func__ << ": max_len=" << max_len;
+
+ BTA_DmBleSetDataLength(remote_device, max_len);
+}
+
static void btsock_signaled(int fd, int type, int flags, uint32_t user_id) {
switch (type) {
case BTSOCK_RFCOMM:
bt_status_t (*connect)(const RawAddress* bd_addr, btsock_type_t type,
const bluetooth::Uuid* uuid, int channel, int* sock_fd,
int flags, int callingUid);
+
+ /**
+ * Set the LE Data Length value to this connected peer to the
+ * maximum supported by this BT controller. This command
+ * suggests to the BT controller to set its maximum transmission
+ * packet size.
+ */
+ void (*request_max_tx_data_length)(const RawAddress& bd_addr);
+
} btsock_interface_t;
__END_DECLS