Esempio n. 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="source"></param>
        /// <param name="bs"></param>
        private void Transmit(object source, byte[] bs)
        {
            if (this.Transmitter.Enable &&
                this.Transmitter.CanTransmit())
            {
                ITransmit d = this.Transmitter.GetTo(source);
                if (d != null)
                {
                    d.Write(bs);

                    string from = string.Empty;
                    string to   = string.Empty;
                    if (source is SocketClient)
                    {
                        from = this.GetMe();
                        to   = this.GetSerialPortName();
                    }

                    if (source is SerialPortManager)
                    {
                        from = this.GetLocalString();
                        to   = this.GetRemoteString();
                    }

                    this.AddSend(
                        from,
                        to,
                        bs);
                }
            }
        }
Esempio n. 2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="from"></param>
 /// <param name="bytes"></param>
 void OnReceived(object from, byte[] bytes)
 {
     if (this.Transmitter.Enable)
     {
         ITransmit to = this.Transmitter.GetTo(from);
         if (to != null)
         {
             to.Write(bytes);
         }
     }
 }