I get the impression TAPI and C# has already been discussed by various
clever chaps and chapesses - but this mostly goes right over my head!
All I want to know is how do I place a GSM call on my PocketPC (Mobile
Phone Edition) using C# and .net CF.
The device (MDA II / XDA II) even offers a 'wireless modem' feature to
any external device - just connect per Bluetooth/USB/serial/IrDA and
issue AT commands just like any other normal modem. But I am not an
external device - I am (in this context!) an application running on
the MDA II / XDA II.
How do I get to place a GSM call (for V110 data) - I just want to dial
a phone number and be told when I am connected, with the option to
abort if this takes too long. I have no problem issuing AT commands,
if I just knew where I should be sending them (I think it is a feature
of TAPI to identify the 'modem' devices, but I am not at all sure!).
Any user interface will be supplied by my application - the process of
calling etc. must take place without any additional screens to bother
the user.
C++ is a number too big for me and TAPI is way too complex for what I
want - has somebody got a neat, lightweight C# solution... or at least
a push in the right direction! Is there anybody out there that can
help me?

Peter Beedell

"Remember that age and treachery will always triumph over youth and
ability." Quoted from the BBC Comedy 'The Office'.

RE: How can I use a PocketPC 'modem' under C# ? by PeterBeedell

PeterBeedell
Tue Feb 01 05:09:02 CST 2005

I have been investing some time researching this issue the last few days - it
would seem I am not alone in requiring this functionality. There must be
some clever Johnnys out there that are able to encapsulate all this
complexity for everyday simpletons like me to consume in their C# programs?
Or at least to provide an explanation detailed enough for me to use (I do not
know how to use a solution provided in C++, that blows my stack!). I am sure
this would make a lot of other C# programmers happy as well... at least until
Microsoft provides this functionality out of the box!

Basically, I need a data connection - a stream would be optimal - as follows:

if (DataCall.Connect(strModemNumber, intTimeout) == LineStatus.Connected)
stream myStream = DataCall.GetStream();
else
MessageBox.Show("Failed to connect!");

Where the method Connect should be blocking (keep it simple!) but with a
timeout.

"Peter Beedell" wrote:

> I get the impression TAPI and C# has already been discussed by various
> clever chaps and chapesses - but this mostly goes right over my head!
> All I want to know is how do I place a GSM call on my PocketPC (Mobile
> Phone Edition) using C# and .net CF.
> The device (MDA II / XDA II) even offers a 'wireless modem' feature to
> any external device - just connect per Bluetooth/USB/serial/IrDA and
> issue AT commands just like any other normal modem. But I am not an
> external device - I am (in this context!) an application running on
> the MDA II / XDA II.
> How do I get to place a GSM call (for V110 data) - I just want to dial
> a phone number and be told when I am connected, with the option to
> abort if this takes too long. I have no problem issuing AT commands,
> if I just knew where I should be sending them (I think it is a feature
> of TAPI to identify the 'modem' devices, but I am not at all sure!).
> Any user interface will be supplied by my application - the process of
> calling etc. must take place without any additional screens to bother
> the user.
> C++ is a number too big for me and TAPI is way too complex for what I
> want - has somebody got a neat, lightweight C# solution... or at least
> a push in the right direction! Is there anybody out there that can
> help me?
>
> Peter Beedell
>
> "Remember that age and treachery will always triumph over youth and
> ability." Quoted from the BBC Comedy 'The Office'.
>

Re: How can I use a PocketPC 'modem' under C# ? by r_z_aret

r_z_aret
Tue Feb 01 15:53:19 CST 2005

On Tue, 1 Feb 2005 03:09:02 -0800, "Peter Beedell"
<PeterBeedell@discussions.microsoft.com> wrote:

>I have been investing some time researching this issue the last few days - it
>would seem I am not alone in requiring this functionality. There must be
>some clever Johnnys out there that are able to encapsulate all this
>complexity for everyday simpletons like me to consume in their C# programs?
>Or at least to provide an explanation detailed enough for me to use (I do not
>know how to use a solution provided in C++, that blows my stack!). I am sure
>this would make a lot of other C# programmers happy as well... at least until
>Microsoft provides this functionality out of the box!

