消防controller代码

zw
CZ 4 months ago
parent f7c839be2d
commit 578369e75b

@ -0,0 +1,156 @@
namespace Entity.Api.Resp;
public partial class FireResp
{
public Subzone2 Subzone2 = new Subzone2();
public Subzone5 Subzone5 = new Subzone5();
public Subzone7 Subzone7 = new Subzone7();
}
public class Subzone2
{
/// <summary>
/// 启动喷洒 1延时结束后发出启动喷洒 信号0默认状态
/// </summary>
public bool PrimingSpray { get; set; }
/// <summary>
/// 喷洒 1存在喷洒状态 即收到启动 反馈信号,表示灭火器启动成功 0默认状态
/// </summary>
public bool Spray { get; set; }
/// <summary>
/// 声光报警状态 1声光报警状态0默认状态
/// </summary>
public bool AudibleVisualAlarmStatus { get; set; }
/// <summary>
/// 放气勿入状态 1放气勿入状态0默认状态
/// </summary>
public bool DeflatedDoNotEnter { get; set; }
}
public class Subzone5
{
/// <summary>
/// 防护区
/// 防护区编号:
/// 1表示电池仓
/// 2表示充电室
/// 3表示主控室
/// 4表示换电通道
/// 5表示电池仓 2
/// 6表示充电室 2
/// 7预留
/// 8预留
/// </summary>
public byte ProtectionZone001 { get; set; }
/// <summary>
/// 类型
/// </summary>
public byte Type001 { get; set; }
/// <summary>
/// 探测器 ID 与探测器编号对应
/// </summary>
public byte DetectorID001 { get; set; }
/// <summary>
/// 报警等级 0x0000正常0x0001一级预警 0x0002二级报警 0x0003三级报警 0x0004四级报警预留
/// </summary>
public byte AlarmLevel001 { get; set; }
/// <summary>
/// 温度 实际值=寄存器值 -40
/// </summary>
public byte Temperature001 { get; set; }
/// <summary>
/// 一氧化碳浓度 实际值=寄存器值 / 1000
/// </summary>
public byte CoConcentration001 { get; set; }
/// <summary>
/// VOC
/// </summary>
public byte VOC001 { get; set; }
/// <summary>
/// 烟雾 0xFF00 烟雾报警 0x0000 烟雾正常
/// </summary>
public byte Smoke001 { get; set; }
public byte ProtectionZone002 { get; set; }
public byte Type002 { get; set; }
public byte DetectorID002 { get; set; }
public byte AlarmLevel002 { get; set; }
public byte Temperature002 { get; set; }
public byte CoConcentration002 { get; set; }
public byte VOC002 { get; set; }
public byte Smoke002 { get; set; }
public byte ProtectionZone003 { get; set; }
public byte Type003 { get; set; }
public byte DetectorID003 { get; set; }
public byte AlarmLevel003 { get; set; }
public byte Temperature003 { get; set; }
public byte CoConcentration003 { get; set; }
public byte VOC003 { get; set; }
public byte Smoke003 { get; set; }
public byte ProtectionZone004 { get; set; }
public byte Type004 { get; set; }
public byte DetectorID004 { get; set; }
public byte AlarmLevel004 { get; set; }
public byte Temperature004 { get; set; }
public byte CoConcentration004 { get; set; }
public byte VOC004 { get; set; }
public byte Smoke004 { get; set; }
public byte ProtectionZone005 { get; set; }
public byte Type005 { get; set; }
public byte DetectorID005 { get; set; }
public byte AlarmLevel005 { get; set; }
public byte Temperature005 { get; set; }
public byte CoConcentration005 { get; set; }
public byte VOC005 { get; set; }
public byte Smoke005 { get; set; }
public byte ProtectionZone006 { get; set; }
public byte Type006 { get; set; }
public byte DetectorID006 { get; set; }
public byte AlarmLevel006 { get; set; }
public byte Temperature006 { get; set; }
public byte CoConcentration006 { get; set; }
public byte VOC006 { get; set; }
public byte Smoke006 { get; set; }
}
public class Subzone7
{
/// <summary>
/// 1#灭火器状态
/// 0x0000未启用表示灭火器不存在
/// 0x0001正常
/// 0x0002喷洒表示灭火 器正在启动中
/// 0x0003失效表示灭火 器已喷洒完毕
/// </summary>
public ushort FireExtinguisherStatus01 { get; set; }
/// <summary>
/// 1#灭火器防护区
/// 1表示电池仓
/// 2表示充电室
/// 3表示主控室
/// 4表示换电通道
/// 5表示电池仓 2
/// 6表示充电室 2
/// 7预留
/// 8预留
/// </summary>
public ushort FireExtinguisherProtectionArea01 { get; set; }
public ushort FireExtinguisherStatus02 { get; set; }
public ushort FireExtinguisherProtectionArea02 { get; set; }
public ushort FireExtinguisherStatus03 { get; set; }
public ushort FireExtinguisherProtectionArea03 { get; set; }
public ushort FireExtinguisherStatus04 { get; set; }
public ushort FireExtinguisherProtectionArea04 { get; set; }
}

