simulateCharacteristicOperationResponse method

Future<void> simulateCharacteristicOperationResponse(
  1. String characteristicId,
  2. CharacteristicOperationType type,
  3. int code, {
  4. String? data,
})

Simulates the response from the characteristic with |characteristicId| for a characteristic operation of |type|. The |code| value follows the Error Codes from Bluetooth Core Specification Vol 3 Part F 3.4.1.1 Error Response. The |data| is expected to exist when simulating a successful read operation response.

Implementation

Future<void> simulateCharacteristicOperationResponse(
  String characteristicId,
  CharacteristicOperationType type,
  int code, {
  String? data,
}) async {
  await _client
      .send('BluetoothEmulation.simulateCharacteristicOperationResponse', {
        'characteristicId': characteristicId,
        'type': type,
        'code': code,
        if (data != null) 'data': data,
      });
}