Android BLE ERROR CODE

So here is a list of commands that aredocumented by hardware developers, such as Nordic and codes I figured outmyself. List is to be completed.


Status

Status Hex

Description

Explanation

0

0x00

BLE_HCI_STATUS_CODE_SUCCESS

Everything ok.

1

0x01

BLE_HCI_STATUS_CODE_UNKNOWN_BTLE_COMMAND

2

0x02

BLE_HCI_STATUS_CODE_UNKNOWN_CONNECTION_IDENTIFIER

5

0x05

BLE_HCI_AUTHENTICATION_FAILURE

6

0x06

BLE_HCI_STATUS_CODE_PIN_OR_KEY_MISSING

7

0x07

BLE_HCI_MEMORY_CAPACITY_EXCEEDED

8

0x08

BLE_HCI_CONNECTION_TIMEOUT

Could not establish a connection in specified period. Maybe device is currently connected to something else?

the connection got lost because no synchronization packet was received from the remote device within the specified supervision timeout value. Normally this happens due to that the devices got out of range from each other

12

0x0C

BLE_HCI_STATUS_CODE_COMMAND_DISALLOWED

18

0x12

BLE_HCI_STATUS_CODE_INVALID_BTLE_COMMAND_PARAMETERS

19

0x13

BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION

Remote device has forced a disconnect.

20

0x14

BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_LOW_RESOURCES

21

0x15

BLE_HCI_REMOTE_DEV_TERMINATION_DUE_TO_POWER_OFF

22

0x16

BLE_HCI_LOCAL_HOST_TERMINATED_CONNECTION

26

0x1A

BLE_HCI_UNSUPPORTED_REMOTE_FEATURE

30

0x1E

BLE_HCI_STATUS_CODE_INVALID_LMP_PARAMETERS

31

0x1F

BLE_HCI_STATUS_CODE_UNSPECIFIED_ERROR

34

0x22

BLE_HCI_STATUS_CODE_LMP_RESPONSE_TIMEOUT

36

0x24

BLE_HCI_STATUS_CODE_LMP_PDU_NOT_ALLOWED

40

0x28

BLE_HCI_INSTANT_PASSED

41

0x29

BLE_HCI_PAIRING_WITH_UNIT_KEY_UNSUPPORTED

42

0x2A

BLE_HCI_DIFFERENT_TRANSACTION_COLLISION

58

0x3A

BLE_HCI_CONTROLLER_BUSY

59

0x3B

BLE_HCI_CONN_INTERVAL_UNACCEPTABLE

60

0x3C

BLE_HCI_DIRECTED_ADVERTISER_TIMEOUT

61

0x3D

BLE_HCI_CONN_TERMINATED_DUE_TO_MIC_FAILURE

62

0x3E

BLE_HCI_CONN_FAILED_TO_BE_ESTABLISHED

128

0x80

GATT_NO_RESSOURCES

129

0x81

GATT_INTERNAL_ERROR

130

0x82

GATT_WRONG_STATE

131

0x83

GATT_DB_FULL

132

0x84

GATT_BUSY

133

0x85

GATT_ERROR

Can be anything, from device not in Range to a random error.

135

0x87

GATT_ILLEGAL_PARAMETER

137

0x89

GATT_AUTH_FAIL


Sources:
Nordic
Android Source

Link:https://allmydroids.blogspot.jp/2015/06/android-ble-error-status-codes-explained.html

好的,我可以为您解答Android BLE广播获取广播时间的问题。在Android BLE中,可以通过BluetoothLeAdvertiser对象的startAdvertising()方法的回调函数来获取BLE广播的时间。以下是获取BLE广播时间的步骤: 1. 创建AdvertiseSettings对象:AdvertiseSettings是广播设置的对象,可以通过它来设置广播模式、广播信号强度等参数。例如,可以通过以下代码创建一个高功率的广播设置对象: ``` AdvertiseSettings settings = new AdvertiseSettings.Builder() .setAdvertiseMode(AdvertiseSettings.ADVERTISE_MODE_HIGH_POWER) .setTxPowerLevel(AdvertiseSettings.ADVERTISE_TX_POWER_HIGH) .setConnectable(false) .build(); ``` 2. 创建AdvertiseData对象:AdvertiseData是广播数据的对象,可以通过它来设置广播的内容。例如,可以通过以下代码创建一个包含设备名称和服务UUID的广播数据对象: ``` AdvertiseData data = new AdvertiseData.Builder() .setIncludeDeviceName(true) .addServiceUuid(new ParcelUuid(SERVICE_UUID)) .build(); ``` 3. 开始广播:使用BluetoothLeAdvertiser.startAdvertising()方法开始广播,可以传入AdvertiseSettings和AdvertiseData对象。例如,可以通过以下代码开始广播: ``` BluetoothLeAdvertiser advertiser = BluetoothAdapter.getDefaultAdapter().getBluetoothLeAdvertiser(); long startTimeMillis = System.currentTimeMillis(); advertiser.startAdvertising(settings, data, new AdvertiseCallback() { @Override public void onStartSuccess(AdvertiseSettings settingsInEffect) { long endTimeMillis = System.currentTimeMillis(); long advertisingTimeMillis = endTimeMillis - startTimeMillis; Log.d(TAG, "Advertising time: " + advertisingTimeMillis + " ms"); } @Override public void onStartFailure(int errorCode) { Log.e(TAG, "Advertising onStartFailure: " + errorCode); } }); ``` 在上面的代码中,创建一个AdvertiseCallback对象,并在它的onStartSuccess()方法中获取BLE广播的时间。使用System.currentTimeMillis()方法获取当前时间,然后计算广播时间差即可。 需要注意的是,在获取BLE广播时间时,需要在回调函数中进行计时,不能在广播开始前或结束后计时,否则计算的广播时间不准确。同时,BLE广播时间也受到广播设置和设备性能的影响,可能会有一定的误差。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值