파일정리
This commit is contained in:
142
HMI/SubProject/AGV/Structure/ErrorFlag.cs
Normal file
142
HMI/SubProject/AGV/Structure/ErrorFlag.cs
Normal file
@@ -0,0 +1,142 @@
|
||||
using System;
|
||||
|
||||
namespace arDev
|
||||
{
|
||||
public partial class Narumi
|
||||
{
|
||||
|
||||
public class ErrorFlag
|
||||
{
|
||||
private COMM.Flag _value { get; set; } = new COMM.Flag(16);
|
||||
public void SetValue(Int16 value) { this._value.writeValue(value); }
|
||||
public UInt16 Value
|
||||
{
|
||||
get
|
||||
{
|
||||
return (UInt16)_value.Value;
|
||||
}
|
||||
}
|
||||
public enum eflag
|
||||
{
|
||||
Emergency = 0,
|
||||
Overcurrent,
|
||||
Charger_run_error,
|
||||
Charger_pos_error,
|
||||
line_out_error = 4,
|
||||
|
||||
/// <summary>
|
||||
/// 기동시 자석 감지 에러
|
||||
/// </summary>
|
||||
runerror_by_no_magent_line=5,
|
||||
/// <summary>
|
||||
/// 호출제어기 통신 오류
|
||||
/// </summary>
|
||||
controller_comm_error =6,
|
||||
|
||||
/// <summary>
|
||||
/// 배터리 저전압
|
||||
/// </summary>
|
||||
battery_low_voltage=7,
|
||||
|
||||
spare08=8,
|
||||
|
||||
lift_timeout=9,
|
||||
lift_driver_overcurrent=10,
|
||||
lift_driver_emergency = 11,
|
||||
|
||||
/// <summary>
|
||||
/// 도착경보기 통신 오류
|
||||
/// </summary>
|
||||
arrive_ctl_comm_error,
|
||||
|
||||
/// <summary>
|
||||
/// 자동문제어기 통신 오류
|
||||
/// </summary>
|
||||
door_ctl_comm_error,
|
||||
|
||||
/// <summary>
|
||||
/// 자동충전기 통신 오류
|
||||
/// </summary>
|
||||
charger_comm_error,
|
||||
|
||||
/// <summary>
|
||||
/// 교차로 제어기 통신 오류
|
||||
/// </summary>
|
||||
cross_ctrl_comm_error,
|
||||
}
|
||||
|
||||
public bool GetValue(eflag idx)
|
||||
{
|
||||
return _value.Get((int)idx);
|
||||
}
|
||||
public bool GetChanged(eflag idx)
|
||||
{
|
||||
return _value.GetChanged((int)idx);
|
||||
}
|
||||
|
||||
public bool Emergency { get { return GetValue(eflag.Emergency); } }
|
||||
public bool Overcurrent { get { return GetValue(eflag.Overcurrent); } }
|
||||
public bool Charger_run_error { get { return GetValue(eflag.Charger_run_error); } }
|
||||
public bool Charger_pos_error { get { return GetValue(eflag.Charger_pos_error); } }
|
||||
public bool line_out_error { get { return GetValue(eflag.line_out_error); } }
|
||||
public bool runerror_by_no_magent_line { get { return GetValue(eflag.runerror_by_no_magent_line); } }
|
||||
public bool controller_comm_error { get { return GetValue(eflag.controller_comm_error); } }
|
||||
public bool arrive_ctl_comm_error { get { return GetValue(eflag.arrive_ctl_comm_error); } }
|
||||
public bool door_ctl_comm_error { get { return GetValue(eflag.door_ctl_comm_error); } }
|
||||
public bool charger_comm_error { get { return GetValue(eflag.charger_comm_error); } }
|
||||
public bool cross_ctrl_comm_error { get { return GetValue(eflag.cross_ctrl_comm_error); } }
|
||||
public override string ToString()
|
||||
{
|
||||
//모든사태값을 탭으로 구분하여 문자를 생성한다
|
||||
var sb = new System.Text.StringBuilder();
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
var def = Enum.IsDefined(typeof(eflag), i);
|
||||
if (def)
|
||||
{
|
||||
var flag = (eflag)i;
|
||||
var value = _value.Get(i);
|
||||
sb.AppendLine($"[{i:00}][{flag}] : {value}");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public string ToRtfString()
|
||||
{
|
||||
var sb = new System.Text.StringBuilder();
|
||||
sb.AppendLine(@"{\rtf1\ansi\deff0");
|
||||
sb.AppendLine(@"{\colortbl ;\red0\green0\blue255;}"); // Color 1 = Blue
|
||||
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
var def = Enum.IsDefined(typeof(eflag), i);
|
||||
if (def)
|
||||
{
|
||||
var flag = (eflag)i;
|
||||
var value = _value.Get(i);
|
||||
string line = $"[{i:00}][{flag}] : {value}";
|
||||
|
||||
// : true가 포함된 줄은 파란색
|
||||
if (value == true)
|
||||
{
|
||||
sb.AppendLine(@"\cf1 " + line + @"\cf0\line");
|
||||
}
|
||||
else
|
||||
{
|
||||
sb.AppendLine(line + @"\line");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sb.AppendLine("}");
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user