Windows CE Dialing Internet (reproduced)

xiaoxiao2021-03-06  111

Please don't check the overall category (what is your article with news, music, film and television ?!), waste everyone's resources. This time I helped you change, and I will delete it directly next time. --administrator

Windows CE dial-up Internet Author: Fu Linlin currently most Windows CE-based products have Internet access, can connect to the Internet to achieve the basic functions of web browsing, e-mail and so on. To achieve more features depends on the speed of the Internet, the speed depends on the way the Internet is connected. Divided into both Internet: Wired and wireless. In fact, most products still use wireless Internet access. Windows Mobile's Pocket PC and Smart Phone can easily implement Internet access. Software developers of these two products can do not have to consider how to achieve dial-up Internet. For products that use custom Windows CE kernels, relevant software developers must realize their dial-up Internet. Fortunately, the SDK of Windows CE includes dial-up support to greatly alleviate the work of software developers. The dial-up hardware device can be a stand-alone mobile phone with a built-in modem and a mobile phone with GPRS function, or a mobile phone chip embedded in the motherboard. Specifically, it is not important, because the dial-up network module contained in Windows CE uses a standard AT command set to communicate with the hardware device. Software developers can use the interface function provided by CE to control the entire dialing process until the connection is disconnected. Windows CE.NET provides a service called RAS (Remote Access Service), which can be connected to the remote server via a WAN (wide area network) or VPN (virtual personal network) through the RAS Windows CE-based product. Calling the RAS application usually executes on the client, connects to the remote server via telephone network, which uses two standard remote access protocols: PPP point-to-point protocol and SLIP serial line Internet protocol. The RAS structure is shown in Figure 1. From the figure, it is possible to see the upper layer of the ISO / OSI model. The lower layer TAPI (phone API) calls Unimodeem, unimodem is a universal modem driver, which calls the serial port API to implement communication with the modulation demodulation device. Figure 1 RAS Service Structure Figure 1 The functionality of RAS under Windows CE.NET is similar to the PC, which also supports the phone book, and the dial-up control script. Different from the RAS phone of CE is stored in the registry. These are the secondary functions, which will not be given here. The functions that implement the dial-up must be called as follows:

Function Description Rasdial Creating RAS Connections RaseNuMentries Lists All Dial Records in the Registry Get the current state of the specified remote access connection. RasgeTryDialParams Gets the Connection Data (Parameters) RassetTryDialParams Settings the Specifies Last Success Dial Record Settings The Connection Data (Parameters) RasgeTryProperties Get Dialing Properties RashangeProperties Settings Dial Record Properties Rashangup Termination RAS Connections Based on Windows CE The design can save registry data before power off, and some can't. For products that cannot save registry data, use the phone to dialing. You can only re-enter the dial data each time you start, or save the data to a permanent memory, read the dial data before starting the next dialler. The entire dial-up state is divided into synchronous and asynchronous. The RasDial function is returned when the RasDial function is established or an error occurs if an error cannot be established. The disadvantage of the synchronization mode is that the customer cannot receive the current status and progress information of the connection operation. But there is still a solution, the method is to create a new thread to dial (call rasdial), and create a new thread query the current dial-up status every other time (call RasgetConnectStatus). Compared with the asynchronous mode, it is easy to get the current dial state. In asynchronous mode, the Rasdial function will return immediately, then RasgetConnectStatus can be called to get the current dial state. RasgeTryDialParams and RasgeTryProperties two functions are different from different aspects. Before doing this: CE defines structural RasDialParams for DialPrarms dialing parameters. It includes dial-up names, phone numbers, username, password, domain name, etc. For Properties attribute data, CE defines structural Rasentry. It includes connection options, national code, area code, local telephone number, can specify local IP addresses, remote DNS server IP, remote WINS server IP, etc., you can also specify connection control script file paths, adopted protocols, modem types, and names, etc. . Be sure to set the parameters before dialing, but do not have to set each parameter. The easiest way is to get all the default parameters of the system. The calling code is as follows: DWORD dwreturn; dwreturn = rasgetntryProperties (NULL, L ", & Rasentry, & dwsize, null, null);

IF (dwreturn! = 0)

{

Do not get system dialing parameters

Return;

}

After getting the default parameters of the system, modify it, avoid setting the error parameters, and most of the parameters do not need to be set. So much about dialing Internet, if you have questions or encounter difficulties, you can send me an email. If you have time, I will reply. In addition, about PlatformBuilder, many people send me an email, I hope I can answer their questions about PB. Here I announced to the readers, about the PB and EVC books, I and my colleagues are writing, and it is expected to be completed in September. This book details the use of PB (including drivers) and EVC, and some development instances. PB and drive parts are written by my colleagues, they are very experienced. Writing time: 2004-08-11

转载请注明原文地址:https://www.9cbs.com/read-124638.html

New Post(0)