Ejemplo n.º 1
0
 public bool Open(ePWR_PortName port)
 {
     try
     {
         serialPort.PortName = port.ToString();
         serialPort.Open();
         _StateChk.Start();
         Evt_Connection?.Invoke(this, serialPort.IsOpen);
         return(serialPort.IsOpen);
     }
     catch (Exception e)
     {
         ReportLog(e.ToString(), false);
         return(false);
     }
 }
Ejemplo n.º 2
0
        public bool Open(ePWR_PortName port) // 에러는 보호상태
        {
            bool rtn = false;

            if (false == bUseModbus)
            {
                _PwrCom.PortName = port.ToString();
                _PwrCom.Open();
                rtn = _PwrCom.IsOpen;
            }
            else
            {
                // 모드버스 Data 주소 Curr Volt 온도1 온도2  온도3  보호상태(Error) 사용안함 버젼 == ePWRREAD_ITEMS
                var ary = new int[8] {
                    86, 73, -1, -1, -1, -1, -1, 1
                };
                var bit = new Any64();
                bit[(int)ePWRREAD_ITEMS.Current]  = true;
                bit[(int)ePWRREAD_ITEMS.Voltage]  = true;
                bit[(int)ePWRREAD_ITEMS.Error]    = false;
                bit[(int)ePWRREAD_ITEMS.Ver]      = false;
                bit[(int)ePWRREAD_ITEMS.Temp_1st] = false;
                bit[(int)ePWRREAD_ITEMS.Temp_2nd] = false;
                bit[(int)ePWRREAD_ITEMS.Temp_3th] = false;
                bit[(int)ePWRREAD_ITEMS.State]    = false;

                var chk = _PwrBus.Open(port, ary, bit.INT32_0);
                if (null != chk.msg)
                {
                    ReportLog(chk.msg);
                }
                rtn = chk.rtn;
            }
            _StateChk.Start();
            Evt_Connection?.Invoke(this, rtn);
            return(rtn);
        }
Ejemplo n.º 3
0
 private void Sock_Disconnected(object sender, EventArgs e)
 {
     Evt_Connection?.Invoke(this, false);
 }
Ejemplo n.º 4
0
 private void On_Connection(object sender, bool connection)
 {
     bConnection = connection;
     Evt_Connection?.Invoke(this, connection);
 }