예제 #1
0
        /// <summary>
        /// Requests to change MTU size.
        /// The results of this call are delivered to the MLBluetoohLE.OnBluetoothMTUSizeChanged callback.
        /// </summary>
        /// <param name="mtu">The characteristic to write on the remote device</param>
        /// <returns>Returns <c>MLResult.Code.Ok</c> on success or an error on failure.</returns>
        public static MLResult ChangeMTUSize(int mtu)
        {
            if (mtu < MinMTUSize)
            {
                MLPluginLog.Warning($"MTU size {mtu} is less than the minimum of {MinMTUSize}.");
            }

            else if (mtu > MaxMTUSize)
            {
                MLPluginLog.Warning($"MTU size {mtu} is greater than the maximum of {MaxMTUSize}.");
            }

            return(MLResult.Create(NativeBindings.MLBluetoothGattRequestMtu(Mathf.Clamp(mtu, MinMTUSize, MaxMTUSize))));
        }