|
|
@@ -48,8 +48,10 @@ typedef struct
|
|
|
struct
|
|
|
{
|
|
|
bool bOK; // 定位是否成功
|
|
|
- char lat[MAX_LINE_CHARS]; // 纬度字符串
|
|
|
- char lon[MAX_LINE_CHARS]; // 经度字符串
|
|
|
+ char lat[32]; // 纬度字符串
|
|
|
+ char lon[32]; // 经度字符串
|
|
|
+ char inuse[8]; // 使用卫星数
|
|
|
+ char inview[8]; // 总的卫星数
|
|
|
} outPos2d;
|
|
|
void *out_rwlock;
|
|
|
} SAir530ZCom;
|
|
|
@@ -77,6 +79,7 @@ static int comio_data_recv_proc(unsigned long wParam/*传递打开的串口句
|
|
|
else { bWeakPos = true; pComIO->filter.weak_cnt++; }
|
|
|
|
|
|
double lat = pComIO->info.lat, lon = pComIO->info.lon;
|
|
|
+ int inuse = pComIO->info.satinfo.inuse, inview = pComIO->info.satinfo.inview;
|
|
|
|
|
|
if(IS_COORD_NAN(pComIO->filter.lat) || IS_COORD_NAN(pComIO->filter.lon))
|
|
|
{
|
|
|
@@ -111,13 +114,14 @@ static int comio_data_recv_proc(unsigned long wParam/*传递打开的串口句
|
|
|
sw_rwlock_wrlock(pComIO->out_rwlock, WAIT_FOREVER);
|
|
|
sprintf(pComIO->outPos2d.lat, "%.6f", out_lat);
|
|
|
sprintf(pComIO->outPos2d.lon, "%.6f", out_lon);
|
|
|
+ sprintf(pComIO->outPos2d.inuse, "%d", inuse);
|
|
|
+ sprintf(pComIO->outPos2d.inview, "%d", inview);
|
|
|
pComIO->outPos2d.bOK = true;
|
|
|
sw_rwlock_unlock(pComIO->out_rwlock);
|
|
|
|
|
|
// 3-打印定位结果
|
|
|
sw_log_trace("[%s] 已定位: lat=%.6f, lon=%.6f, HDOP=%.1f, Sats=%d/%d, DeltaMeters=%.1fm, IsWeakPos=%d", MODULE_NAME,
|
|
|
- out_lat, out_lon, pComIO->info.HDOP,
|
|
|
- pComIO->info.satinfo.inuse, pComIO->info.satinfo.inview, dist, bWeakPos);
|
|
|
+ out_lat, out_lon, pComIO->info.HDOP, inuse, inview, dist, bWeakPos);
|
|
|
}
|
|
|
|
|
|
if(pComIO->filter.weak_cnt >= CONT_WEAK_FRAMES)
|
|
|
@@ -178,15 +182,15 @@ int Air530Z_ComExit()
|
|
|
}
|
|
|
|
|
|
// 获取当前的2D位置, 返回: 0成功, -1未定位
|
|
|
-int Air530Z_GetPos2D(char lat[MAX_LINE_CHARS], char lon[MAX_LINE_CHARS])
|
|
|
+int Air530Z_GetPos2D(char lat[32], char lon[32], char inuse[8], char inview[8])
|
|
|
{
|
|
|
bool bOK = false;
|
|
|
if(!s_myCom.h || !s_myCom.out_rwlock) return -1; // 防御检查, 加强健壮性
|
|
|
sw_rwlock_rdlock(s_myCom.out_rwlock, WAIT_FOREVER);
|
|
|
bOK = s_myCom.outPos2d.bOK;
|
|
|
if(bOK) {
|
|
|
- strcpy(lat, s_myCom.outPos2d.lat);
|
|
|
- strcpy(lon, s_myCom.outPos2d.lon);
|
|
|
+ strcpy(lat, s_myCom.outPos2d.lat); strcpy(lon, s_myCom.outPos2d.lon);
|
|
|
+ strcpy(inuse, s_myCom.outPos2d.inuse); strcpy(inview, s_myCom.outPos2d.inview);
|
|
|
}
|
|
|
sw_rwlock_unlock(s_myCom.out_rwlock);
|
|
|
return bOK ? 0 : -1;
|