I working with a BGS2-W modem. I have a C app writing AT commands to the modem. The responses of the modem look something like \r\n OK or \r\n\n OK. Anytime I receive a \r or a \n, I consider that the end of the modem at response.
Issue is I am attempting to download a binary file through HTTP GET and the binary file can and does contain '\r' and '\n'. This is causing issues when I try to parse the modem responses.
Anyone ever experience this problem? Thanks.
You should not consider \r or \n as a modem answer, since those characters might come as legitimate data exchange both in binary files, ascii files or just the header of an http message.
The AT+RECV or whatever similar command that your modem uses to receive data must have a field that specify the amount of data received, then comes the data and then the OK string.
Focus on parsing the field as a whole, so that you ignore those special characters within the expected data.