L2capNetworkSpecifier Class

Definition

A NetworkSpecifier used to identify an L2CAP network over BLE.

[Android.Runtime.Register("android/net/L2capNetworkSpecifier", ApiSince=36, DoNotGenerateAcw=true)]
public sealed class L2capNetworkSpecifier : Android.Net.NetworkSpecifier, Android.OS.IParcelable, IDisposable, Java.Interop.IJavaPeerable
[<Android.Runtime.Register("android/net/L2capNetworkSpecifier", ApiSince=36, DoNotGenerateAcw=true)>]
type L2capNetworkSpecifier = class
    inherit NetworkSpecifier
    interface IParcelable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Inheritance
L2capNetworkSpecifier
Attributes
Implements

Remarks

A NetworkSpecifier used to identify an L2CAP network over BLE.

An L2CAP network is not symmetrical, meaning there exists both a server (Bluetooth peripheral) and a client (Bluetooth central) node. This specifier contains the information required to request a client L2CAP network using ConnectivityManager#requestNetwork while specifying the remote MAC address, and Protocol/Service Multiplexer (PSM). It can also contain information allocated by the system when reserving a server network using ConnectivityManager#reserveNetwork such as the Protocol/Service Multiplexer (PSM). In both cases, the header compression option must be specified.

An L2CAP server network allocates a Protocol/Service Multiplexer (PSM) to be advertised to the client. A new server network must always be reserved using ConnectivityManager#reserveNetwork. The subsequent ConnectivityManager.NetworkCallback#onReserved(NetworkCapabilities) callback includes an L2CapNetworkSpecifier. The getPsm() method will return the Protocol/Service Multiplexer (PSM) of the reserved network so that the server can advertise it to the client and the client can connect. An L2CAP server network is backed by a android.bluetooth.BluetoothServerSocket which can, in theory, accept many connections. However, before SDK version Build.VERSION_CODES.VANILLA_ICE_CREAM Bluetooth APIs do not expose the channel ID, so these connections are indistinguishable. In practice, this means that the network matching semantics in ConnectivityService will tear down all but the first connection.

When the connection between client and server completes, a Network whose capabilities satisfy this L2capNetworkSpecifier will connect and the usual callbacks, such as NetworkCallback#onAvailable, will be called on the callback object passed to ConnectivityManager#reserveNetwork or ConnectivityManager#requestNetwork.

Java documentation for android.net.L2capNetworkSpecifier.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Fields

HeaderCompression6lowpan
Obsolete.

Use 6lowpan header compression as specified in rfc6282.

HeaderCompressionAny
Obsolete.

Accept any form of header compression.

HeaderCompressionNone
Obsolete.

Do not compress packets on this network.

PsmAny

Match any Protocol/Service Multiplexer (PSM).

RoleAny
Obsolete.

Match any role.

RoleClient
Obsolete.

Specifier describes a client network, i.

RoleServer
Obsolete.

Specifier describes a server network, i.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Creator
Handle

The handle to the underlying Android instance.

(Inherited from Object)
HeaderCompression

Returns the compression mechanism for this network.

JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
Psm

Returns the Protocol/Service Multiplexer (PSM) for this network to connect to.

RemoteAddress

Returns the remote MAC address for this network to connect to.

Role

Returns the role to be used for this network.

ThresholdClass (Inherited from NetworkSpecifier)
ThresholdType (Inherited from NetworkSpecifier)

Methods

CanBeSatisfiedBy(NetworkSpecifier)
Clone()

Creates and returns a copy of this object.

(Inherited from Object)
DescribeContents()
Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Redact()
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
WriteToParcel(Parcel, ParcelableWriteFlags)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to