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
>>