Exemplo n.º 1
0
        public void StartPlcS7onlineMsgPump(PlcsimProtocolType plcsimVersion)
        {
            Thread PlcS7onlineMsgPumpThread = new Thread(StartPlcS7onlineMsgPumpThread);

            if (plcsimVersion == PlcsimProtocolType.S7commPlus)
            {
                m_PlcS7onlineMsgPump = new PlcS7onlineMsgPumpTia(m_PlcsimIpAdress, m_PlcsimRackNumber, m_PlcsimSlotNumber);
            }
            else
            {
                m_PlcS7onlineMsgPump = new PlcS7onlineMsgPumpS7(m_PlcsimIpAdress, m_PlcsimRackNumber, m_PlcsimSlotNumber);
            }
            m_PlcS7onlineMsgPump.eventOnDataFromPlcsimReceived += new PlcS7onlineMsgPump.OnDataFromPlcsimReceived(OnDataFromPlcsimReceived);
            PlcS7onlineMsgPumpThread.Start();
        }
Exemplo n.º 2
0
 public bool InitPlcsim(PlcsimProtocolType plcsimVersion)
 {
     m_autoEvent_MsgPumpThreadStart = new AutoResetEvent(false);
     StartPlcS7onlineMsgPump(plcsimVersion);
     m_autoEvent_MsgPumpThreadStart.WaitOne();       // Wait until the message pumpe thread has started
     try
     {
         m_ConnectPlcsimSuccess    = false;
         m_autoEvent_ConnectPlcsim = new AutoResetEvent(false);
         SendMessage(m_PlcS7onlineMsgPump_Handle, PlcS7onlineMsgPump.WM_M_CONNECTPLCSIM, IntPtr.Zero, IntPtr.Zero);
         m_autoEvent_ConnectPlcsim.WaitOne();        // Wait until a connect success or connect error was received
     }
     catch (Exception)
     {
         return(false);
     }
     return(m_ConnectPlcsimSuccess);
 }