Esempio n. 1
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Sends a ringing event. </summary>
        ///
        /// <param name="evt">  The event. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public void SendRingingEvent(RingingEvent evt)
        {
            if (IsValidCommand(evt))
            {
                SendKeystroke(evt.ToChar());
            }
        }
Esempio n. 2
0
        ////////////////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Sends and rings a key stroke. </summary>
        ///
        /// <param name="ringingEvent"> The ringing event. </param>
        ////////////////////////////////////////////////////////////////////////////////////////////////////

        public void SendAndRingKeyStroke(RingingEvent ringingEvent)
        {
            if (simulator.IsValidCommand(ringingEvent))
            {
                var txBytes = Encoding.ASCII.GetBytes($"{ringingEvent.ToChar()}");
                foreach (var _socket in peerSockets)
                {
                    if (_socket.Connected)
                    {
                        logger.Debug("Sending message to: {dest}", _socket.RemoteEndPoint.ToString());
                        Task.Factory.StartNew(() => { _socket.Send(txBytes); });
                    }
                }
            }

            if (SendKeepAlives)
            {
                TimeSinceLastTX.Restart();
            }

            simulator.SendRingingEvent(ringingEvent);
        }