REPOST: Invoking AT modem type commands programmatically

N

nzpcmad

I have a Win CE 4.1 (Not PPC) handheld with a GPRS card installed.

One of the applications that came with the device is a Terminal
application. Using this, I can configure a new session, select a modem
(obviously the GPRS one) from a drop-down list, select the baud rate
etc. etc.

When I then start the session, I can send AT type commands to the modem
e.g. COPS, CREG ....

Now I want to do this within my own application.

I have looked at the OpenNetCF serial code. This supports COM1 through
4. What port does the GPRS card use? Is this some kind of virtual port?
In which case, how do I access it?

Also, what do I use to get the list of available modems?

Any sample code to send AT type commands to a GPRS modem that anyone
can point me to?

Grateful for any help that can get me over this initial hump!
Many thanks
 
I

Ilya Tumanov [MS]

What exactly are you trying to do with that modem? Why can't you create a
normal connection and control it using Connection Manager from OpenNETCF? OS
will deal with COM and AT commands for you in that case, you'll just need to
tell it to connect or disconnect.



If you do need to send AT commands to this modem for some reason, OpenNETCF
serial would work just fine for COM ports above 4. The sample is limited to
4 COM ports, but you can specify any COM you need. Sample contains all you
need to open COM and send AT command, just tweak it to allow COM ports above
4 if your modem is on such port.



You modem can be on any COM port, that depends on hardware.

You can enumerate available COM ports from
HKEY_LOCAL_MACHINE\Drivers\Active.

Open them one by one, send some supported AT command (ATI, for example) and
see if modem will reply.



Best regards,



Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
 
N

nzpcmad

Ilya,

This is a GPRS modem which supports some extra commands e.g.

AT+COPS? - will display the network

So essentially I need some special modem statuses.

Following your suggestion, I found that the GPRS modem was in fact
using COM2:.

However, when I try and open it with "Port.open ()", I get:
"CreateFile Failed: 55"

Any ideas?

Thanks
 
N

nzpcmad

OK - I made good progress.

I am using the SerialCSharp example from OpenNetCF Samples which
handles one character at a time.

I changed the code to add a 0x0d to each line in the Outgoing text box
when I press the "Send" button.

When I do this, I only get one character back. Repeated presses of the
"Send" button bring back the next character in the return string .

eg.

I type ABC and add the 0x0d when I press Send. Th correct response is
say DEF.

D comes back.

Press "Send".

E comes back.

Press "Send".

F comes back.
... and so on.

How do I get the entire string?

Many thanks
 
G

Guest

Modify how it reads. I wrote the sample to do 1 char at a time so it could
handle any length input without delay - inefficient but it works.

-Chris
 

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

Top