{"id":846,"date":"2013-02-18T10:00:53","date_gmt":"2013-02-18T04:30:53","guid":{"rendered":"http:\/\/www.e-consystems.com\/blog\/windowsce\/?p=846"},"modified":"2023-08-15T12:31:28","modified_gmt":"2023-08-15T07:01:28","slug":"programmatically-adding-apn-in-ras-book-for-unimodem-and-celltsp-on-windows-ce-6-07-0","status":"publish","type":"post","link":"https:\/\/www.e-consystems.com\/blog\/windowsce\/programmatically-adding-apn-in-ras-book-for-unimodem-and-celltsp-on-windows-ce-6-07-0\/","title":{"rendered":"Add  APN in RAS Book for Unimodem &#038; CellTSP on WinCE 6.0\/7.0"},"content":{"rendered":"<p align=\"justify\">RAS book can be created in two ways in windows CE either  through <a href=\"https:\/\/www.e-consystems.com\/Articles\/Windows-CE\/gprs.asp\">Dial up and network  wizard<\/a> 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&hellip; 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.<\/p>\n<p align=\"justify\">Let&rsquo;s get our Hands dirty<\/p>\n<p align=\"justify\">Sample application for creating a RAS book (generic  application) given in \\WINCE600\\PUBLIC\\ COMMON\\OAK\\DRIVERS\\NETSAMP\\RASENTRY  folder. This application doesn&rsquo;t cover the necessary information for creating  RAS book for GPRS specifically adding service provider APN, Extra commands etc&#8230;  But we can use this application as a base.&nbsp; <\/p>\n<p align=\"justify\"><strong>Configuring Access  point information for Unimodem<\/strong><\/p>\n<p align=\"justify\">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 <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ee496243.aspx\">UNIMDM_CHG_DEVCFG<\/a>&nbsp; TAPI structure. You can see the below code  snippet in the setBaudRate() function that uses UNIMDM_OPT_BAUDRATE to set the  baud rate.<\/p>\n<p><a href=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img1.jpg\" target=\"_blank\" title=\"Click to Open in New Tab\" rel=\"noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img1.jpg\" alt=\"APN RAS\" width=\"582\" height=\"280\" border=\"0\" \/><\/a><\/p>\n<p align=\"justify\">In Unimodem, Access point is set through an extra AT command  such as <strong>+cgdcont=1,&quot;IP&quot;,&quot;airtelgprs.com&quot;<\/strong>.  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 <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ee496243.aspx\">UNIMDM_CHG_DEVCFG<\/a> 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.<\/p>\n<p><a href=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img2.jpg\" target=\"_blank\" title=\"Click to Open in New Tab\" rel=\"noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img2.jpg\" alt=\"APN RAS\" width=\"615\" height=\"277\" border=\"0\" \/><\/a><\/p>\n<p align=\"justify\">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<\/p>\n<p><a href=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img3.jpg\" target=\"_blank\" title=\"Click to Open in New Tab\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img3.jpg\" alt=\"APN RAS\" border=\"0\" \/><\/a><\/p>\n<p align=\"justify\">Also add one more entry for dial modifier in the parameter input  text file given to RAS_ENTRY program.<\/p>\n<p><a href=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img4.jpg\" target=\"_blank\" title=\"Click to Open in New Tab\" rel=\"noopener\"><img decoding=\"async\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img4.jpg\" alt=\"APN RAS\" border=\"0\" \/><\/a><\/p>\n<p align=\"justify\"><strong>Also you can click  here to download the sample source code, it is built in VS2005.<\/strong><\/p>\n<p align=\"justify\"><strong>Configuring Access  point information in Cellcore (CellTsp)<\/strong><\/p>\n<p align=\"justify\">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 <a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ee498094.aspx\">CELLDEVCONFIG<\/a> for celltsp and it has some sub structure to configure various radio parameters  including configuring the access point. &nbsp;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().<\/p>\n<p><a href=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img5.jpg\" target=\"_blank\" title=\"Click to Open in New Tab\" rel=\"noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img5.jpg\" alt=\"APN RAS\" width=\"580\" height=\"170\" border=\"0\" \/><\/a><\/p>\n<p align=\"justify\">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 &ldquo;Cellular  TAPI service Provider&rdquo; instead of &ldquo;UNIMODEM&rdquo; 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.<\/p>\n<p><a href=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img6.jpg\" target=\"_blank\" title=\"Click to Open in New Tab\" rel=\"noopener\"><img decoding=\"async\" loading=\"lazy\" src=\"https:\/\/www.e-consystems.com\/images\/blog\/apn-ras\/APN-RAS-img6.jpg\" alt=\"APN RAS\" width=\"580\" height=\"192\" border=\"0\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>RAS book can be created in two ways in windows CE either through Dial up&#8230;<\/p>\n","protected":false},"author":12,"featured_media":1388,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[190,192],"tags":[122,119,120,118,121,123,105,99,132],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/posts\/846"}],"collection":[{"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/users\/12"}],"replies":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/comments?post=846"}],"version-history":[{"count":29,"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/posts\/846\/revisions"}],"predecessor-version":[{"id":2035,"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/posts\/846\/revisions\/2035"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/media\/1388"}],"wp:attachment":[{"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/media?parent=846"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/categories?post=846"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.e-consystems.com\/blog\/windowsce\/wp-json\/wp\/v2\/tags?post=846"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}