I just used google (http://groups.google.com/advanced_group_search) to
look up
c# modem
in this newsgroup and got 5 hits. I use C++, not C#, so I'm cautious
about judging. But one long answer in the thread referenced articles
about .NET.

>
>Basically, I need a data connection - a stream would be optimal - as follows:
>
>if (DataCall.Connect(strModemNumber, intTimeout) == LineStatus.Connected)
> stream myStream = DataCall.GetStream();
>else
> MessageBox.Show("Failed to connect!");
>
>Where the method Connect should be blocking (keep it simple!) but with a
>timeout.
>
>"Peter Beedell" wrote:
>
>> I get the impression TAPI and C# has already been discussed by various
>> clever chaps and chapesses - but this mostly goes right over my head!
>> All I want to know is how do I place a GSM call on my PocketPC (Mobile
>> Phone Edition) using C# and .net CF.
>> The device (MDA II / XDA II) even offers a 'wireless modem' feature to
>> any external device - just connect per Bluetooth/USB/serial/IrDA and
>> issue AT commands just like any other normal modem. But I am not an
>> external device - I am (in this context!) an application running on
>> the MDA II / XDA II.
>> How do I get to place a GSM call (for V110 data) - I just want to dial
>> a phone number and be told when I am connected, with the option to
>> abort if this takes too long. I have no problem issuing AT commands,
>> if I just knew where I should be sending them (I think it is a feature
>> of TAPI to identify the 'modem' devices, but I am not at all sure!).
>> Any user interface will be supplied by my application - the process of
>> calling etc. must take place without any additional screens to bother
>> the user.
>> C++ is a number too big for me and TAPI is way too complex for what I
>> want - has somebody got a neat, lightweight C# solution... or at least
>> a push in the right direction! Is there anybody out there that can
>> help me?
>>
>> Peter Beedell
>>
>> "Remember that age and treachery will always triumph over youth and
>> ability." Quoted from the BBC Comedy 'The Office'.
>>

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com

Re: How can I use a PocketPC 'modem' under C# ? by PeterBeedell

PeterBeedell
Wed Feb 02 02:27:02 CST 2005

Thanks for replying - I have followed pretty much all the hopeful links from
Google and many others! There are indeed solutions written in C++ and
doubtless, if I were clever enough, I would be able to package them for
consumption in my C# application... but I am NOT that clever - I write
business applications in C# and not drivers in C++!
One hot trail suggests that I am indeed able to issue AT commands over COM2:
(in the XDA/MDA II device, may be different for other devices!), but only
after a specific command has been issued to the controller. The following is
the C++ code has been provided by a generous contributer (sorry, he did not
include his name in the code!):
DeviceIoControl (hCom, 0xAAAA5679L, comdevcmd, sizeof(comdevcmd), 0, 0, 0, 0)
Now, how do I do this in C#? If I were able to issue this special command
and thus activate the modem on COM2: (115200, 8, N, 1), apparantly I would be
able to establish a data call ("ATD<tel.no>") and, if connected, the port
COM9: would become my data stream. I would love to test this... if I could
only issue this command in C#! Your support here would be fantastic!

"r_z_aret@pen_fact.com" wrote:

> On Tue, 1 Feb 2005 03:09:02 -0800, "Peter Beedell"
> <PeterBeedell@discussions.microsoft.com> wrote:
>
> >I have been investing some time researching this issue the last few days - it
> >would seem I am not alone in requiring this functionality. There must be
> >some clever Johnnys out there that are able to encapsulate all this
> >complexity for everyday simpletons like me to consume in their C# programs?
> >Or at least to provide an explanation detailed enough for me to use (I do not
> >know how to use a solution provided in C++, that blows my stack!). I am sure
> >this would make a lot of other C# programmers happy as well... at least until
> >Microsoft provides this functionality out of the box!
>
> I just used google (http://groups.google.com/advanced_group_search) to
> look up
> c# modem
> in this newsgroup and got 5 hits. I use C++, not C#, so I'm cautious
> about judging. But one long answer in the thread referenced articles
> about .NET.
>
> >
> >Basically, I need a data connection - a stream would be optimal - as follows:
> >
> >if (DataCall.Connect(strModemNumber, intTimeout) == LineStatus.Connected)
> > stream myStream = DataCall.GetStream();
> >else
> > MessageBox.Show("Failed to connect!");
> >
> >Where the method Connect should be blocking (keep it simple!) but with a
> >timeout.
> >
> >"Peter Beedell" wrote:
> >
> >> I get the impression TAPI and C# has already been discussed by various
> >> clever chaps and chapesses - but this mostly goes right over my head!
> >> All I want to know is how do I place a GSM call on my PocketPC (Mobile
> >> Phone Edition) using C# and .net CF.
> >> The device (MDA II / XDA II) even offers a 'wireless modem' feature to
> >> any external device - just connect per Bluetooth/USB/serial/IrDA and
> >> issue AT commands just like any other normal modem. But I am not an
> >> external device - I am (in this context!) an application running on
> >> the MDA II / XDA II.
> >> How do I get to place a GSM call (for V110 data) - I just want to dial
> >> a phone number and be told when I am connected, with the option to
> >> abort if this takes too long. I have no problem issuing AT commands,
> >> if I just knew where I should be sending them (I think it is a feature
> >> of TAPI to identify the 'modem' devices, but I am not at all sure!).
> >> Any user interface will be supplied by my application - the process of
> >> calling etc. must take place without any additional screens to bother
> >> the user.
> >> C++ is a number too big for me and TAPI is way too complex for what I
> >> want - has somebody got a neat, lightweight C# solution... or at least
> >> a push in the right direction! Is there anybody out there that can
> >> help me?
> >>
> >> Peter Beedell
> >>
> >> "Remember that age and treachery will always triumph over youth and
> >> ability." Quoted from the BBC Comedy 'The Office'.
> >>
>
> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
>
> Robert E. Zaret, eMVP
> PenFact, Inc.
> 500 Harrison Ave., Suite 3R
> Boston, MA 02118
> www.penfact.com
>

Re: How can I use a PocketPC 'modem' under C# ? by Chris

Chris
Wed Feb 02 08:41:32 CST 2005

You simply need to P/Invoke DeviceIoControl. I see you argue that you're
not a C++ driver author, but if you plan on doing much in the CF you really
need to learn how to P/Invoke to native methods. There will *always* be
that need. It will get easier in the future as marshaling support gets
better, but you'll never get around the need.

There are plenty of online resources and articles that explain P/Invoke.
There are a couple right on MSDN that cover the basics and are very good.
Beyond that a search on google for 'P/Invoke DeviceIoControl' brought up
lots of promising results. In fact the first result is an MSDN article that
has the C# declaration in it.

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate


"Peter Beedell" <PeterBeedell@discussions.microsoft.com> wrote in message
news:C076AE66-2421-4E31-9280-4A7668185E00@microsoft.com...
> Thanks for replying - I have followed pretty much all the hopeful links
> from
> Google and many others! There are indeed solutions written in C++ and
> doubtless, if I were clever enough, I would be able to package them for
> consumption in my C# application... but I am NOT that clever - I write
> business applications in C# and not drivers in C++!
> One hot trail suggests that I am indeed able to issue AT commands over
> COM2:
> (in the XDA/MDA II device, may be different for other devices!), but only
> after a specific command has been issued to the controller. The following
> is
> the C++ code has been provided by a generous contributer (sorry, he did
> not
> include his name in the code!):
> DeviceIoControl (hCom, 0xAAAA5679L, comdevcmd, sizeof(comdevcmd), 0, 0, 0,
> 0)
> Now, how do I do this in C#? If I were able to issue this special command
> and thus activate the modem on COM2: (115200, 8, N, 1), apparantly I would
> be
> able to establish a data call ("ATD<tel.no>") and, if connected, the port
> COM9: would become my data stream. I would love to test this... if I
> could
> only issue this command in C#! Your support here would be fantastic!
>
> "r_z_aret@pen_fact.com" wrote:
>
>> On Tue, 1 Feb 2005 03:09:02 -0800, "Peter Beedell"
>> <PeterBeedell@discussions.microsoft.com> wrote:
>>
>> >I have been investing some time researching this issue the last few
>> >days - it
>> >would seem I am not alone in requiring this functionality. There must
>> >be
>> >some clever Johnnys out there that are able to encapsulate all this
>> >complexity for everyday simpletons like me to consume in their C#
>> >programs?
>> >Or at least to provide an explanation detailed enough for me to use (I
>> >do not
>> >know how to use a solution provided in C++, that blows my stack!). I am
>> >sure
>> >this would make a lot of other C# programmers happy as well... at least
>> >until
>> >Microsoft provides this functionality out of the box!
>>
>> I just used google (http://groups.google.com/advanced_group_search) to
>> look up
>> c# modem
>> in this newsgroup and got 5 hits. I use C++, not C#, so I'm cautious
>> about judging. But one long answer in the thread referenced articles
>> about .NET.
>>
>> >
>> >Basically, I need a data connection - a stream would be optimal - as
>> >follows:
>> >
>> >if (DataCall.Connect(strModemNumber, intTimeout) ==
>> >LineStatus.Connected)
>> > stream myStream = DataCall.GetStream();
>> >else
>> > MessageBox.Show("Failed to connect!");
>> >
>> >Where the method Connect should be blocking (keep it simple!) but with a
>> >timeout.
>> >
>> >"Peter Beedell" wrote:
>> >
>> >> I get the impression TAPI and C# has already been discussed by various
>> >> clever chaps and chapesses - but this mostly goes right over my head!
>> >> All I want to know is how do I place a GSM call on my PocketPC (Mobile
>> >> Phone Edition) using C# and .net CF.
>> >> The device (MDA II / XDA II) even offers a 'wireless modem' feature to
>> >> any external device - just connect per Bluetooth/USB/serial/IrDA and
>> >> issue AT commands just like any other normal modem. But I am not an
>> >> external device - I am (in this context!) an application running on
>> >> the MDA II / XDA II.
>> >> How do I get to place a GSM call (for V110 data) - I just want to dial
>> >> a phone number and be told when I am connected, with the option to
>> >> abort if this takes too long. I have no problem issuing AT commands,
>> >> if I just knew where I should be sending them (I think it is a feature
>> >> of TAPI to identify the 'modem' devices, but I am not at all sure!).
>> >> Any user interface will be supplied by my application - the process of
>> >> calling etc. must take place without any additional screens to bother
>> >> the user.
>> >> C++ is a number too big for me and TAPI is way too complex for what I
>> >> want - has somebody got a neat, lightweight C# solution... or at least
>> >> a push in the right direction! Is there anybody out there that can
>> >> help me?
>> >>
>> >> Peter Beedell
>> >>
>> >> "Remember that age and treachery will always triumph over youth and
>> >> ability." Quoted from the BBC Comedy 'The Office'.
>> >>
>>
>> -----------------------------------------
>> To reply to me, remove the underscores (_) from my email address (and
>> please indicate which newsgroup and message).
>>
>> Robert E. Zaret, eMVP
>> PenFact, Inc.
>> 500 Harrison Ave., Suite 3R
>> Boston, MA 02118
>> www.penfact.com
>>



Re: How can I use a PocketPC 'modem' under C# ? by r_z_aret

r_z_aret
Wed Feb 02 14:09:46 CST 2005

On Wed, 2 Feb 2005 00:27:02 -0800, "Peter Beedell"
<PeterBeedell@discussions.microsoft.com> wrote:

>Thanks for replying - I have followed pretty much all the hopeful links from
>Google and many others! There are indeed solutions written in C++ and

Did you see the 26 Nov 2004 post from Daniel Moth to a thread called
"Comm Port Send/Read Data"? It looks like a clear, concise discussion
of your options. Especially the third link. Maybe not what you _want_.


>doubtless, if I were clever enough, I would be able to package them for
>consumption in my C# application... but I am NOT that clever - I write
>business applications in C# and not drivers in C++!

I got all that from your original post.


-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com

Re: How can I use a PocketPC 'modem' under C# ? by PeterBeedell

PeterBeedell
Thu Feb 03 11:37:01 CST 2005

Correct - this is NOT what I want :-(

I think that Daniel Moth has done a fantastic job of explaining all aspects
of RS232 and .NET. Likewise OpenNETCF.org are brilliant - both the
implementation and the open code are a gift from the Gods to a pesant
programmer like me!

BUT, neither help me to implement the DeviceIoControl API... the first
parameter it requires is a handle to the COM port (or file?) and this is not
avaliable if I open the port using the OpenNETCF class because it is marked
private - here is the declaration on line 117: private IntPtr hPort =
(IntPtr)CommAPI.INVALID_HANDLE_VALUE;

I guess I could take this class and modify it to give me the handle I need,
but is this the correct approach? Maybe another approach is to take over all
the COM port API work in C# and not bother with the OpenNETCF class, which
would be a shame and is also non-trivial for a bear of little brain like me!

If you have any good ideas, do let me know - there really have been dozens
of folk asking pretty much this same questions and nobody has really given a
satisfactory answer yet. I promise to publish my results.. if I ever get it
to work!


"r_z_aret@pen_fact.com" wrote:

> On Wed, 2 Feb 2005 00:27:02 -0800, "Peter Beedell"
> <PeterBeedell@discussions.microsoft.com> wrote:
>
> >Thanks for replying - I have followed pretty much all the hopeful links from
> >Google and many others! There are indeed solutions written in C++ and
>
> Did you see the 26 Nov 2004 post from Daniel Moth to a thread called
> "Comm Port Send/Read Data"? It looks like a clear, concise discussion
> of your options. Especially the third link. Maybe not what you _want_.
>
>
> >doubtless, if I were clever enough, I would be able to package them for
> >consumption in my C# application... but I am NOT that clever - I write
> >business applications in C# and not drivers in C++!
>
> I got all that from your original post.
>
>
> -----------------------------------------
> To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).
>
> Robert E. Zaret, eMVP
> PenFact, Inc.
> 500 Harrison Ave., Suite 3R
> Boston, MA 02118
> www.penfact.com
>

Re: How can I use a PocketPC 'modem' under C# ? by Chris

Chris
Thu Feb 03 12:01:11 CST 2005

If you need the handle, but want to use the rest of the OpenNETCF
functionality your best bet is going to be to modify the source code and
recompile it. Either add a method to allow you to call DeviceIoControl, or
expose the handle. Not many options otherwise.

--
Chris Tacke
Co-founder
OpenNETCF.org
Has OpenNETCF helped you? Consider donating to support us!
http://www.opennetcf.org/donate


"Peter Beedell" <PeterBeedell@discussions.microsoft.com> wrote in message
news:7CCCF888-84AF-49D7-B35C-C81C305F4807@microsoft.com...
> Correct - this is NOT what I want :-(
>
> I think that Daniel Moth has done a fantastic job of explaining all
> aspects
> of RS232 and .NET. Likewise OpenNETCF.org are brilliant - both the
> implementation and the open code are a gift from the Gods to a pesant
> programmer like me!
>
> BUT, neither help me to implement the DeviceIoControl API... the first
> parameter it requires is a handle to the COM port (or file?) and this is
> not
> avaliable if I open the port using the OpenNETCF class because it is
> marked
> private - here is the declaration on line 117: private IntPtr
> hPort =
> (IntPtr)CommAPI.INVALID_HANDLE_VALUE;
>
> I guess I could take this class and modify it to give me the handle I
> need,
> but is this the correct approach? Maybe another approach is to take over
> all
> the COM port API work in C# and not bother with the OpenNETCF class, which
> would be a shame and is also non-trivial for a bear of little brain like
> me!
>
> If you have any good ideas, do let me know - there really have been dozens
> of folk asking pretty much this same questions and nobody has really given
> a
> satisfactory answer yet. I promise to publish my results.. if I ever get
> it
> to work!
>
>
> "r_z_aret@pen_fact.com" wrote:
>
>> On Wed, 2 Feb 2005 00:27:02 -0800, "Peter Beedell"
>> <PeterBeedell@discussions.microsoft.com> wrote:
>>
>> >Thanks for replying - I have followed pretty much all the hopeful links
>> >from
>> >Google and many others! There are indeed solutions written in C++ and
>>
>> Did you see the 26 Nov 2004 post from Daniel Moth to a thread called
>> "Comm Port Send/Read Data"? It looks like a clear, concise discussion
>> of your options. Especially the third link. Maybe not what you _want_.
>>
>>
>> >doubtless, if I were clever enough, I would be able to package them for
>> >consumption in my C# application... but I am NOT that clever - I write
>> >business applications in C# and not drivers in C++!
>>
>> I got all that from your original post.
>>
>>
>> -----------------------------------------
>> To reply to me, remove the underscores (_) from my email address (and
>> please indicate which newsgroup and message).
>>
>> Robert E. Zaret, eMVP
>> PenFact, Inc.
>> 500 Harrison Ave., Suite 3R
>> Boston, MA 02118
>> www.penfact.com
>>