Send Sms with C++ code


#1

Hello everybody,

I want to send an sms using C++ code.

I’m trying the following code but it doesn’t work.

wm_atSendCommand(45,WM_AT_SEND_RSP_TO_EMBEDDED,“AT+CMGS=”+30694000000">Good morning"1A"\r");

Is it possible to do this or not?
Is it another way to achieve it?
I’d appreciate your help.


#2

What do you mean, “doesn’t work”?

Does it compile?
What is the return value from wm_atSendCommand?

Is there any particular reason why you’re using the “Basic” API (wm_…) rather than the Application Development Layer (adl_…) ?

Have you tried looking at the Wavecom samples?
They include examples of how to send SMS…


#3

Hello,
I use wm and SND_CMD and the compilation was ok but no msg was sent.

I found this way easier.
I use the following code:

ascii TxtStr [ 100 ];
ascii PhoneNumber [ 30 ];

wm_sprintf ( CmdStr, “at+cmgs=%s\r”, PhoneNumber );
SND_CMD ( CmdStr );

The Target Monitoring Tools shows me the > and then i’m sending

wm_sprintf ( TxtStr, “Hello world\1a” );
SND_CMD ( TxtStr );

After that the WM_AT_RESPONSE responses me ERROR.

What’s wrong?

Thanks for your help.


#4

You didn’t answer why you’re using the Basic API, rather than ADL?
Wavecom recommend the Basic API for experts only…

You also didn’t answer whether you’ve looked at the sample applications for sending SMS.

Surely, that should be:

wm_sprintf ( TxtStr, "Hello world\x1a" );
SND_CMD ( TxtStr );

#5

Hello,
I use Basic API because I thought it was easier and I have spent a lot of time to change now.
I looked at the at the samples and i found something.

Thanks for your help!


#6

Hmm… yes, the name is a bit unfortunate, isn’t it? :confused:

“Basic” could easily imply that it’s the “easy” option for making “basic” applications.
In fact, as far as I can tell, “Basic” means that the facilities provided are only basic - so that the developer has to do a lot more work.

ADL actually makes it a lot “easier” for the application developer.

Maybe this has just lost something in translation from the original French…? (which is not uncommon in the Wavecom documents :frowning: )

In this case, though, the Wavecom documents do clearly state that ADL is the one to use unless you really know what you’re doing. :slight_smile: