Most visited

Recently visited

Added in API level 14

WifiP2pDevice

public class WifiP2pDevice
extends Object implements Parcelable

java.lang.Object
   ↳ android.net.wifi.p2p.WifiP2pDevice


代表Wi-Fi p2p设备的类请注意,这些操作不是线程安全的

也可以看看:

Summary

Constants

int AVAILABLE

int CONNECTED

int FAILED

int INVITED

int UNAVAILABLE

Inherited constants

From interface android.os.Parcelable

Fields

public static final Creator<WifiP2pDevice> CREATOR

实现Parcelable接口

public String deviceAddress

设备MAC地址唯一标识一个Wi-Fi p2p设备

public String deviceName

设备名称是用于识别Wi-Fi p2p设备的用户友好字符串

public String primaryDeviceType

主要设备类型标识设备的类型。

public String secondaryDeviceType

辅助设备类型是可选属性,除了主设备类型之外,还可以由设备提供。

public int status

设备连接状态

Public constructors

WifiP2pDevice()
WifiP2pDevice(WifiP2pDevice source)

复制构造函数

Public methods

int describeContents()

实现Parcelable接口

boolean equals(Object obj)

指示其他某个对象是否“等于”这一个。

boolean isGroupOwner()

如果设备是组所有者,则返回true

boolean isServiceDiscoveryCapable()

如果设备能够进行服务发现,则返回true

String toString()

返回对象的字符串表示形式。

boolean wpsDisplaySupported()

如果支持WPS显示配置,则返回true

boolean wpsKeypadSupported()

如果支持WPS键盘配置,则返回true

boolean wpsPbcSupported()

如果支持WPS按钮配置,则返回true

void writeToParcel(Parcel dest, int flags)

实现Parcelable接口

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Constants

AVAILABLE

Added in API level 14
int AVAILABLE

常量值:3(0x00000003)

CONNECTED

Added in API level 14
int CONNECTED

常量值:0(0x00000000)

FAILED

Added in API level 14
int FAILED

常量值:2(0x00000002)

INVITED

Added in API level 14
int INVITED

常数值:1(0x00000001)

UNAVAILABLE

Added in API level 14
int UNAVAILABLE

常量值:4(0x00000004)

Fields

CREATOR

Added in API level 14
Creator<WifiP2pDevice> CREATOR

实现Parcelable接口

deviceAddress

Added in API level 14
String deviceAddress

设备MAC地址唯一标识一个Wi-Fi p2p设备

deviceName

Added in API level 14
String deviceName

设备名称是用于识别Wi-Fi p2p设备的用户友好字符串

primaryDeviceType

Added in API level 14
String primaryDeviceType

主要设备类型标识设备的类型。 例如,如果应用程序的目的是启用用户的打印操作,则应用程序可以将发现的设备过滤为仅显示打印机。 有关支持的标准设备类型的完整列表,请参阅Wi-Fi Direct技术规范。

secondaryDeviceType

Added in API level 14
String secondaryDeviceType

辅助设备类型是可选属性,除了主设备类型之外,还可以由设备提供。

status

Added in API level 14
int status

设备连接状态

Public constructors

WifiP2pDevice

Added in API level 14
WifiP2pDevice ()

WifiP2pDevice

Added in API level 14
WifiP2pDevice (WifiP2pDevice source)

复制构造函数

Parameters
source WifiP2pDevice

Public methods

describeContents

Added in API level 14
int describeContents ()

实现Parcelable接口

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.

equals

Added in API level 14
boolean equals (Object obj)

指示其他某个对象是否“等于”这一个。

equals方法在非空对象引用上实现等价关系:

  • It is reflexive: for any non-null reference value x, x.equals(x) should return true.
  • It is symmetric: for any non-null reference values x and y, x.equals(y) should return true if and only if y.equals(x) returns true.
  • It is transitive: for any non-null reference values x, y, and z, if x.equals(y) returns true and y.equals(z) returns true, then x.equals(z) should return true.
  • It is consistent: for any non-null reference values x and y, multiple invocations of x.equals(y) consistently return true or consistently return false, provided no information used in equals comparisons on the objects is modified.
  • For any non-null reference value x, x.equals(null) should return false.

equals类的方法Object实现了对象上最可能的等价关系; 也就是说,对于任何非空参考值xy ,当且仅当xy引用同一对象( x == y的值为true )时,此方法返回true

请注意,无论何时重写此方法,通常都必须覆盖 hashCode方法,以便维护 hashCode方法的常规协定,该方法声明相等对象必须具有相同的哈希码。

Parameters
obj Object: the reference object with which to compare.
Returns
boolean true if this object is the same as the obj argument; false otherwise.

isGroupOwner

Added in API level 14
boolean isGroupOwner ()

如果设备是组所有者,则返回true

Returns
boolean

isServiceDiscoveryCapable

Added in API level 14
boolean isServiceDiscoveryCapable ()

如果设备能够进行服务发现,则返回true

Returns
boolean

toString

Added in API level 14
String toString ()

返回对象的字符串表示形式。 通常, toString方法将返回一个“文本地表示”该对象的字符串。 结果应该是一个简洁但内容丰富的表述,对于一个人来说很容易阅读。 建议所有子类重写此方法。

ObjecttoString方法返回一个字符串,其中包含对象为实例的类的名称,符号字符“ @ ”以及对象的哈希代码的无符号十六进制表示形式。 换句话说,这个方法返回一个字符串,其值等于:

 getClass().getName() + '@' + Integer.toHexString(hashCode())
 

Returns
String a string representation of the object.

wpsDisplaySupported

Added in API level 14
boolean wpsDisplaySupported ()

如果支持WPS显示配置,则返回true

Returns
boolean

wpsKeypadSupported

Added in API level 14
boolean wpsKeypadSupported ()

如果支持WPS键盘配置,则返回true

Returns
boolean

wpsPbcSupported

Added in API level 14
boolean wpsPbcSupported ()

如果支持WPS按钮配置,则返回true

Returns
boolean

writeToParcel

Added in API level 14
void writeToParcel (Parcel dest, 
                int flags)

实现Parcelable接口

Parameters
dest Parcel: The Parcel in which the object should be written.
flags int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.

Hooray!