/// <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); } } }
/// <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); } } }