FileDocCategorySizeDatePackage
WifiP2pProvDiscEvent.javaAPI DocAndroid 5.1 API2706Thu Mar 12 22:22:44 GMT 2015android.net.wifi.p2p

WifiP2pProvDiscEvent

public class WifiP2pProvDiscEvent extends Object
A class representing a Wi-Fi p2p provisional discovery request/response See {@link #WifiP2pProvDiscEvent} for supported types
hide

Fields Summary
private static final String
TAG
public static final int
PBC_REQ
public static final int
PBC_RSP
public static final int
ENTER_PIN
public static final int
SHOW_PIN
public int
event
public WifiP2pDevice
device
public String
pin
Constructors Summary
public WifiP2pProvDiscEvent()


      
        device = new WifiP2pDevice();
    
public WifiP2pProvDiscEvent(String string)

param
string formats supported include P2P-PROV-DISC-PBC-REQ 42:fc:89:e1:e2:27 P2P-PROV-DISC-PBC-RESP 02:12:47:f2:5a:36 P2P-PROV-DISC-ENTER-PIN 42:fc:89:e1:e2:27 P2P-PROV-DISC-SHOW-PIN 42:fc:89:e1:e2:27 44490607 Note: The events formats can be looked up in the wpa_supplicant code
hide

        String[] tokens = string.split(" ");

        if (tokens.length < 2) {
            throw new IllegalArgumentException("Malformed event " + string);
        }

        if (tokens[0].endsWith("PBC-REQ")) event = PBC_REQ;
        else if (tokens[0].endsWith("PBC-RESP")) event = PBC_RSP;
        else if (tokens[0].endsWith("ENTER-PIN")) event = ENTER_PIN;
        else if (tokens[0].endsWith("SHOW-PIN")) event = SHOW_PIN;
        else throw new IllegalArgumentException("Malformed event " + string);


        device = new WifiP2pDevice();
        device.deviceAddress = tokens[1];

        if (event == SHOW_PIN) {
            pin = tokens[2];
        }
    
Methods Summary
public java.lang.StringtoString()

        StringBuffer sbuf = new StringBuffer();
        sbuf.append(device);
        sbuf.append("\n event: ").append(event);
        sbuf.append("\n pin: ").append(pin);
        return sbuf.toString();