Java Code Examples for android.net.wifi.p2p.WifiP2pDevice#UNAVAILABLE

The following examples show how to use android.net.wifi.p2p.WifiP2pDevice#UNAVAILABLE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WifiDirectManager.java    From ShareBox with Apache License 2.0 6 votes vote down vote up
public static String getDeviceStatus(int deviceStatus) {
	switch (deviceStatus) {
	case WifiP2pDevice.AVAILABLE:
		return "Available";
	case WifiP2pDevice.INVITED:
		return "Invited";
	case WifiP2pDevice.CONNECTED:
		return "Connected";
	case WifiP2pDevice.FAILED:
		return "Failed";
	case WifiP2pDevice.UNAVAILABLE:
		return "Unavailable";
	default:
		return "Unknown error";
	}
}
 
Example 2
Source File: DeviceListFragment.java    From Demo_Public with MIT License 6 votes vote down vote up
private static String getDeviceStatus(int deviceStatus){
    Log.e(WiFiDirectActivity.TAG, "Peer status: "+deviceStatus);
    switch(deviceStatus){
    case WifiP2pDevice.AVAILABLE:
        return "Avaiable";
    case WifiP2pDevice.INVITED:
        return "Invited";
    case WifiP2pDevice.CONNECTED:
        return "Conntend";
    case WifiP2pDevice.FAILED:
        return "Failed";
    case WifiP2pDevice.UNAVAILABLE:
        return "Unavailable";
    default:
        return "Unkonw";
    }
}
 
Example 3
Source File: WifiDirectHandler.java    From WiFi-Buddy with MIT License 6 votes vote down vote up
/**
 * Translates a device status code to a readable String status
 * @param status
 * @return A readable String device status
 */
public String deviceStatusToString(int status) {
    if (status == WifiP2pDevice.AVAILABLE) {
        return "Available";
    } else if (status == WifiP2pDevice.INVITED) {
        return "Invited";
    } else if (status == WifiP2pDevice.CONNECTED) {
        return "Connected";
    } else if (status == WifiP2pDevice.FAILED) {
        return "Failed";
    } else if (status == WifiP2pDevice.UNAVAILABLE) {
        return "Unavailable";
    } else {
        return "Unknown";
    }
}
 
Example 4
Source File: ActivityManageP2P.java    From nfcspy with GNU General Public License v3.0 6 votes vote down vote up
private CharSequence getWifiP2pDeviceStatus(WifiP2pDevice dev) {

		switch (dev.status) {
		case WifiP2pDevice.CONNECTED:
			return getString(R.string.status_p2p_connected);
		case WifiP2pDevice.INVITED:
			return getString(R.string.status_p2p_invited);
		case WifiP2pDevice.FAILED:
			return getString(R.string.status_p2p_failed);
		case WifiP2pDevice.AVAILABLE:
			return getString(R.string.status_p2p_available);
		case WifiP2pDevice.UNAVAILABLE:
		default:
			return getString(R.string.status_p2p_unavailable);
		}
	}
 
Example 5
Source File: DeviceListFragment.java    From commcare-android with Apache License 2.0 6 votes vote down vote up
private static String getDeviceStatus(int deviceStatus) {
    Log.d(TAG, "Peer status :" + deviceStatus);
    switch (deviceStatus) {
        case WifiP2pDevice.AVAILABLE:
            return "Available";
        case WifiP2pDevice.INVITED:
            return "Invited";
        case WifiP2pDevice.CONNECTED:
            return "Connected";
        case WifiP2pDevice.FAILED:
            return "Failed";
        case WifiP2pDevice.UNAVAILABLE:
            return "Unavailable";
        default:
            return "Unknown";

    }
}
 
Example 6
Source File: ActivityManageP2P.java    From nfcspy with GNU General Public License v3.0 5 votes vote down vote up
void handlePeerListClick(int index) {
	WifiP2pDevice dev = peerdevs.get(index);

	if (dev.status == WifiP2pDevice.CONNECTED
			|| dev.status == WifiP2pDevice.INVITED) {
		disconnectPeer(dev);
	} else if (dev.status != WifiP2pDevice.UNAVAILABLE) {
		connectPeer(dev);
	}
}