Code example for WifiManager.MulticastLock

Methods: isHeld, release

0
		multicastLock.acquire();
		return multicastLock;
	} 
 
	public static void releaseMulticastLock(final MulticastLock pMulticastLock) {
		if (pMulticastLock.isHeld()) {
			pMulticastLock.release();
		} 
	} 
 
 
	public static byte[] getBroadcastIPAddressRaw(final Context pContext) throws WifiException {
		final WifiManager wifiManager = WifiUtils.getWifiManager(pContext);
		final DhcpInfo dhcp = wifiManager.getDhcpInfo();
		// TODO handle null somehow... 
 
		final int broadcast = (dhcp.ipAddress & dhcp.netmask) | ~dhcp.netmask;
		final byte[] broadcastIP = new byte[4];
		for (int k = 0; k < 4; k++) {
			broadcastIP[k] = (byte) ((broadcast >> (k * 8)) & 0xFF);
		}