// +build ignore #include "air530z.h" #include "../swapi/subjects/serial/serial.h" // 主函数入口, 测试联网 int main(int argc,char *argv[]) { int ret = Air530Z_ComInit(); if(ret < 0) { sw_log_error("an error occurred while calling the Air530Z_ComInit() function(%d)!!", ret); goto end_p; } char *pos[] = { // 第一组网上获取测试数据样例 /*"$GPGGA,111609.14,5001.27,N,3613.06,E,3,08,0.0,10.2,M,0.0,M,0.0,0000*70\r\n", "$GPGSV,2,1,08,01,05,005,80,02,05,050,80,03,05,095,80,04,05,140,80*7f\r\n", "$GPGSV,2,2,08,05,05,185,80,06,05,230,80,07,05,275,80,08,05,320,80*71\r\n", "$GPGSA,A,3,01,02,03,04,05,06,07,08,00,00,00,00,0.0,0.0,0.0*3a\r\n"*/ // 第二组实际采集测试数据样例 "$GNGGA,084215.000,3448.59738,N,11339.70987,E,1,08,1.1,195.9,M,-18.9,M,,*6A\r\n", "$GNRMC,084215.000,A,3448.59738,N,11339.70987,E,0.00,0.00,260925,,,A,V*09\r\n", "$GPGSV,2,1,08,03,32,290,29,26,,,27,28,50,052,47,29,24,067,46,0*58\r\n", "$BDGSV,1,1,04,01,,,35,29,07,065,31,40,22,162,34,45,25,053,39,0*46\r\n" }; for(int i = 0; i < 4; i++) for(int j = 0; j < 4; j++) serial_write_recv_buffer(Air530Z_GetSerialHandle(), (unsigned char*)pos[j], strlen(pos[j])); char lat[MAX_LINE_CHARS] = {0}, lon[MAX_LINE_CHARS] = {0}; pos_p: ret = Air530Z_GetPos2D(lat, lon); if(ret == -1) { sw_log_warn("未定位!"); sw_thrd_delay(1000); goto pos_p; } sw_log_info("已定位: lat=%s, lon=%s", lat, lon); end_p: Air530Z_ComExit(); return ret; }