yy1717
2024-02-28 27fc91fbe8f88b6885356e68828cfe1ce1db7601
lib/src/main/java/com/anyun/exam/lib/RemoteService.java
@@ -23,6 +23,9 @@
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;
@@ -55,7 +58,7 @@
 * 邮箱: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;
@@ -80,6 +83,8 @@
    private String mTargetBluetooth = null;
    private String mTargetBluetoothAddr = null;
    private boolean mDiscoveryBluetooth = false;
    public NtripTcpClient ntripTcpClient = null;
    private IRemoteInterface.Stub iRemoteInterface = new IRemoteInterface.Stub(){
        @Override
@@ -150,6 +155,16 @@
        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 {
@@ -302,6 +317,8 @@
    public void onDestroy() {
        super.onDestroy();
        Log.i(TAG,"onDestroy");
        Rtcm.INSTANCE.unRegisterCallback();
        if (mChatService != null) {
            mChatService.stop();
@@ -569,6 +586,11 @@
        }
    }
    @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");
@@ -582,4 +604,5 @@
    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);
}