CPIT GP7x/GP6X SDK

Embed Size (px)

Citation preview

  • 7/30/2019 CPIT GP7x/GP6X SDK

    1/25

    Document about SDK

    For CPIT Devices

    Creator: slyzhang/cang.zhang

    DateTime: July 3, 2006

    Module: Samsung2410 solution(GP7X/GP6X)

    Version: R1.6

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    2/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 2 of page 25 2006-7-7

    Content

    History Version Control List................3

    Requeset...............................................4

    Install SDK ..........................................4

    Create a demo application .................10Steps................................................................................................................................10

    Debug with Remote Tool ................................................................................................ 13

    FAQ about user application ...............16Could I use the registry to save the user values? .................................................................... 16Could I package the navigation software to OS? .................................................................... 16

    Could we avoid user to copy files using USB connector? ...................................................... 17

    FAQ about SDK.................................17How to control the backlight...................................................................................................17

    How to get the battery life.......................................................................................................18

    How to control the volume......................................................................................................18

    How to control the stylus ........................................................................................................ 18

    How to Get the GUID of device ............................................................................................. 19

    How to get the Memory size...................................................................................................19

    How to get the OS version...................................................................................................... 19

    how to control the GPS com port............................................................................................19

    How to Enter the Suspend mode.............................................................................................20

    How to use the MUI feature....................................................................................................20

    How many languages are supported ....................................................................................... 20

    How to launch external executable file...................................................................................20

    How to Test the GPS signal with our device........................................................................... 21

    How to control the Key Board................................................................................................ 21

    About the Win32 API: CreateFileForMapping ....................................................................... 21

    How to Upgrade the OS..........................................................................................................22

    How to change the second startup logo...................................................................................22

    Support...............................................25

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    3/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 3 of page 25 2006-7-7

    History Version Control List

    Version Content Creator DataTime

    R1.0 sly zhang/cang.zhang June 1, 2006

    R1.1 add auto launch file sly zhang June 5,2006

    R1.2 add the dependence of some API sly z hang June 15, 2006

    R1.3 add the detail of the Upgrade System slyzhang June 29, 2006

    R1.4 found a bug about get the OEM info slyzhang July 3, 2006

    R1.5 and how to change the second logo slyzhang July 4, 2006

    R1.6 Add FAQ about application slyzhang July 7, 2006

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    4/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 4 of page 25 2006-7-7

    Requeset

    OS: Windows2000/windowsXP

    Develop platform: EVC4.0+SP4 or other tools

    ActiveSync: Microsoft ActiveSync 3.7 or later, 3.8 is tested and

    recommended.

    USB interface: you have USB cable and had installed the USB driver for

    PC, not the driver for OS upgrading.

    Install SDK

    Please read the USB driver and ActiveSync installing guide if you did not

    installed those software. You could get it from support page of website:

    http://www.cpit.com.hk

    After you install the USB driver and the Microsoft ActiveSync software,

    you should install the SDK package. Following is the step-to-step:

    1. Download the *.msi(for example:gp-75_SDK.msi) file from supportpage of website:

    http://www.cpit.com.hk

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    5/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 5 of page 25 2006-7-7

    2. Double click or open the file you had downloaded.

    3. Press the Next to continue.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    6/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 6 of page 25 2006-7-7

    4. Accept the license

    5. Input the user name and the Organization.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    7/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 7 of page 25 2006-7-7

    6. You could select the Custom or Complete to install , here I selected theCustom.

    7. select the Location you will to install.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    8/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 8 of page 25 2006-7-7

    8. Press the Install to start coping the files.

    9. and click the Finish to complete.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    9/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 9 of page 25 2006-7-7

    10.You could see the GP75 item at the Install/Remove program controlpanel.

    It is the same operate if you use the old version SDK file, perhaps the sdk

    file name is XXXB.msi on your hand. Dont worry about it its the

    same.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    10/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 10 of page 25 2006-7-7

    Create a demo application

    Steps

    Now, Create a demo application to test this SDK . The test Platform is

    Embedded Visual C++ 4.0. Open the EVC4.0 and create a new

    application as follow.

    Select the Win32 [WCE ARMV4] option.

    Here we will create a Dialog based demo application.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    11/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 11 of page 25 2006-7-7

    You must select the XXXB or XXXB-STANDARD option at the target

    device type list , the last option is XXXB Device like following picture.

    You must connect the USB cable with your PC If want to debug your

    application. After you installed the USB driver and Microsoft ActiveSync,

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    12/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 12 of page 25 2006-7-7

    normally you could see the folders and files of the device.

    Now build and run your application. Maybe following picture are

    appeared, dont worry about it, you only need to click OK(YES) to

    Continue .

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    13/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 13 of page 25 2006-7-7

    You could see your application appeared.

    Debug with Remote Tool

    After you entered the Windows CE desktop, insert the USB into socket

    your PC will auto detect the USB insert event, press the menu tools of

    EVC 4.0, and click the submenu Remote registry Editor.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    14/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 14 of page 25 2006-7-7

    And then click the first button of the tool bar. You could see follow

    remote devices:

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    15/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 15 of page 25 2006-7-7

    Select the GP75_SDK or XXXB option.

    After some files copied to target device, the remote registry will be

    showed.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    16/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 16 of page 25 2006-7-7

    If you could not use the remote debug tools, please check your PC

    windows version, maybe the Windows2003 and ActiveSync4.0 version

    (Chinese version) could not connect correctly. The windowsXP+SP2 and

    ActiveSync3.8 is recommended.

    If you could not connect and copy system file to the target, please connect

    us, and re-upgrade your kernel file. Upgrading the kernel file, please read

    the detail about How to upgrading the Kernel file.

    FAQ about user application

    Could I use the registry to save the user values?

    Our device did not support the Hive-based of registry, so you could not save some values into the

    registry, if you do that, those values will lost after device power off or system reset. You could

    save some values into external storage, such as SD card or internal flash space. If you found a

    folder of IPSM, you could save value on it, its a internal flash.

    Could I package the navigation software to OS?

    You can not package the navigation software into OS, it is have to done by us, not you side. Please

    connect with us if you want to do.

    Its not recommended to package the navigation software to OS, because it cost many and many

    SDRAM and affect the performance of kernel, its recommended to save the navigation software

    to external storage, if you want to protect your navigation, its a good idea to package the

    navigation engineer into OS kernel file. But if you want to upgrade the navigation engine, its

    recommended that you could use the GUID of device by using KernelIOControl().

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    17/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 17 of page 25 2006-7-7

    Could we avoid user to copy files using USB

    connector?

    We could not avoid user to copy files using USB connector, because we want user to upgrade the

    navigation map data by USB connector.

    FAQ about SDK

    How to control the backlight

    Registry key and value

    ;=========== Default backlight Setting ===============

    [HKEY_CURRENT_USER\ControlPanel\Backlight]

    "ACBacklightOnTap"=dword:1

    "BacklightOnTap"=dword:1

    "BatteryTimeout"=dword:0

    "ACTimeout"=dword:0

    "UseExt"=dword:0

    "UseBattery"=dword:0"OnOffAC"=dword:00000000 // 1:Enable the AC plug event 0 :ignore this event

    "ACBrightNess"=dword:00000064 //the default backlight when you insert the AC when

    //OnOffAC value is dword:1

    "BrightNess"=dword:00000032 //the default backlight when you plug out the AC

    //when OnOffAC value is dword:1

    Event

    BackLightChangeEvent

    Example:

    static const TCHAR szevtBacklightChange[] = TEXT("BackLightChangeEvent");

    //user change the BackLight

    HANDLE hBacklightEvent= CreateEvent(NULL,FALSE,FALSE,szevtBacklightChange);

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    18/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 18 of page 25 2006-7-7

    How to get the battery life

    Using the Win32 API :

    GetSystemPowerStatusEx

    The device should auto detect the system battery life , in order to have a

    steady system ,we will set the system level as following:

    Battery Voltage x> 3.8 BATTERY_FLAG_HIGH 50%

    3.8>x>3.6 BATTERY_FLAG_LOW 10%3.3>x>3.6 BATTERY_FLAG_CRITICAL

  • 7/30/2019 CPIT GP7x/GP6X SDK

    19/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 19 of page 25 2006-7-7

    TouchCalibrate();

    How to Get the GUID of device

    1.Define

    #define IOCTL_HAL_GET_DEVICE_INFO CTL_CODE(FILE_DEVICE_HAL, 1,

    METHOD_BUFFERED, FILE_ANY_ACCESS)

    #define IOCTL_HAL_GET_DEVICEID CTL_CODE(FILE_DEVICE_HAL, 21,

    METHOD_BUFFERED, FILE_ANY_ACCESS)

    2.Call the function

    KernelIoControl(IOCTL_HAL_GET_DEVICEID,OutBuf,1024,OutBuf,1024,&dwRe

    turn))To get the OEM information or GUID info.

    The dwReturn may return 0 because of there has a bug. It is fixed after version 2.0623

    How to get the Memory size

    Normally, use the Win32 API of the librarycoredll.dll

    GetSystemMemoryDivisionGlobalMemoryStatus

    How to get the OS version

    Version information is saved at registry:

    [HKEY_LOCAL_MACHINE\SOFTWARE\Version]

    "OS Version"=" OS Version:2.0604 "

    "HW Version" = " R6.0 "

    how to control the GPS com port

    COM Port configuration:

    Port: COM1

    ByteBits : 8

    StopBits: 1

    StartBits: 1

    Parity; None

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    20/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 20 of page 25 2006-7-7

    BaudRate: 9600

    How to Enter the Suspend mode

    Use one of the following Win32 APIs of the library coredll.dll

    SetSystemPowerState()

    PowerOffSystem()

    This feature is supported after kernel version 2.60601partage is supported at before version.

    How to use the MUI feature

    MUI component is packaged into kernel, any other language will be changed freely using the

    Microsofts MUI component. Please send me your idea if you have some. Your idea maybe will

    accelerate our mass product.

    How many languages are supported

    All European main characters and code pages are added. They are Latin, Greece, Baltic sea,

    turkey, Portugal, Iceland , Norwegian, Russian, mid-Europe and the Aria font as the system default

    font .

    The Chinese version do not have MUI component and other language code page.

    How to launch external executable file

    Normally , the Shell will auto run the Main UI file cpithello.exe. This UI has two methods to

    launch the navigation software on the SD card. The one UI has three ICON buttons, our

    end-customer press the navigation ICON button to launch the navigation system or see the GPS

    signal, the other is directly search the navigation software. You can select any one of them.

    Its recommend to save an autorun.inf file to the root of SD card. The content is like following:

    autorun=\Storage Card\MobileNavigation.exe

    the other path is packaged into the kernel file, the following registry key will be auto searched

    after search file \\Storage Card\\autorun.inf

    [HKEY_LOCAL_MACHINE\SOFTWARE\autorun]

    "AutorunFir"="\\Storage Card\\NaviOne\\NaviOne.exe"

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    21/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 21 of page 25 2006-7-7

    "AutorunSed"="\\Storage Card\\startup\\smartguider.exe"

    This way is only for a mass products.

    You must connect with me if you want to launch other application. You must confirm whether you

    OS has those functions.

    How to Test the GPS signal with our device

    We packaged a simple demo application (GPSTest.exe) for test the device, you could find it in

    the \windows, normally , it has the Hide/System attribute.

    You could download the same test software from our website.

    If you use the other test software, you could launch it with up option detail How to launch

    external executable file.

    How to control the Key Board

    Normally, we do not use any key board event for GP7X device because the GP75 module has no

    keyboard.

    But the GP6X modules has 4 key buttons, one is Power ON/OFF, one is for suspend (because of

    customer do not want the suspend/awake feature, we changed it and use it as wake up the Main

    Menu), other two are for volume control.The power on/off button did not have any virtual key value, its depend on the hardware.

    The suspend button has a mapped key value: VK_LEFT.

    The volume control key values are VK_DOWN, VK_UP.

    You could use those keys as any purpose, you only need to RegisterHotKey before use them

    and UnregisterHotKey when you do not use them.

    About the Win32 API: CreateFileForMapping

    Some company use this API to get more RAM for navigation applications. But I known it s

    depended with the OS features, such as the below registry key value.

    ;;;;;;;;;;;; Maybe Some GPS Navigation company do not use this item.

    ;[HKEY_LOCAL_MACHINE\System\StorageManager\FATFS]

    ;"Paging"=dword:0

    So, you must confirm your whether your current OS support it. If not ,please check the OS History

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    22/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 22 of page 25 2006-7-7

    List at our side or check the Remote Registry value with the EVC4.0 or Platform Builder Remote

    tools.

    How to Upgrade the OS

    The OS support upgrading the OS and kernel file on the user interface screen. And there are three

    ways to upgrade the OS and the Logo. The one is ask the upgrade kernel tools from the company

    which made the hardware. Please ask the documents from the original company. The other way is

    that upgrading the OS on the user interface screen. Please read the user guide of the device.

    Normally, its on the system option configuration screen. The last is use the API of the OS

    supported.

    You could use the following library (update.dll) and all the function

    //This functionn will update the OS ,

    // pOSBuffer is the update data from user

    //the length is dwBufferSize, length is limited from 1MB to 32MB

    //Return TRUE indicate the success

    //dwUpdateType : 0:OS

    BOOL UPD_Update(DWORD dwUpdateType, DWORD pOSbuffer,DWORD dwBufferSize)

    The length is limited as following:

    Update type description length limited

    0 update OS Max length is 32MB and Min size is 6MB

    1 No support

    2 not support now

    3 not support now

    If you upgrade the wrong file size, you will get a FALSE return value and you could useGetLastError() get the reason, normally, you will get a ERROR_BAD_LENGTH (Error Code: 24)

    or the ERROR_INVALID_PARAMETER when you input a wrong update type.

    Note: This feature is supported after OS version 2.062201.

    How to change the second startup logo

    Please read the Note at the end of this section.

    There are two startup logos, one is the first logo after power on or reset the device, the other is thethird screen after the screen which showed the message If you could not receive the GPS signal,

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    23/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 23 of page 25 2006-7-7

    please use the external antenna. You could follow the steps to change it.

    1. You must install the USB driver for PC firstly. You could read the USB driver install guider.2. You must install the Microsoft ActiveSync software for files synchronization.3. Power on the device and connect USB cable with your PC after main screen appeared, and

    then ActiveSync will auto connect to device and at the same time you could see the files in the

    ActiveSync explorer. Then, copy the GPS test software (normally you got it from CPIT, and

    its name normal is GPSreciever_test.exe or something else) to the SD card(its the folder

    Storage card in the ActiveSync explorer). File Microsoft ActiveSync and USB driver

    install Guide.pdf will give you some help. After you connected with PC, you could see the

    files and folders in the device, if you found the IPSM folder, you could skip the step 4,5 and

    directly do the step 6.

    4. Rename your original navigation software name, normally rename Alturion gps.exe to somename else, and then rename the GPS test software(GPSReciever_test.exe) to Alturion

    GPS.exe to make the kernel could execute the test application. This file will be executed

    automatically. (Insert SD card and reboot the device if you do it using SD card reader.)

    5. Click the menu TEST and select the submenu STORAGE MEMORY, to format the internalflash, this internal flash will save your logo which you want to show. After you click this

    submenu , test software will ask you whether you want to format the follow storage memory

    and at the same time it will show the device name and storage name like FlashDr and Flash

    Disk, select YES to format the internal flash. And you could find the folder IPSM in the

    ActiveSync explorer.

    6. Copy your logo to the IPSM folder and rename it as logo.bmp and reboot/reset device youwill see the new second logo appeared.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    24/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 24 of page 25 2006-7-7

    Note:

    l not all of versions OS support this feature, its depend which one you use.l Normally you could seccuss after you format the flash storage. If you have a failure

    message, please check whether the folder IPSM exists.

    l If you want to change the second logo but your current OS did not support this feature,please connect us.

    l This feature is only for special customer. And you must check whether your kernelsupported it

    l If you found your device entering the RGB three color screen after you format the internalflash, please upgrade a old OS using DNW.exe. this is only because a few version OS will

    format all data(including the image space) on the internal flash. Dont worry about it, only

    need to upgrade again. And use a other OS is recommended.

    PDF "pdfFactory Pro" www.fineprint.cn

    http://www.fineprint.cn/http://www.fineprint.cn/
  • 7/30/2019 CPIT GP7x/GP6X SDK

    25/25

    CPIT DOCUMENT OF SOFTWARE DEVELOPMENT

    Createor : Sly Zhang(Cang.zhang) page 25 of page 25 2006-7-7

    Okay, good luck . please connect to sly.zhang (cang.zhang) if you have

    other troubles.

    Creator: slyzhang (Cang.zhang)

    Support

    Company: CPIT ( Central Pacific Electronics(ShenZhen)Ltd.)

    Website: http://www.cpit.com.hk

    http://www.cpit.com

    Email: [email protected]

    [email protected]

    [email protected]

    PostCode: 518057

    Address : Shen Jian building

    Shenzhen Hi Tech science Pard

    Ma Que Ling industrial Estate

    Nanshan Shenzhen

    CHINA