// 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; } }