コード例 #1
0
            public void Put(byte[] src)
            {
                if (!Monitor.TryEnter(LockObject, 5000))
                {
                    throw new System.TimeoutException("LNGCommunication.PhysicalLayer.Channel.CreateChannel Lock_Exception");
                }
                try
                {
                    if (src == null || src.Length == 0)
                    {
                        return;
                    }

                    if (debugging)
                    {
                        UsbSerialDebugger.PrintLogPut(src, true);
                    }

                    buffer.Write(src);
                    Monitor.Pulse(LockObject);
                }
                finally
                {
                    Monitor.Exit(LockObject);
                }
            }
コード例 #2
0
 public override int SyncWrite(byte[] buffer, int timeout)
 {
     if (!asyncMode)
     {
         if (buffer == null)
         {
             return(0);
         }
         if (debugging)
         {
             UsbSerialDebugger.PrintLogPut(buffer, true);
         }
         return(connection.BulkTransfer(outEndpoint, buffer, buffer.Length, timeout));
     }
     else
     {
         return(-1);
     }
 }