一次大的提交
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
/// 设备运行参数实体
|
||||
class DeviceRunParamEntity {
|
||||
final int id;
|
||||
final String deviceId;
|
||||
final int siteId;
|
||||
final int orgId;
|
||||
final double runSpeed;
|
||||
final double leftForwardGain;
|
||||
final double leftBackwardGain;
|
||||
final double rightForwardGain;
|
||||
final double rightBackwardGain;
|
||||
/// API 返回的全部原始字段,用于页面展示
|
||||
final Map<String, dynamic> rawData;
|
||||
|
||||
DeviceRunParamEntity({
|
||||
required this.id,
|
||||
required this.deviceId,
|
||||
required this.siteId,
|
||||
required this.orgId,
|
||||
required this.runSpeed,
|
||||
required this.leftForwardGain,
|
||||
required this.leftBackwardGain,
|
||||
required this.rightForwardGain,
|
||||
required this.rightBackwardGain,
|
||||
required this.rawData,
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import 'package:fpdart/fpdart.dart';
|
||||
import 'package:maibu_satabot_v2/core/error/failure.dart';
|
||||
import '../entities/device_run_param_entity.dart';
|
||||
|
||||
abstract class DeviceRunParamRepository {
|
||||
Future<Either<Failure, DeviceRunParamEntity>> getByDeviceId(String deviceId);
|
||||
Future<Either<Failure, bool>> save(Map<String, dynamic> params);
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import 'package:fpdart/fpdart.dart';
|
||||
import 'package:maibu_satabot_v2/core/error/failure.dart';
|
||||
import '../entities/device_run_param_entity.dart';
|
||||
import '../repositories/device_run_param_repository.dart';
|
||||
|
||||
class GetDeviceRunParamUseCase {
|
||||
final DeviceRunParamRepository repository;
|
||||
|
||||
GetDeviceRunParamUseCase(this.repository);
|
||||
|
||||
Future<Either<Failure, DeviceRunParamEntity>> execute(String deviceId) async {
|
||||
return await repository.getByDeviceId(deviceId);
|
||||
}
|
||||
}
|
||||
|
||||
class SaveDeviceRunParamUseCase {
|
||||
final DeviceRunParamRepository repository;
|
||||
|
||||
SaveDeviceRunParamUseCase(this.repository);
|
||||
|
||||
Future<Either<Failure, bool>> execute(Map<String, dynamic> params) async {
|
||||
return await repository.save(params);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user