package jp.naist.inet_lab.android.ipv6multicast;

import android.content.Context;

/**
 * Manage communicating over the IP multicast.
 * 
 * @author yohei-ka
 * 
 */
public class MulticastManager {
    public MulticastManager() {

    }

    /**
     * Join the specified multicast group.
     * 
     * @param group_address
     *            Address of the multicast group (Human readable string)
     */
    public void join(String group_address) {

    }

    /**
     * Leave the multicast group that already joined.
     */
    public void leave() {

    }

    /**
     * Send data to the joined multicast group.
     * 
     * @param data
     *            Data that you want to send
     * @return Size of the data that I actually sent
     */
    public int sendData(byte[] data) {
        return 0;
    }

    /**
     * Receive data from the joined multicast group.
     * 
     * @param buffer_size
     *            Maximum size by byte that I receive
     * @return Size of the data that I actually received
     */
    public int receiveData(int buffer_size) {
        return 0;
    }

    /**
     * Enable IP multicast on WiFi interface.
     * 
     * A developer who want to use IP multicast on WiFi interface MUST call this
     * method manually before joining a multicast group. Also, you don't forget
     * to call disableMulticastOnWifi(). It may cause battery issue if you
     * forget to call that method.
     * 
     * 
     * @param context
     *            Context of the application
     */
    public void enableMulticastOnWifi(Context context) {

    }

    /**
     * Disable IP multicast on WiFi interface.
     */
    public void disableMulticastOnWifi() {

    }

}

@@ -74,16 +74,53 @@
 Context;
+%0Aimport android.net.wifi.WifiManager;
 %0A%0A/**%0A *
@@ -228,16 +228,146 @@
 nager %7B%0A
+%0A    /**%0A     * A state of a MulticastLock on the WiFi interface%0A     */%0A    protected WifiManager.MulticastLock multicast_lock;%0A%0A
     publ
@@ -1687,67 +1687,489 @@
    *
-/%0A    public void enableMulticastOnWifi(Context context) %7B%0A
+ @param tag%0A     *            A tag for identify a state of the WiFi. This tag is only used%0A     *            internally.%0A     */%0A    public void enableMulticastOnWifi(Context context, String tag) %7B%0A        WifiManager wifiman = (WifiManager) context%0A                .getSystemService(android.content.Context.WIFI_SERVICE);%0A        this.multicast_lock = wifiman.createMulticastLock(tag);%0A        this.multicast_lock.setReferenceCounted(true);%0A        this.multicast_lock.acquire();
 %0A   
@@ -2274,22 +2274,60 @@
 tOnWifi() %7B%0A
+        this.multicast_lock.release();
 %0A    %7D%0A%0A%7D%0A

Implement which lock/unlock the MulticastLock of the WiFi.