Table of Contents

Class NearbyTransferProgress

Namespace
Plugin.Maui.NearbyConnectivity
Assembly
Plugin.Maui.NearbyConnectivity.dll

Represents the progress of an ongoing or completed payload transfer.

public sealed class NearbyTransferProgress
Inheritance
NearbyTransferProgress
Inherited Members

Remarks

Instances are reported through the IProgress<T> supplied to a SendFileAsync overload for an outgoing transfer, or through InboundTransfersAsync(CancellationToken) for an incoming one.

Constructors

NearbyTransferProgress(long, long, long?, NearbyTransferStatus)

Represents the progress of an ongoing or completed payload transfer.

public NearbyTransferProgress(long payloadId, long bytesTransferred, long? totalBytes, NearbyTransferStatus status)

Parameters

payloadId long

An identifier for this transfer, distinct from other transfers in flight on the same connection. Session-scoped and meaningful only within this plugin.

bytesTransferred long

The number of bytes transferred so far.

totalBytes long?

The total size of the payload in bytes, or null when unknown. Zero or less is stored as null. See TotalBytes.

status NearbyTransferStatus

The status of the transfer.

Remarks

Instances are reported through the IProgress<T> supplied to a SendFileAsync overload for an outgoing transfer, or through InboundTransfersAsync(CancellationToken) for an incoming one.

Properties

BytesTransferred

Gets the number of bytes transferred so far.

public long BytesTransferred { get; }

Property Value

long

The count of bytes transferred at the time this update was reported.

Fraction

Gets the proportion of the transfer that has completed.

public double? Fraction { get; }

Property Value

double?

A value between 0.0 and 1.0, or null when TotalBytes is null. Bind to this value to drive a progress indicator.

PayloadId

Gets the identifier for this transfer.

public long PayloadId { get; }

Property Value

long

An identifier that distinguishes this transfer from others in flight on the same connection, on every platform. Session-scoped, and meaningful only within this plugin. Do not persist it or send it to a peer.

Remarks

To cancel an inbound transfer, pass this value to CancelInboundTransferAsync(long).

Status

Gets the status of the transfer.

public NearbyTransferStatus Status { get; }

Property Value

NearbyTransferStatus

One of the NearbyTransferStatus values.

TotalBytes

Gets the total size of the payload.

public long? TotalBytes { get; }

Property Value

long?

The total size of the payload in bytes, or null when the size is not known in advance, as for a stream. Never zero or negative.