// Path: modules/core/android/src/main/java/com/github/creative/mars/tasks/ByteArrayTaskWrapper.java
// abstract  public class ByteArrayTaskWrapper extends MarsTaskWrapper{
// 
// 
//     protected  byte[] request;
//     protected  byte[] response;
// 
// 
//     public ByteArrayTaskWrapper(byte[] request) {
//         this.request = request;
//     }
// 
// 
//     @Override
//     public Object getResponse() {
//         return response;
//     }
// 
//     @Override
//     public Object getRequest() {
//         return request;
//     }
// 
// 
//     @Override
//     public byte[] marshal() {
//         return request;
//     }
// 
//     @Override
//     public void unmarshal(byte[] bytes) {
//         response = bytes;
//     }
// }
// 
// Path: modules/core/android/src/main/java/com/github/creative/mars/tasks/MarsTaskProperty.java
// public class MarsTaskProperty {
//     public static final String OPTIONS_HOST = "host";
//     public static final String OPTIONS_CGI_PATH = "cgi_path";
//     public static final String OPTIONS_CMD_ID = "cmd_id";
//     public static final String OPTIONS_CHANNEL_SHORT_SUPPORT = "short_support";
//     public static final String OPTIONS_CHANNEL_LONG_SUPPORT = "long_support";
// }


import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.github.creative.mars.tasks.ByteArrayTaskWrapper;
import com.github.creative.mars.tasks.MarsTaskProperty;
import com.tencent.mars.BaseEvent;
import com.tencent.mars.Mars;
import com.tencent.mars.app.AppLogic;
import com.tencent.mars.sdt.SdtLogic;
import com.tencent.mars.stn.StnLogic;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import static com.github.creative.mars.BaseConstants.CGIHISTORY_CMDID;
import static com.github.creative.mars.BaseConstants.CONNSTATUS_CMDID;
import static com.github.creative.mars.BaseConstants.FLOW_CMDID;
import static com.github.creative.mars.BaseConstants.PUSHMSG_CMDID;
import static com.github.creative.mars.BaseConstants.SDTRESULT_CMDID;
    public void setStatisticEnable(boolean enable) {
        mEnableStat = enable;
    }



    static public byte[] toByteArray(ReadableArray data) {

        byte[] bytes = new byte[data.size()];

        for (int i = 0 ; i < data.size(); i ++ ) {
            bytes[i] = (byte) data.getInt(i);
        }
        return bytes;
    }

    static public WritableArray toReadableArray(byte[] bytes) {
        WritableArray array = Arguments.createArray();
        for (int i = 0; i < bytes.length; i++) {
            array.pushInt(bytes[i]);
        }
        return array;
    }


    @ReactMethod
    public void send(final ReadableArray data, final ReadableMap properties, final Promise promise) {



// Path: modules/core/android/src/main/java/com/github/creative/mars/tasks/ByteArrayTaskWrapper.java
// abstract  public class ByteArrayTaskWrapper extends MarsTaskWrapper{
// 
// 
//     protected  byte[] request;
//     protected  byte[] response;
// 
// 
//     public ByteArrayTaskWrapper(byte[] request) {
//         this.request = request;
//     }
// 
// 
//     @Override
//     public Object getResponse() {
//         return response;
//     }
// 
//     @Override
//     public Object getRequest() {
//         return request;
//     }
// 
// 
//     @Override
//     public byte[] marshal() {
//         return request;
//     }
// 
//     @Override
//     public void unmarshal(byte[] bytes) {
//         response = bytes;
//     }
// }
// 
// Path: modules/core/android/src/main/java/com/github/creative/mars/tasks/MarsTaskProperty.java
// public class MarsTaskProperty {
//     public static final String OPTIONS_HOST = "host";
//     public static final String OPTIONS_CGI_PATH = "cgi_path";
//     public static final String OPTIONS_CMD_ID = "cmd_id";
//     public static final String OPTIONS_CHANNEL_SHORT_SUPPORT = "short_support";
//     public static final String OPTIONS_CHANNEL_LONG_SUPPORT = "long_support";
// }


// Path: modules/core/android/src/main/java/com/github/creative/mars/MarsCoreModule.java
import android.os.Handler;
import android.os.Looper;
import android.util.Log;
import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.LifecycleEventListener;
import com.facebook.react.bridge.Promise;
import com.facebook.react.bridge.ReactApplicationContext;
import com.facebook.react.bridge.ReactContextBaseJavaModule;
import com.facebook.react.bridge.ReactMethod;
import com.facebook.react.bridge.ReadableArray;
import com.facebook.react.bridge.ReadableMap;
import com.facebook.react.bridge.WritableArray;
import com.facebook.react.bridge.WritableMap;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import com.github.creative.mars.tasks.ByteArrayTaskWrapper;
import com.github.creative.mars.tasks.MarsTaskProperty;
import com.tencent.mars.BaseEvent;
import com.tencent.mars.Mars;
import com.tencent.mars.app.AppLogic;
import com.tencent.mars.sdt.SdtLogic;
import com.tencent.mars.stn.StnLogic;
import java.util.HashMap;
import java.util.Map;
import javax.annotation.Nullable;
import static com.github.creative.mars.BaseConstants.CGIHISTORY_CMDID;
import static com.github.creative.mars.BaseConstants.CONNSTATUS_CMDID;
import static com.github.creative.mars.BaseConstants.FLOW_CMDID;
import static com.github.creative.mars.BaseConstants.PUSHMSG_CMDID;
import static com.github.creative.mars.BaseConstants.SDTRESULT_CMDID;

    public void setStatisticEnable(boolean enable) {
        mEnableStat = enable;
    }



    static public byte[] toByteArray(ReadableArray data) {

        byte[] bytes = new byte[data.size()];

        for (int i = 0 ; i < data.size(); i ++ ) {
            bytes[i] = (byte) data.getInt(i);
        }
        return bytes;
    }

    static public WritableArray toReadableArray(byte[] bytes) {
        WritableArray array = Arguments.createArray();
        for (int i = 0; i < bytes.length; i++) {
            array.pushInt(bytes[i]);
        }
        return array;
    }


    @ReactMethod
    public void send(final ReadableArray data, final ReadableMap properties, final Promise promise) {



        ByteArrayTaskWrapper taskWrapper = new ByteArrayTaskWrapper(toByteArray(data)) {