@ -0,0 +1,37 @@
using Entity.Api.Resp;
namespace Service.FireControl;
public class FireAutoMapper
{
public static Entity.Api.Resp.Subzone2 Subzone2(Service.FireControl.Msg.Subzone2 subzone2)
{
Entity.Api.Resp.Subzone2 Subzone2 = new Subzone2();
Subzone2.PrimingSpray = subzone2.PrimingSpray.Value;
Subzone2.Spray = subzone2.Spray.Value;
Subzone2.AudibleVisualAlarmStatus = subzone2.AudibleVisualAlarmStatus.Value;
Subzone2.DeflatedDoNotEnter = subzone2.DeflatedDoNotEnter.Value;
return Subzone2;
}
public static Entity.Api.Resp.Subzone5 Subzone5(Service.FireControl.Msg.Subzone5 subzone5)
{
Entity.Api.Resp.Subzone5 Subzone5 = new Subzone5();
Subzone5.DetectorID001 = subzone5.DetectorID001.Value;
Subzone5.Temperature001 = subzone5.Temperature001.Value;
Subzone5.CoConcentration001 = subzone5.CoConcentration001.Value;
Subzone5.AlarmLevel001 = subzone5.AlarmLevel001.Value;
Subzone5.Smoke001 = subzone5.Smoke001.Value;
return Subzone5;
}
public static Entity.Api.Resp.Subzone7 Subzone7(Service.FireControl.Msg.Subzone7 subzone7)
{
Entity.Api.Resp.Subzone7 Subzone7 = new Subzone7();
return Subzone7;
}
}

