using DispenserCommon.DB;
using DispenserCommon.Ioc;
using DispenserCommon.Utils;
using DispenserCore.Model.Entity;
using DispenserHal.Camera.DTO;
namespace DispenserCore.Service;
///
/// 相机参数业务接口
///
[Component]
public class CameraParamsService
{
private readonly SqliteHelper _db = ServiceLocator.GetService();
///
/// 获取算法参数
///
///
public CameraParams? GetCameraParams()
{
return _db.Query("select * from camera_params limit 1")
.FirstOrDefault();
}
///
/// 保存或者更新系统参数
///
///
///
public CameraParams SaveOrUpdate(CameraParams @params)
{
// 每次更新配置都要刷新一下配置
CameraConfig.Dll = @params.Dll;
CameraConfig.Sdk = @params.Sdk;
CameraConfig.CameraSn = @params.CameraSn;
CameraConfig.ScaleRatio = @params.ScaleRatio;
return _db.SaveOrUpdate(@params);
}
///
/// 清除历史纪录
///
///
public void Delete(string id)
{
_db.DeleteById(id);
}
}