Esempio n. 1
0
 private void RaiseIncomingCall(TelecomIncomingInfo info)
 {
     if (IncomingCall != null)
         IncomingCall(this, info);
 }
Esempio n. 2
0
 private void _IncomingCall(ITelecom sender, TelecomIncomingInfo info)
 {
     Console.WriteLine("Incoming Call from '{0}' detected", info.Identifier);
 }
Esempio n. 3
0
        /// <summary>
        /// Checks the buffer for valid sequences
        /// </summary>
        private bool CheckBuffer()
        {
            string receiveBuffer = _receiveBuffer.ToString();

            if (receiveBuffer.Contains("\r") && receiveBuffer.Contains("\n") == false)
                receiveBuffer = receiveBuffer.Replace("\r", "\r\n");

            if (receiveBuffer.Contains("\n"))
            {
                string[] lines = receiveBuffer.Split('\n');
                _receiveBuffer.Remove(0, _receiveBuffer.Length);
                _receiveBuffer.Append(lines[lines.Length - 1]);

                for (int i = 0; i < lines.Length - 1; i++)
                {
                    string realLine = lines[i].Trim('\r');
                    realLine = realLine.Trim();
                    if (_waitingForStatus && realLine == _modemConfiguration.ConfirmOk)
                    {
                        _lastStatusSuccessful = true;
                        _transmittingCommand.Set();
                    }
                    else if (_waitingForStatus && realLine == _modemConfiguration.ConfirmError)
                    {
                        _lastStatusSuccessful = false;
                        _transmittingCommand.Set();
                    }
                    else if (_inRingStatus == false && realLine == _modemConfiguration.Ring)
                        _inRingStatus = true;
                    else if (lines[i].Contains("="))
                    {
                        string[] keyValue = realLine.Split('=');

                        if (keyValue.Length > 0)
                        {
                            for (int x = 0; x < keyValue.Length; x++)
                                keyValue[x] = keyValue[x].Trim();
                        }

                        if (keyValue.Length == 2)
                        {
                            if (keyValue[0] == _modemConfiguration.InfoNumberField && _inRingStatus)
                            {
                                TelecomIncomingInfo incomingInfo = new TelecomIncomingInfo(keyValue[1], keyValue[1] == _modemConfiguration.SuppressedCallerId);
                                _inRingStatus = false;

                                if (IncomingCall != null)
                                    IncomingCall(this, incomingInfo);

                                return true;
                            }
                        }
                    }
                }
            }

            return false;
        }