yy1717
2020-01-06 9c13ff18dab0c35ada32a318ab6e380c9b184ffe
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);
    }
}