Api23

constructor(deviceName: String = DEFAULT_NAME, isBluetoothSupported: Boolean = true, isBluetoothEnabled: Boolean = true, isMultipleAdvertisementSupported: Boolean = true, isLocationPermissionGranted: Boolean = true, isLocationEnabled: Boolean = true, advertiser: MockAdvertiser = DEFAULT_MOCK_ADVERTISER, scanner: MockScanner = DEFAULT_MOCK_SCANNER, issueOnlyOneActiveScan: Boolean = false, issueIncorrectL2capTxMtu: Boolean = false)

Parameters

deviceName

The device name, by default set to "Mock".

isBluetoothSupported

Whether Bluetooth is supported on the device.

isBluetoothEnabled

Whether Bluetooth is enabled on the device.

isMultipleAdvertisementSupported

Whether multi advertisement is supported by the chipset.

isLocationPermissionGranted

Whether the fine location permission is granted.

isLocationEnabled

Whether location service is enabled on the device.

advertiser

A callback that will be called when the app requests to advertise. The callback should return TX power level used for mock advertising.

scanner

A callback that will be called when the mock central manager requests to scan for devices. It returns whether the scan was successful, secretly failed, or returned an error.

issueOnlyOneActiveScan

Some early Android devices were sending only one Scan Request message for a single device per scan. Non-connectable devices were reported continuously, but connectable devices were reported only once. The client had to stop and start scanning again to receive further advertisements. This flag simulates this issue. It was encountered e.g. on Nexus 4.

issueIncorrectL2capTxMtu

Some Android devices claim they can only transmit 27-byte long packets on L2CAP in the LLCP Data Length Update procedure, while later trying to send 251 bytes. This causes the peripheral to terminate the connection. This flag simulates this issue. It was encountered e.g. on Samsung A8 and Samsung A8 Tab.