Add APN in RAS Book for Unimodem & CellTSP on WinCE 6.0/7.0
RAS book can be created in two ways in windows CE either through Dial up and network wizard or through programmatically. Although Microsoft provides sample application for creating a RAS book in Windows CE 6.0, still it is not clearly answering on how to add some specific parameters to establish GPRS connectivity. Adding parameters such as service provider APN details etc… are not addressed in the given sample application. Also there are some difference in creating RAS book for Unimodem and CellTSP (cellcore) GPRS connectivity. I am seeing considerable posting on MSDN forum regarding the RAS book creation for GPRS connectivity. On this sake, I am showing some lights for the developers who involved in this.
Let’s get our Hands dirty
Sample application for creating a RAS book (generic application) given in \WINCE600\PUBLIC\ COMMON\OAK\DRIVERS\NETSAMP\RASENTRY folder. This application doesn’t cover the necessary information for creating RAS book for GPRS specifically adding service provider APN, Extra commands etc… But we can use this application as a base.
Configuring Access point information for Unimodem
Device specific things such as serial port baud rate, Access point information will be configured only through TAPI APIs and not through RAS APIs. Existing RAS ENTRY sample application shows how to change the baud rate of the serial port using TAPI API. You can see the function BOOL SetBaudRate(TCHAR * szBaud) in the sample application which demonstrate it. It uses the TAPI API lineDevSpecfic() to set the baud rate by passing UNIMDM_CHG_DEVCFG TAPI structure. You can see the below code snippet in the setBaudRate() function that uses UNIMDM_OPT_BAUDRATE to set the baud rate.
In Unimodem, Access point is set through an extra AT command such as +cgdcont=1,”IP”,”airtelgprs.com”. Now how to pass this extra AT command is the question. There is no straight answer in msdn for this but the way is simple. To pass the AT command, there is another option called Dial modifier (UNIMDM_OPT_DIALMOD) in the UNIMDM_CHG_DEVCFG TAPI structure. So you can create a new function called BOOL SetDialMod(TCHAR * szDialMod) similar to setBaudRate() and replace the above code snippet with the below one. You can pass the AT command parameters through the szDialMod.
Just go through how the setBaudRate() is called in this application, similarly you have to add code in the calling point as shown below in the RAS_ENTRY application
Also add one more entry for dial modifier in the parameter input text file given to RAS_ENTRY program.
Also you can click here to download the sample source code, it is built in VS2005.
Configuring Access point information in Cellcore (CellTsp)
We can to use the same TAPI APIs for configuring radio parameters for celltsp but the structure and the API call is different. We have to use lineSetDevConfig() and CELLDEVCONFIG for celltsp and it has some sub structure to configure various radio parameters including configuring the access point. I have created a function BOOL SetCellGPRSConnInfo(TCHAR * szAPN) simillar to SetDialMod() function and pass the access point information in the same RAS_ENTRY application. Following snapshot shows it after call the lineGetDevConfig().
You have to include tsp.h file instead of unimodem.h file. Also a change in FindDeviceID() function. You have to use Device Name as “Cellular TAPI service Provider” instead of “UNIMODEM” to get the correct Device ID. Same Device Name should be entered in the input file passed to RAS_ENRTY application. See the Following code snippet of FindDeviceID() in RAS_ENTRY application.