Exemplo n.º 1
0
 private void eventWorkerThread_TO()
 {
     do
     {
         try
         {
             if (this.evHandel_TO <= 0)
             {
                 this.diagnostic.Throw((Enum)IBS_G4_Drv.DiagnosticCodes.NoValidEventHandleTO, IBS_G4_Drv.Int32ToByteArray(this.evHandel_TO, 2));
                 this.thrHdlIB.Abort();
             }
             if (PhoenixContact.DDI.DDI.WaitForNamedEvent(this.evHandel_TO, 200))
             {
                 this.OnUpdateTick();
             }
         }
         catch (ThreadAbortException ex)
         {
             Thread.ResetAbort();
             PhoenixContact.DDI.DDI.SetNamedEvent(this.evHandel_TO);
             this.doWorker_TO = false;
         }
     }while (this.doWorker_TO);
 }
Exemplo n.º 2
0
        public bool Enable()
        {
            lock (this.syncObject)
            {
                if (this.GetState() != IBS_G4_Drv.DriverState.Idle)
                {
                    if (this.GetState() != IBS_G4_Drv.DriverState.Disable)
                    {
                        goto label_20;
                    }
                }
                this.ChangeState(IBS_G4_Drv.DriverState.GoingToEnable);
                this.diagnostic.Enable();
                if (this._connectionDTI.Length != 0)
                {
                    int Integer = PhoenixContact.DDI.DDI.OpenNode(this._connectionDTI, out this._dtiHandle);
                    if (Integer != 0)
                    {
                        this.diagnostic.Throw((Enum)IBS_G4_Drv.DiagnosticCodes.OpenNodeErrorDTI, IBS_G4_Drv.Int32ToByteArray(Integer, 2));
                        return(false);
                    }
                }
                if (this._connectionMXI.Length != 0)
                {
                    int Integer = PhoenixContact.DDI.DDI.OpenNode(this._connectionMXI, out this._mxiHandle);
                    if (Integer != 0)
                    {
                        this.diagnostic.Throw((Enum)IBS_G4_Drv.DiagnosticCodes.OpenNodeErrorMXI, IBS_G4_Drv.Int32ToByteArray(Integer, 2));
                        return(false);
                    }
                }
                if (this._ibSync)
                {
                    if (this._mxiHandle > 0)
                    {
                        this.hdCreateEvent = this.StartCallbackEvent(257, 100);
                    }
                    else
                    {
                        this.diagnostic.Throw((Enum)IBS_G4_Drv.DiagnosticCodes.NoValidMailboxHandel, IBS_G4_Drv.Int32ToByteArray(this._mxiHandle, 2));
                        return(false);
                    }
                }
                else if (this._dtiHandle > 0 || this._mxiHandle > 0)
                {
                    this.ticker.OnTick += this.hdTicker;
                    this.ticker.Enable();
                }
                else
                {
                    this.diagnostic.Throw((Enum)IBS_G4_Drv.DiagnosticCodes.NoValidHandel, new byte[0]);
                    return(false);
                }
                this.ChangeState(IBS_G4_Drv.DriverState.Start);
                return(true);
            }
label_20:
            return(false);
        }