The wince application was started two years ago. However, due to division of labor, there has never been a chance to gain a deep understanding of the development of the wince Driver (including Pb-related system customization ). If it weren't for the fakegps development work that was scheduled by Ma Ning some time ago, I really don't know when to understand the wince driver development.
Fakegps is a disguised GPS. That is to say, a serial port opened does not actually connect to a GPS device, however, related applications can obtain GPS location information from the serial port (of course, this information is forged ).
My initial thought was to create two serial port drivers. One serial port is the serial port used by the GPS application, and the other serial port is used to establish a soft channel with the serial port, send GPS-related positioning information to the serial port through a dedicated application, and the GPS serial port can receive the data. Later, at the prompt of MA Ning, I still felt that it was better to use the shared memory to exchange data. Therefore, the final solution was to use the shared memory method.
Based on my personal experience, it is not difficult to write a specific driver as long as you have the C language skills. However, it is not a short time to know where the driver is to be written and what parameters need to be set. Fortunately, I have read the blog of Tang Mian, which makes it easy. For more information, see http://blog.csdn.net/nanjianhui/archive/2008/07/18/2674753.aspx.
The following describes how to develop this driver:
1. Write the driver code (fakegps. c)
Because I have integrated the driver into the simulator, the path for storing the source code is under the./wince600/platform directory. The specific path is as follows:
The driver code (Standard streaming driver) is described in detail when introducing the specific implementation of fakegps.
After writing the driver-related code, right-click the options of the project and select the build option to compile the program as a DLL file (for example ).
Note: When creating fakegps in the/wince600/platform/deviceemulator/src/DRIVERS directory, be sure to modify the dirs file in the directory and add "fakegps/" at the end /"
2. Def File
File Name: fakegps. Def (same directory as fakegps. c)
Library fakegps
Exports com_init
Com_deinit
Com_open
Com_close
Com_read
Com_write
Com_seek
Com_iocontrol
Com_powerdown
Com_powerup
3. makefile
The following sentence
! Include $ (_ makeenvroot)/makefile. Def
4. Sources File
The content is as follows:
Targetname = fakegps
Targettype = dynlink
Releasetype = Platform
Targetlibs = $ (_ commonsdkroot)/lib/$ (_ cpuindpath)/coredll. Lib
Deffile = fakegps. Def
Preprocessdeffile = 1
Dllentry = dllentry
Supported des =.../INC
Sources = fakegps. c
5. Modify the platform. reg file (Registry options)
The platform. reg file is in the/wince600/platform/deviceemulator/Files directory.
Open the file and add the following content:
[HKEY_LOCAL_MACHINE/Drivers/builtin/fakegps]
"Prefix" = "com"
"DLL" = "fakegps. dll"
"Index" = DWORD: 8
"Order" = DWORD: 0
"Friendlyname" = "yefan fakegps"
6. Modify the platform. bib file (integrate the DLL file into NK)
The platform. bib file is in the/wince600/platform/deviceemulator/Files directory.
Open the file and add the following content:
Fakegps. dll $ (_ flatreleasedir)/fakegps. dll NK Shk
7. Modify the deviceemulator. pbcxml File
The deviceemulator. pbcxml file is in the/wince600/platform/deviceemulator/CATALOG directory.
Add the following sentence to <BSP> </BSP>:
<Bspitemid> item: YF: fakegps: deviceemulator </bspitemid>
Add the following content to <catalogfile> </catalogfile>:
<Item id = "item: YF: fakegps: deviceemulator">
<Title> fakegps </title>
<Description> fakegps driver </description>
<Type> bspspecific </type>
<Location> # MS: deviceemulator: devicedrivers: Location </location>
<Sourcecode> <title >$ (_ winceroot)/platform/deviceemulator/src/Drivers/fakegps </title> <path >$ (_ winceroot) /platform/deviceemulator/src/Drivers/fakegps </path>
</Sourcecode>
</Item>
Note: Do not use the vs2005 integrated environment to edit the pbcxml file. I just used this environment to break up the pbcxml file. When creating a new project, the simulator options are gone.
Summary of the final results:
Original address http://blog.csdn.net/yefanqiu/article/details/2762305#reply
Post-reading: This article is from Baidu. This fakegps driver is trying to work on it. It inspired me a lot!