Exemplo n.º 1
0
        public void Dispose()
        {
            lock (mSyncLock) {
                try {
                    if(mPLC != null && mPLC.IsConnected) mPLC.Disconnect();
                    foreach (Timer t in mTimers) {
                        t.Change(Timeout.Infinite, Timeout.Infinite);
                        t.Dispose();
                    }
                    mTimers.Clear();
                    mPLC.Dispose();
                } catch {

                } finally {
                    mPLC = null;
                    mTimers = null;
                }
            }
        }
Exemplo n.º 2
0
 public void Initialize(string ipAddress, int timeout)
 {
     mIPAddress = ipAddress;
     mPath = "0";
     mTimeout = timeout;
     try {
         mPLC = new Logix.Controller(mIPAddress, mPath, mTimeout);
         mInitialized = true;
         mConnectionTimer = new Timer(ConnectionCallback, null, 0, mConnetionInterval);
     } catch (Exception ex) {
         mPLC = null;
     }
 }
Exemplo n.º 3
0
        public void Initialize(string ipAddress, int timeout)
        {
            mIPAddress = ipAddress;
            mPath = "0";
            mTimeout = timeout;
            try {
                //mIPAddress = "192.168.3.241";
                //mIPAddress = "10.35.194.71";
                mPLC = new Logix.Controller(mIPAddress, mPath, mTimeout);
                mInitialized = true;
                mConnectionTimer = new Timer(ConnectionCallback, null, 0, mConnetionInterval);
            } catch (Exception ex) {

                //Console.Write(ex.Message + mPLC.ErrorCode + " - " + mPLC.ErrorString);
                mPLC = null;
                throw ex; //throw the exception
            }
        }