12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889 |
- using System;
- using System.Collections.Generic;
- using System.Text;
- using System.Windows.Forms;
- using System.Drawing;
- using System.Diagnostics;
- namespace FPER
- {
-
-
- public enum InputDeviceStatus { Init = -1, Use = 0, Normal = 1, Blocking = 3, PreFire = 4 }
-
- public enum OutputDeviceStatus { Init = -1, NotWrite = 0, Write = 1, Blocking = 3 }
-
- static public class DeviceStatusText
- {
- static public String InputText(InputDeviceStatus ins, bool cutFlag)
- {
- String toText = "";
- try
- {
- if (cutFlag)
- {
- toText = "차단";
- }
- else
- {
- switch (ins)
- {
- case InputDeviceStatus.Init: toText = " - "; break;
- case InputDeviceStatus.Use: toText = "감지"; break;
- case InputDeviceStatus.Normal: toText = "정상"; break;
- case InputDeviceStatus.Blocking: toText = "단선"; break;
- case InputDeviceStatus.PreFire: toText = "PreFire"; break;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return toText;
- }
- static public String InputText(InputDeviceStatus ins, DeviceTypeInfo dev)
- {
- String toText = " - ";
- try
- {
- if (dev == null || !dev.UseFlag)
- {
- toText = " - ";
- }
- else if (dev.CutFlag)
- {
- toText = "차단";
- }
- else
- {
- switch (ins)
- {
- case InputDeviceStatus.Init:
- toText = " - ";
- break;
- case InputDeviceStatus.Use:
- toText = "감지";
- break;
- case InputDeviceStatus.Normal:
- toText = "정상";
- break;
- case InputDeviceStatus.Blocking:
- toText = "단선";
- break;
- case InputDeviceStatus.PreFire:
- toText = "PreFire";
- break;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return toText;
- }
- static public String OutputText(OutputDeviceStatus outs, bool cutFlag)
- {
- String outText = "";
- try
- {
- if (cutFlag)
- {
- outText = "차단";
- }
- else
- {
- switch (outs)
- {
- case OutputDeviceStatus.NotWrite: outText = "정상"; break;
- case OutputDeviceStatus.Write: outText = "출력"; break;
- case OutputDeviceStatus.Blocking: outText = "차단"; break;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return outText;
- }
- static public String OutputText(OutputDeviceStatus outs, DeviceTypeInfo dev)
- {
- String outText = " - ";
- try
- {
- if (dev == null || !dev.UseFlag)
- {
- outText = " - ";
- }
- else if (dev.CutFlag)
- {
- outText = "차단";
- }
- else
- {
- switch (outs)
- {
- case OutputDeviceStatus.NotWrite:
- outText = "꺼짐";
- break;
- case OutputDeviceStatus.Write:
- outText = "동작";
- break;
- case OutputDeviceStatus.Blocking:
- outText = "차단";
- break;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return outText;
- }
- }
-
-
-
-
- public class GridRepeater
- {
- DataGridViewCell repCell;
-
- ImageList backmg;
- bool loopCutFlag = false;
-
- RepeaterDeviceTypeInfo dev;
-
- RepeaterPointUnit unit = null;
- public RepeaterPointUnit Unit { get { return this.unit; } }
-
- String infoMessage = "";
- public GridRepeater(DataGridViewCell repCell, ImageList backmg, int repNo)
- {
- try
- {
- this.repCell = repCell;
- this.backmg = backmg;
-
-
- this.repCell.Value = this.backmg.Images[0];
-
-
-
-
-
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
-
- public void Set_DeviceInfo(RepeaterDeviceTypeInfo dev)
- {
- try
- {
- this.dev = dev;
-
-
-
-
-
-
-
-
-
-
-
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- public void Set_DeviceUnit(RepeaterPointUnit unit)
- {
- try
- {
- this.unit = unit;
- this.reset = true;
- if (this.dev == null)
- {
- if (this.loopCutFlag) repCell.Value = new Bitmap(this.backmg.Images[1]);
- return;
- }
- if (this.dev.UseFlag)
- {
- if (unit != null)
- {
-
- if (this.dev.RepeaterType.Equals("A")) repCell.Value = A_typeImage();
- else if (this.dev.RepeaterType.Equals("B")) repCell.Value = B_typeImage();
-
- else if (this.dev.RepeaterType.Equals("C")) repCell.Value = C_typeImage(unit.AnalogDetecterValue_Input);
- else if (this.dev.RepeaterType.Equals("D")) repCell.Value = C_typeImage(unit.AnalogDetecterValue_Input);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
- }
- }
- bool reset = true;
-
- public bool UpdateDeviceUnit(RepeaterData data)
- {
- bool ret = false;
- try
- {
- if (this.unit.UpdateData(data) || this.reset)
- {
- ret = true;
- this.reset = false;
- if (this.dev == null)
- {
- if (this.loopCutFlag)
- {
-
- repCell.Value = this.backmg.Images[1];
- }
- return ret;
- }
- if (this.dev.UseFlag)
- {
-
- if (this.dev.RepeaterType.Equals("A"))
- repCell.Value = this.A_typeImage();
- else if (this.dev.RepeaterType.Equals("B"))
- repCell.Value = this.B_typeImage();
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
- }
- return ret;
- }
-
-
-
-
- public bool UpdateDeviceUnit(RepeaterData data, AnalogLevel analogLevel, MDIParent mdi)
- {
- bool ret = false;
- try
- {
- if (this.unit.UpdateData(data, analogLevel, mdi) || this.reset)
- {
- ret = true;
- this.reset = false;
- if (this.dev == null)
- {
- if (this.loopCutFlag)
- {
-
- repCell.Value = this.backmg.Images[1];
- }
- return ret;
- }
- if (this.dev.UseFlag)
- {
-
- if (this.dev.RepeaterType.Equals("A"))
- repCell.Value = this.A_typeImage();
- else if (this.dev.RepeaterType.Equals("B"))
- repCell.Value = this.B_typeImage();
-
- else if (this.dev.RepeaterType.Equals("C") || this.dev.RepeaterType.Equals("D"))
- repCell.Value = this.C_typeImage(data.AnalogDetecterValue_Input);
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
-
- }
- return ret;
- }
- public RepeaterDeviceTypeInfo DeviceInfo { get { return this.dev; } }
- public RepeaterPointUnit DeviceUnit { get { return this.unit; } }
- public String InfoMessage { get { return this.infoMessage; } }
- public bool LoopCutFlag { get { return this.loopCutFlag; } set { this.loopCutFlag = value; } }
-
- private Image A_typeImage()
- {
- Point posIn1 = new Point(13, 8);
- Point posIn2 = new Point(13, 23);
- Point posOut1 = new Point(49, 8);
- Point posOut2 = new Point(49, 23);
- System.Drawing.Color StColor_in1 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_in2 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_out1 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_out2 = System.Drawing.Color.Silver;
-
- if (this.unit != null)
- {
- StColor_in1 = InputValue(this.unit.Repeater_Input1, this.dev.getDeviceTypeInfo(1, "I"));
- StColor_in2 = InputValue(this.unit.Repeater_Input2, this.dev.getDeviceTypeInfo(2, "I"));
- StColor_out1 = OutputValue(this.unit.Repeater_Output1, this.dev.getDeviceTypeInfo(1, "O"));
- StColor_out2 = OutputValue(this.unit.Repeater_Output2, this.dev.getDeviceTypeInfo(2, "O"));
- }
- Bitmap bmp;
-
- if (this.dev.CutFlag || this.loopCutFlag)
- {
- bmp = new Bitmap(this.backmg.Images[1]);
- this.infoMessage = "차단된 중계기";
- }
- else
- {
- bmp = new Bitmap(this.backmg.Images[0]);
- if (this.unit != null)
- {
- if (this.unit.RepeaterNon == true)
- {
- bmp = new Bitmap(this.backmg.Images[3]);
- this.infoMessage = "존재하지 않는 중계기";
- }
- else if (this.unit.RepeaterErr == true)
- {
- bmp = new Bitmap(this.backmg.Images[2]);
- this.infoMessage = "중계기 통신 에러";
- }
- else if (this.unit.RepeaterR0 == true)
- {
- bmp = new Bitmap(this.backmg.Images[2]);
- this.infoMessage = "중계기 전원 이상";
- }
- else
- {
- this.infoMessage = "";
- }
- }
- }
- try
- {
- int Width = 12, Height = 12;
-
- FillRectangle(bmp, posIn1.X, posIn1.Y, Width, Height, StColor_in1);
- FillRectangle(bmp, posIn2.X, posIn2.Y, Width, Height, StColor_in2);
- FillRectangle(bmp, posOut1.X, posOut1.Y, Width, Height, StColor_out1);
- FillRectangle(bmp, posOut2.X, posOut2.Y, Width, Height, StColor_out2);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return bmp;
- }
-
- private Image B_typeImage()
- {
- Point posIn1 = new Point(6, 9);
- Point posIn2 = new Point(20, 9);
- Point posIn3 = new Point(6, 23);
- Point posIn4 = new Point(20, 23);
- Point posOut1 = new Point(43, 9);
- Point posOut2 = new Point(57, 9);
- Point posOut3 = new Point(43, 23);
- Point posOut4 = new Point(57, 23);
- System.Drawing.Color StColor_in1 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_in2 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_in3 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_in4 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_out1 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_out2 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_out3 = System.Drawing.Color.Silver;
- System.Drawing.Color StColor_out4 = System.Drawing.Color.Silver;
-
- if (this.unit != null)
- {
- StColor_in1 = InputValue(this.unit.Repeater_Input1, this.dev.getDeviceTypeInfo(1, "I"));
- StColor_in2 = InputValue(this.unit.Repeater_Input2, this.dev.getDeviceTypeInfo(2, "I"));
- StColor_in3 = InputValue(this.unit.Repeater_Input3, this.dev.getDeviceTypeInfo(3, "I"));
- StColor_in4 = InputValue(this.unit.Repeater_Input4, this.dev.getDeviceTypeInfo(4, "I"));
- StColor_out1 = OutputValue(this.unit.Repeater_Output1, this.dev.getDeviceTypeInfo(1, "O"));
- StColor_out2 = OutputValue(this.unit.Repeater_Output2, this.dev.getDeviceTypeInfo(2, "O"));
- StColor_out3 = OutputValue(this.unit.Repeater_Output3, this.dev.getDeviceTypeInfo(3, "O"));
- StColor_out4 = OutputValue(this.unit.Repeater_Output4, this.dev.getDeviceTypeInfo(4, "O"));
- }
- Bitmap bmp;
-
- if (this.dev.CutFlag || this.loopCutFlag)
- {
- bmp = new Bitmap(this.backmg.Images[1]);
- this.infoMessage = "차단된 중계기";
- }
- else
- {
- bmp = new Bitmap(this.backmg.Images[0]);
- if (this.unit != null)
- {
- if (this.unit.RepeaterNon == true)
- {
- bmp = new Bitmap(this.backmg.Images[3]);
- this.infoMessage = "존재하지 않는 중계기";
- }
- else if (this.unit.RepeaterErr == true)
- {
- bmp = new Bitmap(this.backmg.Images[2]);
- this.infoMessage = "중계기 통신 에러";
- }
- else if (this.unit.RepeaterR0 == true)
- {
- bmp = new Bitmap(this.backmg.Images[2]);
- this.infoMessage = "중계기 전원 이상";
- }
- else
- {
- this.infoMessage = "";
- }
- }
- }
- try
- {
- int Width = 12, Height = 12;
-
- FillRectangle(bmp, posIn1.X, posIn1.Y, Width, Height, StColor_in1);
- FillRectangle(bmp, posIn2.X, posIn2.Y, Width, Height, StColor_in2);
- FillRectangle(bmp, posIn3.X, posIn3.Y, Width, Height, StColor_in3);
- FillRectangle(bmp, posIn4.X, posIn4.Y, Width, Height, StColor_in4);
- FillRectangle(bmp, posOut1.X, posOut1.Y, Width, Height, StColor_out1);
- FillRectangle(bmp, posOut2.X, posOut2.Y, Width, Height, StColor_out2);
- FillRectangle(bmp, posOut3.X, posOut3.Y, Width, Height, StColor_out3);
- FillRectangle(bmp, posOut4.X, posOut4.Y, Width, Height, StColor_out4);
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return bmp;
- }
-
-
-
-
-
- private Image C_typeImage(int AnalogDetecterValue_Input)
- {
-
- Point posIn1 = new Point(6, 9);
- System.Drawing.Color StColor_in1 = System.Drawing.Color.Silver;
-
- if (this.unit != null)
- {
- StColor_in1 = AnalogInputValue(this.unit.Repeater_Input1, this.dev.getDeviceTypeInfo(1, "I"));
- }
- Bitmap bmp;
-
- if (this.dev.CutFlag || this.loopCutFlag)
- {
- bmp = new Bitmap(this.backmg.Images[1]);
- this.infoMessage = "차단된 감지기";
- }
- else
- {
- bmp = new Bitmap(this.backmg.Images[0]);
- if (this.unit != null)
- {
- if (this.unit.RepeaterNon == true)
- {
- bmp = new Bitmap(this.backmg.Images[3]);
- this.infoMessage = "존재하지 않는 감지기";
- StColor_in1 = System.Drawing.Color.Silver;
- }
- else if (this.unit.RepeaterErr == true)
- {
- bmp = new Bitmap(this.backmg.Images[2]);
- this.infoMessage = "감지기 통신 에러";
- StColor_in1 = System.Drawing.Color.Silver;
- }
- else if (this.unit.RepeaterR0 == true)
- {
- bmp = new Bitmap(this.backmg.Images[2]);
- this.infoMessage = "감지기 전원 이상";
- StColor_in1 = System.Drawing.Color.Silver;
- }
- else
- {
- this.infoMessage = "";
- }
- }
- }
- try
- {
-
- int Width = 62, Height = 25;
-
- FillRectangle(bmp, posIn1.X, posIn1.Y, Width, Height, StColor_in1, AnalogDetecterValue_Input);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return bmp;
- }
-
-
-
- private void FillRectangle(Bitmap bmp, int x, int y, int w, int h, Color color)
- {
- Graphics gBuffer = Graphics.FromImage(bmp);
- SolidBrush cbrush = new SolidBrush(color);
- Rectangle rect = new Rectangle(x, y, w, h);
- gBuffer.FillRectangle(cbrush, rect);
- }
-
- private void FillRectangle(Bitmap bmp, int x, int y, int w, int h, Color color, int AnalogDetecterValue)
- {
- Graphics gBuffer = Graphics.FromImage(bmp);
- SolidBrush cbrush = new SolidBrush(color);
- Rectangle rect = new Rectangle(x, y, w, h);
- gBuffer.FillRectangle(cbrush, rect);
-
- if (color == Color.Black)
- cbrush = new SolidBrush(Color.White);
-
- else if (color == Color.Silver)
- cbrush = new SolidBrush(Color.Silver);
- else
- cbrush = new SolidBrush(Color.Black);
- gBuffer.DrawString(
- string.Format("{0:000}", AnalogDetecterValue),
- new System.Drawing.Font("굴림", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point),
- cbrush,
- new PointF(22, 13));
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- private Color InputValue(InputDeviceStatus inputValue, DeviceTypeInfo d)
- {
- System.Drawing.Color StColor_in = System.Drawing.Color.Silver;
- try
- {
- if (d == null)
- {
- StColor_in = System.Drawing.Color.Silver;
- }
- else
- {
- switch (inputValue)
- {
- case InputDeviceStatus.Init:
- StColor_in = System.Drawing.Color.Silver;
- break;
- case InputDeviceStatus.Blocking:
- StColor_in = System.Drawing.Color.Black;
- break;
- case InputDeviceStatus.Normal:
- StColor_in = System.Drawing.Color.Lime;
- break;
- case InputDeviceStatus.Use:
-
- if (d.DeviceType == "IC")
- {
- StColor_in = System.Drawing.Color.Blue;
- }
- else
- {
- StColor_in = System.Drawing.Color.Red;
- }
- break;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return StColor_in;
- }
-
- private Color AnalogInputValue(InputDeviceStatus inputValue, DeviceTypeInfo d)
- {
- System.Drawing.Color StColor_in = System.Drawing.Color.Silver;
- try
- {
- if (d == null)
- {
- StColor_in = System.Drawing.Color.Silver;
- }
- else
- {
- switch (inputValue)
- {
-
- case InputDeviceStatus.Init:
- StColor_in = System.Drawing.Color.Silver;
- break;
-
- case InputDeviceStatus.Blocking:
- StColor_in = System.Drawing.Color.Black;
- break;
-
- case InputDeviceStatus.Normal:
- StColor_in = System.Drawing.Color.Lime;
- break;
-
- case InputDeviceStatus.Use:
- StColor_in = System.Drawing.Color.Red;
- break;
-
- case InputDeviceStatus.PreFire:
- StColor_in = System.Drawing.Color.HotPink;
- break;
- }
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return StColor_in;
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- private Color OutputValue(OutputDeviceStatus outputValue, DeviceTypeInfo d)
- {
- System.Drawing.Color StColor_out = System.Drawing.Color.Silver;
- try
- {
-
-
- if (d == null)
- {
- StColor_out = System.Drawing.Color.Silver;
- }
- else
- {
- switch (outputValue)
- {
- case OutputDeviceStatus.Init:
- StColor_out = System.Drawing.Color.Silver;
- break;
- case OutputDeviceStatus.Blocking:
- StColor_out = System.Drawing.Color.Black;
- break;
- case OutputDeviceStatus.NotWrite:
- StColor_out = System.Drawing.Color.Green;
- break;
- case OutputDeviceStatus.Write:
- StColor_out = System.Drawing.Color.Firebrick;
- break;
- }
- }
-
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return StColor_out;
- }
- }
-
-
-
-
-
- public class ReceiverTypeInfo
- {
- private int receiverNo = -1;
- private Boolean frontLoop_UseFlag = true;
- private Boolean backLoop_UseFlag = true;
- private Boolean io_UseFlag = true;
- private Boolean keypad_UseFlag = true;
-
-
-
- private BoardTypeInfo[] myBoardType = new BoardTypeInfo[65];
- public ReceiverTypeInfo(int receiverNo)
- {
- try
- {
- this.receiverNo = receiverNo;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public int ReceiverNo { get { return this.receiverNo; } }
- public Boolean FrontLoop_UseFlag { get { return this.frontLoop_UseFlag; } set { this.frontLoop_UseFlag = value; } }
- public Boolean BackLoop_UseFlag { get { return this.backLoop_UseFlag; } set { this.backLoop_UseFlag = value; } }
- public Boolean Io_UseFlag { get { return this.io_UseFlag; } set { this.io_UseFlag = value; } }
- public Boolean Keypad_UseFlag { get { return this.keypad_UseFlag; } set { this.keypad_UseFlag = value; } }
- public BoardTypeInfo[] MyBoardType { get { return this.myBoardType; } set { this.myBoardType = value; } }
-
- public void Set_RepeaterType(BoardTypeInfo info)
- {
- try
- {
- this.myBoardType[info.BoardNo - 1] = info;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- public BoardTypeInfo Get_RepeaterType(int boardNo)
- {
- BoardTypeInfo info = null;
- try
- {
- info = this.myBoardType[boardNo - 1];
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return info;
- }
- }
-
-
-
-
-
-
-
- public class BoardTypeInfo
- {
- private int boardNo = -1;
-
- private Boolean loop0UseFlag = false;
- private Boolean loop1UseFlag = false;
- private Boolean loop2UseFlag = false;
- private Boolean loop3UseFlag = false;
-
- private Boolean useFlag = false;
-
- private Boolean loop0CutFlag = false;
- private Boolean loop1CutFlag = false;
- private Boolean loop2CutFlag = false;
- private Boolean loop3CutFlag = false;
- private Boolean loop0CutFlag_change = false;
- private Boolean loop1CutFlag_change = false;
- private Boolean loop2CutFlag_change = false;
- private Boolean loop3CutFlag_change = false;
-
- private RepeaterDeviceTypeInfo[] loop0_RepeaterType = new RepeaterDeviceTypeInfo[127];
- private RepeaterDeviceTypeInfo[] loop1_RepeaterType = new RepeaterDeviceTypeInfo[127];
- private RepeaterDeviceTypeInfo[] loop2_RepeaterType = new RepeaterDeviceTypeInfo[127];
- private RepeaterDeviceTypeInfo[] loop3_RepeaterType = new RepeaterDeviceTypeInfo[127];
- private RepeaterPointUnit[] loop0_RepeaterUnit_Data = new RepeaterPointUnit[127];
- private RepeaterPointUnit[] loop1_RepeaterUnit_Data = new RepeaterPointUnit[127];
- private RepeaterPointUnit[] loop2_RepeaterUnit_Data = new RepeaterPointUnit[127];
- private RepeaterPointUnit[] loop3_RepeaterUnit_Data = new RepeaterPointUnit[127];
- public BoardTypeInfo(int boardNo)
- {
- try
- {
- this.boardNo = boardNo;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public BoardTypeInfo(int boardNo, Boolean useFlag, Boolean loop0UseFlag, Boolean loop1UseFlag, Boolean loop2UseFlag, Boolean loop3UseFlag)
- {
- try
- {
- this.boardNo = boardNo;
- this.useFlag = useFlag;
- this.loop0UseFlag = loop0UseFlag;
- this.loop1UseFlag = loop1UseFlag;
- this.loop2UseFlag = loop2UseFlag;
- this.loop3UseFlag = loop3UseFlag;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public int BoardNo { get { return this.boardNo; } }
- public Boolean UseFlag { get { return this.useFlag; } set { this.useFlag = value; } }
- public Boolean Loop0UseFlag { get { return this.loop0UseFlag; } set { this.loop0UseFlag = value; } }
- public Boolean Loop1UseFlag { get { return this.loop1UseFlag; } set { this.loop1UseFlag = value; } }
- public Boolean Loop2UseFlag { get { return this.loop2UseFlag; } set { this.loop2UseFlag = value; } }
- public Boolean Loop3UseFlag { get { return this.loop3UseFlag; } set { this.loop3UseFlag = value; } }
-
- public Boolean Loop0CutFlag { get { return this.loop0CutFlag; } set { this.loop0CutFlag = value; } }
- public Boolean Loop1CutFlag { get { return this.loop1CutFlag; } set { this.loop1CutFlag = value; } }
- public Boolean Loop2CutFlag { get { return this.loop2CutFlag; } set { this.loop2CutFlag = value; } }
- public Boolean Loop3CutFlag { get { return this.loop3CutFlag; } set { this.loop3CutFlag = value; } }
- public RepeaterDeviceTypeInfo[] Loop0_RepeaterType { get { return this.loop0_RepeaterType; } set { this.loop0_RepeaterType = value; } }
- public RepeaterDeviceTypeInfo[] Loop1_RepeaterType { get { return this.loop1_RepeaterType; } set { this.loop1_RepeaterType = value; } }
- public RepeaterDeviceTypeInfo[] Loop2_RepeaterType { get { return this.loop2_RepeaterType; } set { this.loop2_RepeaterType = value; } }
- public RepeaterDeviceTypeInfo[] Loop3_RepeaterType { get { return this.loop3_RepeaterType; } set { this.loop3_RepeaterType = value; } }
- public RepeaterPointUnit[] Loop0_RepeaterUnit_Data { get { return this.loop0_RepeaterUnit_Data; } set { this.loop0_RepeaterUnit_Data = value; } }
- public RepeaterPointUnit[] Loop1_RepeaterUnit_Data { get { return this.loop1_RepeaterUnit_Data; } set { this.loop1_RepeaterUnit_Data = value; } }
- public RepeaterPointUnit[] Loop2_RepeaterUnit_Data { get { return this.loop2_RepeaterUnit_Data; } set { this.loop2_RepeaterUnit_Data = value; } }
- public RepeaterPointUnit[] Loop3_RepeaterUnit_Data { get { return this.loop3_RepeaterUnit_Data; } set { this.loop3_RepeaterUnit_Data = value; } }
- public void Loop0CutFlagChangeReset()
- {
- try
- {
- loop0CutFlag_change = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void Loop1CutFlagChangeReset()
- {
- try
- {
- loop1CutFlag_change = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void Loop2CutFlagChangeReset()
- {
- try
- {
- loop2CutFlag_change = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void Loop3CutFlagChangeReset()
- {
- try
- {
- loop3CutFlag_change = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public Boolean Loop0CutFlagChange
- {
- get { return this.loop0CutFlag_change; }
- set
- {
- bool cutFlag = value;
-
- if (this.loop0CutFlag != cutFlag) loop0CutFlag_change = true;
- this.loop0CutFlag = value;
- }
- }
- public Boolean Loop1CutFlagChange
- {
- get { return this.loop1CutFlag_change; }
- set
- {
- bool cutFlag = value;
-
- if (this.loop1CutFlag != cutFlag) loop1CutFlag_change = true;
- this.loop1CutFlag = value;
- }
- }
- public Boolean Loop2CutFlagChange
- {
- get { return this.loop2CutFlag_change; }
- set
- {
- bool cutFlag = value;
-
- if (this.loop2CutFlag != cutFlag) loop2CutFlag_change = true;
- this.loop2CutFlag = value;
- }
- }
- public Boolean Loop3CutFlagChange
- {
- get { return this.loop3CutFlag_change; }
- set
- {
- bool cutFlag = value;
-
- if (this.loop3CutFlag != cutFlag) loop3CutFlag_change = true;
- this.loop3CutFlag = value;
- }
- }
- }
-
-
-
-
-
-
- public class RepeaterDeviceTypeInfo
- {
- int repeaterNo = -1;
- DeviceTypeInfo[] inDeviceTypeInfo;
- DeviceTypeInfo[] outDeviceTypeInfo;
-
-
-
-
-
-
-
-
-
-
-
- String repeaterType = "";
- Boolean cutFlag = false;
- Boolean useFlag = false;
- Boolean cutFlag_change = false;
- Boolean fireResetFlag = false;
- public void CutFlagChangeReset()
- {
- try
- {
- cutFlag_change = false;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public Boolean CutFlagChange
- {
- get { return this.cutFlag_change; }
- set
- {
- bool cutFlag = value;
-
- if (this.cutFlag != cutFlag) cutFlag_change = true;
- this.cutFlag = value;
- }
- }
- public RepeaterDeviceTypeInfo(int repeaterNo)
- {
- try
- {
- this.repeaterNo = repeaterNo;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public RepeaterDeviceTypeInfo(int repeaterNo, String repeaterType)
- {
- try
- {
- this.repeaterNo = repeaterNo;
- this.repeaterType = repeaterType;
- this.useFlag = true;
- if (repeaterType.Equals("A"))
- {
- this.inDeviceTypeInfo = new DeviceTypeInfo[2];
- this.outDeviceTypeInfo = new DeviceTypeInfo[2];
- }
- else if (repeaterType.Equals("B"))
- {
- this.inDeviceTypeInfo = new DeviceTypeInfo[4];
- this.outDeviceTypeInfo = new DeviceTypeInfo[4];
- }
-
- else if (repeaterType.Equals("C") || repeaterType.Equals("D"))
- {
- this.inDeviceTypeInfo = new DeviceTypeInfo[1];
- this.outDeviceTypeInfo = new DeviceTypeInfo[1];
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public RepeaterDeviceTypeInfo(int repeaterNo, String repeaterType, Boolean cutFlag)
- {
- try
- {
- this.repeaterNo = repeaterNo;
- this.repeaterType = repeaterType;
- this.cutFlag = cutFlag;
- this.useFlag = true;
- if (repeaterType.Equals("A"))
- {
- this.inDeviceTypeInfo = new DeviceTypeInfo[2];
- this.outDeviceTypeInfo = new DeviceTypeInfo[2];
- }
- else if (repeaterType.Equals("B"))
- {
- this.inDeviceTypeInfo = new DeviceTypeInfo[4];
- this.outDeviceTypeInfo = new DeviceTypeInfo[4];
- }
-
- else if (repeaterType.Equals("C") || repeaterType.Equals("D"))
- {
- this.inDeviceTypeInfo = new DeviceTypeInfo[1];
- this.outDeviceTypeInfo = new DeviceTypeInfo[1];
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void setInputDeviceTypeInfo(int deviceNo, String deviceType, String deviceName, String positionCode, Boolean cutFlag)
- {
- try
- {
- if (this.inDeviceTypeInfo == null) return;
- if (this.inDeviceTypeInfo[deviceNo - 1] == null) this.inDeviceTypeInfo[deviceNo - 1] = new DeviceTypeInfo(deviceNo);
- this.inDeviceTypeInfo[deviceNo - 1].DeviceType = deviceType;
- this.inDeviceTypeInfo[deviceNo - 1].DeviceName = deviceName;
- this.inDeviceTypeInfo[deviceNo - 1].PositionCode = positionCode;
- this.inDeviceTypeInfo[deviceNo - 1].CutFlag = cutFlag;
- this.inDeviceTypeInfo[deviceNo - 1].UseFlag = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public void setOutputDeviceTypeInfo(int deviceNo, String deviceType, String deviceName, String positionCode, Boolean cutFlag)
- {
- try
- {
- if (this.outDeviceTypeInfo == null) return;
- if (this.outDeviceTypeInfo[deviceNo - 1] == null) this.outDeviceTypeInfo[deviceNo - 1] = new DeviceTypeInfo(deviceNo);
- this.outDeviceTypeInfo[deviceNo - 1].DeviceType = deviceType;
- this.outDeviceTypeInfo[deviceNo - 1].DeviceName = deviceName;
- this.outDeviceTypeInfo[deviceNo - 1].PositionCode = positionCode;
- this.outDeviceTypeInfo[deviceNo - 1].CutFlag = cutFlag;
- this.outDeviceTypeInfo[deviceNo - 1].UseFlag = true;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public int RepeaterNo { get { return this.repeaterNo; } set { this.repeaterNo = value; } }
- public bool FireResetFlag { get { return this.fireResetFlag; } set { this.fireResetFlag = value; } }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public void setDeviceTypeInfo(DeviceTypeInfo dev, string inoutType)
- {
- try
- {
- if (inoutType.Equals(code_InOutType.Input)) this.inDeviceTypeInfo[dev.DeviceNo - 1] = dev;
- else if (inoutType.Equals(code_InOutType.Output)) this.outDeviceTypeInfos[dev.DeviceNo - 1] = dev;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public DeviceTypeInfo getDeviceTypeInfo(int deviceNo, string inoutType)
- {
- DeviceTypeInfo dev = null;
- try
- {
- if (inoutType.Equals(code_InOutType.Input)) dev = this.inDeviceTypeInfo[deviceNo - 1];
- else if (inoutType.Equals(code_InOutType.Output)) dev = this.outDeviceTypeInfos[deviceNo - 1];
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return dev;
- }
- public DeviceTypeInfo[] inDeviceTypeInfos { get { return this.inDeviceTypeInfo; } set { this.inDeviceTypeInfo = value; } }
- public DeviceTypeInfo[] outDeviceTypeInfos { get { return this.outDeviceTypeInfo; } set { this.outDeviceTypeInfo = value; } }
-
-
-
-
-
- public String RepeaterType
- {
- get { return this.repeaterType; }
- set
- {
- this.repeaterType = value;
-
- if (this.repeaterType.Equals("A"))
- {
- if (this.inDeviceTypeInfo == null)
- {
- this.inDeviceTypeInfo = new DeviceTypeInfo[2];
- this.outDeviceTypeInfo = new DeviceTypeInfo[2];
- }
- }
-
- else if (this.repeaterType.Equals("B"))
- {
- if (this.inDeviceTypeInfo == null)
- {
- this.inDeviceTypeInfo = new DeviceTypeInfo[4];
- this.outDeviceTypeInfo = new DeviceTypeInfo[4];
- }
- }
-
- else if (this.repeaterType.Equals("C") || this.repeaterType.Equals("D"))
- {
- if (this.inDeviceTypeInfo == null)
- {
- this.inDeviceTypeInfo = new DeviceTypeInfo[1];
- this.outDeviceTypeInfo = new DeviceTypeInfo[1];
- }
- }
- }
- }
- public Boolean CutFlag { get { return this.cutFlag; } set { this.cutFlag = value; } }
- public Boolean UseFlag { get { return this.useFlag; } set { this.useFlag = value; } }
- }
-
-
-
-
-
-
- public class DeviceTypeInfo
- {
- int deviceNo = -1;
- string deviceType = null;
- string deviceName = null;
- bool cutFlag = false;
- bool useFlag = false;
- string positionCode = null;
- public DeviceTypeInfo(int deviceNo)
- {
- try
- {
- this.deviceNo = deviceNo;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- public int DeviceNo { get { return this.deviceNo; } }
- public String DeviceType { get { return this.deviceType; } set { this.deviceType = value; } }
- public String DeviceName { get { return this.deviceName; } set { this.deviceName = value; } }
- public bool CutFlag { get { return this.cutFlag; } set { this.cutFlag = value; } }
- public bool UseFlag { get { return this.useFlag; } set { this.useFlag = value; } }
- public String PositionCode { get { return this.positionCode; } set { this.positionCode = value; } }
- }
-
-
-
- public class RepeaterPointUnit
- {
-
- private InputDeviceStatus input1 = InputDeviceStatus.Init;
- private InputDeviceStatus input2 = InputDeviceStatus.Init;
- private InputDeviceStatus input3 = InputDeviceStatus.Init;
- private InputDeviceStatus input4 = InputDeviceStatus.Init;
-
- private OutputDeviceStatus output1 = OutputDeviceStatus.Init;
- private OutputDeviceStatus output2 = OutputDeviceStatus.Init;
- private OutputDeviceStatus output3 = OutputDeviceStatus.Init;
- private OutputDeviceStatus output4 = OutputDeviceStatus.Init;
-
-
-
-
- private int repeater_ID = 0;
-
- private bool repeaterErr = false;
- private bool repeaterNon = false;
- private bool repeaterR0 = false;
- private bool repeaterR1 = false;
- private bool repeaterR2 = false;
- private bool repeaterR = false;
- private bool repeaterW = false;
- private bool repeaterS = false;
-
- public int AnalogDetecterValue_Input = 0;
-
-
-
-
- public AnalogLevel AnalogDetecterLevel = new AnalogLevel(0, 0, 0, 0);
-
- public RepeaterPointUnit(int repeater_ID, RepeaterData unitData)
- {
- try
- {
-
- this.repeater_ID = repeater_ID;
-
- this.SetStateData(unitData);
-
- this.SetInputData(unitData);
-
- this.SetOutputData(unitData);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
-
-
-
- public RepeaterPointUnit(int repeater_ID, RepeaterData unitData, AnalogLevel analogLevel, MDIParent mdi)
- {
- try
- {
-
- this.AnalogDetecterLevel = analogLevel;
-
- this.repeater_ID = repeater_ID;
-
- this.SetStateData(unitData);
-
- this.SetInputData(unitData.AnalogDetecterValue_Input, analogLevel, mdi);
-
- this.SetOutputData(unitData);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- public bool UpdateData(RepeaterData unitData)
- {
- bool ret = false;
- try
- {
- if (this.UpdateStateData(unitData))
- {
- ret = true;
- }
- if (this.UpdateInputData(unitData))
- {
- ret = true;
- }
- if (this.UpdateOutputData(unitData))
- {
- ret = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return ret;
- }
-
- public bool UpdateData(RepeaterData unitData, AnalogLevel analogLevel, MDIParent mdi)
- {
- bool ret = false;
- try
- {
- if (this.UpdateStateData(unitData))
- {
- ret = true;
- }
- if (this.UpdateInputData(unitData.AnalogDetecterValue_Input, analogLevel, mdi))
- {
- ret = true;
- }
- if (this.UpdateOutputData(unitData))
- {
- ret = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return ret;
- }
- bool UpdateStateData(RepeaterData unitData)
- {
- bool ret = false;
- try
- {
-
- if (repeaterNon != unitData.Non)
- {
- repeaterNon = unitData.Non;
- ret = true;
- }
- if (repeaterErr != unitData.Err)
- {
- repeaterErr = unitData.Err;
- ret = true;
- }
- if (repeaterR0 != unitData.R0)
- {
- repeaterR0 = unitData.R0;
- ret = true;
- }
- if (repeaterR1 != unitData.R1)
- {
- repeaterR1 = unitData.R1;
- ret = true;
- }
- if (repeaterR2 != unitData.R2)
- {
- repeaterR2 = unitData.R2;
- ret = true;
- }
- if (repeaterR != unitData.R)
- {
- repeaterR = unitData.R;
- ret = true;
- }
- if (repeaterW != unitData.W)
- {
- repeaterW = unitData.W;
- ret = true;
- }
- if (repeaterS != unitData.S)
- {
- repeaterS = unitData.S;
- ret = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return ret;
- }
-
- private void SetStateData(RepeaterData unitData)
- {
- try
- {
- repeaterErr = unitData.Err;
- repeaterNon = unitData.Non;
- repeaterR0 = unitData.R0;
- repeaterR1 = unitData.R1;
- repeaterR2 = unitData.R2;
- repeaterR = unitData.R;
- repeaterW = unitData.W;
- repeaterS = unitData.S;
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- private void SetInputData(RepeaterData unitData)
- {
- try
- {
- input1 = inputCompute(unitData.Repeater_state_1);
- input2 = inputCompute(unitData.Repeater_state_2);
- input3 = inputCompute(unitData.Repeater_state_3);
- input4 = inputCompute(unitData.Repeater_state_4);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- private void SetInputData(int analogValue, AnalogLevel analogLevel, MDIParent mdi)
- {
- try
- {
- input1 = inputCompute(analogValue, analogLevel, mdi);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
-
- bool UpdateInputData(RepeaterData unitData)
- {
- bool ret = false;
- try
- {
- if (input1 != inputCompute(unitData.Repeater_state_1))
- {
- input1 = inputCompute(unitData.Repeater_state_1);
- ret = true;
- }
- if (input2 != inputCompute(unitData.Repeater_state_2))
- {
- input2 = inputCompute(unitData.Repeater_state_2);
- ret = true;
- }
- if (input3 != inputCompute(unitData.Repeater_state_3))
- {
- input3 = inputCompute(unitData.Repeater_state_3);
- ret = true;
- }
- if (input4 != inputCompute(unitData.Repeater_state_4))
- {
- input4 = inputCompute(unitData.Repeater_state_4);
- ret = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return ret;
- }
-
- bool UpdateInputData(int analogValue, AnalogLevel analogLevel, MDIParent mdi)
- {
- bool ret = false;
- try
- {
- if (input1 != inputCompute(analogValue, analogLevel, mdi)
- || AnalogDetecterValue_Input != analogValue)
- {
- input1 = inputCompute(analogValue, analogLevel, mdi);
- ret = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return ret;
- }
-
- private void SetOutputData(RepeaterData unitData)
- {
- try
- {
- output1 = outputCompute(unitData.Repeater_output_1_C, unitData.Repeater_output_1_W);
- output2 = outputCompute(unitData.Repeater_output_2_C, unitData.Repeater_output_2_W);
- output3 = outputCompute(unitData.Repeater_output_3_C, unitData.Repeater_output_3_W);
- output4 = outputCompute(unitData.Repeater_output_4_C, unitData.Repeater_output_4_W);
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- }
- bool UpdateOutputData(RepeaterData unitData)
- {
- bool ret = false;
- try
- {
- if (output1 != outputCompute(unitData.Repeater_output_1_C, unitData.Repeater_output_1_W))
- {
- output1 = outputCompute(unitData.Repeater_output_1_C, unitData.Repeater_output_1_W);
- ret = true;
- }
- if (output2 != outputCompute(unitData.Repeater_output_2_C, unitData.Repeater_output_2_W))
- {
- output2 = outputCompute(unitData.Repeater_output_2_C, unitData.Repeater_output_2_W);
- ret = true;
- }
- if (output3 != outputCompute(unitData.Repeater_output_3_C, unitData.Repeater_output_3_W))
- {
- output3 = outputCompute(unitData.Repeater_output_3_C, unitData.Repeater_output_3_W);
- ret = true;
- }
- if (output4 != outputCompute(unitData.Repeater_output_4_C, unitData.Repeater_output_4_W))
- {
- output4 = outputCompute(unitData.Repeater_output_4_C, unitData.Repeater_output_4_W);
- ret = true;
- }
- }
- catch (Exception ex)
- {
- Util.UErrorMessage(ex, 0, 0);
- }
- return ret;
- }
-
-
-
-
-
-
-
-
- private OutputDeviceStatus outputCompute(bool repeater_output_C, bool repeater_output_W)
- {
- if (repeater_output_C == true) return OutputDeviceStatus.Blocking;
- else if (repeater_output_W == true) return OutputDeviceStatus.Write;
- else if (repeater_output_W == false) return OutputDeviceStatus.NotWrite;
- else return OutputDeviceStatus.Init;
- }
-
- private InputDeviceStatus inputCompute(int repeater_state)
- {
- if (repeater_state == 0) return InputDeviceStatus.Use;
- else if (repeater_state == 1) return InputDeviceStatus.Normal;
- else if (repeater_state == 3) return InputDeviceStatus.Blocking;
- else if (repeater_state == 4) return InputDeviceStatus.PreFire;
- else return InputDeviceStatus.Init;
- }
-
- private InputDeviceStatus inputCompute(int analogValue, AnalogLevel analogLevel, MDIParent mdi)
- {
-
- int repeater_state = mdi.AnalogDetect.Get_LevelStatus(analogValue, analogLevel);
- if (repeater_state == 3) return InputDeviceStatus.Use;
- else if (repeater_state == 0) return InputDeviceStatus.Normal;
- else if (repeater_state == 1) return InputDeviceStatus.Blocking;
- else if (repeater_state == 2) return InputDeviceStatus.PreFire;
- else return InputDeviceStatus.Init;
- }
- public bool RepeaterErr { get { return this.repeaterErr; } }
- public bool RepeaterNon { get { return this.repeaterNon; } }
- public bool RepeaterR0 { get { return this.repeaterR0; } }
- public bool RepeaterR1 { get { return this.repeaterR1; } }
- public bool RepeaterR2 { get { return this.repeaterR2; } }
- public bool RepeaterR { get { return this.repeaterR; } }
- public bool RepeaterW { get { return this.repeaterW; } }
- public bool RepeaterS { get { return this.repeaterS; } }
- public InputDeviceStatus[] Repeater_Input
- {
- get
- {
- InputDeviceStatus[] indata = new InputDeviceStatus[4] {
- this.input1,this.input2,this.input3,this.input4
- };
- return indata;
- }
- }
- public InputDeviceStatus Repeater_Input1 { get { return this.input1; } }
- public InputDeviceStatus Repeater_Input2 { get { return this.input2; } }
- public InputDeviceStatus Repeater_Input3 { get { return this.input3; } }
- public InputDeviceStatus Repeater_Input4 { get { return this.input4; } }
- public OutputDeviceStatus[] Repeater_Output
- {
- get
- {
- OutputDeviceStatus[] outdata = new OutputDeviceStatus[4] {
- this.output1,this.output2,this.output3,this.output4
- };
- return outdata;
- }
- set
- {
- this.output1 = value[0];
- this.output2 = value[1];
- this.output3 = value[2];
- this.output4 = value[3];
- }
- }
- public OutputDeviceStatus Repeater_Output1 { get { return this.output1; } }
- public OutputDeviceStatus Repeater_Output2 { get { return this.output2; } }
- public OutputDeviceStatus Repeater_Output3 { get { return this.output3; } }
- public OutputDeviceStatus Repeater_Output4 { get { return this.output4; } }
- }
-
-
-
- }
|