CF2.0 WM5 Comms help required please

T

Tym Huckin

I'm a newbie to CF and WM5 and .Net - just to make life easy!!

Previous experience is comms in VB6

My WM5 device is an SPV M5000 which contains a GSM mobile.

What I want to be able to do from it is dial into a data logger, in the same
wasy I do with my desktop app in VB6, and download the data in it.

eg - VB6 code:

MSComm1.CommPort = 2
MSComm1.Settings = "9600,e,7,1"
MSComm1.Handshaking = comRTS
MSComm1.RThreshold = 0 ' on com will not be triggered. I'll do it all in
here...
MSComm1.SThreshold = 0 ' on com will not be triggered. I'll do it all in
here...


My first problem is, locating a com port! What port number should I be
using?

Secondly, I have to get to grips with the different events in .NET

I just *know* this is not going to be easy! ~LOL~

Any help appreciated (and something tells me there'll be a post coming from
Dick Grier ~wink~ Can't seem to find your book in this country. I will try
harder in the new year!)

Tym
 
P

Paul G. Tobey [eMVP]

You are *not* dialing a modem, if you're using GSM. Is the data logger
expecting a modem connection? You can't call it with that device, then, I
believe. Certainly, GSM is *not* a means to make a modem connection. It's
like an Ethernet adapter. If the datalogger is connected to the Internet,
then you can talk to it, using network methods.

If the SPV M5000 has a serial port and a modem, then you can do what you did
before (although the names of things won't be the same; the usage will be
similar), using .NET Compact Framework 2.0 and the serial port classes that
are found there.

Paul T.
 
D

Dick Grier

Hi,

The GetPortNames method returns an array of available ports. You assign the
one that corresponds to your modem for the PortName property. Your guess is
a good as mine about what number that actually is.

You can download the simple VS2005 terminal example that I have on my web
site to use as a starting point (I have a detailed Compact Framework 2
example in my book -- see below). That example is for the desktop, but the
Compact Framework code is similar. Your code, converted to VB2005 syntax to
use the built-in serial port object would be (air code):

With SerialPort1
..DataBits = 7

..RtsEnable = True

..DtrEnable = True

..StopBits = IO.Ports.StopBits.One

..ReceivedBytesThreshold = 1

..BaudRate = 9600

..Parity =IO.Ports.Parity.Even

..Handshake = IO.Ports.Handshake.RequestToSend

End With

There is no RThreshold equivalent.

You still can use a loop to poll for responses (use Read or ReadExisting
instead of Input and Write instead of Output).

BTW, you can order my book directly from me (see Books on my homepage for
cost), or via Amazon.com. If you use Amazon, use the Buy New and Used
button and select my entry (dick_grier). I ship immediately, and the cost
using either of these methods would be less than buying it locally. It is
stocked only in the UK (Atlantic Books), or in the US (me).

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
D

Dick Grier

Hi Tym,

Paul's comment about GSM is correct. If you are trying to use a GSM modem
for its common usage (a network connection), then you would not use the
SerialPort object. Network connections use completely different APIs.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
T

Tym Huckin

Dick/Paul,

I've used GSM modems quite successfully before on my laptop.

Here in the UK, a GSM sim card can have 3 "lines" on it - voice, fax and
data, each with a specific number.

The device I have used is here:
http://www.cubeblue.co.uk/gsmmodem.htm

In this case it was attached to the serial port of my laptop, with a GSM sim
card in it. Selecting COM1 from my software, it correctly dialled, and
connected to the datalogger.

The old win3.11 TERMINAL.EXE program was used to test it extensively
independent of my own software.

What I am wanting to do is use the SPV M5000 as a combined platform AND
modem and repeat the exercise, as I said, the problem is selecting the
correct COM port! (and getting to grips with serial coms in vb.net!)

I'll clarify beyond doubt - this is NOT a "network" connection of any
description!!!! This is a serial connection - not internet connection - but
physically dialling in to a data logger which has a 2400baud (!) modem in it
as it's only source of connection. Consequently I *have* to use the serial
port object or I won't be able to connect.

Tym
 
G

Guest

Let's see if we understand. What I get from your post is that

1. In the past you used an external GSM modem in the past that was external
and emulated a telephony model, plikely with an internal microcontroller.

2. Now you are not using that modem, but trying to use an internal GSM modem
of a new device to dial out.

3. The data logger is remote and has a modem that will answer a call.

If these are all true, then the case is still true that you cannot just open
the built-in GSM modem as a serial port and pass it AT commands - it just
doesn't work that way. You probably want the RAS APIs to get it to call
out, then you likely want to emulate something like a VT100.
 
T

Tym Huckin

Chris, thanks for your post.

