Files
flutterApp/lib/features/home/presentation/widgets/common/commonFn.dart

42 lines
985 B
Dart
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// common/location_utils.dart
/// 定位质量解析工具类
class LocationUtils {
/// 解析定位质量值为可读字符串
/// [locationValue] 定位质量编码(0/1/2/4/5)
/// 返回:对应的中文描述
static String parseLocationQuality(int locationValue) {
switch (locationValue) {
case 0:
return '无效';
case 1:
return 'GPS 单点定位';
case 2:
return 'DGPS 伪距差分或 SBAS';
case 4:
return 'RTK 固定解';
case 5:
return 'RTK 浮点解';
default:
return '未知($locationValue)';
}
}
static String parseControlMode(int value) {
switch (value) {
case 3:
return '远程控制';
default:
return '本地控制';
}
}
// 【可选扩展】可添加更多定位相关工具方法
// 示例:校验定位质量是否有效
static bool isLocationValid(int locationValue) {
return locationValue != 0;
}
}