Example #1
0
        void IOPCDataCallback.OnWriteComplete(
            int dwTransid, int hGroup, int hrMastererr, int dwCount,
            IntPtr pClienthandles, IntPtr ppErrors)
        {
            Trace.WriteLine($"{nameof(OpcGroup)}.{nameof(IOPCDataCallback.OnWriteComplete)}, transID:{dwTransid}, count:{dwCount}, thread ID:{System.Threading.Thread.CurrentThread.ManagedThreadId}");

            if ((dwCount == 0) || (hGroup != stateHandleClient))
            {
                return;
            }

            WriteCompleteEventArgs eventArgs = new WriteCompleteEventArgs()
            {
                TransactionID     = dwTransid,
                GroupHandleClient = hGroup,
                MasterError       = hrMastererr,
                WriteResults      = new OpcWriteResult[dwCount]
            };

            for (int i = 0; i < dwCount; i++)
            {
                eventArgs.WriteResults[i] = new OpcWriteResult
                {
                    Error        = Extensions.ReadInt32(ppErrors, i),
                    HandleClient = Extensions.ReadInt32(pClienthandles, i)
                };
            }

            writeCompleted?.Invoke(this, eventArgs);
        }
Example #2
0
        void IOPCDataCallback.OnWriteComplete(
            int dwTransid, int hGroup, int hrMastererr, int dwCount,
            IntPtr pClienthandles, IntPtr ppErrors)
        {
            Trace.WriteLine("OpcGroup.OnWriteComplete");
            if ((dwCount == 0) || (hGroup != state.HandleClient))
            {
                return;
            }
            int count = (int)dwCount;

            int runh = (int)pClienthandles;
            int rune = (int)ppErrors;

            WriteCompleteEventArgs e = new WriteCompleteEventArgs();

            e.transactionID     = dwTransid;
            e.groupHandleClient = hGroup;
            e.masterError       = hrMastererr;
            e.res = new OPCWriteResult[count];

            for (int i = 0; i < count; i++)
            {
                e.res[i] = new OPCWriteResult();

                e.res[i].Error = Marshal.ReadInt32((IntPtr)rune);
                rune          += 4;

                e.res[i].HandleClient = Marshal.ReadInt32((IntPtr)runh);
                runh += 4;
            }

            if (WriteCompleted != null)
            {
                WriteCompleted(this, e);
            }
        }
 public void TheGrpWriteComplete(object sender, WriteCompleteEventArgs e)
 {
     lock (locker) {
         InstantLogger.msg("WriteComplete event: gh={0} id={1} me={2}", e.groupHandleClient, e.transactionID,
                           e.masterError);
         foreach (OPCWriteResult r in e.res) {
             if (HRESULTS.Succeeded(r.Error))
                 InstantLogger.msg(" ih={0} e={1}", r.HandleClient, r.Error);
             else
                 InstantLogger.msg(" ih={0}    ERROR=0x{1:x} !", r.HandleClient, r.Error);
         }
     }
 }
 // event handler: called if asynch write finished
 protected void theGrp_WriteComplete(object sender,WriteCompleteEventArgs e)
 {
     foreach (OPCWriteResult w in e.res) {
     //if (HRESULTS.Failed(w.Error))
     //   //txtItemWriteRes.Text = "ERROR 0x" + w.Error.ToString("X");
     //else
     //   //txtItemWriteRes.Text = "ok";
     }
 }
        void IOPCDataCallback.OnWriteComplete(
            int dwTransid, int hGroup, int hrMastererr, int dwCount,
            IntPtr pClienthandles, IntPtr ppErrors)
        {
            Trace.WriteLine( "OpcGroup.OnWriteComplete" );
            if( (dwCount == 0) || (hGroup != state.HandleClient) )
            return;
            int count = (int) dwCount;

            int	runh = (int) pClienthandles;
            int	rune = (int) ppErrors;

            WriteCompleteEventArgs	e = new WriteCompleteEventArgs();
            e.transactionID		= dwTransid;
            e.groupHandleClient	= hGroup;
            e.masterError		= hrMastererr;
            e.res				= new OPCWriteResult[ count ];

            for( int i = 0; i < count; i++ )
            {
            e.res[i] = new OPCWriteResult();

            e.res[i].Error = Marshal.ReadInt32( (IntPtr) rune );
            rune += 4;

            e.res[i].HandleClient = Marshal.ReadInt32( (IntPtr) runh );
            runh += 4;
            }

            if( WriteCompleted != null )
            WriteCompleted( this, e );
        }
Example #6
0
 private void OpcGroup_WriteCompleted(object sender, WriteCompleteEventArgs e)
 {
     this.WriteCompleted -= new WriteCompleteEventHandler(OpcGroup_WriteCompleted);
     writed = true;
 }
 private void WriteDataCompleted(object sender, WriteCompleteEventArgs e)
 {
 }