Yes - 1,2 & 3 are correct.

However, the device does contain a "modem", which is available for external
connection via bt/ir to such as laptop or other PC. What I anticipate being
able to do it access this internally and achieve the same results.

The previous GSM modem worked, as did previous attemtps to use a GSM handset
and accessing the serial port via BT to connect a laptop to the said
datalogger.

What I would like to is to be able to do is have this as a self contained
app in my device, instead of having to use a laptop to access the serial
port externally.

Being completely new to vb.net I know I'm probably cloud chasing, but this
is how I would like it to be able to work.

My device can make normal data calls, internally, (I speak of net access,
when if GPRS is not available, it makes a "WAP" dial and connects to a modem
at the other end) so I don't understand why I can't write an app to do the
self same thing....

Thanks for everyone's input on this

Tym
 
T

Tym Huckin

Dick,

Every time I try to write, I get an IOException

System.IO.IOException was unhandled
Message="IOException"
StackTrace:
at System.IO.Ports.SerialStream.WinIOError()
at System.IO.Ports.SerialStream.Write()
at System.IO.Ports.SerialPort.Write()
at DeviceApplication1.Form1.Button2_Click()
at System.Windows.Forms.Control.OnClick()
at System.Windows.Forms.Button.OnClick()
at System.Windows.Forms.ButtonBase.WnProc()
at System.Windows.Forms.Control._InternalWnProc()
at Microsoft.AGL.Forms.EVL.EnterMainLoop()
at System.Windows.Forms.Application.Run()
at DeviceApplication1.Form1.Main()


With SerialPort1

..PortName = cmbPORT.Text

..DataBits = 7

..RtsEnable = True

..DtrEnable = True

..StopBits = IO.Ports.StopBits.One

..ReceivedBytesThreshold = 1

..BaudRate = 9600

..Parity = IO.Ports.Parity.Even

..Handshake = IO.Ports.Handshake.RequestToSend

..Open()

..Write("ATI0") '<<<<<<<<<<<<<<<<<<<<<<<<<<<< The error happens here

..Write(Chr(13))

End With
 
G

Guest

I'm confused how the BT stuff has bearing on this - if you want to connect
to a paired BT device, then yet, you use serial - but that has nothing to do
with modems or dialing.

If you want to dial with internal hardware, regardless of the modem type,
then you must use RAS, not a serial interface.
 
T

Tym Huckin

Chris,

Thanks for that- I think I need to explore RAS to understand what you are
saying.

If I pair my laptop up to my old mobile via BlueTooth and have a virtual
serial port, I can access this port on the laptop to dial out through the
modem in the mobile

If I was using a PDA which connected via BT to a mobile via a virtual serial
port, I would expect to be able to do the same thing.

What I would like to be able to do is have one app which would work with
either a PDA and separate phone as described, or a combined device, such as
the SPV M5000 to achieve the same result. On the M5000, inder
programs>accessories I have the wireless modem setting, which enables me to
connect to it via BT or IR from a laptop and use the modem wirelesly. I
would hope (always a dangerous move!) that I could access the same modem
*internally* and operate it in the same way.

Are you saying this is not going to be possible? Will I need separate apps?

Tym
 
G

Guest

You keep confusing me - I think you need to stick to one technology at a
time. Do you want to connect with Bluetooth or with GSM? They work in
completely different ways, so the code to do one (RAS for GSM) will be
completely different from the other (serial cooms for BT).

One app can certainly support both.
 
D

Dick Grier

Hi,

If you are sending SMS messages (a common use for these modems in Europe,
but not in the US), then you can just use standard serial APIs (CFSerialIO
from my homepage, the SerialPort object in the SDF on www.opennetcf.org, or
the SerialPort object built into the Compact Framework 2 using VS 2005).

However, as to specific hardware, I'd have to be "hands-on." I don't have
any such. You said:
What I am wanting to do is use the SPV M5000 as a combined platform AND
modem and repeat the exercise, as I said, the problem is selecting the
correct COM port! (and getting to grips with serial coms in vb.net!)
<<

I have no idea how your modem appears... Are you sure that this is
comparable to your other situations? A built-in modem wouldn't (by what
appears logical to me) be intended by the device manufacturer to be used for
non-internet connections. Thus, my doubts.

Dick


--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
D

Dick Grier

Hi,
..Write("ATI0") '<<<<<<<<<<<<<<<<<<<<<<<<<<<< The error happens here

..Write(Chr(13))
<<

What is the error? If the port opened correctly, your code should work.

Dick

--
Richard Grier, MVP
Hard & Software
Author of Visual Basic Programmer's Guide to Serial Communications, Fourth
Edition,
ISBN 1-890422-28-2 (391 pages, includes CD-ROM). July 2004, Revised March
2006.
See www.hardandsoftware.net for details and contact information.
 
