| | |
| | | import android.util.Base64; |
| | | import android.util.Log; |
| | | |
| | | import com.anyun.exam.lib.net.Constant; |
| | | import com.anyun.exam.lib.net.NtripTcpClient; |
| | | import com.anyun.exam.lib.net.TcpSession; |
| | | import com.anyun.exam.lib.util.Bluetooth; |
| | | import com.anyun.exam.lib.util.BluetoothChatService; |
| | | import com.anyun.exam.lib.util.BluetoothChatServiceCallback; |
| | |
| | | * 邮箱:632393724@qq.com |
| | | * All Rights Saved! Chongqing AnYun Tech co. LTD |
| | | */ |
| | | public class RemoteService extends Service { |
| | | public class RemoteService extends Service implements IRtcmData { |
| | | private static final String TAG = "RemoteService"; |
| | | |
| | | public static final boolean mAyDevice = true; |
| | |
| | | private String mTargetBluetooth = null; |
| | | private String mTargetBluetoothAddr = null; |
| | | private boolean mDiscoveryBluetooth = false; |
| | | |
| | | public NtripTcpClient ntripTcpClient = null; |
| | | |
| | | private IRemoteInterface.Stub iRemoteInterface = new IRemoteInterface.Stub(){ |
| | | @Override |
| | |
| | | String ver = getBaseband_Ver(); |
| | | |
| | | new Thread(new TestCls()).start(); |
| | | |
| | | Rtcm.INSTANCE.registerCallback(this); |
| | | TcpSession tcpSession = new TcpSession(); |
| | | tcpSession.ip = "base.staroadnav.com"; |
| | | // tcpSession.ip = "192.168.16.212"; |
| | | tcpSession.phone = ""; |
| | | tcpSession.setPort(6060); |
| | | // tcpSession.setPort(8080); |
| | | ntripTcpClient = new NtripTcpClient(tcpSession); |
| | | ntripTcpClient.connect(this); |
| | | } |
| | | |
| | | class TestCls implements Runnable { |
| | |
| | | public void onDestroy() { |
| | | super.onDestroy(); |
| | | Log.i(TAG,"onDestroy"); |
| | | |
| | | Rtcm.INSTANCE.unRegisterCallback(); |
| | | |
| | | if (mChatService != null) { |
| | | mChatService.stop(); |
| | |
| | | } |
| | | } |
| | | |
| | | @Override |
| | | public void sendRtcm(byte []data, int length) { |
| | | uploadRtcm(data, length); |
| | | } |
| | | |
| | | // Used to load the 'native-lib' library on application startup. |
| | | static { |
| | | System.loadLibrary("native-lib"); |
| | |
| | | public native void BluetoothConnected(String name, String addr); |
| | | public native void BluetoothStatusChange(int status); |
| | | public native void BluetoothDataComeIn(byte []data, int length); |
| | | public native void uploadRtcm(byte []data, int length); |
| | | } |