yy1717
2020-01-06 9c13ff18dab0c35ada32a318ab6e380c9b184ffe
修改ndk,20200106
9个文件已修改
63 ■■■■ 已修改文件
.idea/misc.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
app/src/main/java/safeluck/drive/evaluation/app.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/build.gradle 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/native-lib.cpp 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/rtk_module/rtk.cpp 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/rtk_platform/parse_net.cpp 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/rtk_platform/platform.cpp 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/cpp/rtk_platform/platform.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
lib/src/main/java/com/anyun/exam/lib/RemoteService.java 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
.idea/misc.xml
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="1.8" project-jdk-type="JavaSDK">
  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" project-jdk-name="JDK" project-jdk-type="JavaSDK">
    <output url="file://$PROJECT_DIR$/build/classes" />
  </component>
  <component name="ProjectType">
app/src/main/java/safeluck/drive/evaluation/app.java
@@ -31,8 +31,6 @@
    public void onCreate() {
        super.onCreate();
        //初始化Fragment 建议在Application onCreate里面初始化
        if (SystemUtil.compareProcessName(this)){
            Fragmentation.builder().stackViewMode(Fragmentation.BUBBLE).debug(false)
                    .handleException(new ExceptionHandler() {
lib/build.gradle
@@ -20,7 +20,7 @@
        ndk {
            // Specifies the ABI configurations of your native
            // libraries Gradle should build and package with your APK.
            abiFilters 'armeabi-v7a','arm64-v8a'
            abiFilters 'armeabi-v7a'
        }
    }
lib/src/main/cpp/native-lib.cpp
@@ -19,7 +19,7 @@
const char *RTK_PLATFORM_IP = "47.93.80.84";
const int RTK_PLATFORM_PORT = 12125;
const uint8_t phone[] = {0x20,0x19,0x10,0x15,0x00,0x00,0x00,0x02};
const uint8_t phone[] = {0x20,0x19,0x10,0x15,0x00,0x00,0x00,0x01};
#define IMEI_LENGTH         15
lib/src/main/cpp/rtk_module/rtk.cpp
@@ -294,8 +294,8 @@
        gpsStatus.bcd_time[1] = ((MM/10)<<4) + (MM%10);
        gpsStatus.bcd_time[2] = ((DD/10)<<4) + (DD%10);
        gpsStatus.bcd_time[3] = ((hh/10)<<4) + (hh%10);
        gpsStatus.bcd_time[4] = ((ss/10)<<4) + (ss%10);
        gpsStatus.bcd_time[5] = ((mm/10)<<4) + (mm%10);
        gpsStatus.bcd_time[4] = ((mm/10)<<4) + (mm%10);
        gpsStatus.bcd_time[5] = ((ss/10)<<4) + (ss%10);
        recved_gprmc_time = AppTimer_GetTickCount();
lib/src/main/cpp/rtk_platform/parse_net.cpp
@@ -369,10 +369,7 @@
        }
        case ID_PC_RTK_DOWNLOAD:
            DEBUG("ID_PC_RTK_DOWNLOAD");
            // 汇报给单片机
            if (length > 0) {
                SendRtkToMcu(data, length);
            }
            ReceivedRtk(data, length);
            break;
        default:
            break;
@@ -936,6 +933,7 @@
    uint8_t data[MAX_CONTENT_SIZE];
    int x = 0;
    data[x++] = 0;
    data[x++] = gps_status;
    data[x++] = BREAK_UINT32(latitude, 3);
    data[x++] = BREAK_UINT32(latitude, 2);
lib/src/main/cpp/rtk_platform/platform.cpp
@@ -15,6 +15,7 @@
#include "parse_net.h"
#include "../defs.h"
#include "../rtk_module/rtk.h"
#include "../mcu/mcu_if.h"
#define PARSE_BUFF_SIZE         4096
@@ -69,6 +70,7 @@
static void LoginPlatform(void);
static void LoginPlatformTimeout(union sigval sig);
static void TriggerHeartbeat(union sigval sig);
static void RequestRtkNoResp(union sigval sig);
void InitPlatform(const uint8_t *phone, const char *domain_name, int port)
{
@@ -96,8 +98,6 @@
    pthread_attr_init(&attr);
    pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);//detached
    pthread_create(&pid, &attr, StatusListenThread, NULL);
    strcpy(deviceInfo.imei, GetImei());
    ConnectPlatform(domain_name, port);
}
@@ -346,11 +346,31 @@
    }
}
void ReceivedRtk(const uint8_t *data, int length)
{
    AppTimer_delete(RequestRtkNoResp);
    // 汇报给单片机
    if (length > 0) {
        SendRtkToMcu(data, length);
    }
}
static void RequestRtkNoResp(union sigval sig)
{
    AppTimer_delete(RequestRtkNoResp);
    requestPlatformSendRtk = true;
}
void RequestRtkDownload(uint32_t latitude, uint32_t longitude, uint16_t altitude,
                        const uint8_t *bcd_time, uint16_t rtk_pkt_interval)
{
    if (requestPlatformSendRtk) {
        DisplayText("请求下载RTK数据");
        requestPlatformSendRtk = false;
        AppTimer_delete(RequestRtkNoResp);
        AppTimer_add(RequestRtkNoResp, D_SEC(5));
        SendRTKStart(latitude, longitude, altitude, bcd_time, rtk_pkt_interval);
    }
}
lib/src/main/cpp/rtk_platform/platform.h
@@ -17,6 +17,7 @@
int WritePlatform(const uint8_t * buf, uint32_t len);
void DeviceRegisterCallback(uint8_t res, const uint8_t *data, int length);
void DeviceLoginCallback(uint8_t res);
void ReceivedRtk(const uint8_t *data, int length);
void RequestRtkDownload(uint32_t latitude, uint32_t longitude, uint16_t altitude,
                        const uint8_t *bcd_time, uint16_t rtk_pkt_interval);
