完成路及规划的作业的开始工作成功.
完成路径规划的暂停功能的对接 完成路径规划的继续功能的对接 完成路径规划的停止功能的对接
This commit is contained in:
@@ -8,6 +8,8 @@ import '../models/route_plan_send_entity.dart';
|
||||
class RoutePlanningRepositoryImpl implements RoutePlanningRepository {
|
||||
final TcpClient tcp;
|
||||
late PathPlanner _planner;
|
||||
// 🔥 新增:存储 AppState 的引用
|
||||
dynamic _appState;
|
||||
|
||||
RoutePlanningRepositoryImpl({required this.tcp}) { // ✅ 加 {required} 和类型注解
|
||||
_planner = PathPlanner(tcp);
|
||||
@@ -15,6 +17,7 @@ class RoutePlanningRepositoryImpl implements RoutePlanningRepository {
|
||||
@override
|
||||
Future<void> startRoutePlanning(Queue<DeviceAddPathPointModel> locationQueue) async {
|
||||
// 直接传入 DeviceAddPathPointModel 列表(无需转换)
|
||||
print("[底层开始发送指令了]");
|
||||
final List<DeviceAddPathPointModel> locations = locationQueue.toList();
|
||||
_planner.startRoutePlanning(locations);
|
||||
}
|
||||
@@ -36,6 +39,15 @@ class RoutePlanningRepositoryImpl implements RoutePlanningRepository {
|
||||
// TODO: implement stopRoutePlanning
|
||||
_planner.stopRoutePlanning();
|
||||
}
|
||||
|
||||
@override
|
||||
getCurrentAppState() {
|
||||
// TODO: implement getCurrentAppState
|
||||
return _appState;
|
||||
}
|
||||
void setAppState(dynamic state) {
|
||||
_appState = state;
|
||||
}
|
||||
}
|
||||
|
||||
// PathPlanner
|
||||
@@ -47,6 +59,7 @@ class PathPlanner {
|
||||
PathPlanner(this.tcpClient);
|
||||
|
||||
void sendNextLocation() {
|
||||
print("[在发送指令sendNextLocation方法中]");
|
||||
if (isStart && locationQueue.isEmpty) {
|
||||
isStart = false;
|
||||
print("[track]");
|
||||
@@ -71,7 +84,9 @@ class PathPlanner {
|
||||
void startRoutePlanning(List<DeviceAddPathPointModel> locations) {
|
||||
locationQueue.addAll(locations);
|
||||
isStart = true;
|
||||
print("[发送指令要转换类型了完成]");
|
||||
sendNextLocation();
|
||||
|
||||
}
|
||||
/// 暂停
|
||||
void pauseRPWork() {
|
||||
|
||||
Reference in New Issue
Block a user