Discriminator

class Discriminator : Parcelable


Represents a Matter discriminator.

A discriminator may either be a long discriminator (12 bits) or a short discriminator (4 bits). For instance, a manual pairing code specifies only a short discriminator, which provides less uniqueness than the long discriminator provided in the QR code or NFC tag data.

Summary

Public functions

Boolean
equals(other: Any?)
java-static Discriminator!
forLongValue(longDiscriminator: @IntRange(from = 0, to = 4095) Int)

Creates a new Discriminator representing a full 12-bit discriminator (such as for a QR code).

java-static Discriminator!
forShortValue(shortDiscriminator: @IntRange(from = 0, to = 4095) Int)

Creates a new Discriminator representing an abbreviated value (such as for a manual pairing code).

Int
Boolean

Returns true if the discriminator is a match for another discriminator.

String!
Unit
writeToParcel(dest: Parcel!, flags: Int)

Public properties

Int

Inherited functions

From android.os.Parcelable

Public functions

equals

fun equals(other: Any?): Boolean

forLongValue

java-static fun forLongValue(longDiscriminator: @IntRange(from = 0, to = 4095) Int): Discriminator!

Creates a new Discriminator representing a full 12-bit discriminator (such as for a QR code).

Parameters
longDiscriminator: @IntRange(from = 0, to = 4095) Int

the 12-bit discriminator value

Throws
java.lang.IllegalArgumentException

if the given value is negative, or greater than 12 bits

forShortValue

java-static fun forShortValue(shortDiscriminator: @IntRange(from = 0, to = 4095) Int): Discriminator!

Creates a new Discriminator representing an abbreviated value (such as for a manual pairing code). For this discriminator, only the upper 4 bits of the 12-bit value will be used for comparison in matches.

Parameters
shortDiscriminator: @IntRange(from = 0, to = 4095) Int

the 12-bit discriminator value, of which only the upper 4-bits will be kept. For example, given 0xFAB, the value will be masked to 0xF00)

Throws
java.lang.IllegalArgumentException

if the given value is negative, or greater than 12 bits

hashCode

fun hashCode(): Int

matches

fun matches(other: Discriminator!): Boolean

Returns true if the discriminator is a match for another discriminator. If both are long discriminators, then this is a simple equality test. However, if one or the other being compared is an abbreviated discriminator, then only the upper 4 bits of the discriminator are considered in the comparison.

Note that this is different behavior from equals which does not incorporate the mask into the equality test.

Parameters
other: Discriminator!

the discriminator to compare to

toString

fun toString(): String!

writeToParcel

fun writeToParcel(dest: Parcel!, flags: Int): Unit

Public properties

value

val valueInt