// Path: asynctcp/src/main/java/com/beetle/AsyncTCP.java
// public class AsyncTCP {
//     private int sock;
//     private int events;
// 
//     private byte[] data;
//     private boolean connecting;
//     
//     private TCPConnectCallback connectCallback;
//     private TCPReadCallback readCallback;
//     private long self;
//    
// 
//     public void setConnectCallback(TCPConnectCallback cb) {
// 	connectCallback = cb;
//     }
//     public void setReadCallback(TCPReadCallback cb) {
// 	readCallback = cb;
//     }
//     public native boolean connect(String host, int port);
//     public native void close();
// 
//     public native void writeData(byte[] bytes);
//     
//     public native void startRead();
//   
// 
//     static {
//         System.loadLibrary("async_tcp");
//     }
// }
// 
// Path: asynctcp/src/main/java/com/beetle/TCPConnectCallback.java
// public interface TCPConnectCallback {
//  
//     public void onConnect(Object tcp, int status);
//  
// }
// 
// Path: asynctcp/src/main/java/com/beetle/TCPReadCallback.java
// public interface TCPReadCallback {
//  
//     public void onRead(Object tcp, byte[] data);
//  
// }


import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.util.Log;
import com.beetle.AsyncTCP;
import com.beetle.TCPConnectCallback;
import com.beetle.TCPReadCallback;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import static android.os.SystemClock.uptimeMillis;
package com.beetle.im;





/**
 * Created by houxh on 14-7-21.
 */
public class IMService {

    private final String HOST = "imnode2.gobelieve.io";
    private final int PORT = 23000;

    public enum ConnectState {
        STATE_UNCONNECTED,
        STATE_CONNECTING,
        STATE_CONNECTED,
        STATE_CONNECTFAIL,
    }

    private final String TAG = "imservice";
    private final int HEARTBEAT = 60*3;
// Path: asynctcp/src/main/java/com/beetle/AsyncTCP.java
// public class AsyncTCP {
//     private int sock;
//     private int events;
// 
//     private byte[] data;
//     private boolean connecting;
//     
//     private TCPConnectCallback connectCallback;
//     private TCPReadCallback readCallback;
//     private long self;
//    
// 
//     public void setConnectCallback(TCPConnectCallback cb) {
// 	connectCallback = cb;
//     }
//     public void setReadCallback(TCPReadCallback cb) {
// 	readCallback = cb;
//     }
//     public native boolean connect(String host, int port);
//     public native void close();
// 
//     public native void writeData(byte[] bytes);
//     
//     public native void startRead();
//   
// 
//     static {
//         System.loadLibrary("async_tcp");
//     }
// }
// 
// Path: asynctcp/src/main/java/com/beetle/TCPConnectCallback.java
// public interface TCPConnectCallback {
//  
//     public void onConnect(Object tcp, int status);
//  
// }
// 
// Path: asynctcp/src/main/java/com/beetle/TCPReadCallback.java
// public interface TCPReadCallback {
//  
//     public void onRead(Object tcp, byte[] data);
//  
// }


// Path: imsdk/src/main/java/com/beetle/im/IMService.java
import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.os.AsyncTask;
import android.util.Log;
import com.beetle.AsyncTCP;
import com.beetle.TCPConnectCallback;
import com.beetle.TCPReadCallback;
import java.net.Inet4Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import static android.os.SystemClock.uptimeMillis;

package com.beetle.im;





/**
 * Created by houxh on 14-7-21.
 */
public class IMService {

    private final String HOST = "imnode2.gobelieve.io";
    private final int PORT = 23000;

    public enum ConnectState {
        STATE_UNCONNECTED,
        STATE_CONNECTING,
        STATE_CONNECTED,
        STATE_CONNECTFAIL,
    }

    private final String TAG = "imservice";
    private final int HEARTBEAT = 60*3;
    private AsyncTCP tcp;