T

Tym Huckin

Chris

Sorry for any confusion - I'll try to explain it better!

I have a data capture application which has been written in VB6 to use a
"normal" modem connected to the serial port to dial out and connect to a
remote data logger. No problems there - been working fine for 3 years now...

During the development of this application I also connected a GSM modem to
my PC via cable and a GSM telephone with data capabilities via both
Bluetooth and ir. The latter two methods used a virtual serial port rather
than a physical one, but as all three could be addressed via a com port
number they all still operated in the same way and each simply replaced the
phone line with the cellular connection. Still with me?

In all these situations the *same* application would set the serial port as
required, open the port and dial the logger. When connected it would send
the trigger command and then capture the data sent by the data logger.

What I *now* want to do is develop the app further my using VB.Net 2005 to
create an app for the WM5 OS. This could be either a "Normal" PDA device, or
a device such as mine which is a phone/pda combined, but it still operates
WM5

Using the separate PDA, I am working on the assumption that the user will
pair up their mobile, and create a virtual serial port in much the same way
that I had previously. No problem there as I can quite easily use this port
number as I have before.

Using my "phone" is where I see the problem, in that (in laymen's terms) the
PDA part of the device is already "paired" to the phone part, and I want to
be able to access this actual/virtual "serial port" in order to make the app
dial out through the phone

Hope that makes sense now.

I would like to know about RAS please. Can you elucidate?

Tym
 
G

Guest

Now it does make sense. Yes, stick with the same serial stuff for the
bluetooth. FOr the built-in modem, it won't work like a serial port.
You'll have to use the Remote Access Services (RAS) APIs like RasDial (or
have the user manually dial first). There are commercial 3rd party RAS
components out there (Intelliprog) and IIRC we have some source in our
Forums for RAS as well. Google should get you there.
 
T

Tym Huckin

Thanks Chris - Glad we got there in the end!

The odd thing is - when I check the portnames, it only returns one - COM3.

I've not set com3, in fact, the only port I have set is com4 which is paired
to my GPS receiver. That doesn't appear at all!!! ANy ideas why? and what
com3 might be?

Tym
 
D

dbonfilt

Hi Tym,

I have recently found this post and I'd like to know if you had been
succesful with the tips people gave you.

I'm facing exactly the same problems you experienced and I think I'm
pursuing the same target you explained in the posts (.net mobile used
for transmisión of data via a modem connection).

Nowadays, I have found the OpenNetCF Telephony API to be the tool I
was looking for (but the first 10 licenses cost 500$), and before that
I found the MW6 "MegaPipe" Library (for .NET CF and costing 1000$ /
license). I want to evaluate both in next days.

FYI:
OpenNetCF Telephony:
http://blog.opennetcf.org/ncowburn/2006/12/19/IntroducingOpenNETCFTelephonyLibrary10.aspx
http://store.opennetcf.com/ProductDetails.aspx?productID=18
http://www.opennetcf.com/library/telephony/

MW6 Megapipe:
http://www.mw6tech.com/megapipe/cf/megapipe.html

Thanks & Best Regards,

Diego
 
D

dbonfilt

Oops, the Megapipe license is 299$ w/o file transfer, and 699$ w/file
transfer. The runtime is royalty free (the 1000$ tag was for the file
transfer with Kermit protocol)
 
G

Guest

I think you may be a bit confused. They are two completely separate things.
Megapipe's product provides serial transfer protocols like kermit and the
like. OpenNETCF's is for the telephony API (TAPI), which is used for
controlling something like a GMS modem (dial numbers, intercept phone calls,
etc).


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--



Hi Tym,

I have recently found this post and I'd like to know if you had been
succesful with the tips people gave you.

I'm facing exactly the same problems you experienced and I think I'm
pursuing the same target you explained in the posts (.net mobile used
for transmisión of data via a modem connection).

Nowadays, I have found the OpenNetCF Telephony API to be the tool I
was looking for (but the first 10 licenses cost 500$), and before that
I found the MW6 "MegaPipe" Library (for .NET CF and costing 1000$ /
license). I want to evaluate both in next days.

FYI:
OpenNetCF Telephony:
http://blog.opennetcf.org/ncowburn/2006/12/19/IntroducingOpenNETCFTelephonyLibrary10.aspx
http://store.opennetcf.com/ProductDetails.aspx?productID=18
http://www.opennetcf.com/library/telephony/

MW6 Megapipe:
http://www.mw6tech.com/megapipe/cf/megapipe.html

Thanks & Best Regards,

Diego
 

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