mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-16 08:44:38 +08:00
android: Re-enable support for Android 4.4.2
Due to very unfortunate change Android 4.4.3-r1.1 BT GATT HAL API is not backward compatible. This adds support for 4.4.3-r1.1 and 4.4.2. On android PLATFORM_VERSION is used to determine which API should be used. On Linux we always build with latest API.
This commit is contained in:
parent
0655ac0d32
commit
c4f4fdc964
@ -3,12 +3,15 @@ LOCAL_PATH := external/bluetooth
|
||||
# Retrieve BlueZ version from configure.ac file
|
||||
BLUEZ_VERSION := `grep "^AC_INIT" $(LOCAL_PATH)/bluez/configure.ac | sed -e "s/.*,.\(.*\))/\1/"`
|
||||
|
||||
ANDROID_VERSION := `echo $(PLATFORM_VERSION) | awk -F. '{ printf "0x%02d%02d%02d",$$1,$$2,$$3 }'`
|
||||
|
||||
# Specify pathmap for glib and sbc
|
||||
pathmap_INCL += glib:external/bluetooth/glib \
|
||||
sbc:external/bluetooth/sbc \
|
||||
|
||||
# Specify common compiler flags
|
||||
BLUEZ_COMMON_CFLAGS := -DVERSION=\"$(BLUEZ_VERSION)\" \
|
||||
-DANDROID_VERSION=$(ANDROID_VERSION) \
|
||||
-DANDROID_STORAGEDIR=\"/data/misc/bluetooth\" \
|
||||
|
||||
# Enable warnings enabled in autotools build
|
||||
|
@ -1,4 +1,7 @@
|
||||
if ANDROID
|
||||
|
||||
AM_CFLAGS += -DANDROID_VERSION=0xFFFFFF
|
||||
|
||||
android_plugindir = $(abs_top_srcdir)/android/.libs
|
||||
|
||||
noinst_PROGRAMS += android/system-emulator
|
||||
|
@ -971,7 +971,7 @@ static int get_device_type(const bt_bdaddr_t *bd_addr)
|
||||
return dev_type;
|
||||
}
|
||||
|
||||
static bt_status_t set_adv_data(int server_if, bool set_scan_rsp,
|
||||
static bt_status_t set_adv_data_real(int server_if, bool set_scan_rsp,
|
||||
bool include_name, bool include_txpower,
|
||||
int min_interval, int max_interval,
|
||||
int appearance, uint16_t manufacturer_len,
|
||||
@ -1025,6 +1025,41 @@ static bt_status_t set_adv_data(int server_if, bool set_scan_rsp,
|
||||
cmd_len, cmd, 0, NULL, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
* This is temporary solution and support for older Android versions might
|
||||
* be removed at any time.
|
||||
*/
|
||||
#if ANDROID_VERSION < PLATFORM_VER(4,4,3)
|
||||
static bt_status_t set_adv_data(int server_if, bool set_scan_rsp,
|
||||
bool include_name, bool include_txpower,
|
||||
int min_interval, int max_interval,
|
||||
int appearance, uint16_t manufacturer_len,
|
||||
char *manufacturer_data)
|
||||
{
|
||||
return set_adv_data_real(server_if, set_scan_rsp, include_name,
|
||||
include_txpower, min_interval,
|
||||
max_interval, appearance,
|
||||
manufacturer_len, manufacturer_data,
|
||||
0, NULL, 0, NULL);
|
||||
}
|
||||
#else
|
||||
static bt_status_t set_adv_data(int server_if, bool set_scan_rsp,
|
||||
bool include_name, bool include_txpower,
|
||||
int min_interval, int max_interval,
|
||||
int appearance, uint16_t manufacturer_len,
|
||||
char *manufacturer_data,
|
||||
uint16_t service_data_len, char *service_data,
|
||||
uint16_t service_uuid_len, char *service_uuid)
|
||||
{
|
||||
return set_adv_data_real(server_if, set_scan_rsp, include_name,
|
||||
include_txpower, min_interval,
|
||||
max_interval, appearance,
|
||||
manufacturer_len, manufacturer_data,
|
||||
service_data_len, service_data,
|
||||
service_uuid_len, service_uuid);
|
||||
}
|
||||
#endif
|
||||
|
||||
static bt_status_t test_command(int command, btgatt_test_params_t *params)
|
||||
{
|
||||
struct hal_cmd_gatt_client_test_command cmd;
|
||||
|
@ -17,6 +17,8 @@
|
||||
|
||||
#include <hardware/bluetooth.h>
|
||||
|
||||
#define PLATFORM_VER(a,b,c) ((a << 16) | ( b << 8) | (c))
|
||||
|
||||
#define MAX_UUID_STR_LEN 37
|
||||
#define HAL_UUID_LEN 16
|
||||
#define MAX_ADDR_STR_LEN 18
|
||||
|
Loading…
Reference in New Issue
Block a user