RAS connection using GSM - GPRS Modem [modified]
-
How do I programmatically set the Extra Initialization string on the modem when making a RAS connection through a GSM – GPRS modem device to get TCP/IP connectivity through the ISP provider to the internet?? Here’s the Extra Initialization string needed on the modem for RAS: +CGDCONT=1,"IP,"IPS.CINGULAR" Here’s my targeted device environment: OS: Windows CE 5.0 (using .Net Compact Framework 2.0) Here’s the sample code that I’m calling to connect to a RAS phonebook entry profile. namespace TestDevices { class RasWrapperII { [DllImport("coredll.dll")] public static extern uint RasDial(IntPtr dialExtensions, IntPtr phoneBookPath, IntPtr rasDialParam, uint NotifierType, IntPtr notifier, ref IntPtr pRasConn); [DllImport("coredll.dll")] public static extern uint RasHangUp(IntPtr pRasConn); /// /// EntryName ,UserName,Password - same as in RASDIALPARAMS structure (see MSDN) /// /// /// /// /// /// unsafe public static uint myRasDial(string EntryName, string UserName, string Password, out IntPtr RasConn) { uint r = 0; RasConn = IntPtr.Zero; byte[] bRASDIALPARAMS = new byte[1464]; fixed (byte* pAddr = bRASDIALPARAMS) { byte* pCurrent = pAddr; Marshal.WriteInt32((IntPtr)pCurrent, bRASDIALPARAMS.Length); pCurrent += 4; foreach (byte b in Encoding.Unicode.GetBytes(EntryName)) { Marshal.WriteByte((IntPtr)pCurrent, b); pCurrent++; } pCurrent = pAddr + 0x192; //0x192 - offset for RASDIALPARAMS.UserName foreach (byte b in Encoding.Unicode.GetBytes(UserName)) { Marshal.WriteByte((IntPtr)pCurrent, b); pCurrent++; } pCurrent = pAddr + 0x394; //0x394 - offset for RASDIALPARAMS.Password foreach (byte b in Encoding.Unicode.GetBytes(Password))
-
How do I programmatically set the Extra Initialization string on the modem when making a RAS connection through a GSM – GPRS modem device to get TCP/IP connectivity through the ISP provider to the internet?? Here’s the Extra Initialization string needed on the modem for RAS: +CGDCONT=1,"IP,"IPS.CINGULAR" Here’s my targeted device environment: OS: Windows CE 5.0 (using .Net Compact Framework 2.0) Here’s the sample code that I’m calling to connect to a RAS phonebook entry profile. namespace TestDevices { class RasWrapperII { [DllImport("coredll.dll")] public static extern uint RasDial(IntPtr dialExtensions, IntPtr phoneBookPath, IntPtr rasDialParam, uint NotifierType, IntPtr notifier, ref IntPtr pRasConn); [DllImport("coredll.dll")] public static extern uint RasHangUp(IntPtr pRasConn); /// /// EntryName ,UserName,Password - same as in RASDIALPARAMS structure (see MSDN) /// /// /// /// /// /// unsafe public static uint myRasDial(string EntryName, string UserName, string Password, out IntPtr RasConn) { uint r = 0; RasConn = IntPtr.Zero; byte[] bRASDIALPARAMS = new byte[1464]; fixed (byte* pAddr = bRASDIALPARAMS) { byte* pCurrent = pAddr; Marshal.WriteInt32((IntPtr)pCurrent, bRASDIALPARAMS.Length); pCurrent += 4; foreach (byte b in Encoding.Unicode.GetBytes(EntryName)) { Marshal.WriteByte((IntPtr)pCurrent, b); pCurrent++; } pCurrent = pAddr + 0x192; //0x192 - offset for RASDIALPARAMS.UserName foreach (byte b in Encoding.Unicode.GetBytes(UserName)) { Marshal.WriteByte((IntPtr)pCurrent, b); pCurrent++; } pCurrent = pAddr + 0x394; //0x394 - offset for RASDIALPARAMS.Password foreach (byte b in Encoding.Unicode.GetBytes(Password))
It's not officially supported, I'm afraid. The 'Extra Dialling Commands' field is a field of the opaque structure pointed to by the lpbDeviceInfo parameter passed to
RasSetEntryProperties
which isn't officially documented. Strictly it can be whatever the TAPI (Telephony API) provider for this phonebook entry wants it to be. For standard dial-up connections, though, the TAPI provider is the Universal Modem (Unimodem) provider. If you have access to the Windows CE shared source code, you discover that it's aDEVMINICFG
structure. You'll have to see that source for the definition of the structure and how to use it. The only supported way of editing this information programmatically is on Windows Mobile 2003 and later, using configuration XML with theCM_PPPEntries
configuration service provider. However, normally WM2003 and later devices with a GSM/GPRS radio will ship with Phone Edition and offer a direct Cellular Radio TAPI Provider, which can be used with theCM_GPRSEntries
configuration service provider.
DoEvents
: Generating unexpected recursion since 1991 -
It's not officially supported, I'm afraid. The 'Extra Dialling Commands' field is a field of the opaque structure pointed to by the lpbDeviceInfo parameter passed to
RasSetEntryProperties
which isn't officially documented. Strictly it can be whatever the TAPI (Telephony API) provider for this phonebook entry wants it to be. For standard dial-up connections, though, the TAPI provider is the Universal Modem (Unimodem) provider. If you have access to the Windows CE shared source code, you discover that it's aDEVMINICFG
structure. You'll have to see that source for the definition of the structure and how to use it. The only supported way of editing this information programmatically is on Windows Mobile 2003 and later, using configuration XML with theCM_PPPEntries
configuration service provider. However, normally WM2003 and later devices with a GSM/GPRS radio will ship with Phone Edition and offer a direct Cellular Radio TAPI Provider, which can be used with theCM_GPRSEntries
configuration service provider.
DoEvents
: Generating unexpected recursion since 1991Thanks Mike for the information about the DEVMINICFG structure under the TAPI, at least now I have a starting point to check into!
-
Thanks Mike for the information about the DEVMINICFG structure under the TAPI, at least now I have a starting point to check into!
Could you please provide the code to set the unimodem dial up connection properties on Win ce 5 using c#... I need to set programatically baud rate, stop bit, flow control, extra dial up string etc., Thanks in advance... my mail id is prajwal_ap@yahoo.co.uk