onWriteCommand
A callback called when the client sends a Write Command (write without response) to a characteristic.
The maximum length of the value is guaranteed to be at most PeripheralSpec.mtu- 3 bytes. 1 byte is consumed by the OpCode and 2 by the handle number. In case of a Signed Write Without Response the maximum length is further reduced by 12 bytes, which are used for the signature. This mock implementation ignores the signature and assumes it to be always valid.
After this method returns, an artificial delay is added to emulate the time needed to send the data to the peripheral. The length of the delay depends on the length of the value, active PHY and L2CAP MTU.
Read more in Bluetooth Code Specification 6.2, Vol 3 (Host), Part G (GATT), 4.9.1 Write Without Response: link.
Exceptions
Exceptions thrown by this method are rethrown immediately, without the simulated transfer time, emulating a failure on the client side (e.g. OperationFailedException, or SecurityException).
Any exception other than OperationFailedException will be wrapped into BluetoothException.