首先我们都知道蓝牙第一步是上电,但是android4.4蓝牙上电部分的代码实际已经和android4.3不一样了。
android4.3蓝牙os是走system/bluetooth,但是android4.4走的是hardware/libhardware和external/bluetooth/,具体请看下面:
Bluetooth.h(hardware/libhardware/include/hardware/)----这是结构体,主要是看enable函数。
[cpp] view
plaincopy
-
typedef struct {
-
-
size_t size;
-
-
-
-
-
int (*init)(bt_callbacks_t* callbacks );
-
-
-
int (*"color:#ff0000;">enable)(void);
-
-
-
int (*disable)(void);
-
-
-
void (*cleanup)(void);
-
-
-
int (*get_adapter_properties)(void);
-
-
-
int (*get_adapter_property)(bt_property_type_t type);
-
-
-
-
-
-
int (*set_adapter_property)(const bt_property_t *property);
-
-
-
int (*get_remote_device_properties)(bt_bdaddr_t *remote_addr);
-
-
-
int (*get_remote_device_property)(bt_bdaddr_t *remote_addr,
-
bt_property_type_t type);
-
-
-
int (*set_remote_device_property)(bt_bdaddr_t *remote_addr,
-
const bt_property_t *property);
-
-
-
int (*get_remote_service_record)(bt_bdaddr_t *remote_addr,
-
bt_uuid_t *uuid);
-
-
-
int (*get_remote_services)(bt_bdaddr_t *remote_addr);
-
-
-
int (*start_discovery)(void);
-
-
-
int (*cancel_discovery)(void);
-
-
-
int (*create_bond)(const bt_bdaddr_t *bd_addr);
-
-
-
int (*remove_bond)(const bt_bdaddr_t *bd_addr);
-
-
-
int (*cancel_bond)(const bt_bdaddr_t *bd_addr);
-
-
-
-
int (*pin_reply)(const bt_bdaddr_t *bd_addr, uint8_t accept,
-
uint8_t pin_len, bt_pin_code_t *pin_code);
-
-
-
-
-
-
-
int (*ssp_reply)(const bt_bdaddr_t *bd_addr, bt_ssp_variant_t variant,
-
uint8_t accept, uint32_t passkey);
-
-
-
const void* (*get_profile_interface) (const char *profile_id);
-
-
-
-
int (*dut_mode_configure)(uint8_t enable);
-
-
-
int (*dut_mode_send)(uint16_t opcode, uint8_t *buf, uint8_t len);
-
-
-
int (*le_test_mode)(uint16_t opcode, uint8_t *buf, uint8_t len);
-
-
-
int (*config_hci_snoop_log)(uint8_t enable);
-
} bt_interface_t;
有结构体就会要找结构体对照的函数实现:
Bluetooth.c (externalluetoothluedroidtifsrc)
[cpp] view
plaincopy
-
const bt_interface_t* bluetooth__get_bluetooth_interface ()
-
{
-
-
-
return &bluetoothInterface;
-
}