lib/src/main/java/com/anyun/exam/lib/RemoteService.java
@@ -11,6 +11,7 @@
import com.anyun.exam.lib.util.DESUtil;
import com.anyun.exam.lib.util.NetUtils;
import com.anyun.exam.lib.util.Speaker;
import androidx.annotation.Nullable;
@@ -30,6 +31,8 @@
    private RemoteCallbackList<IListenerInterface> mListenerList = new RemoteCallbackList();
    private IListenerInterface mListener;
    private int msgId = 0;
    private Speaker speaker = null;
    private IRemoteInterface.Stub iRemoteInterface = new IRemoteInterface.Stub(){
        @Override
        public void registListener(IListenerInterface i) throws RemoteException {
@@ -59,6 +62,8 @@
    public void onCreate() {
        super.onCreate();
        Log.i(TAG,"onCreate()");
        speaker = new Speaker(getApplicationContext());
        startNative();
        new Thread(new Worker()).start();
    }
@@ -69,7 +74,7 @@
        public void run() {
            while (!mIsServiceDestroyed.get()){
                try {
                    Thread.sleep(4*1000);
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
@@ -88,8 +93,12 @@
    private void onMessageArrived(String json){
        int N = mListenerList.getRegisteredCallbackCount();
        Log.d(TAG, "getRegisteredCallbackCount = " + N);
        mListenerList.beginBroadcast();
        for (int i = 0; i < N; i++) {
            mListenerList.beginBroadcast();
            mListener  = mListenerList.getBroadcastItem(i);
            if (mListener != null){
                try {
@@ -98,8 +107,9 @@
                    e.printStackTrace();
                }
            }
            mListenerList.finishBroadcast();
        }
        mListenerList.finishBroadcast();
    }
    public String javaGetImei() {
@@ -163,9 +173,9 @@
    }
    public void TextSpeak(String text) {
/*        if (speaker != null) {
        if (speaker != null) {
            speaker.speak(text);
        }*/
        }
    }
    // Used to load the 'native-lib' library on application startup.