| | |
| | | #include "parse_net.h" |
| | | #include "../defs.h" |
| | | #include "../rtk_module/rtk.h" |
| | | #include "../mcu/mcu_if.h" |
| | | |
| | | #define PARSE_BUFF_SIZE 4096 |
| | | |
| | |
| | | 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) |
| | | { |
| | |
| | | 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); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | 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); |
| | | } |
| | | } |