public ServerCycleNotificationMngt(TcAdsSyncPort syncPort, SymbolTable symbolTable, bool synchronize) : base(syncPort, symbolTable, synchronize)
 {
     this._curHandle               = 0;
     this._bPeak                   = false;
     this._bPeakError              = false;
     this._clientHandleTable       = new Dictionary <int, int>();
     this._enqueueEvent            = new ManualResetEvent(false);
     this._queue                   = new Queue <QueueElement>(500);
     this._adsNotificationDelegate = new TcAdsDllWrapper.AdsNotificationDelegate(this.OnNotification);
 }
示例#2
0
        public override unsafe AdsErrorCode AddDeviceNotification(uint indexGroup, uint indexOffset, AdsNotificationAttrib *noteAttrib, TcAdsDllWrapper.AdsNotificationDelegate noteFunc, int hUser, bool throwAdsException, out int hNotification)
        {
            byte[]       buffer;
            int          pNotification = 0;
            IntPtr       functionPointerForDelegate = Marshal.GetFunctionPointerForDelegate(noteFunc);
            AdsErrorCode noError = AdsErrorCode.NoError;

            if (((buffer = AmsAddressMarshaller.Marshal(base.address)) == null) || (buffer.Length == 0))
            {
                numRef = null;
            }
            else
            {
                numRef = buffer;
            }
            noError = TcAdsDllWrapper.UnsafeNativeMethods.AdsSyncAddDeviceNotificationReqEx(base._port, numRef, indexGroup, indexOffset, noteAttrib, functionPointerForDelegate, hUser, &pNotification);
            fixed(byte *numRef = null)
            {
                base.OnHandleCommunicationResult(noError, throwAdsException);
                hNotification = pNotification;
                return(noError);
            }
        }