예제 #1
0
        protected override IEnumerable <string> ExecuteCore(ATChat chat)
        {
            WriteCommand(chat);
            var res = chat.Read();

            if (res.Trim().StartsWith(MESSAGE_PROMPT))
            {
                chat.Write(message);
                chat.Write(new string((char)26, 1));
            }
            else
            {
                throw new UnexpectedATResponseException(res, MESSAGE_PROMPT, 0);
            }

            return(ReadResponse(chat));
        }
예제 #2
0
        protected override async IAsyncEnumerable <string> ExecuteCore(ATChat chat)
        {
            await WriteCommand(chat);

            var res = await chat.Read();

            if (res.Trim().StartsWith(MESSAGE_PROMPT))
            {
                await chat.Write(message);

                await chat.Write(new string((char)26, 1));
            }
            else
            {
                throw new UnexpectedATResponseException(res, MESSAGE_PROMPT, 0);
            }

            await foreach (var line in ReadResponse(chat))
            {
                yield return(line);
            }
        }