problems with siemens m20 gsm modem & c++

J

Janne

Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL);
After this modem says ERROR on terminal. What return-key is supported
by m20 because "\r" return key does not work.
 
J

Jacques Labuschagne

Janne said:
Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL);
After this modem says ERROR on terminal. What return-key is supported
by m20 because "\r" return key does not work.

How is this a C++ problem? Talk to a Siemens tech-support group.

Jacques.
 
K

Karl Heinz Buchegger

Janne said:
Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL);
After this modem says ERROR on terminal. What return-key is supported
by m20 because "\r" return key does not work.

Generally you should ask this the guys who designed the m20.
But I would try \n
 
M

Martijn Lievaart

Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL);
After this modem says ERROR on terminal. What return-key is supported
by m20 because "\r" return key does not work.

Maybe you can check the specs of the modem? You'll not get many answers in
this group, this group deals with the C++ language, not with modems.

That said, you do realize that '\r' is a seldomly used code by itself? EOL
conventions differ, but the most common are "\n" and "\n\r". '\r' may be
the code generated by the return key on some terminals, but that is about
as far as it goes, that has /nothing/ to do with how you should end you
lines, both in C++ and with modems.

<OT> IIRC hayes compatible modems (almost all of them are) use "\r\n" to
end lines. </OT>

HTH,
M4
 
J

Jack Klein

Hi,

I have one problem with siemens m20 gsm modem. It returns error when i
try to send at-command and use "\r" <return> character.

Example:
at = "ATI"+"\r";
WriteFile(hCom,at.c_str(),at.length()+1, &NumBytesWritten, NULL);
^^^^^^^^^^^^^
Why are you writing one more character than the length of the C
string? Do you think the modem really wants the '\0'? Probably not.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top