@ -1,5 +1,7 @@
using HybirdFrameworkCore.Entity; using Entity.Api.Resp;
using HybirdFrameworkCore.Entity;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Service.FireControl;
using Service.FireControl.Client; using Service.FireControl.Client;
using Service.FireControl.Msg; using Service.FireControl.Msg;
@ -23,7 +25,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.WriteExtinguisherOn(id)); return Result<bool>.Success(FireControlMgr.WriteExtinguisherOn(id));
} }
/// <summary> /// <summary>
/// 分区灭火器关 /// 分区灭火器关
/// </summary> /// </summary>
@ -35,7 +37,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.WriteExtinguisherOff(id)); return Result<bool>.Success(FireControlMgr.WriteExtinguisherOff(id));
} }
/// <summary> /// <summary>
/// 复位开 /// 复位开
/// </summary> /// </summary>
@ -47,7 +49,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.ResettingOn()); return Result<bool>.Success(FireControlMgr.ResettingOn());
} }
/// <summary> /// <summary>
/// 复位关 /// 复位关
/// </summary> /// </summary>
@ -59,7 +61,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.ResettingOff()); return Result<bool>.Success(FireControlMgr.ResettingOff());
} }
/// <summary> /// <summary>
/// 报警消音开 /// 报警消音开
/// </summary> /// </summary>
@ -71,7 +73,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.MuteAlarmToneOn()); return Result<bool>.Success(FireControlMgr.MuteAlarmToneOn());
} }
/// <summary> /// <summary>
/// 报警消音关 /// 报警消音关
/// </summary> /// </summary>
@ -83,7 +85,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.MuteAlarmToneOff()); return Result<bool>.Success(FireControlMgr.MuteAlarmToneOff());
} }
/// <summary> /// <summary>
/// 自检关 /// 自检关
/// </summary> /// </summary>
@ -95,7 +97,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.SelfInspectionOn()); return Result<bool>.Success(FireControlMgr.SelfInspectionOn());
} }
/// <summary> /// <summary>
/// 自检关 /// 自检关
/// </summary> /// </summary>
@ -107,7 +109,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.SelfInspectionOff()); return Result<bool>.Success(FireControlMgr.SelfInspectionOff());
} }
/// <summary> /// <summary>
/// 声光报警开 /// 声光报警开
/// </summary> /// </summary>
@ -119,7 +121,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.AudibleVisualAlarmOn()); return Result<bool>.Success(FireControlMgr.AudibleVisualAlarmOn());
} }
/// <summary> /// <summary>
/// 声光报警关 /// 声光报警关
/// </summary> /// </summary>
@ -131,7 +133,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.AudibleVisualAlarmOff()); return Result<bool>.Success(FireControlMgr.AudibleVisualAlarmOff());
} }
/// <summary> /// <summary>
/// 手动模式开 /// 手动模式开
/// </summary> /// </summary>
@ -143,7 +145,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.ManualModeOn()); return Result<bool>.Success(FireControlMgr.ManualModeOn());
} }
/// <summary> /// <summary>
/// 手动模式关 /// 手动模式关
/// </summary> /// </summary>
@ -155,7 +157,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.ManualModeOff()); return Result<bool>.Success(FireControlMgr.ManualModeOff());
} }
/// <summary> /// <summary>
/// 自动模式关 /// 自动模式关
/// </summary> /// </summary>
@ -167,7 +169,7 @@ public class FireControlController
{ {
return Result<bool>.Success(FireControlMgr.AutomaticModeOn()); return Result<bool>.Success(FireControlMgr.AutomaticModeOn());
} }
/// <summary> /// <summary>
/// 自动模式关 /// 自动模式关
/// </summary> /// </summary>
@ -185,11 +187,11 @@ public class FireControlController
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("GetSubzone2")] [HttpGet("GetSubzone2")]
public Result<Subzone2> GetSubzone2() public Result<Service.FireControl.Msg.Subzone2> GetSubzone2()
{ {
return Result<Subzone2>.Success(FireControlMgr.Subzone2); return Result<Service.FireControl.Msg.Subzone2>.Success(FireControlMgr.Subzone2);
} }
/// <summary> /// <summary>
/// 获取读取到的信息 /// 获取读取到的信息
/// </summary> /// </summary>
@ -199,7 +201,7 @@ public class FireControlController
{ {
return Result<Subzone3>.Success(FireControlMgr.Subzone3); return Result<Subzone3>.Success(FireControlMgr.Subzone3);
} }
/// <summary> /// <summary>
/// 获取读取到的信息 /// 获取读取到的信息
/// </summary> /// </summary>
@ -209,17 +211,17 @@ public class FireControlController
{ {
return Result<Subzone4>.Success(FireControlMgr.Subzone4); return Result<Subzone4>.Success(FireControlMgr.Subzone4);
} }
/// <summary> /// <summary>
/// 获取读取到的信息 /// 获取读取到的信息
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("GetSubzone5")] [HttpGet("GetSubzone5")]
public Result<Subzone5> GetSubzone5() public Result<Service.FireControl.Msg.Subzone5> GetSubzone5()
{ {
return Result<Subzone5>.Success(FireControlMgr.Subzone5); return Result<Service.FireControl.Msg.Subzone5>.Success(FireControlMgr.Subzone5);
} }
/// <summary> /// <summary>
/// 获取读取到的信息 /// 获取读取到的信息
/// </summary> /// </summary>
@ -229,17 +231,17 @@ public class FireControlController
{ {
return Result<Subzone6>.Success(FireControlMgr.Subzone6); return Result<Subzone6>.Success(FireControlMgr.Subzone6);
} }
/// <summary> /// <summary>
/// 获取读取到的信息 /// 获取读取到的信息
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
[HttpGet("GetSubzone7")] [HttpGet("GetSubzone7")]
public Result<Subzone7> GetSubzone7() public Result<Service.FireControl.Msg.Subzone7> GetSubzone7()
{ {
return Result<Subzone7>.Success(FireControlMgr.Subzone7); return Result<Service.FireControl.Msg.Subzone7>.Success(FireControlMgr.Subzone7);
} }
/// <summary> /// <summary>
/// 获取读取到的信息 /// 获取读取到的信息
/// </summary> /// </summary>
@ -249,7 +251,7 @@ public class FireControlController
{ {
return Result<Subzone8>.Success(FireControlMgr.Subzone8); return Result<Subzone8>.Success(FireControlMgr.Subzone8);
} }
/// <summary> /// <summary>
/// 获取读取到的信息 /// 获取读取到的信息
/// </summary> /// </summary>
@ -259,4 +261,16 @@ public class FireControlController
{ {
return Result<Subzone9>.Success(FireControlMgr.Subzone9); return Result<Subzone9>.Success(FireControlMgr.Subzone9);
} }
[HttpGet("FireResp")]
public Result<FireResp> FireResp()
{
FireResp FireResp = new FireResp();
FireResp.Subzone2 = FireAutoMapper.Subzone2(FireControlMgr.Subzone2);
FireResp.Subzone5 = FireAutoMapper.Subzone5(FireControlMgr.Subzone5);
FireResp.Subzone7 = FireAutoMapper.Subzone7(FireControlMgr.Subzone7);
return Result<FireResp>.Success(FireResp);
}
} }
Loading…
Cancel
Save