private boolean internalWriteCharacteristic(
			@Nullable final BluetoothGattCharacteristic characteristic,
			@Nullable final byte[] data,
			@WriteType final int writeType
	) {
		final BluetoothGatt gatt = bluetoothGatt;
		if (gatt == null || characteristic == null || !connected)
			return false;

		// Check characteristic property.
		final int properties = characteristic.getProperties();
		if ((properties & (BluetoothGattCharacteristic.PROPERTY_WRITE |
				BluetoothGattCharacteristic.PROPERTY_WRITE_NO_RESPONSE)) == 0)
			return false;

		try {
			final byte[] notNullData = data != null ? data : new byte[] {};
			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.TIRAMISU) {
				log(Log.VERBOSE, () ->
						"Writing characteristic " + characteristic.getUuid() +
								" (" + ParserUtils.writeTypeToString(writeType) + ")");
				log(Log.DEBUG, () -> "gatt.writeCharacteristic(" + characteristic.getUuid() +
						", value=" + ParserUtils.parseDebug(notNullData) +
						", " + ParserUtils.writeTypeToString(writeType) + ")");
				return gatt.writeCharacteristic(characteristic, notNullData, writeType) == BluetoothStatusCodes.SUCCESS;
			} else {
				log(Log.VERBOSE, () ->
						"Writing characteristic " + characteristic.getUuid() +
								" (" + ParserUtils.writeTypeToString(writeType) + ")");
				log(Log.DEBUG, () -> "characteristic.setValue(" + ParserUtils.parseDebug(notNullData) + ")");
				characteristic.setValue(notNullData);
				log(Log.DEBUG, () -> "characteristic.setWriteType(" + ParserUtils.writeTypeToString(writeType) + ")");
				characteristic.setWriteType(writeType);
				log(Log.DEBUG, () -> "gatt.writeCharacteristic(" + characteristic.getUuid() + ")");
				return gatt.writeCharacteristic(characteristic);
			}
		} catch (final SecurityException e) {
			log(Log.ERROR, e::getLocalizedMessage);
			return false;
		}
	}
Returns the Client Characteristic Config Descriptor if the characteristic has the
required property. It may return null if the CCCD is not there.

@param characteristic   the characteristic to look the CCCD in.
@param requiredProperty the required property: {@link BluetoothGattCharacteristic#PROPERTY_NOTIFY}
                        or {@link BluetoothGattCharacteristic#PROPERTY_INDICATE}.
@return The CCC descriptor or null if characteristic is null, if it doesn't have the
required property, or if the CCCD is missing.
ble/src/main/java/no/nordicsemi/android/ble/BleManagerHandler.java