public PwrModbus(ePWRTYPE Type) { type = Type; var Current = new READITEM() { bEnb = true }; var Voltage = new READITEM() { bEnb = true }; var Temp_1st = new READITEM() { bEnb = true }; var Temp_2nd = new READITEM() { bEnb = true }; var Temp_3th = new READITEM() { bEnb = true }; var Temp_4th = new READITEM() { bEnb = true }; var Error = new READITEM() { bEnb = true }; var State = new READITEM() { bEnb = true }; var Ver = new READITEM() { bEnb = true }; var soc = new READITEM() { bEnb = true }; _dicItems[ePWRREAD_ITEMS.Current] = Current; _dicItems[ePWRREAD_ITEMS.Voltage] = Voltage; _dicItems[ePWRREAD_ITEMS.Temp_1st] = Temp_1st; _dicItems[ePWRREAD_ITEMS.Temp_2nd] = Temp_2nd; _dicItems[ePWRREAD_ITEMS.Temp_3th] = Temp_3th; _dicItems[ePWRREAD_ITEMS.Temp_4th] = Temp_4th; _dicItems[ePWRREAD_ITEMS.Error] = Error; _dicItems[ePWRREAD_ITEMS.State] = State; _dicItems[ePWRREAD_ITEMS.Ver] = Ver; }
public bool Pwr_Open(ePWRTYPE Type, ePWR_PortName port) { switch (Type) { case ePWRTYPE.TabosBattery: _Pwr = new Bat4Tabos(); break; case ePWRTYPE.ElgenBattery: _Pwr = new Bat4Elgen(); break; case ePWRTYPE.ElgenCharger: _Pwr = new Chr4Elgen(); break; case ePWRTYPE.AutonicMeter: _Pwr = new Mtr4Autonics(); break; } _Pwr.Evt_Connection += On_PwrConnection; _Pwr.Evt_UpdateData += On_PwrUpdateData; _Pwr.Open(port); return(true); }