APP远程遥控推出页面释放权限集成-待测试
This commit is contained in:
@@ -35,8 +35,6 @@ class RemoteControlRepositoryImpl implements RemoteControlRepository {
|
||||
void sendControlMachineCmd(MachineControlStatusEntity status) {
|
||||
// 1. 调用算法:将摇杆坐标 (x, y) 转换为左右轮电机转速
|
||||
final speeds = _diffSteer.calculate(status.originX, status.originY);
|
||||
|
||||
|
||||
//debugPrint('🎮 [摇杆数据] originX: ${status.originX}, originY: ${status.originY}');
|
||||
_logger.logWithLevel('⚙️ [电机速度] left: ${speeds['left']}, right: ${speeds['right']}');
|
||||
|
||||
@@ -54,15 +52,18 @@ class RemoteControlRepositoryImpl implements RemoteControlRepository {
|
||||
ignition: status.ignitionStatus,
|
||||
emergency: status.isEmergency ? 1 : 0,
|
||||
);
|
||||
debugPrint('📦 [发送数据] payload: ${payload}');
|
||||
debugPrint('📦 [发送数据] emergency 字节值:${payload[7]}');
|
||||
//debugPrint('📦 [发送数据] payload: ${payload}');
|
||||
_logger.logWithLevel('📦 [发送数据] payload: ${payload}');
|
||||
//debugPrint('📦 [发送数据] emergency 字节值:${payload[7]}');
|
||||
_logger.logWithLevel('📦 [发送数据] emergency 字节值:${payload[7]}');
|
||||
// 3. 调用 TcpClient:发送指令。
|
||||
// TcpClient.sendRaw 会自动帮你加上 [0xAB, 0xAA] 头和 [0xAA, 0xAB] 尾
|
||||
_tcpClient.sendRaw(
|
||||
MachineProtocolConstants.cmdRemoteControl, // 这里通常是 0x00
|
||||
payload,
|
||||
);
|
||||
debugPrint('✅ [TCP] 指令已发送');
|
||||
//debugPrint('✅ [TCP] 指令已发送');
|
||||
_logger.logWithLevel('✅ [TCP] 指令已发送');
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -91,4 +92,9 @@ class RemoteControlRepositoryImpl implements RemoteControlRepository {
|
||||
_remoteTcp.sendSwitchControlResponse(false, deviceId);
|
||||
}
|
||||
}
|
||||
///app退出远程控制后释放权限
|
||||
@override
|
||||
Future<bool> releasePermission(String platform) async {
|
||||
return await _remoteHttp.releaseRemoteControlViaHttp(platform);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user