Turn on / off flight mode

  • Thread starter Thread starter cyberco
  • Start date Start date
C

cyberco

Using: WM5 PPC, .NetCF 2.0 OpenNetCF, C#

Before opening a socket I have to make sure the phone is on (not in
flight mode) and there is a GPRS attach. The latter can be solved by:

=============
bool connected = false;
ConnectionManager connMgr = new ConnectionManager();
connMgr.Connect(true, ConnectionMode.Asynchronous);
while (!connected) {
if (connMgr.Status != ConnectionStatus.Connected) {
Thread.Sleep(1000);
continue;
}
connected = true;
}
=============

But how about when the phone is in flight mode? I've read that you can
use OpenNetCF's Telephony API (tapi) for that, more specifically the
lineSetEquipmentState(hLine, dwState) method. But how do I invoke this
method? How do I know what the parameters should be? I'm using C#.
 
Thanks.
Using OpenNet's TAPI I should be able to accomplish this. Thanks for
your parameters, but there is an enumeration for the equipment state. I
figured I should invoke the folowing methods:

OpenNETCF.Telephony.NativeMethods.lineSetEquipmentState(IntPtr hLine,
EquipmentState dwState)
OpenNETCF.Telephony.NativeMethods.lineRegister(IntPtr hLine, int
dwRegisterMode, string lpszOperator, int dwOperatorFormat)

The difficulty is in deciding what the hLine parameter in
lineSetEquipmentState() is, and what all parameters in lineRegister()
are.
About hLine, MSDN says: "The line device handle. The line device handle
must have been previously obtained by a call to lineOpen with the
proper Telephony API (TAPI) device ID specified and a device-specific
extension version was successfully negotiated with
lineNegotiateExtVersion. For more information about
lineNegotiateExtVersion and lineOpen, see the TAPI Functions API
Reference topics in the Microsoft® Windows® CE SDK."

All in all this seems very elaborate, and it DOES require me to dive
into the low level details, or am I misinterpreting something?
 
We have a sample for doing this somewhere - let me see if I can dig it up.


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


Thanks.
Using OpenNet's TAPI I should be able to accomplish this. Thanks for
your parameters, but there is an enumeration for the equipment state. I
figured I should invoke the folowing methods:

OpenNETCF.Telephony.NativeMethods.lineSetEquipmentState(IntPtr hLine,
EquipmentState dwState)
OpenNETCF.Telephony.NativeMethods.lineRegister(IntPtr hLine, int
dwRegisterMode, string lpszOperator, int dwOperatorFormat)

The difficulty is in deciding what the hLine parameter in
lineSetEquipmentState() is, and what all parameters in lineRegister()
are.
About hLine, MSDN says: "The line device handle. The line device handle
must have been previously obtained by a call to lineOpen with the
proper Telephony API (TAPI) device ID specified and a device-specific
extension version was successfully negotiated with
lineNegotiateExtVersion. For more information about
lineNegotiateExtVersion and lineOpen, see the TAPI Functions API
Reference topics in the Microsoft® Windows® CE SDK."

All in all this seems very elaborate, and it DOES require me to dive
into the low level details, or am I misinterpreting something?
 
Back
Top