Table of Contents

Enum NearbyConnectFailure

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

Why a connection request or handshake ended without producing a connection.

public enum NearbyConnectFailure

Fields

DeviceUnknown = 2

No device with that identifier is currently known to the session.

The answer for a device that has gone out of range or stopped advertising since the caller read its id. Reported here rather than as a bare NearbyException so a caller branches on Reason for every connect outcome instead of on the exception type for one of them.

Failed = 1

The handshake ended without a connection: the remote device declined the request, it left range mid-handshake, the radio dropped, or the platform returned an error.

A decline is not reported separately, because the two platforms cannot agree on it. Android distinguishes one, since Nearby Connections answers a declined request with STATUS_CONNECTION_REJECTED, but iOS does not: MultipeerConnectivity answers invitationHandler(false, null), which reaches the initiator as an ordinary MCSessionState.NotConnected with no reason attached, and no session exists to carry one.

Reporting a decline only on Android would make one user action arrive as two different values, so every caller who cared would branch on the platform. This value is deliberately the coarser, uniform answer instead. Android's status code is still written to the log for diagnostics.

TimedOut = 0

The offer window elapsed before the request was answered.

The window is OfferWindow, declared by the initiator and honored by both sides. An initiator sees it when nobody answered; an acceptor sees it when an accept lost its race with the same deadline.

Remarks

One vocabulary for both roles. The offer's deadline is declared once, by the initiator, and travels to the acceptor on the wire, so an elapsed window is the same fact on both sides and reports the same TimedOut value, rather than two exception types split by which side observed it.

Carried by Reason. Branch on this rather than on the exception type.