Top Banner
******************************************************************************* * * * * * TeamPad500G Programmer's Reference Guide * * * * * * * * September 2004 First Edition * ******************************************************************************* All Rights Reserved, Copyright (C) FUJITSU LIMITED 2004 ########################### Table of Contents ############################# 0. Introduction 1. Application Development Environment 1.1 Setting Up Development Environment 1.1.1 eMbedded Visual C++ 4.0 1.1.2 Visual Basic.NET 1.2 Development for Application 1.2.1 eMbedded Visual C++ 4.0 1.2.2 Visual Basic.NET 2. Application Software Installation 2.1 Setup File (CONFIG.HHT) 2.2 Installation Procedure 3. Devices on TeamPad500G 3.1 Storage devices 3.2 Keyboard 3.3 Soft Keyboard 3.4 Integrated Printer 3.5 Serial communication 4. API for Visual C++ 4.1 Power Control 4.1.1 Enable/Disable 'PWR' key 4.1.2 Force A Suspend 4.1.3 Set power ON Mode 4.1.4 Back Light of Screen 4.1.5 Read Battery Status 4.1.6 Enable/Disable The Auto Suspend 4.1.7 Wait For Resume Started 4.1.8 Stop Waiting For Resume Started 4.2 Serial communication 4.2.1 Get COM Port Status 4.2.2 Connect Peripheral To COM Port 4.3 Device Information 4.3.1 Get Unique ID 4.4 USB Configuration 4.4.1 Select USB Adapetor/LAN Adaptor 4.4.2 Enable/Disable USB Device 4.5 initialization file function 4.5.1 Obtaining the integer correlated to a specific key 4.5.2 Obtaining all the keys and values 4.5.3 Obtaining the character string correlated to the key 4.5.4 Replaces the keys and values for the specified section 4.5.5 Copies a string into the specified section 4.6 Trace 4.6.1 Char type String trace log output 4.6.2 TCHAR type String trace log output 5. API for Visual Basic.NET 5.1 Power Control 5.1.1 Enable/Disable 'PWR' key 5.1.2 Force A Suspend 5.1.3 Set power ON Mode
63

Fujitsu Programing

Apr 02, 2015

Download

Documents

Paulo Monteiro
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Fujitsu Programing

*******************************************************************************

* *

* *

* TeamPad500G Programmer's Reference Guide *

* *

* *

* *

* September 2004 First Edition *

*******************************************************************************

All Rights Reserved, Copyright (C) FUJITSU LIMITED 2004

########################### Table of Contents #############################

0. Introduction

1. Application Development Environment

1.1 Setting Up Development Environment

1.1.1 eMbedded Visual C++ 4.0

1.1.2 Visual Basic.NET

1.2 Development for Application

1.2.1 eMbedded Visual C++ 4.0

1.2.2 Visual Basic.NET

2. Application Software Installation

2.1 Setup File (CONFIG.HHT)

2.2 Installation Procedure

3. Devices on TeamPad500G

3.1 Storage devices

3.2 Keyboard

3.3 Soft Keyboard

3.4 Integrated Printer

3.5 Serial communication

4. API for Visual C++

4.1 Power Control

4.1.1 Enable/Disable 'PWR' key

4.1.2 Force A Suspend

4.1.3 Set power ON Mode

4.1.4 Back Light of Screen

4.1.5 Read Battery Status

4.1.6 Enable/Disable The Auto Suspend

4.1.7 Wait For Resume Started

4.1.8 Stop Waiting For Resume Started

4.2 Serial communication

4.2.1 Get COM Port Status

4.2.2 Connect Peripheral To COM Port

4.3 Device Information

4.3.1 Get Unique ID

4.4 USB Configuration

4.4.1 Select USB Adapetor/LAN Adaptor

4.4.2 Enable/Disable USB Device

4.5 initialization file function

4.5.1 Obtaining the integer correlated to a specific key

4.5.2 Obtaining all the keys and values

4.5.3 Obtaining the character string correlated to the key

4.5.4 Replaces the keys and values for the specified section

4.5.5 Copies a string into the specified section

4.6 Trace

4.6.1 Char type String trace log output

4.6.2 TCHAR type String trace log output

5. API for Visual Basic.NET

5.1 Power Control

5.1.1 Enable/Disable 'PWR' key

5.1.2 Force A Suspend

5.1.3 Set power ON Mode

Kirk
Realce
Page 2: Fujitsu Programing

5.1.4 Back Light of Screen

5.1.5 Read Battery Status

5.1.6 Enable/Disable The Auto Suspend

5.1.7 Wait For Resume Started

5.1.8 Stop Waiting For Resume Started

5.2 Serial communication

5.2.1 Get COM Port Status

5.2.2 Connect Peripheral To COM Port

5.3 Device Information

5.3.1 Get Unique ID

5.4 USB Configuration

5.4.1 Select USB Adapetor/LAN Adaptor

5.4.2 Enable/Disable USB Device

5.5 initialization file function

5.5.1 Obtaining the integer correlated to a specific key

5.5.2 Obtaining all the keys and values

5.5.3 Obtaining the character string correlated to the key

5.5.4 Replaces the keys and values for the specified section

5.5.5 Copies a string into the specified section

5.6 Trace

5.6.1 TCHAR type String trace log output

6. Cautions

6.1 Memory Card

6.2 TeamPad-Explorer

6.3 Memory Trouble

6.4 When using the LAN adaptor

6.5 Regading the necessity for regular rebooting the system

###############################################################################

===============================================================================

0. Introduction

===============================================================================

This documentation provides explanation for set-up procedure of Application

environment for TeamPad500G, Application development environment with

Microsoft(R) eMbedded Visual C++ 4.0 and API for TeamPad500G.

Also this documentation describes some information to develop Application

Software Program.

Knowledge of below items is required to fully understand the contents.

Microsoft(R) Windows (R) 2000 Professional

Microsoft(R) Windows (R) 2000 Server

Microsoft(R) Windows (R) XP Professional

Microsoft(R) Windows(R) CE Operating system 4.2 (Windows CE)

Microsoft(R) eMbedded Visual C++ 4.0 (eMbedded Visual C++)

Microsoft(R) Windows(R) CE 4.2 Standard SDK (Standard SDK)

Microsoft(R) ActiveSync(R) Version 3.7 (ActiveSync)

* Tips on Viewing This Document

Use a text editor to view this document. This document has been formatted

for a line length of 80 characters. If characters appear to be out of

place, change the layout, format, or other settings to improve the display

of the document.

* Rule of notation *

Below table describe a rule of notation on this documentation.

----------------+-------------------------------------------------------

Mark | Meaning

----------------+-------------------------------------------------------

| Possible to omit the content of [ ]

[ ]m | m is expressed as possible for repetition

|

| e.g. [variable name] means to be able to omit

| variable name.

----------------+-------------------------------------------------------

Page 3: Fujitsu Programing

Microsoft, Windows, Windows XP, and Visual C++ are registered trademarks

of Microsoft Corporation in the United States and other countries.

Other company names and product names in this document are trademarks or

registered trademarks of their respective owners.

===============================================================================

1. Application Development Environment

===============================================================================

------------------------------------------------------------------------------

1.1 Setting Up Development Environment

------------------------------------------------------------------------------

1.1.1 eMbedded Visual C++ 4.0

------------------------------------------------------------------------------

Microsoft•fs "eMbedded Visual C++ 4.0" development product must be used to

develop code for the TeamPad500G, to which the Fujitsu TeamPad SDK must be

added.

The "eMbedded Visual C++ 4.0" tools cannot be loaded onto the same disk

partition as "eMbedded Visual Tools 3.0" .

At the writing of this document the "eMbedded Visual C++ 4.0" product could

be downloaded free from Microsoft, or a CD obtained by paying the shipping and

handling charge.

The "eMbedded Visual C++ 4.0" product could (at the writing of this document)

be ordered or downloaded from the following Microsoft•fs web site:

http://www.microsoft.com/downloads/release.asp?ReleaseID=37662&area=search&ordinal=3

The Service Pack 2(SP2) or the Service Pack 3(SP3) must be added to "eMbedded

Visual C++ 4.0" .

The service pack 2(SP2) can be found at:

http://microsoft.com/downloads/details.aspx?FamilyId=CE7F1AAA-54EB-4989-812B-

7F955605DCB8&displaylang=en

The Service Pack 3(SP3) can be found at:

http://www.microsoft.com/downloads/details.aspx?familyid=5bb36f3e-5b3d-419a-9610-

2fe53815ae3b&displaylang=en

The standard SDK for for Microsoft Windows CE 4.2 also can be added to

"eMbedded Visual C++ 4.0" if nessesary, and the standard SDK can be found at:

http://www.microsoft.com/downloads/details.aspx?FamilyID=a08f6991-16b0-4019-a174-

0c40e6d25fe7&DisplayLang=en

The comments in this section referencing the loading of Microsoft products

are meant as hints to be used when following the Microsoft instructions.

Knowledge on how to install and use the Microsoft products is outside the

scope of this document.

The following Microsoft products are required to develop for the TeamPad500G,

along with the knowledge on how to use them:

1. Microsoft(R) Windows 2000 (SP2) or Windows XP on the development PC.

2. Microsoft(R) Windows(R) CE.NET 4.2 Operating system (Provided in the

TeamPad500G)

3. Microsoft(R) eMbedded Visual C++ 4.0 (SP2 or SP3) on the development PC.

4. Standard SDK for Microsoft(R) Windows CE 4.2 (If necessary)

5. TeamPad SDK

1) Installation of eMbedded Visual C++ 4.0

------------------------------------------

Page 4: Fujitsu Programing

a. Before you start, make sure you have write access to the Registry.

You may need to be logged in as administrator to run the install.

b. Place the "Microsoft eMbedded Visual C++ 4.0" CD into the CD drive.

The install program will start automatically.

c. The install program will ask what components you wish to install.

Make sure only "eMbedded Visual C++ 4.0" is checked.

d. When prompted for permission to install "Windows CE Platform Manager" ,

respond "YES" .

e. The install program will ask what components you wish to install.

Make sure both "eMbedded Visual C++ 4.0" and "Common Components" are

selected.

f. Add "eMbedded Visual C++ 4.0 SP2" or "eMbedded Visual C++ 4.0 SP3".

g. Install "Standard SDK" for Windows CE 4.2.

Respond with "Complete" during the Standard SDK installation when asked

"Complete" or "Custom" install.

h. Install ActiveSync 3.7. This software is needed to ship software to the

TeamPad500G from your PC via a cable and/or for remote debugging.

2) Installation of TeamPad SDK

------------------------------

TeamPad_EN_SDK.MSI : For English Language

a. Execute the install program "TEAMPAD_EN_SDK.MSI" in the provided CD.

b. Accept the license agreement.

c. Select a "Complete" install versus a "Custom" install.

1.1.2 Visual Basic.NET

------------------------------------------------------------------------------

The following Microsoft products are required to develop for the TeamPad500G,

along with the knowledge on how to use them:

1. Microsoft(R) Windows 2000 (SP2) or Windows XP on the development PC.

2. Microsoft(R) Windows(R) CE.NET 4.2 Operating system (Provided in the

TeamPad500G)

3. Microsoft(R) Visual Studio.NET 2003 on development PC.

4. Standard SDK for Microsoft(R) Windows CE 4.2 (If necessary)

5. TeamPad SDK

1) Installation of Visual Studio.NET 2003

------------------------------------------

a. Before you start, make sure you have write access to the Registry.

You may need to be logged in as administrator to run the install.

b. Place the "Visual Studio.NET 2003" CD into the CD drive.

The install program will start automatically.

c. Install "Standard SDK" for Windows CE 4.2.

Respond with "Complete" during the Standard SDK installation when asked

"Complete" or "Custom" install.

d. Install ActiveSync 3.7. This software is needed to ship software to the

TeamPad500G from your PC via a cable and/or for remote debugging.

2) Installation of TeamPad SDK

------------------------------

TeamPad_EN_SDK.MSI : For English Language

Page 5: Fujitsu Programing

a. Execute the install program "TEAMPAD_EN_SDK.MSI" in the provided CD.

b. Accept the license agreement.

c. Select a "Complete" install versus a "Custom" install.

-------------------------------------------------------------------------------

1.2 Development for Application

-------------------------------------------------------------------------------

1.2.1 eMbedded Visual C++ 4.0

------------------------------------------------------------------------------

Application Software by using eMbedded Visual C++ 4.0 for the TeamPad500G

will be developed with the following sequence.

a. Making Project

Start eMbedded Visual C++ 4.0 and create a new project.

Then designate the project "WCE Application" or "WCE MFC AppWizard(EXE)"

and select "Win32(WCE ARMV4I)" as CPU type.

(*) If you implement emulation, select "Win32(WCE emulation)".

b. Coding for Application Software

The method is just similar with standard VC++.

(*) However eMbedded Visual C++ 4.0 has some restrictions differently

from Visual C++ 6.0 for Windows.

Please refer Help file attached with eMbedded Visual C++ 4.0 in detail.

d. Build (Compile)

Select the following configuration.

In case of executing on TeamPad500G

Select "TEAMPAD_EN" on "Select Active WCE Configuration"

Select "Win32 (WCE ARMV4I) Release" on "Select Active Configuration"

Select "TEAMPAD_EN Device" on "Select Default Device"

In case of emulation on development PC

Select "TEAMPAD_EN" on "Select Active WCE Configuration"

Select "Win32 (WCE emulator) Release"

or "Win32 (WCE emulator) Debug" on "Select Active Configuration"

Select "TEAMPAD_EN Emulator" on "Select Default Device"

After the coding is completed, build (compile) and create the XXXXXX.EXE

file.

(*) XXXXXX is a name of the project which you made.

e. Emulation

The emulation function is supported on Windows 2000/XP for the application

development. The part other than the I/O control can be tested on PC.

1.2.2 Visual Basic.NET

------------------------------------------------------------------------------

Application Software by using Visula Basic.NET for the TeamPad500G will

be developed with the following sequence.

a. Making Project

Start Visual Studio.NET and create a new project.

Then designate "Visual Basic Project" as project type, and select

Page 6: Fujitsu Programing

"Smart Device Application" in template box on new project window.

Next, in "Smart Device Application Wizard", select "Windows CE" as

target platform and select "Windows Application" as project type.

b. Coding for Application Software

The method is just similar with standard Visual Basic.

(*) However Visual Basic.NET for WindowsCE.NET has some restrictions

differently from Visual Basic.NET for Windows.

Please refer Help file attached with Visual Studio.NET 2003 in detail.

b. Build (Compile)

Select the following configuration.

In case of executing on TeamPad500G

Solution configurations : Release

Deployment Device : Windows CE.NET Device

In case of emulation on development PC

Solution configurations : Release or Debug

Deployment Device : TEAMPAD_EN - SDK emulator

After the coding is completed, build (compile) and create the XXXXXX.EXE

file.

(*) XXXXXX is a name of the project which you made.

e. Emulation

The emulation function is supported on Windows 2000/XP for the application

development. The part other than the I/O control can be tested on PC.

===============================================================================

2. Application Software Installation

===============================================================================

This section describes some notifications when application software is

installed.

The TeamPad500G supports 4 type of installation method.

- Storage Card (Compact Flash disk card or PCMCIA card).

- ActiveSync via USB CIU (Cradle)

- Downloader via RS232C CIU or USB CIU (Cradle)

- Ethernet via LAN Adaptor (Cradle)

-------------------------------------------------------------------------------

2.1 Setup File (CONFIG.HHT)

-------------------------------------------------------------------------------

The setup file (CONFIG.HHT) must be made to install application program

in TeamPad500G.

The setup file could be edited by any kind of text editor (e.g. Notepad).

1) Erasing folders before installation

----------------------------------------------------------------------------

a. Function

Before installing from Storage Card, initialization of the specific

folder in TeamPad500G can be possible.

b. Format

+-------------------------------------------------------------------------+

| [Initialize] |

Page 7: Fujitsu Programing

| DirectoryName=Destination_Folder[,Destination_Folder]m |

| END |

+-------------------------------------------------------------------------+

- Specify this section only when you need to initialize specific folders.

- This function is supported in case of installing from Storage Card. This

function is invalid when the program loader or ActiveSync is used.

- In the case of more than one folder initialization, add ","and specify

folder name.

- Example for removing all the files in \Storage Card1\Temp

[Initialize]

DirectoryName="\Storage Card1\Temp"

END

*=== CAUTION ==============================================================*

| - Do not designate the \Windows folder as initialization target. |

*==========================================================================*

2) Designate location where to install from/to

----------------------------------------------------------------------------

a. Function

This section designates the location where the files to be installed.

b. Format

+-------------------------------------------------------------------------+

| [Install File] |

| Source_Filename=Destination_Filename |

| END |

+-------------------------------------------------------------------------+

- You have to designate the full path names for both source and

destination.

- Do not put the blank (space) before and after the "=" sign.

- When you use Wild Card *.* for installing, all the files under the folder

is copied to designated location. Then you have to designate the both

filename as *.*.

- Describe END only after [Install File] section when it runs a program on

the Memory Card.

- The name of Compact Flash card slots are "Storage Card1" and "Storage

Card2".

- Example for copying all files in \Storage Card1\HhtApl\ folder to

\HhtApl folder in TeamPad500G

[Install File]

"\Storage Card1\HhtApl\*.*"=\HhtApl\*.*

END

*=== CAUTION ==============================================================*

| - In case of designating of existing folder such like Windows, you must |

| not install with *.*. If done, files back-up function will not be |

| available. Because the BackUp function will use the destination |

| statement as the source and will fail when it tries to read the |

| EXECUTE only system files. |

*==========================================================================*

3) Defining the auto startup program

----------------------------------------------------------------------------

a. Function

This section designates the application program to execute automatically

when TeamPad500G is booted.

b. Format

+-------------------------------------------------------------------------+

| [StartUp] |

| FileName=Startup_Filename [parameter] |

Page 8: Fujitsu Programing

| END |

+-------------------------------------------------------------------------+

- Ensure that Startup_Filename includes the full path name.

- In case that you use Startup file including space in the folder name or

the parameter, you have to enclose the startup file or the parameter

with "".

- Example for designating \Hht Apl\HhtApl.exe as startup file

[StartUp]

FileName="\Hht Apl\HhtApl.exe"

END

*=== CAUTION ==============================================================*

| - The startup section is mandatory. So if you do not wish to start an |

| application automatically, include the [StartUp] and END statements. |

| If this section does not exist, the install process will be aborted. |

| - Only one Startup program can be specified. If many programs need to |

| be executed, the one startup program needs to execute other programs. |

*==========================================================================*

4) Install a CAB File

----------------------------------------------------------------------------

a. Function

This section designates the CAB file to extract when the application is

installed.

b. Format

+-------------------------------------------------------------------------+

| [WceLoad] |

| CabFile=CAB_Filename |

| END |

+-------------------------------------------------------------------------+

- Ensure that CAB_Filename is with full path name where the file is

installed.

- In case that you use CAB file including space in the path name or

file name, you have to enclose the parameter with "".

- Example for designating \WinCeApp\WinCeApp.Cab as CAB file

[WceLoad]

CabFile=\WinCeApp\WinCeApp.Cab

END

*=== CAUTION ==============================================================*

| - Only one CAB file can be specified to extract. |

*==========================================================================*

5) Registering DLL's

----------------------------------------------------------------------------

a. Function

This section designates Class ID to register the registry.

b. Format

+-------------------------------------------------------------------------+

| [RegSvrCE] |

| CESelfRegister=Filename_to_Register[,Filename_to_Register]m |

| END |

+-------------------------------------------------------------------------+

- When a path is omitted, the \Windows folder is referred to.

- Example for registering registry

[RegSvrCE]

CESelfRegister=\HhtApl\HhtApl.dll,HhtApl.ocx

END

Page 9: Fujitsu Programing

6) Define control panel settings

----------------------------------------------------------------------------

a. Function

This section provides a method of the configuration of control panel

settings, when installing the application software.

b. Format

+-------------------------------------------------------------------------+

| [Control Panel] |

| TaskBar=W/Wo displaying of Task Bar |

| TeampadInf=W/Wo displaying of Battery/Sound volume screen |

| ScrKey=W/Wo displaying of Screen Keyboard |

| BattPowerOff=Time period for auto-power OFF with battery operation |

| ExtPowerOff=Time period for auto-power OFF with AC Outlet operation |

| BattBackLightOff=Time period for auto-backlight-off with battery |

| operation |

| ExtBackLightOff=Time period for auto-backlight-off with AC Outlet |

| operation |

| DeviceName=Device name for communication |

| Volume=Speaker Volume |

| MemorySize=Size of RAM ObjectStore |

| AutoRestore=Automatic restoring function when memory contents is lost |

| ClearType=Clear Type Font |

| MyComputerIcon=W/Wo displaying of MyComputer icon on desktop |

| USBMode=LAN Adaptor(FHTUL411) Setting |

| END |

+-------------------------------------------------------------------------+

The below items show Control Panel Information to be able to set with

Installing.

- W/Wo displaying of Task Bar (Default:disable)

(0:disable 1:enable)

- W/Wo displaying of Battery/Sound volume screen (Default:enable)

(0:disable 1:enable)

- W/Wo displaying of Screen Keyboard (Default:enable)

(0:disable 1:enable)

- Time period for auto-power OFF with battery operation (Default:180sec)

(Value:Sec 0sec means disable)

- Time period for auto-power OFF with AC Outlet operation (Default:0sec

(disable)

(Value:Sec 0sec means disable)

- Time period for auto-backlight-off with battery operation (Default:60

sec)

(Value:Sec 0sec means disable)

- Time period for auto-backlight-off with AC Outlet operation (Default:

600sec)

(Value:Sec 0sec means disable)

- Device name for communication(Default:WindowsCE)

Designate device name with communication

- Volume (Default:Medium)

(Level 1:High 2:Medium 3:Low 4:Off)

- Size of RAM disk (Object Store) (Default:30116KB)

(Size KB)

- Settings of automatic restoring function when memory contents is lost.

(Default:0x00000000)

Notification Touch Panel Calendar Setting

Screen Calibration Screen Screen

0x00000000: Yes Yes Yes

0x00000001: No No No

0x00010001: Yes No No

0x00020001: No Yes No

0x00030001: Yes No No

0x00040001: No No Yes

0x00050001: Yes No Yes

0x00060001: No Yes Yes

Page 10: Fujitsu Programing

- Clear Type Font (Default:disable)

(0:disable 1:enable)

- W/Wo displaying of MyComputer Icon on desktop (Default:disable)

(0:disable 1:enable)

- LAN Adaptor(FHTUL581) Setting (Default:USB-CIU)

( 0:USB-CIU(FHTUA571) 1:USB-LAN Adaptor(FHTUL581) )

You can set these designating only when you need to change Control Panel

information. Also you can set some (or one) item(s) only which you need.

Example for designating "With displaying of Task Bar"

[Control Panel]

TaskBar=1

END

7) Quick launch

----------------------------------------------------------------------------

a. Function

This section designates the program (launcher) by pressing 'F1'-'F5' key.

b. Format

+-------------------------------------------------------------------------+

| [Launch] |

| F1=Program_name_by_pressing_F1_key [parameter] |

| F2=Program_name_by_pressing_F2_key [parameter] |

| F3=Program_name_by_pressing_F3_key [parameter] |

| F4=Program_name_by_pressing_F4_key [parameter] |

| F5=Program_name_by_pressing_F5_key [parameter] |

| END |

+-------------------------------------------------------------------------+

- Ensure to edit file name with full path which is executed by launcher.

- You can set these designating only when you need to register or change

launcher. Also you can set some (or one) item(s) only which you need.

- In case of including space in the program name or path name, you have

to enclose the program name or the parameter with "".

- Example for designating \HhtApl\HhtApl.exe as 'F2' key

[Launch]

F2=\HhtApl\HhtApl.exe

END

8) Editing the registry

----------------------------------------------------------------------------

a. Function

Some programs require registry-key and value to be added to the Registry.

This section will import Registry update files exported by registry editor

(fhtUreg.exe).

b. Format

+-------------------------------------------------------------------------+

| [User Registry] |

| RegFile=Registry_Import_Filename[,Registry_Import_Filename]m |

| END |

+-------------------------------------------------------------------------+

- Ensure to define the registry filename with full path.

- Windows CE cannot use INI file differently from Windows.

Application may work with making the specific registry-key instead of

that. In that case, it is available for getting the specific registry-key

and the value.

- The registry file can be made by the registry editor (fhtUreg.exe)

built into TeamPad500G.

- Example for getting Registry file(\Storage Card1\User1.Reg)

[User Registry]

RegFile="\Storage Card1\User1.Reg"

END

Page 11: Fujitsu Programing

*=== CAUTION ==============================================================*

| - Only the registry file exported by the registry editor in TeamPad500G |

| can be imported. |

*==========================================================================*

Example of setup file (Config.HHT) for installation

+-------------------------------------------------------------------------+

| [Install File] |

| "\Storage Card1\HhtApl\*.*"=\HhtApl\*.* |

| "\Storage Card1\HhtApl.dll"=\Windows\HhtApl.dll |

| END |

| |

| [StartUp] |

| FileName=\HhtApl\HhtApl.exe |

| END |

| |

| [RegSvrCE] |

| CESelfRegister=\Windows\HhtApl.dll |

| END |

| |

| [Control Panel] |

| BattPowerOff=300 |

| ExtPowerOff=600 |

| BattBackLightOff=180 |

| ExtBackLightOff=0 |

| Volume=3 |

| END |

| |

| [User Registry] |

| RegFile=\HhtApl\Hht.reg,\HhtApl\Comm.reg |

| END |

| |

+-------------------------------------------------------------------------+

-------------------------------------------------------------------------------

2.2 Installation Procedure

-------------------------------------------------------------------------------

(1) Installing to TeamPad500G by Storage Card

a. Storage Card configuration

Prepare a formatted Storage Card (Compact Flash Disk card).

Install the Storage Card into PC, and copy the application software to

the Storage Card.

Example for the configuration:

Storage Card <DIR>

+--App <DIR> ------- Folder for application program

| +--APL.EXE ------- Application program file

+--Config.HHT ------- Setup file for installation

(*) It is available for installing without creation of folder. In case of

that, you have to make the setup information for each files.

b. Startup of Setup tool

When TeamPad500G is not yet setup, the message of "No application has

been installed. Press 'ENT'+'1' to continue." will be displayed.

Press '1' key with 'ENT' key.

The "Setup Menu" is started.

The "Setup Menu" can be started by pressing 'SFT'+'CLR'+'F2' key after

reset switch of TeamPad500G.

c. Implement to install (card)

Install the Storage Card to the TeamPad500G.

Page 12: Fujitsu Programing

Press '2' key from "Setup Menu", then select "Storage Card" as install

method and press "Next" button.

Select the folder name which the CONFIG.HHT is stored and start

installation by pressing "Next" button.

The application will be installed from the Storage Card.

When the installation is completed, the installed file list is displayed.

Exit installation process by pressing the "End" button.

d. Reboot the TeamPad500G

When the installation is completed, reboot the TeamPad500G.

The application software defined by StartUp section will be started.

*=== CAUTION ==============================================================*

| - If format of Setup file (CONFIG.HHT) is wrong, the software will be |

| installed without correct registration. |

| - If error occurred during installation of application software, system |

| error message will be displayed and TeamPad500G returns to initial |

| state. In case if system error occurred, re-installation of the |

| application is required. |

| - When application installation, the application program is automatically|

| backed up to the following folder. |

| \FlashDisk\System : Backup folder |

| Do not delete the file in this backup folder or do not move. |

| If it is deleted or moved, the automatic restoration function does not |

| work when the battery empty. |

*==========================================================================*

(2) Installing to TeamPad500G via ActiveSync (for application development)

a. Start ActiveSync on PC

b. Startup of Setup tool

When TeamPad500G is not yet setup, the message of "No application has been

installed. Press 'ENT'+'1' to continue." will be displayed.

Press '1' key with 'ENT' key.

The "Setup Menu" is started.

The "Setup Menu" can be started by pressing 'SFT'+'CLR'+'F2' key after

reset switch of TeamPad500G.

c. Implement to install (ActiveSync)

Press '2' key on "Setup Menu", and then select "ActiveSync" and press

"Next" button.

Select the connection method and press "connect" button.

Once the PC and TeamPad500G connected, TeamPad500G can be accessed as a

device on the Desktop "My Computer" or Explorer.

Copy CAB file and CONFIG.HHT file into TeamPad500G by using Explorer on PC.

After files copied on PC, press "Disconnect" button on the TeamPad500G,

then press "Next" button.

Select the folder name which the CONFIG.HHT is stored, and start

installation by pressing "Next" button.

The application will be installed from the CAB file.

When the installation is completed, the installed file list is displayed.

Exit installation process by pressing the "End" button.

d. Reboot the TeamPad500G

When the installation is completed, reboot the TeamPad500G.

The application software defined by StartUp section will be started.

Note: CONFIG.HHT for extract CAB file

Make CONFIG.HHT to extract application from the CAB file as follows.

Example for CAB file stored in \WinCeApp folder:

[WceLoad]

CabFile=\WinCeApp\WinCeApp.Cab

END

Page 13: Fujitsu Programing

*=== CAUTION ==============================================================*

| - If format of Setup file (CONFIG.HHT) is wrong, the software will be |

| installed without correct registration. |

| - If error occurred during installation of application software, system |

| error message will be displayed and TeamPad500G returns to initial |

| state. In case if system error occurred, re-installation of the |

| application is required. |

| - When application installation, the application program is automatically|

| backed up to the following folder. |

| \FlashDisk\System : Backup folder |

| Do not delete the file in this backup folder or do not move. |

| If it is deleted or moved, the automatic restoration function does not |

| work when the battery empty. |

*==========================================================================*

(3) Installing to TeamPad500G via downloader

a. Start Program dumper on PC

Copy the application software to the disk on PC, and start the program

dumper.

b. Startup of Setup tool

When TeamPad500G is not yet setup, the message of "No application has been

installed. Press 'ENT'+'1' to continue." will be displayed.

Press '1' key with 'ENT' key.

The "Setup Menu" is started.

The "Setup Menu" can be started by pressing 'SFT'+'CLR'+'F2' key after

reset switch of TeamPad500G.

c. Implement to install (Program loader)

Press '2' key on "Setup Menu", and then select "Program Loader" and press

"Next" button.

Next, connected means (USB adaptor/optical adaptor) is selected.

(Set the transmission rate when you use an optical adaptor.)

Download starts when the Start button is pressed specifying the folder

downloaded to TeamPad500G. Download ends, the downloaded file list is

displayed.

Select the folder name which the CONFIG.HHT is stored and start

installation by pressing "Next" button.

The application will be installed from the Storage Card.

When the installation is completed, the installed file list is displayed.

Exit installation process by pressing the "End" button.

d. Reboot the TeamPad500G

When the installation is completed, reboot the TeamPad500G.

The application software defined by StartUp section will be started.

*=== CAUTION ==============================================================*

| - If format of Setup file (CONFIG.HHT) is wrong, the software will be |

| installed without correct registration. |

| - If error occurred during installation of application software, system |

| error message will be displayed and TeamPad500G returns to initial |

| state. In case if system error occurred, re-installation of the |

| application is required. |

| - When application installation, the application program is automatically|

| backed up to the following folder. |

| \FlashDisk\System : Backup folder |

| Do not delete the file in this backup folder or do not move. |

| If it is deleted or moved, the automatic restoration function does not |

| work when the battery empty. |

*==========================================================================*

When installing it, the application program is automatically backed up to the

following folders.

===============================================================================

3. Devices on TeamPad500G

Page 14: Fujitsu Programing

===============================================================================

-------------------------------------------------------------------------------

3.1 Storage devices

-------------------------------------------------------------------------------

The TeamPad500G supports the following 3 storage devices.

It is possible to store application programs and data files into the

following memory area of TeamPad500G.

+---------------------+-----------------+---------------------------------+

| Memory area | Capacity | Note |

+---------------------+-----------------+---------------------------------+

| RAM disk | Approx.32MB | Back-up available by internal |

| | | battery (Volatile) |

| Flash Disk | Approx.32MB | Back-up even if no internal |

| | | battery (Non-volatile) |

| Storage Card | Card Capability | External media, Optional card is|

| | | required (Non-volatile) |

+---------------------+-----------------+---------------------------------+

Note: Capacity of RAM disk can be changed by Control Panel, however if the

RAM disk capacity is expanded, the program may work properly

because of short of executable area.

(1) RAM disk (Object Store)

It is possible to store on Memory (RAM). Main battery and Super capacitor

retain the contents. If the Main battery is exchanged with Super capacitor

is low state, the RAM disk is initialized.

* We strongly recommend to store your important files into Storage Card or

Flash Disk.

(2) Internal Flash Disk (Disk On Chip)

32M bytes of Flash Disk is supported as non-volatile program storage.

If application program stores data to the Flash Disk, the data will be not

lost when TeamPad500G keep long time without main battery.

The drive name of the Flash Disk is "FlashDisk".

When you install a certain file(e.g. XXXXX.DAT) from Compact Flash Card to

Flash Disk drive, you need specify on CONFIG.HHT as follows;

[Install File]

\Strage Card1\XXXXXX.DAT=\FlashDisk\XXXXXX.DAT

END

(3) Storage Card (External media)

If you wish to expand the area to store files, optional Compact Flash disk

card or PCMCIA card is required.

TeamPad500G has two(2) card slots, and the folder name of Compact Flash card

is "Storage Card1" and the folder name of PCMCIA card is "Storage Card2".

When you install a certain file(e.g. XXXXX.DAT) from Compact Flash card to

a certain location (e.g. under \Temp\Data), you need specify on CONFIG.HHT

as follows;

[Install File]

\Storage Card1\XXXXXX.DAT=\Temp\Data\XXXXXX.DAT

END

-------------------------------------------------------------------------------

3.2 Keyboard

-------------------------------------------------------------------------------

a. key code

This section describe the Key Code (message) to be informed to application

Kirk
Realce
Page 15: Fujitsu Programing

program on TeamPad500G.

(1)Normal status

+---------+ +---------+ +---------+ +---------+ +---------+

| F 1 | | F 2 | | F 3 | | F 4 | | F 5 |

+---------+ +---------+ +---------+ +---------+ +---------+

+---------+ +---------+ +---------+ +---------+ +---------+

| PWR | | 1 | | 2 | | 3 | | CLR |

+---------+ +---------+ +---------+ +---------+ +---------+

+---------+ +---------+ +---------+ +---------+ +---------+

| <== | | 4 | | 5 | | 6 | | BKS |

+---------+ +---------+ +---------+ +---------+ +---------+

+---------+ +---------+ +---------+ +---------+ +---------+

| ==> | | 7 | | 8 | | 9 | | |

+---------+ +---------+ +---------+ +---------+ | ENT |

+---------+ +---------+ +---------+ +---------+ | |

| SFT | | 0 | | 00 | | . | | |

+---------+ +---------+ +---------+ +---------+ +---------+

(2)With Shift Key

+---------+ +---------+ +---------+ +---------+ +---------+

| F 6 | | F 7 | | F 8 | | F 9 | | F10 |

| (Paper | |(Paper | | (Darker | |(Brighter| |(Screen |

| Feed ) | |BackFeed)| | BKLT) | | BKLT) | |Keyboard)|

+---------+ +---------+ +---------+ +---------+ +---------+

+---------+ +---------+ +---------+ +---------+ +---------+

| PWR | | 1 | | 2 | | 3 | | - |

+---------+ +---------+ +---------+ +---------+ +---------+

+---------+ +---------+ +---------+ +---------+ +---------+

| /\ | | 4 | | 5 | | 6 | | ESC |

+---------+ +---------+ +---------+ +---------+ +---------+

+---------+ +---------+ +---------+ +---------+ +---------+

| \/ | | 7 | | 8 | | 9 | | |

+---------+ +---------+ +---------+ +---------+ | SYS |

+---------+ +---------+ +---------+ +---------+ | |

| SFT | | 0 | | CTL | | ALT | | |

+---------+ +---------+ +---------+ +---------+ +---------+

The below table shows the relation as name of the keys and virtual key codes.

This virtual key code is notified to the user application as "wParam"

parameter of the WM_KEYDOWN message.

+-------+-----------------+-------+ +---------+-----------------+-------+

| Key | Symbolize | Value | | Key | Symbolize | Value |

| | constant | | | with SFT| constant | |

+-------+-----------------+-------+ +---------+-----------------+-------+

| 0 | VK_0 | 0x30 | | 0 | VK_NUMPAD0 | 0x60 |

| 1 | VK_1 | 0x31 | | 1 | VK_NUMPAD1 | 0x61 |

| 2 | VK_2 | 0x32 | | 2 | VK_NUMPAD2 | 0x62 |

| 3 | VK_3 | 0x33 | | 3 | VK_NUMPAD3 | 0x63 |

| 4 | VK_4 | 0x34 | | 4 | VK_NUMPAD4 | 0x64 |

| 5 | VK_5 | 0x35 | | 5 | VK_NUMPAD5 | 0x65 |

| 6 | VK_6 | 0x36 | | 6 | VK_NUMPAD6 | 0x66 |

| 7 | VK_7 | 0x37 | | 7 | VK_NUMPAD7 | 0x67 |

| 8 | VK_8 | 0x38 | | 8 | VK_NUMPAD8 | 0x68 |

| 9 | VK_9 | 0x39 | | 9 | VK_NUMPAD9 | 0x69 |

| F1 | VK_F1 | 0x70 | | F6 | VK_F6 | 0x75 |

| F2 | VK_F2 | 0x71 | | F7 | VK_F7 | 0x76 |

| F3 | VK_F3 | 0x71 | | F8 | VK_F8 | 0x77 |

| F4 | VK_F4 | 0x71 | | F9 | VK_F9 | 0x78 |

| F5 | VK_F5 | 0x71 | | F10 | VK_F10 | 0x79 |

| SFT | VK_SHIFT | 0x10 | | | | |

| <= | VK_LEFT | 0x25 | | /\ | VK_UP | 0x26 |

| => | VK_RIGHT | 0x27 | | \/ | VK_DOWN | 0x28 |

| ENT | VK_RETURN | 0x0D | |(System) | (System Menu) | |

| 00 | VK_0,VK_0 | | | CTL | VK_CONTROL | 0x11 |

Kirk
Realce
Kirk
Realce
Page 16: Fujitsu Programing

| BKS | VK_BACK | 0x08 | | ESC | VK_ESCAPE | 0x1B |

| . | VK_PERIOD | 0xBE | | ALT | VK_MENU | 0x12 |

| CLR | VK_CLEAR | 0x0C | | - | VK_HYPHEN | 0xBD |

+-------+-----------------+-------+ +---------+-----------------+-------+

b. Key Sequence

+----------+------------------------------------------------------------+

|SFT+F1 |Paper Feed of integrated printer |

|SFT+F2 |Paper Back Feed of integrated printer |

|SFT+F3 |Set the back light of screen darker |

|SFT+F4 |Set the back light of screen lighter |

|SFT+F5 |Toggles presence of touch screen keyboard on display |

|SFT+ENT |Displays battery status and allows speaker volume |

| |control and touch screen calibration |

|SFT+CLR+F2|Display "Setup Menu" when these keys pressing on boot, |

| |even if an application is to be started automatically. |

+----------+------------------------------------------------------------+

c. Keyborad back light

The mechanical keys are back lighted when it is pressed.

This keyboard back light is automatically turned off after 5 seconds of no

activity for keyboard.

Note:

The keyboard backlight is turned off whenever the screen back light is

active.

-------------------------------------------------------------------------------

3.3 Soft Keyboard

-------------------------------------------------------------------------------

TeamPad400G supports software keyboard, the application program can setup

to display it or not.

(1) Files to be used

- Sipapi.h ---------- Header file for Soft Keyboard

(2) Function

BOOL SipShowIM(DWORD dwFlags);

(3) Parameter

dwFlags : Designate soft keyboard display or not.

0(SIPF_ON) Display SIP

1(SIPF_OFF) Not display SIP

(4) Return value

Return processed result

TRUE : Success

FALSE : Abnormal end

(5) Example

BOOL bRet;

// Display SIP

bRet = SipShowIM(SIPF_ON);

if(!bRet) goto Error_Exit;

// Not display SIP

SipShowIM(SIPF_OFF);

if(!bRet) goto Error_Exit;

-------------------------------------------------------------------------------

3.4 Integrated Printer

-------------------------------------------------------------------------------

Kirk
Realce
Kirk
Nota
É Sempre bom saber....
Page 17: Fujitsu Programing

The application program can control the integrated printer by the following

library.

- The printer OPOS in the "TeamPad I/O Control Library".

or

- The device stream library for printer.

* Please refer to the "Application Developer's Guide" in "TeamPad I/O Control

Library" for further details of the printer OPOS.

-------------------------------------------------------------------------------

3.5 Serial Communication

-------------------------------------------------------------------------------

TeamPad500G is available to communicate with serial devices.

Devices to be able to connect are as follows;

+-----+----------------------------+-----------------------------------------+

|Port | Device | Purpose |

+-----+----------------------------+-----------------------------------------+

|COM1 | Mechanical RS232 Port | For use with External 1D barcode reader |

|COM2 | Integrated Scanner | 1D barcode reader (Symbol SE923) |

|COM3 | IrComm | For use with IrComm/IrLPT Devices |

| | | (most often printers) |

|COM4 | --- | No device assigned |

|COM5A| IrDA Multiplex | For use with CIU when Modem control |

| | | signals are required |

|COM5D| Magnetic Stripe Reader | Track 1 and 2 card reader (Omron) |

|COM5E| Magnetic Stripe Reader | Track 2 and 3 card reader (Omron) |

|COM6 | IrDA Raw (direct access) | Use for custom IR protocols. |

| | | Or, for use with CIU when modem control |

| | | signals not required. |

|COM7 | USB (Slave port) | For USB connection with PC |

|COMx | CF Type Modem Card | Most often data collection |

|LPT1 | Integrated Printer | For Invoice/Receipt |

+-----+----------------------------------------------------------------------+

The IrDA port can be used in three different modes. The modes are IrDA Raw,

IrDA Multiplex, and IrComm/IrLPT.

While each of these modes are accessed differently, only one can be used

at a time as they share the same hardware.

The IrDA Raw mode is used to send data out the IrDA port when communicating

by a proprietary protocol. IrDA Raw only supports transmit (Tx) and receive

(Rx) data. The protocol is the responsibility of the program sending the

data, as no protocol is provided by the TeamPad500G.

The IrDA Raw mode can transmit and receive at Max 115Kbps. The receiving

device must have knowledge of the protocol and the baud rate at which the

data is to be received.

If the IrDA Raw mode is used with the RS232C-CIU, then the dip switches

on the back of the CIU must be set to corresponding baud rate.

The IrDA Multiplex mode is a proprietary extension to the standard IrDA

interface. The IrDA Multiplex mode can only be used with the RS232C-CIU

with switch 1 and 2 set to ON.

Using this mode, the RS232 modem control signals in the CIU are functional.

Maximum baud rate of IrDA Multiplex is 19.2Kbps. The IrDA Multiplex mode

is slower than IrDA Raw but provides modem control signals.

The DTR signal has a special meaning in this mode. The DTR signal must be

set for other modem control and data signals to be valid. The DTR signal

must be set prior to using the port.

When COM3 is used to access the IrDA port, then the data is sent to the port

via the industry standard IrCOMM protocol. IrCOMM is supported directly from

the COM3 interface.

Page 18: Fujitsu Programing

Note that the COM3, COM5, and COM6 devices share the same hardware and only

one can be opened by the application at a time.

Power supply to every serial device is done when the "CreateFile" function

is called, and power abort is done when the "CloseHandle" function is

called.

When CF Type Modem Card is placed into TeamPad500G, unoccupied and lowest

COM number is assigned for COM port.

===============================================================================

4. API for Visual C++

===============================================================================

-------------------------------------------------------------------------------

4.1 Power Control

-------------------------------------------------------------------------------

4.1.1 Enable/Disable 'PWR' key

-------------------------------------------------------------------------------

This function is capable to enable/disable the power OFF switch through the

application program in order to prevent power OFF from careless operation of

application process.

(1) Files to be used

- fhtUpow.h --------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtGetSetPowkeyStatus (DWORD dwGetSetCmd,

DWORD *pdwStatus,

DWORD *pdwErrDetail);

(3) Parameter

dwGetSetCmd : Command which designates to get or set status of 'PWR' key

control.

0(POW_GET_STATUS) Get 'PWR' key status

1(POW_SET_STATUS) Set 'PWR' key status

pdwStatus : Buffer pointer to store 'PWR' key status.

In case of getting status, the status return to designated

buffer. In case of setting status, set the status which you

wish to set.

Values of 'PWR' key status are as follows;

0(POW_SW_DISABLE) Power off disable by 'PWR' key

1(POW_SW_ENABLE) Power off enable by 'PWR' key

pdwErrDetail: Buffer pointer to return error detail code

If you need no error detail code, you can designate NULL.

In case that returned value is FALSE, it returns the

following error detail code.

101(POW_INVALID_PARAMETER) Parameter error

102(POW_SYSTEM_ERROR) System error(Lack of resource or

others)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

In case when the 'PWR' key is disabled.

DWORD dwStatus,dwErrDetail,dwGetSetCmd;

BOOL bRet;

// Get 'PWR' key status

dwGetSetCmd = POW_GET_STATUS;

bRet = fhtGetSetPowkeyStatus(dwGetSetCmd,

Page 19: Fujitsu Programing

&dwStatus,

&dwErrDetail);

if(!bRet) goto Error_Exit;

if(dwStatus == POW_SW_ENABLE){

// Mask 'PWR' key

dwGetSetCmd = POW_SET_STATUS;

dwStatus = POW_SW_DISABLE;

bRet = fhtGetSetPowkeyStatus(dwGetSetCmd,

&pdwStatus,

&pdwErrDetail);

if(!bRet) goto Error_Exit;

}

4.1.2 Force A Suspend

-------------------------------------------------------------------------------

This function is capable to enter the unit into Suspend mode through

application program.

(1) Files to be used

- fhtUpow.h -------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtSetPowerDown(DWORD dwResume,

DWORD *pdwErrDetail);

(3) Parameter

dwResume : Setting of next power ON mode.

0 Resume

0x55AA55AA Warm Boot

pdwErrDetail : Buffer pointer to return error detail code

If you need no error detail code, you can designate NULL.

In case that returned value is FALSE, it returns the

following error detail code.

101(POW_INVALID_PARAMETER) Parameter error

102(POW_SYSTEM_ERROR) System error

(Lack of resource or others)

103(POW_SYSTEM_BUSY) System busy

(Suspend can't transit)

104(POW_KEY_DISABLE) 'PWR' key event is masked

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

BOOL bRet;

DWORD dwErrDetail, dwResume;

// Setting Suspend

while(1){

dwResume = 0;

bRet = fhtSetPowerDown(dwResume, &dwErrDetail);

if(bRet) break;

if(dwErrDetail != POW_SYSTEM_BUSY) goto Error_Exit;

Sleep(1000);

}

4.1.3 Set power ON Mode

-------------------------------------------------------------------------------

Page 20: Fujitsu Programing

This function has a capability to set power ON mode.

In case of warm boot setting, TeamPad500G restarts after power ON.

(1) Files to be used

- fhtUpow.h -------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtSetPowonSeq(DWORD dwResume,

DWORD *pdwErrDetail);

(3) Parameter

dwResume : Setting of power ON mode.

0 Resume

0x55AA55AA Warm Boot

pdwErrDetail: Buffer pointer to return error detail code

If you need no error detail code, you can designate NULL.

In case that returned value is FALSE, it returns the

following error detail code.

101(POW_INVALID_PARAMETER) Parameter error

102(POW_SYSTEM_ERROR) System error(Lack of resource or

others)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

DWORD dwErrDetail,dwResume;

BOOL bRet;

// Setting Warm Boot mode

dwResume = 0x55AA55AA;

bRet = fhtSetPowonSeq(dwResume, &dwErrDetail);

if(!bRet) goto Error_Exit;

4.1.4 Back Light of Screen

-------------------------------------------------------------------------------

This function has a capability to set Back light ON/OFF and to adjust

Brightness or to get their status.

(1) Files to be used

- fhtUpow.h -------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtGetSetBacklight(DWORD dwGetSetCmd,

DWORD *pdwValue,

DWORD *pdwErrDetail);

(3) Parameter

dwGetSetCmd : Command which designates to get or set status of Back light

or Contrast.

4(GET_LIGHT) Get Back light status

5(SET_LIGHT) Set Back light status

pdwValue : Buffer pointer to designate brightness value of Back light.

In case of getting status, the status returns to designated

buffer. In case of setting status, set the status which you

wish to change.

Back light value is follows;

0 Back light Off

1-128 Brightness value

pdwErrDetail: Buffer pointer to return error detail code

Page 21: Fujitsu Programing

If you do not need error detail code, you can designate NULL.

In case that returned value is FALSE, it returns the follow

error detail code.

101(POW_INVALID_PARAMETER) Parameter error

102(POW_SYSTEM_ERROR) System error(Lack of resource or

others)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

DWORD dwErrDetail,dwGetSetCmd,dwValue;

BOOL bRet;

// Get Back light status

dwGetSetCmd = GET_LIGHT;

bRet = fhtGetSetBacklight(dwGetSetCmd,

&dwValue,

&dwErrDetail);

if(!bRet) goto Error_Exit;

if(dwValue == POW_LIGHT_OFF){

// setting back-light on

dwGetSetCmd = SET_LIGHT;

dwValue = POW_LIGHT_ON;

bRet = fhtGetSetBacklight(dwGetSetCmd,

&dwValue,

&dwErrDetail);

if(!bRet) goto Error_Exit;

}

4.1.5 Read Battery Status

-------------------------------------------------------------------------------

This function has a capability to get main-battery status.

(1) Files to be used

- fhtUpow.h -------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtBatteryGetStatus2

(PSYSTEM_POWER_STATUS_EX2 pSystemPowerStatusEx,

UINT16 *pwCharge, DWORD *pdwErrDetail);

(3) Parameter

pSystemPowerStatusEx: Pointer to structure of battery status information.

pwCharge : Pointer to the number of times for battery charge/discharge.

Note this value is not supported in TeamPad500G.

pdwErrDetail: Buffer pointer to return error detail code

If you do not need error detail code, you can designate NULL.

In case that returned value is FALSE, it returns the

following error detail code.

101(POW_INVALID_PARAMETER) Parameter error

102(POW_SYSTEM_ERROR) System error(Lack of resource or

others)

- Structure of battery status information

typedef struct _SYSTEM_POWER_STATUS_EX2{

BYTE ACLineStatus;

BYTE BatteryFlag;

BYTE BatteryLifePercent;

BYTE Reserved1;

DWORD BatteryLifeTime;

Page 22: Fujitsu Programing

DWORD BatteryFullLifeTime;

BYTE Reserved2;

BYTE BackupBatteryFlag;

BYTE BackupBatteryLifePercent;

BYTE Reserved3

DWORD BackupBatteryLifeTime;

DWORD BackupBatteryFullLifeTime;

DWORD BatteryVoltage;

DWORD BatteryCurrent;

DWORD BatteryAverageCurrent;

DWORD BatteryAverageInterval;

DWORD BatterymAHourConsumed;

DWORD BatteryTemperature;

DWORD BackupBatteryVoltage;

BYTE BatteryChemistry;

} SYSTEM_POWER_STATUS_EX2, *PSYSTEM_POWER_STATUS_EX2, *LPSYSTEM_POWER_STATUS_EX2;

ACLineStatus :Status of AC Line

0x00(AC_LINE_OFFLINE) AC off line

0x01(AC_LINE_ONLINE) AC on line

0xFF(AC_LINE_UNKNOWN) Unknown Status

BatteryFlag : Status of main battery

0x01(BATTERY_FLAG_HIGH) Good

0x04(BATTERY_FLAG_CRITICAL) Critical

0xFF(BATTERY_FLAG_UNKNOWN) Unknown Status

BatteryLifePercent : Remaining amount of main battery

Return 0 to 100

0xFF(BATTERY_PERCENTAGE_UNKNOWN) Unknown Status

BatteryLifeTime : Remaining time of main battery

TeamPad500G returns BATTERY_LIFE_UNKNOWN

0xFFFFFFFF(BATTERY_LIFE_UNKNOWN) Unknown Status

BatteryFullLifeTime : Operating time for main battery full

TeamPad500G returns BATTERY_LIFE_UNKNOWN

0xFFFFFFFF(BATTERY_LIFE_UNKNOWN) Unknown Status

BackupBatteryFlag : Status of sub battery

TeamPad500G returns BATTERY_FLAG_UNKNOWN

0xFF(BATTERY_FLAG_UNKNOWN) Unknown Status

BackupBatteryLifePercent : Remaining sub battery

TeamPad500G returns BATTERY_PERCENTAGE_UNKNOWN

0xFF(BATTERY_PERCENTAGE_UNKNOWN) Unknown Status

BackuptteryLifeTime : Operating time for remaining sub battery

TeamPad500G returns BATTERY_LIFE_UNKNOWN

0xFFFFFFFF(BATTERY_LIFE_UNKNOWN) Unknown Status

BackupBatteryFullLifeTime : Operating time for full life time of sub

battery

TeamPad500G returns BATTERY_LIFE_UNKNOWN

0xFFFFFFFF(BATTERY_LIFE_UNKNOWN) Unknown Status

BatteryVoltage : Voltage of main battery

TeamPad500G returns voltage of main battery

BatteryCurrent : TeamPad500G always returns Zero

BatteryAverageCurrent : Ditto

BatteryAverageInterval : Ditto

BatterymAHourConsumed : Ditto

BatteryTemperature : Ditto

BackupBatteryVoltage : Ditto

BatteryChemistry : Type of battery

TeamPad500G returns BATTERY_CHEMISTRY_LION

0x04 (BATTERY_CHEMISTRY_LION) Lithium Ion battery

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

Page 23: Fujitsu Programing

DWORD dwErrDetail;

BOOL bRet;

SYSTEM_POWER_STATUS_EX2 ps;

UINT16 pwCharge;

// Get main-battery and sub-battery status

bRet = fhtBatteryGetStatus2(&ps,

&pwCharge,

&dwErrDetail);

// main-battery status

switch(ps.BatteryFlag){

// Good

case BATTERY_FLAG_HIGH:

break;

// Critical

case BATTERY_FLAG_CRITICAL:

break;

// Unknown Status

case BATTERY_FLAG_UNKNOWN:

break;

default:

break;

}

4.1.6 Enable/Disable The Auto Suspend

-------------------------------------------------------------------------------

This function has a capability to set auto power OFF function, or to get

this status.

When no activity detects in specified time, the unit will enter Suspend mode

automatically. Application can disable this automatic Suspend mode.

(1) Files to be used

- fhtUpow.h -------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtGetSetAutoPwrOff(DWORD dwGetSetCmd,

DWORD *pdwStatus,

DWORD *pdwErrDetail);

(3) Parameter

dwGetSetCmd : Command which designates to get or set status of auto

power OFF function.

0(POW_GET_STATUS) Get auto power OFF function status

1(POW_SET_STATUS) Set auto power OFF function status

pdwStatus : Designate pointer of buffer to Auto power OFF function

status.

Values of auto power OFF function status are as follows;

0(AUT_POWER_OFF) Disable Auto power OFF function

1(AUT_POWER_ON) Enable Auto power OFF function

pdwErrDetail: Buffer pointer to return error detail code.

If you do not need error detail code, you can designate NULL.

In case that returned value is FALSE, it returns the follow

error detail code.

101(POW_INVALID_PARAMETER) Parameter error

102(POW_SYSTEM_ERROR) System error(Lack of resource or

others)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

DWORD dwErrDetail,dwGetSetCmd,dwStatus;

Page 24: Fujitsu Programing

BOOL bRet;

// Get auto power OFF function status

dwGetSetCmd = POW_GET_STATUS;

bRet = fhtGetSetAutoPwrOff(dwGetSetCmd,

&dwStatus,

&dwErrDetail);

if(!bRet) goto Error_Exit;

if(dwStatus == AUT_POWER_ON){

// Disable Auto power OFF function

dwGetSetCmd = POW_SET_STATUS;

dwStatus = AUT_POWER_OFF;

bRet = fhtGetSetAutoPwrOff(dwGetSetCmd,

&dwStatus,

&dwErrDetail);

if(!bRet) goto Error_Exit;

}

4.1.7 Wait For Resume Started

-------------------------------------------------------------------------------

This function has a capability to know beginning of resuming (power-on).

This function does not return to application until the system begins

resuming. Make a thread to use this function.

(1) Files to be used

- fhtUpow.h -------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtResumeWait(DWORD *pdwErrDetail);

(3) Parameter

pdwErrDetail: Buffer pointer to return error detail code.

If you do not need error detail code, you can designate NULL.

In case that returned value is FALSE, it returns the follow

error detail code.

102(POW_SYSTEM_ERROR) System error(Lack of resource or

others)

103(POW_SYSTEM_BUSY) System busy

(Suspend can't transit)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

LRESULT CALLBACK WndProc(HWND hWnd,UINT message,

WPARAM wParam,LPARAM lParam)

{

¥

¥

// Make a thread to check beginning of resuming.

HANDLE hResumeTread = CreateThread(NULL,0,ResumeWaitThread,

(LPVOID)hWnd,0,NULL );

if(hResumeTread)

{

CloseHandle(hResumeTread) ;

}

else

{

MessageBox(hWnd, TEXT("CreateThread fail."),

Page 25: Fujitsu Programing

TEXT("SampleResume"),MB_OK);

}

¥

¥

}

The thread to check beginning of resuming by this function.

DWORD WINAPI ResumeWaitThread(LPVOID lpParameter)

{

HWND hWnd = (HWND)lpParameter ;

DWORD dwErrDetail;

// Wait for beginning of Resuming

if(fhtResumeWait(&dwErrDetail))

{ // Normal

MessageBox(hWnd,TEXT("Resume"),TEXT("SampleResume"),MB_OK);

}

else

{ // Failure

TCHAR szString[129] ;

_stprintf(szString,TEXT("Fail [%d]"),dwErrDetail);

MessageBox(hWnd,szString,TEXT("SampleResume"),MB_OK);

}

ExitThread( 0 ) ;

return 0 ;

}

4.1.8 Stop Waiting For Resume Started

-------------------------------------------------------------------------------

This function stops the fhtResumeWait function which waits for resuming

(power-on).

(1) Files to be used

- fhtUpow.h -------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtResumeWaitDone(DWORD *pdwErrDetail);

(3) Parameter

pdwErrDetail: Buffer pointer to return error detail code.

If you do not need error detail code, you can designate NULL.

In case that returned value is FALSE, it returns the follow

error detail code.

102(POW_SYSTEM_ERROR) System error(Lack of resource or

others)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

// Stop to Wait For Resume Started

if(fhtResumeWaitDone(&dwErrDetail))

{ // Normal

MessageBox(hWnd,TEXT("Done"),TEXT("SampleResume"), MB_OK);

}

Page 26: Fujitsu Programing

else

{ // Failure

TCHAR szString[129] ;

_stprintf(szString,TEXT("fhtResumeWaitDone fail[%d]"),dwErrDetail);

MessageBox(hWnd,szString,TEXT("SampleResume"),MB_OK);

}

-------------------------------------------------------------------------------

4.2 Serial communication

-------------------------------------------------------------------------------

Serial devices can be accessed through the file I/O function. Power can be

supplied to each serial device by calling the CreateFile function,

and power can be cut-off by calling the CloseHandle function. However,

regarding the serial port wherein multiple devices can be connected

(when extended), it is necessary to use the function described in

"4.2.2 Connect Peripheral To COM Port";

keep the function selected prior to powering the serial port.

This device supports 6 serial port interfaces (COM1, COM2, COM3, COM5, COM6

and COM7).

The connections for each port are shown below.

*=== CAUTION ==============================================================*

| - In the port where the 1 device is allocated to 1 port, there is no |

| necessity for using this facilities at all. |

*==========================================================================*

- COM1 -- Mechanical RS232 Port

- COM2 -- Integrated Scanner

- COM3 -- IrCOMM

- COM5 -- PortA:IrDA Multiplex

PortD:Magnetic Stripe Reader(Track 1 and 2 card reader)

PortE:Magnetic Stripe Reader(Track 2 and 3 card reader)

- COM6 -- IrDA

- COM7 -- USB (Slave port)

4.2.1 Get COM Port Status

-------------------------------------------------------------------------------

This device provides a method to obtain the connection status for each

COM port.

(1) Files to be used

- fhtUmpx.h --------- Header file for COM MPX control DLL

- fhtUmpx.lib -------- Library for COM MPX control DLL

(2) Function

BOOL MpxGetPort(DWORD dwCom, DWORD *pdwPort, BOOL *pbPow,

BYTE *pbyRfStatus, BYTE *pbyInService, DWORD *pdwErr);

(3) Parameter

dwCom : Specify the port for which the connection status is to be

obtained.

1 (MPX_COM1) Get the status of COM1

2 (MPX_COM2) Get the status of COM2

5 (MPX_COM5) Get the status of COM5

6 (MPX_COM6) Get the status of COM6

pdwPort : Specify the pointer for the buffer that returns the

connection device on COM, specified in the first parameter

of dwCom.

0 (PORT_A)

3 (PORT_D)

4 (PORT_E)

Page 27: Fujitsu Programing

pbPow : Specify the pointer for the buffer that returns the

power status of the connection device on COM, specified

in the first parameter of dwCom.

0 (POWOFF)

1 (POWON)

pbyRfStatus : Reserve parameter

Specify NULL.

pbyInService : Reserve parameter

Specify NULL.

pdwErr : Specify the pointer for the buffer that returns the Error

Detail Code.

When the return value is FALSE, return the following Error

Detail Code.

0 (MPX_ERR_SUCCESS) No error (Successful)

101 (MPX_ERR_PARAM) Parameter error

104 (MPX_ERR_SUSPEND) The power for the device is in the

OFF status during the power supply

to the port

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

In case when getting the port status of COM5:

DWORD dwCom,dwPort,dwErr;

BOOL bPow, bRet;

// Get the port status of COM5

dwCom = MPX_COM5;

bRet = MpxGetPort(dwCom, &dwPort, &bPow, NULL , NULL, &dwErr);

if(!bRet) goto Error_Exit;

* Note 1: When MPX_ERR_SUSPEND is reported, close the corresponding port

(CloseHandle function).

4.2.2 Connect Peripheral To COM Port

-------------------------------------------------------------------------------

Since it is not possible to simultaneously use the COM port, the following

functions are provided to select the device to be connected to the COM port.

(1) Files to be used

- fhtUmpx.h --------- Header file for COM MPX control DLL

- fhtUmpx.lib -------- Library for COM MPX control DLL

(2) Function

BOOL MpxSetPort(DWORD dwCom, DWORD dwPort, DWORD *pdwErr);

(3) Parameter

dwCom : Specify the port.

1 (MPX_COM1) Set COM1

2 (MPX_COM2) Set COM2

5 (MPX_COM5) Set COM5

6 (MPX_COM6) Set COM6

dwPort : Specify the connection target device for COM, specified in the

first parameter of dwCom.

0 (PORT_A)

3 (PORT_D)

Page 28: Fujitsu Programing

4 (PORT_E)

pdwErr : Specify the pointer for the buffer that returns the Error

Detail Code.

When the return value is FALSE, return the following Error

Detail Code.

0 (MPX_ERR_SUCCESS) No error (Successful)

101 (MPX_ERR_PARAM) Parameter error

102 (MPX_ERR_CONFLICT) Cannot change due to device conflicts

103 (MPX_ERR_INUSE) Cannot change since the specified COM

is occupied or is in use

104 (MPX_ERR_SUSPEND) The power to the device is in OFF status

during the power supply to the port

* Note 2

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

In case when selecting the PortD device for COM5:

DWORD dwCom,dwPort,dwErr;

BOOL bRet;

// Select the PortD device of COM5

dwCom = MPX_COM5;

dwPort = PORT_D;

bRet = MpxSetPort(dwCom, dwPort, &pdwErr);

if(!bRet) goto Error_Exit;

* Note 2: When MPX_ERR_SUSPEND is reported, close the corresponding port

(CloseHandle function).

----------------------------------------------------------------------------

4.3 Device Information

----------------------------------------------------------------------------

TeamPad500G has a capability to get device information.

4.3.1 Get Unique ID

----------------------------------------------------------------------------

This function has a capability to get unique ID of each unit.

(1) Files to be used

- fhtUinfo.h ------- Header file for device information DLL

- fhtUinfo.lib ------- Library for device information DLL

(2) Function

DWORD fhtGetUniqueID(PDEVICE_INFO pDeviceInfo);

(3) Parameter

pDeviceInfo: Pointer to structure of device information.

- Structure of device information

typedef struct_UNIQUEID_INFO {

BYTE bID[16];

DWORD dwFFSError;

}

bID : Unique ID Code(16 byes fixed)

Page 29: Fujitsu Programing

dwFFSError: Buffer pointer to return error detail code.

(4) Return value

0 : Success

Other : Failure

(5) Example

UNIQUEID_INFO uid;

DWORD dwRet;

dwRet=fhtGetUniqueID(&uid);

if(dwRet == 0 && uid.dwFFSError == 0){

// Display Unique ID

DWORD i;

for(i=0;i<16;i++){

printf("%02X",uid.bID[i]);

if(((i+1) % 4) == 0) printf(" ");

}

} else {

// Display Eror code

printf("Error %d %d\r\n",dwRet,dwFFSError);

}

----------------------------------------------------------------------------

4.4 USB Configuration

----------------------------------------------------------------------------

In this device, LAN communication uses a LAN adaptor (FHTUL581).

However, before implementing LAN communication with the LAN adaptor

(FHTUL581), it is necessary to enable the LAN adaptor beforehand.

- Method to switch between the communication environments of the USB adaptor

(FHTUA571)/LAN adaptor (FHTUL581)

It is possible to switch between communication environments using any of

the following methods.

1) Switch using "Set communication adaptor" in the control panel

2) Switch using "Specify control panel information" in the installation

settings file (CONFIG.HHT)

3) Switch using the select function (fhtGetSetUSBMode) of the LAN adaptor

network environment.

When using the USB adaptor (FHTUA571) after enabling the LAN adaptor

(FHTUL581), set the USB adaptor (FHTUA571) to enabled with any of the

above-mentioned 1) to 3) methods.

*=== CAUTION ==============================================================*

| - When using the USB adaptor (FHTUA571), do not enable the LAN adaptor |

| (FHTUL581) using the function described in "4.4.1 Select USB Adapetor |

| /LAN Adaptor" The USB adaptor (FHTUA571) communication function |

| cannot be used when the LAN adaptor (FHTUL581) is enabled. |

*==========================================================================*

4.4.1 Select USB Adapetor/LAN Adaptor

----------------------------------------------------------------------------

This device provides a function to set network communication with the LAN

adaptor and the USB adaptor through the application program.

(1) Files to be used

- fhtUpow.h --------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtGetSetUSBMode( DWORD dwGetSetCmd,

Page 30: Fujitsu Programing

DWORD *pdwValue,

DWORD *pdwErrDetail );

(3) Parameter

dwGetSetCmd : Specify whether to obtain or set the status of the

LAN adaptor.

0 (POW_GET_STATUS) Obtain the current setting of the

LAN adaptor

1 (POW_SET_STATUS) Set the status of the LAN adaptor

pdwValue : Specify the pointer for the buffer that stores the status

of the LAN adaptor.

When obtaining the status, the status returns to the

specified buffer.

When specifying the status, set the status to be changed.

Furthermore, the values for the LAN adaptor status are as

follows:

0 (USB_SLAVE) USB adaptor (FHTUA571) communication enabled

1 (USB_HOST) LAN adaptor (FHTUL581) communication enabled

pdwErrDetail : Specify the pointer for the buffer that stores the error

code. When NULL is specified, the error code is not

returned.

101(POW_INVALID_PARAMETER) Parameter error

102(POW_SYSTEM_ERROR) System error(Lack of resource or

others)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

In case when setting the LAN adaptor communication environment to enabled.

DWORD dwGetSetCmd,dwValue,dwErrDetail;

BOOL bRet;

// Obtain the settings for the LAN adaptor

dwGetSetCmd = POW_GET_STATUS;

bRet = fhtGetSetUSBMode(dwGetSetCmd, &dwValue, &dwErrDetail);

if(!bRet) goto Error_Exit;

// For the USB adaptor, set to LAN adaptor

if(dwValue == USB_SLAVE){

dwGetSetCmd = POW_SET_STATUS;

dwValue = USB_HOST;

bRet = fhtGetSetUSBMode(dwGetSetCmd, &dwValue, &dwErrDetail);

if(!bRet) goto Error_Exit;

}

4.4.2 Enable/Disable USB Device

----------------------------------------------------------------------------

The function to control the power supply on/off of the USB device is offered.

(1) Files to be used

- fhtUpow.h --------- Header file for power control DLL

- fhtUpow.lib -------- Library for Power control DLL

(2) Function

BOOL fhtGetSetUSBPower( DWORD dwGetSetCmd,

DWORD *pdwValue,

DWORD *pdwErrDetail );

(3) Parameter

Page 31: Fujitsu Programing

dwGetSetCmd : Command which designates to get or set status of USB device

power ON/OFF.

0 (POW_GET_STATUS) Get status of USB device power ON/OFF

1 (POW_SET_STATUS) Set status of USB device power ON/OFF

pdwValue : Designate pointer of buffer to USB device power supply.

0 (USB_OFF) Power off status

1 (USB_ON) Power on status

pdwErrDetail: Specify the pointer for the buffer that stores the error

code. When NULL is specified, the error code is not

returned.

101(POW_INVALID_PARAMETER) Parameter error

102(POW_SYSTEM_ERROR) System error(Lack of resource or

others)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

In case when it is reconnected with the USB device.

DWORD dwGetSetCmd,dwValue,dwErrDetail;

BOOL bRet;

// Communication abnormality generation

// Get status of USB device power ON/OFF

dwGetSetCmd = POW_GET_STATUS;

bRet = fhtGetSetUSBPower(dwGetSetCmd, &dwValue, &dwErrDetail);

if(!bRet) goto Error_Exit;

// USB device is set off once

if(dwValue == USB_ON){

dwGetSetCmd = POW_SET_STATUS;

dwValue = USB_OFF;

bRet = fhtGetSetUSBPower(dwGetSetCmd, &dwValue, &dwErrDetail);

if(!bRet) goto Error_Exit;

}

Sleep(500);

// Set status of USB device power ON

dwGetSetCmd = POW_SET_STATUS;

dwValue = USB_ON;

bRet = fhtGetSetUSBPower(dwGetSetCmd, &dwValue, &dwErrDetail);

if(!bRet) goto Error_Exit;

// The communication is restarted

¥

¥

----------------------------------------------------------------------------

4.5 initialization file function

----------------------------------------------------------------------------

In this device, the function of initialization file (ini file) operation is

being offered.

4.5.1 Obtaining the integer correlated to a specific key

----------------------------------------------------------------------------

The fhtGetPrivateProfileInt function retrieves an integer associated with

a key in the specified section of an initialization file. The function

searches the file for a key that matches the name specified by the lpKeyName

Page 32: Fujitsu Programing

parameter under the section name specified by the lpAppName parameter. A

section in the initialization file must have the following form:

[section]

key=value

¥

¥

¥

The fhtGetPrivateProfileInt function is not case-sensitive; the strings in

pszSection and pszKey can be a combination of uppercase and lowercase

letters.

(1) Files to be used

- fhtUini.h ------- Header file for .ini file DLL

- fhtUini.lib ------- Library for .ini file DLL

(2) Function

DWORD fhtGetPrivateProfileInt(TCHAR *pszSection, TCHAR *pszKey,

DWORD dwDefault, TCHAR *pszFile);

(3) Parameter

pszSection : Pointer to a null-terminated string specifying the name of

the section in the initialization file.

pszKey : Pointer to the null-terminated string specifying the name of

the key whose value is to be retrieved.

dwDefault : Default value to return if the key name cannot be found in

the initialization file.

pszFile : Pointer to a null-terminated string that specifies the name

of the initialization file.

(4) Return value

The return value is the integer equivalent of the string following the

specified key name in the specified initialization file. If the key is not

found, the return value is the specified default value.

(5) Example

When obtaining the integer value correlated to "Key" within the "Section"

section of the \Temp\Sample.ini file:

DWORD dwValue;

dwValue=fhtGetPrivateProfileInt(TEXT("Section"),TEXT("Key"),1

,TEXT("\Temp\Sample.ini"));

4.5.2 Obtaining all the keys and values

----------------------------------------------------------------------------

The fhtGetPrivateProfileSection function retrieves all the keys and values

for the specified section of an initialization file. The data in the buffer

pointed to by the pszReturnBuffer parameter consists of one or more

null-terminated strings, followed by a final null character.

Each string has the following format:

key=string

The fhtGetPrivateProfileSection function is not case-sensitive; the string

pointed to by the pszSection parameter can be a combination of uppercase and

lowercase letters. This operation is atomic; no updates to the specified

initialization file are allowed while the key name and value pairs for the

section are being copied to the buffer pointed to by the pszReturnBuffer

parameter.

The comment line that starts by the semicolon is deleted, and it doesn't store

Page 33: Fujitsu Programing

it in the buffer that the pszReturnBuffer parameter indicates.

(1) Files to be used

- fhtUini.h ------- Header file for .ini file DLL

- fhtUini.lib ------- Library for .ini file DLL

(2) Function

DWORD fhtGetPrivateProfileSection(TCHAR *pszSection, TCHAR *pszReturnBuff,

DWORD dwBuffer, TCHAR *pszFile);

(3) Parameter

pszSection : Pointer to a null-terminated string specifying the name of

the section in the initialization file.

pszReturnBuff: Pointer to a buffer that receives the key name and value

pairs associated with the named section. The buffer is

filled with one or more null-terminated strings; the last

string is followed by a second null character.

dwBuffer : Size of the buffer pointed to by the pszReturnBuffer

parameter, in TCHARs.

pszFile : Pointer to a null-terminated string that specifies the name

of the initialization file. If this parameter does not

contain a full path to the file, the system searches for

the file in the Windows directory.

(4) Return value

The return value specifies the number of characters copied to the buffer,

not including the terminating null character. If the buffer is not large

enough to contain all the key name and value pairs associated with the

named section, the return value is equal to nSize minus two.

(5) Example

When getting the value correlated to all keys within the "Section" section

of the \Temp\Sample.ini file.

DWORD dwValue;

TCHAR szKey[129];

dwValue=fhtGetPrivateProfileSection(TEXT("Section"),szKey,129

,TEXT("\Temp\Sample.ini"));

4.5.3 Obtaining the character string correlated to the key

----------------------------------------------------------------------------

The fhtGetPrivateProfileString function retrieves a string from the specified

section in an initialization file. The fhtGetPrivateProfileString function

searches the specified initialization file for a key that matches the name

specified by the pszKey parameter under the section heading specified by

the pszSection parameter. If it finds the key, the function copies the

corresponding string to the buffer. If the key does not exist, the function

copies the default character string specified by the pszDefault parameter.

A section in the initialization file must have the following form:

[section]

key=string

¥

¥

¥

If pszSection is NULL, fhtGetPrivateProfileString copies all section names in

the specified file to the supplied buffer. If pszKey is NULL, the function

copies all key names in the specified section to the supplied buffer. An

application can use this method to enumerate all of the sections and keys in a

file. In either case, each string is followed by a null character and the

Page 34: Fujitsu Programing

final string is followed by a second null character. If the supplied

destination buffer is too small to hold all the strings, the last string is

truncated and followed by two null characters.

If the string associated with pszKey is enclosed in single or double quotation

marks, the marks are discarded when the fhtGetPrivateProfileString function

retrieves the string.

The fhtGetPrivateProfileString function is not case-sensitive; the strings can

be a combination of uppercase and lowercase letters.

(1) Files to be used

- fhtUini.h ------- Header file for .ini file DLL

- fhtUini.lib ------- Library for .ini file DLL

(2) Function

DWORD fhtGetPrivateProfileString(TCHAR *pszSection, TCHAR *pszKey,

TCHAR *pszDefault, TCHAR *pszReturnBuffer,

DWORD dwReturnBuffer, TCHAR *pszFile);

(3) Parameter

pszSection : Pointer to a null-terminated string that specifies the name

of the section containing the key name. If this parameter is

NULL, the fhtGetPrivateProfileString function copies all

section names in the file to the supplied buffer.

pszKey : Pointer to the null-terminated string specifying the name of

the key whose associated string is to be retrieved. If this

parameter is NULL, all key names in the section specified by

the lpAppName parameter are copied to the buffer specified

by the pszReturnBuffer parameter.

pszDefault : Pointer to a null-terminated default string. If the

pszKey key cannot be found in the initialization file,

fhtGetPrivateProfileString copies the default string to the

pszReturnBuffer buffer. This parameter cannot be NULL.

pszReturnBuffer: Pointer to the buffer that receives the retrieved string.

Strings containing control characters may be truncated.

dwReturnBuffer: Size of the buffer pointed to by the pszReturnBuffer

parameter, in TCHARs.

pszFile : Pointer to a null-terminated string that specifies the name

of the initialization file. If this parameter does not

contain a full path to the file, the system searches for the

file in the Windows directory.

(4) Return value

The return value is the number of characters copied to the buffer, not

including the terminating null character.

If neither pszSection nor pszKey is NULL and the supplied destination

buffer is too small to hold the requested string, the string is truncated

and followed by a null character, and the return value is equal to

dwReturnBuffer minus one.

If either pszSection or pszKey is NULL and the supplied destination buffer

is too small to hold all the strings, the last string is truncated and

followed by two null characters. In this case, the return value is equal

to dwReturnBuffer minus two.

(5) Example

When getting the character string correlated to the "Key" key within the

"Section" section of the \Temp\Sample.ini file.

DWORD dwValue;

TCHAR szString[129];

Page 35: Fujitsu Programing

dwValue=fhtGetPrivateProfileString(TEXT("Section"),

TEXT("Key"),

TEXT("Default"),

szString,

129,

TEXT("\Temp\Sample.ini"));

4.5.4 Replaces the keys and values for the specified section

----------------------------------------------------------------------------

The fhtWritePrivateProfileSection function replaces the keys and values for

the specified section in an initialization file.

The data in the buffer pointed to by the pszKeysAndValues parameter consists

of one or more null-terminated strings, followed by a final null character.

Each string has the following form:

key=string

The fhtWritePrivateProfileSection function is not case-sensitive; the string

pointed to by the pszSection parameter can be a combination of uppercase and

lowercase letters.

If no section name matches the string pointed to by the pszSection parameter,

fhtWritePrivateProfileSection creates the section at the end of the specified

initialization file and initializes the new section with the specified key

name and value pairs.

fhtWritePrivateProfileSection deletes the existing keys and values for the

named section and inserts the key names and values in the buffer pointed to by

the pszKeysAndValues parameter. The function does not attempt to correlate old

and new key names; if the new names appear in a different order from the old

names, any comments associated with preexisting keys and values in the

initialization file will probably be associated with incorrect keys and

values.

This operation is atomic; no operations that read from or write to the

specified initialization file are allowed while the information is being

written.

(1) Files to be used

- fhtUini.h ------- Header file for .ini file DLL

- fhtUini.lib ------- Library for .ini file DLL

(2) Function

BOOL fhtWritePrivateProfileSection(TCHAR *pszSection,

TCHAR *pszKeyAndValues,

TCHAR *pszFile);

(3) Parameter

pszSection : Pointer to a null-terminated string specifying the name

of the section in which data is written.

pszKeysAndValues: Pointer to a buffer containing the new key names and

associated values that are to be written to the named

section. This string is limited to 65,535 bytes.

pszFile : Pointer to a null-terminated string containing the name of

the initialization file. If this parameter does not contain

a full path for the file, the function searches the Windows

directory for the file. However, the specified directory must

already exist.

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

Page 36: Fujitsu Programing

(5) Example

When deleting all the keys of the "Section" section of the \Temp\Sample.ini

file, and the values correlated to that key, and changing to the specified

new key and value.

BOOL bResult;

TCHAR szKeyAndValue[129];

memset(szKeyAndValue,0,sizeof(TCHAR)* 129);

_tcscpy(szKeyAndValue,TEXT("Key1=String"));

_tcscpy(szKeyAndValue,[_tcslen(TEXT("Key1=String"))+1],TEXT(Key2=222"));

bResult=fhtWritePrivateProfileSection(TEXT("Section"),szKeyAndValue,

TEXT("\Temp\Sample.ini"));

4.5.5 Copies a string into the specified section

----------------------------------------------------------------------------

The fhtWritePrivateProfileString function copies a string into the specified

section of an initialization file.

A section in the initialization file must have the following form:

[section]

key=string

If the pszFile parameter does not contain a full path and file name for the

file, fhtWritePrivateProfileString searches the Windows directory for the

file. If the file does not exist, this function creates the file in the

Windows directory.

(1) Files to be used

- fhtUini.h ------- Header file for .ini file DLL

- fhtUini.lib ------- Library for .ini file DLL

(2) Function

BOOL fhtWritePrivateProfileString(TCHAR *pszSection,

TCHAR *pszKey,

TCHAR *pszString,

TCHAR *pszFile);

(3) Parameter

pszSection : Pointer to a null-terminated string containing the name of

the section to which the string will be copied. If the

section does not exist, it is created. The name of the

section is case-independent; the string can be any

combination of uppercase and lowercase letters.

pszKey : Pointer to the null-terminated string containing the name of

the key to be associated with a string. If the key does not

exist in the specified section, it is created. If this

parameter is NULL, the entire section, including all entries

within the section, is deleted.

pszString : Pointer to a null-terminated string to be written to the

file. If this parameter is NULL, the key pointed to by the

pszKey parameter is deleted.

pszFile : Pointer to a null-terminated string that specifies the name

of the initialization file.

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

Page 37: Fujitsu Programing

When searching for the "Key" key of the "Section" section of the

\Temp\Sample.ini file and changing the value correlated to that key to

the specified new value.

BOOL bResult;

bResult=fhtWritePrivateProfileString(TEXT("Section"),TEXT("Key"),

TEXT("newvalue"),

TEXT("\Temp\Sample.ini"));

-------------------------------------------------------------------------------

4.6 Trace

-------------------------------------------------------------------------------

This device provides a function to output a log file for applications file.

Enter or edit the settings in the following registry to output the log.

* If no setting are entered in the registry, the device operates with

the default values listed below.

[HKEY_LOCAL_MACHINE\TEAMPADKEY\Trace]

"StringLevel"=dword:2 ;String trace level settings

"FileLog"=dword:1 ;String trace file output enabled flag

"FileName"="\Temp\TraceLog.txt" ;String trace output file name

"FileSize"=dword:200 ;String trace Max file size

; (Kbytes)

"Backup"=dword:1 ;String trace file generation

; Number of backups

Example: When creating TraceLog.txt file in the \FlashDisk folder.

[HKEY_LOCAL_MACHINE\TEAMPADKEY\Trace]

"FileName"="\FlashDisk\TraceLog.txt"

Example: When disabling log output.

[HKEY_LOCAL_MACHINE\TEAMPADKEY\Trace]

"FileLog"=dword:0

4.6.1 Char type String trace log output

-------------------------------------------------------------------------------

In accordance with the settings for the specified char type String, output

the log data to the specified file.

In the case of the fhtTraceString function, output is to a file in a format

where the current date and time are added to the log. Moreover, even when

a line feed (CR+LF) is not specified, output is in a format where the line

feed code is added.

In the case of the fhtTraceString0 function, output is to the file in a

format where the specified log data remains unchanged.

(1) Files to be used

- fhtUtrace.h ------- Header file for Trace DLL

- fhtUtrace.lib ------- Library for Trace DLL

(2) Function

BOOL fhtTraceString(DWORD TraceLevel, const char *pString);

BOOL fhtTraceString0(DWORD TraceLevel, const char *pString);

(3) Parameter

TraceLevel : Trace log output level (1 to 3)

When the set value level of "StringLevel" key to the registry

is the same or higher than a specified value of this parameter,

the trace log data is output to the file.

pString : Pointer to the character string for CHAR type ending in NULL,

Page 38: Fujitsu Programing

including the format control

specifier (maximum 255 characters).

FormatString can be used in the same way as printf.

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

When carrying out output of trace log data using the fhtTraceString function.

BOOL bRet;

bRet = fhtTraceString(2, "error = %d\r\n",GetLastError());

if(!bRet) goto Error_Exit;

- File log output contents

"YYYY/MM/DD HH:MM:SS xxxxxxxx error = 101"

* "xxxxxxxx": Indicates the management pointer.

4.6.2. TCHAR type String trace log output

-------------------------------------------------------------------------------

In accordance with the settings for the specified TCHAR type String,

output the log data to the specified file.

In the case of the fhtTraceStringW function, output is to the file in a

format where the current date and time are added to the log data.

Moreover, even when the line feed (CR+LF) is not specified,

output is in a format where the line feed code is added.

In the case of the fhtTraceStringw0 function, output is to the file in

a format where the specified log data remains unchanged.

(1) Files to be used

- fhtUtrace.h ------- Header file for Trace DLL

- fhtUtrace.lib ------- Library for Trace DLL

(2) Function

BOOL fhtTraceStringW(DWORD TraceLevel, const TCHAR *pString);

BOOL fhtTraceStringW0(DWORD TraceLevel, const TCHAR *pString);

(3) Parameter

TraceLevel : Trace log output level (1 to 3)

When the set value level of "StringLevel" key to the registry

is the same or higher than a specified value of this parameter,

the trace log data is output to the file.

pString : Pointer to the character string for the TCHAR type ending in

NULL, including the format control specifier (maximum 255

characters).

FormatString can be used in the same way as wprintf.

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

When outputting trace log data using the fhtTraceStringW function.

BOOL bRet;

bRet = fhtTraceStringW(2, TEXT("error = %d\r\n"),GetLastError());

if(!bRet) goto Error_Exit;

Page 39: Fujitsu Programing

- File log output contents

"YYYY/MM/DD HH:MM:SS xxxxxxxx error = 101"

* "xxxxxxxx": Indicates the management pointer.

===============================================================================

5. API for Visual Basic.NET

===============================================================================

The method to use in Visual Basic.NET, the exclusive function library that

provides functions specific to this device, is mentioned here.

In this chapter, the method for Visual Basic.NET is noted as functions.

-------------------------------------------------------------------------------

5.1 Power Control

-------------------------------------------------------------------------------

5.1.1 Enable/Disable 'PWR' key

-------------------------------------------------------------------------------

This function is capable to enable/disable the power OFF switch through the

application program in order to prevent power OFF from careless operation of

application process.

(1) Files to be used

- fhtUpow.vb -------- Class file for Power control DLL

(2) Format

Declare Function fhtGetSetPowkeyStatus Lib "fhtUpow.dll" ( _

ByVal dwGetSetCmd As Integer, _

ByRef pdwStatus As Integer, _

ByRef pdwErrDetail As Integer _

) As Boolean

(3) Parameter

dwGetSetCmd : Command which designates to get or set status of 'PWR' key

control.

0(POW_GET_STATUS) Get 'PWR' key status

1(POW_SET_STATUS) Set 'PWR' key status

pdwStatus : Buffer pointer to store 'PWR' key status.

In case of getting status, the status return to designated

buffer. In case of setting status, set the status which you

wish to set.

Values of 'PWR' key status are as follows;

0(POW_SW_DISABLE) Power off disable by 'PWR' key

1(POW_SW_ENABLE) Power off enable by 'PWR' key

pdwErrDetail: Buffer pointer to return error detail code

If you need no error detail code, you can designate Nothing.

In case that returned value is False, it returns the

following error detail code.

101 Parameter error

102 System error(Lack of resource or others)

(4) Return value

Return processed result

True : Success

False: Failure

(5) Example

In case when the 'PWR' key is disabled.

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim iCommand As Integer

Dim iStatus As Integer

Dim iErrDetail As Integer

Dim bReturn As Boolean

Page 40: Fujitsu Programing

' Get 'PWR' key status

iCommand = cLibrary.POW_GET_STATUS

bReturn = cLibrary.fhtGetSetPowkeyStatus(iCommand, iStatus, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

If (cLibrary.POW_SW_ENABLE = iStatus) Then

' Mask 'PWR' key

iCommand = cLibrary.POW_SET_STATUS

iStatus = cLibrary.POW_SW_DISABLE

bReturn = cLibrary.fhtGetSetPowkeyStatus(iCommand, iStatus, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

End If

5.1.2 Force A Suspend

-------------------------------------------------------------------------------

This function is capable to enter the unit into Suspend mode through

application program.

(1) Files to be used

- fhtUpow.vb -------- Class file for Power control DLL

(2) Function

Declare Function fhtSetPowerDown Lib "fhtUpow.dll" ( _

ByVal dwResume As Integer, _

ByRef pdwErrDetail As Integer _

) As Boolean

(3) Parameter

dwResume : Setting of next power ON mode.

0 Resume

&H55AA55AA Warm Boot

pdwErrDetail : Buffer pointer to return error detail code

If you need no error detail code, you can designate Nothing.

In case that returned value is False, it returns the

following error detail code.

101 Parameter error

102 System error

(Lack of resource or others)

103 System busy

(Suspend can't transit)

104 'PWR' key event is masked

(4) Return value

Return processed result

True : Success

False: Failure

(5) Example

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim iResume As Integer

Dim iErrDetail As Integer

Dim bReturn As Boolean

' Setting Suspend

iResume = cLibrary.POW_SYSTEM_RESUME

bReturn = cLibrary.fhtSetPowerDown(iResume, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

Page 41: Fujitsu Programing

5.1.3 Set power ON Mode

-------------------------------------------------------------------------------

This function has a capability to set power ON mode.

In case of warm boot setting, TeamPad500G restarts after power ON.

(1) Files to be used

- fhtUpow.vb -------- Class file for Power control DLL

(2) Function

Declare Function fhtSetPowonSeq Lib "fhtUpow.dll" ( _

ByVal dwResume As Integer, _

ByRef pdwErrDetail As Integer _

) As Boolean

(3) Parameter

dwResume : Setting of power ON mode.

0 Resume

&H55AA55AA Warm Boot

pdwErrDetail: Buffer pointer to return error detail code

If you need no error detail code, you can designate Nothing.

In case that returned value is False, it returns the

following error detail code.

101 Parameter error

102 System error(Lack of resource or others)

(4) Return value

Return processed result

True : Success

False: Failure

(5) Example

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim iResume As Integer

Dim iErrDetail As Integer

Dim bReturn As Boolean

'/ Setting Warm Boot mode

iResume = cLibrary.POW_SYSTEM_WARM

bReturn = cLibrary.fhtSetPowonSeq(iResume, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

5.1.4 Back Light of Screen

-------------------------------------------------------------------------------

This function has a capability to set Back light ON/OFF and to adjust

Brightness or to get their status.

(1) Files to be used

- fhtUpow.vb -------- Class file for Power control DLL

(2) Function

Declare Function fhtGetSetBacklight Lib "fhtUpow.dll" ( _

ByVal dwGetSetCmd As Integer, _

ByRef pdwValue As Integer, _

ByRef pdwErrDetail As Integer _

) As Boolean

(3) Parameter

dwGetSetCmd : Command which designates to get or set status of Back light

or Contrast.

4(GET_LIGHT) Get Back light status

Page 42: Fujitsu Programing

5(SET_LIGHT) Set Back light status

pdwValue : Buffer pointer to designate brightness value of Back light.

In case of getting status, the status returns to designated

buffer. In case of setting status, set the status which you

wish to change.

Back light value is follows;

0 Back light Off

1-128 Brightness value

pdwErrDetail: Buffer pointer to return error detail code

If you do not need error detail code, you can designate Nothing.

In case that returned value is False, it returns the follow

error detail code.

101 Parameter error

102 System error(Lack of resource or others)

(4) Return value

Return processed result

True : Success

False: Failure

(5) Example

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim iCommand As Integer

Dim iValue As Integer

Dim iErrDetail As Integer

Dim bReturn As Boolean

' Get Back light status

iCommand = cLibrary.GET_LIGHT

bReturn = cLibrary.fhtGetSetBacklight(iCommand, iValue, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

If (Not (100 = iValue)) Then

' set back-light

iCommand = cLibrary.SET_LIGHT

iValue = 100

bReturn = cLibrary.fhtGetSetBacklight(iCommand, iValue, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

End If

5.1.5 Read Battery Status

-------------------------------------------------------------------------------

This function has a capability to get main-battery status.

(1) Files to be used

- fhtUpow.vb -------- Class file for Power control DLL

(2) Function

Declare Function fhtBatteryGetStatus2 Lib "fhtUpow.dll" ( _

<System.Runtime.InteropServices.In(), _

System.Runtime.InteropServices.Out()> _

ByVal pSystemPowerStatusEx As SYSTEM_POWER_STATUS_EX2, _

ByRef pwCharge As Short, _

ByRef pdwErrDetail As Integer _

)As Boolean

(3) Parameter

pSystemPowerStatusEx: Pointer to structure of battery status information.

pwCharge : Pointer to the number of times for battery charge/discharge.

Note this value is not supported in TeamPad500G.

pdwErrDetail: Buffer pointer to return error detail code

Page 43: Fujitsu Programing

If you do not need error detail code, you can designate Nothing.

In case that returned value is False, it returns the

following error detail code.

101 Parameter error

102 System error(Lack of resource or others)

- Structure of battery status information

<StructLayout(LayoutKind.Sequential)>Public Class SYSTEM_POWER_STATUS_EX2

Byte ACLineStatus;

Public ACLineStatus As Byte

Public BatteryFlag As Byte

Public BatteryLifePercent As Byte

Public Reserved1 As Byte

Public BatteryLifeTime As Integer

Public BatteryFullLifeTime As Integer

Public Reserved2 As Byte

Public BackupBatteryFlag As Byte

Public BackupBatteryLifePercent As Byte

Public Reserved3 As Byte

Public BackupBatteryLifeTime As Integer

Public BackupBatteryFullLifeTime As Integer

Public BatteryVoltage As Integer

Public BatteryCurrent As Integer

Public BatteryAverageCurrent As Integer

Public BatteryAverageInterval As Integer

Public BatterymAHourConsumed As Integer

Public BatteryTemperature As Integer

Public BackupBatteryVoltage As Integer

Public BatteryChemistry As Byte

End Class

ACLineStatus :Status of AC Line

0 AC off line

1 AC on line

255 Unknown Status

BatteryFlag : Status of main battery

1 Good

4 Critical

255 Unknown Status

BatteryLifePercent : Remaining amount of main battery

Return 0 to 100

255 Unknown Status

BatteryLifeTime : Remaining time of main battery

TeamPad500G returns value of Unknown Status.

-1 Unknown Status

BatteryFullLifeTime : Operating time for main battery full

TeamPad500G returns value of Unknown Status.

-1 Unknown Status

BackupBatteryFlag : Status of sub battery

TeamPad500G returns value of Unknown Status.

255 Unknown Status

BackupBatteryLifePercent : Remaining sub battery

TeamPad500G returns value of Unknown Status.

255 Unknown Status

BackuptteryLifeTime : Operating time for remaining sub battery

TeamPad500G returns value of Unknown Status.

-1 Unknown Status

BackupBatteryFullLifeTime : Operating time for full life time of sub

battery

TeamPad500G returns value of Unknown Status.

-1 Unknown Status

BatteryVoltage : Voltage of main battery

TeamPad500G returns voltage of main battery.

BatteryCurrent : TeamPad500G always returns Zero.

BatteryAverageCurrent : Ditto

BatteryAverageInterval : Ditto

BatterymAHourConsumed : Ditto

Page 44: Fujitsu Programing

BatteryTemperature : Ditto

BackupBatteryVoltage : Ditto

BatteryChemistry : Type of battery

TeamPad500G returns BATTERY_CHEMISTRY_LION

0x04 (BATTERY_CHEMISTRY_LION) Lithium Ion battery

(4) Return value

Return processed result

True : Success

False: Failure

(5) Example

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim strPowStatus As New fhtApi.SYSTEM_POWER_STATUS_EX2

Dim iErrDetail As Integer

Dim wCharge As Short

Dim bReturn As Boolean

' Get main-battery status

bReturn = cLibrary.fhtBatteryGetStatus2(strPowStatus, wCharge, iErrDetail)

' main-battery status

Select Case strPowStatus.BatteryFlag

' Good

Case 1

' Crirical

Case 4

' Unknown Status

Case 255

Case Else

End Select

5.1.6 Enable/Disable The Auto Suspend

-------------------------------------------------------------------------------

This function has a capability to set auto power OFF function, or to get

this status.

When no activity detects in specified time, the unit will enter Suspend mode

automatically. Application can disable this automatic Suspend mode.

(1) Files to be used

- fhtUpow.vb -------- Class file for Power control DLL

(2) Function

Declare Function fhtGetSetAutoPwrOff Lib "fhtUpow.dll" ( _

ByVal dwGetSetCmd As Integer, _

ByRef pdwStatus As Integer, _

ByRef pdwErrDetail As Integer _

) As Boolean

(3) Parameter

dwGetSetCmd : Command which designates to get or set status of auto

power OFF function.

0(POW_GET_STATUS) Get auto power OFF function status

1(POW_SET_STATUS) Set auto power OFF function status

pdwStatus : Designate pointer of buffer to Auto power OFF function

status.

Values of auto power OFF function status are as follows;

0(AUT_POWER_OFF) Disable Auto power OFF function

1(AUT_POWER_ON) Enable Auto power OFF function

pdwErrDetail: Buffer pointer to return error detail code.

If you do not need error detail code, you can designate Nothing.

Page 45: Fujitsu Programing

In case that returned value is False, it returns the follow

error detail code.

101 Parameter error

102 System error(Lack of resource or others)

(4) Return value

Return processed result

True : Success

False: Failure

(5) Example

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim iCommand As Integer

Dim iStatus As Integer

Dim iErrDetail As Integer

Dim bReturn As Boolean

' Get auto power OFF function status

iCommand = cLibrary.POW_GET_STATUS

bReturn = cLibrary.fhtGetSetAutoPwrOff(iCommand, iStatus, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

If (cLibrary.AUTO_POWEROFF_ENABLE = iStatus) Then

' Disable Auto power OFF function

iCommand = cLibrary.POW_SET_STATUS

iStatus = cLibrary.AUTO_POWEROFF_DISABLE

bReturn = cLibrary.fhtGetSetAutoPwrOff(iCommand, iStatus, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

End If

5.1.7 Wait For Resume Started

-------------------------------------------------------------------------------

This function has a capability to know beginning of resuming (power-on).

This function does not return to application until the system begins

resuming. Make a thread to use this function.

(1) Files to be used

- fhtUpow.vb -------- Class file for Power control DLL

(2) Function

Declare Function fhtResumeWait Lib "fhtUpow.dll" ( _

ByRef pdwErrDetail As Integer _

) As Boolean

(3) Parameter

pdwErrDetail: Buffer pointer to return error detail code.

If you do not need error detail code, you can designate Nothing.

In case that returned value is False, it returns the follow

error detail code.

102 System error (Lack of resource or others)

103 System busy (Suspend can't transit)

(4) Return value

Return processed result

True : Success

False: Failure

(5) Example

Private Sub Button1_Click(ByVal sender As System.Object, _

ByVal e As System.EventArgs) Handles Button1.Click

Page 46: Fujitsu Programing

Dim cResumeThreadStart As System.Threading.ThreadStart

Dim cResumeThread As System.Threading.Thread

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim iErrDetail As Integer

Dim bReturn As Boolean

' Make a thread to check beginning of resuming.

cResumeThreadStart = New System.Threading.ThreadStart( _

AddressOf fvResumeThread)

cResumeThread = New System.Threading.Thread(cResumeThreadStart)

Try

cResumeThread.Start()

Catch

MessageBox.Show("ThreadStart fail.", "SampleResume")

End Try

End Sub

Private Sub fvResumeThread()

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim iErrDetail As Integer

Dim bReturn As Boolean

Dim szString As String

' Wait for beginning of Resuming

bReturn = cLibrary.fhtResumeWait(iErrDetail)

If (True = bReturn) Then

MessageBox.Show("Resume", "SampleResume")

Else

String.Format(szString, "Fail [{0}]", iErrDetail)

MessageBox.Show(szString, "SampleResume")

End If

End Sub

5.1.8 Stop Waiting For Resume Started

-------------------------------------------------------------------------------

This function stops the fhtResumeWait function which waits for resuming

(power-on).

(1) Files to be used

- fhtUpow.vb -------- Class file for Power control DLL

(2) Function

Declare Function fhtResumeWaitDone Lib "fhtUpow.dll" ( _

ByRef pdwErrDetail As Integer _

) As Boolean

(3) Parameter

pdwErrDetail: Buffer pointer to return error detail code.

If you do not need error detail code, you can designate Nothing.

In case that returned value is False, it returns the follow

error detail code.

102 System error(Lack of resource or others)

(4) Return value

Return processed result

True : Success

False: Failure

(5) Example

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim iErrDetail As Integer

Dim bReturn As Boolean

Dim szString As String

Page 47: Fujitsu Programing

' Stop Waiting For Resume Started

bReturn = cLibrary.fhtResumeWaitDone(iErrDetail)

If (True = bReturn) Then

' Normal

MessageBox.Show("Done", "SampleResume")

Else

' Failure

String.Format(szString, "fhtResumeWaitDone fail[{0}]", iErrDetail)

MessageBox.Show(szString, "SampleResume")

End If

-------------------------------------------------------------------------------

5.2 Serial communication

-------------------------------------------------------------------------------

Serial devices can be accessed through the file I/O function. Power can be

supplied to each serial device by calling the CreateFile function,

and power can be cut-off by calling the CloseHandle function. However,

regarding the serial port wherein multiple devices can be connected

(when extended), it is necessary to use the function described in

"5.2.2 Connect Peripheral To COM Port";

keep the function selected prior to powering the serial port.

This device supports 6 serial port interfaces (COM1, COM2, COM3, COM5, COM6

and COM7).

The connections for each port are shown below.

*=== CAUTION ==============================================================*

| - In the port where the 1 device is allocated to 1 port, there is no |

| necessity for using this facilities at all. |

*==========================================================================*

- COM1 -- Mechanical RS232 Port

- COM2 -- Integrated Scanner

- COM3 -- IrCOMM

- COM5 -- PortA:IrDA Multiplex

PortD:Magnetic Stripe Reader(Track 1 and 2 card reader)

PortE:Magnetic Stripe Reader(Track 2 and 3 card reader)

- COM6 -- IrDA

- COM7 -- USB (Slave port)

5.2.1 Get COM Port Status

-------------------------------------------------------------------------------

This device provides a method to obtain the connection status for each

COM port.

(1) Files to be used

- fhtUmpx.vb --------- Class file for COM MPX control DLL

(2) Function

Declare Function MpxGetPort Lib "fhtUmpx.dll" ( _

ByVal dwCom As Integer, _

ByRef pdwPort As Integer, _

ByRef pbPow As Integer, _

ByRef pbyRfStatus As Byte, _

ByRef pbyInService As Byte, _

ByRef pdwErr As Integer _

) As Boolean

(3) Parameter

dwCom : Specify the port for which the connection status is to be

obtained.

1 (MPX_COM1) Get the status of COM1

Page 48: Fujitsu Programing

2 (MPX_COM2) Get the status of COM2

5 (MPX_COM5) Get the status of COM5

6 (MPX_COM6) Get the status of COM6

pdwPort : Specify the pointer for the buffer that returns the

connection device on COM, specified in the first parameter

of dwCom.

0 (PORT_A)

3 (PORT_D)

4 (PORT_E)

pbPow : Specify the pointer for the buffer that returns the

power status of the connection device on COM, specified

in the first parameter of dwCom.

0 (POWOFF)

1 (POWON)

pbyRfStatus : Reserve parameter

Specify NULL.

pbyInService : Reserve parameter

Specify NULL.

pdwErr : Specify the pointer for the buffer that returns the Error

Detail Code.

When the return value is FALSE, return the following Error

Detail Code.

0 No error (Successful)

101 Parameter error

104 The power for the device is in the OFF status during

the power supply to the port

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example: In case when getting the port status of COM5:

Dim cLibrary As New fhtApi.fhtUmpx ' fhtUmpx.vb is used

Dim iCom As Integer

Dim iPort As Integer

Dim bPow As Integer

Dim iErrDetail As Integer

Dim bReturn As Boolean

' Get the port status of COM5

iCom = cLibrary.MPX_COM5

bReturn = cLibrary.MpxGetPort(iCom, iPort, bPow, Nothing, Nothing, _

iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

* Note 1: When 104 is reported to pdwErr, close the corresponding port

(CloseHandle function).

5.2.2 Connect Peripheral To COM Port

-------------------------------------------------------------------------------

Since it is not possible to simultaneously use the COM port, the following

functions are provided to select the device to be connected to the COM port.

(1) Files to be used

- fhtUmpx.vb --------- Class file for COM MPX control DLL

Page 49: Fujitsu Programing

(2) Function

Declare Function MpxSetPort Lib "fhtUmpx.dll" ( _

ByVal dwCom As Integer, _

ByVal dwPort As Integer, _

ByRef pdwErr As Integer _

) As Boolean

(3) Parameter

dwCom : Specify the port.

1 (MPX_COM1) Set COM1

2 (MPX_COM2) Set COM2

5 (MPX_COM5) Set COM5

6 (MPX_COM6) Set COM6

dwPort : Specify the connection target device for COM, specified in the

first parameter of dwCom.

0 (PORT_A)

3 (PORT_D)

4 (PORT_E)

pdwErr : Specify the pointer for the buffer that returns the Error

Detail Code.

When the return value is FALSE, return the following Error

Detail Code.

0 No error (Successful)

101 Parameter error

102 Cannot change due to device conflicts

103 Cannot change since the specified COM

is occupied or is in use

104 The power to the device is in OFF status

during the power supply to the port

* Note 2

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example: In case when selecting the PortD device for COM5:

Dim cLibrary As New fhtApi.fhtUmpx ' fhtUmpx.vb is used

Dim iCom As Integer

Dim iPort As Integer

Dim iErrDetail As Integer

Dim bReturn As Boolean

' Select the PortD device of COM5

iCom = cLibrary.MPX_COM5

iPort = cLibrary.PORT_D

bReturn = cLibrary.MpxSetPort(iCom, iPort, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

* Note 2: When 104 is reported to pdwErr, close the corresponding port

(CloseHandle function).

----------------------------------------------------------------------------

5.3 Device Information

----------------------------------------------------------------------------

TeamPad500G has a capability to get device information.

5.3.1 Get Unique ID

----------------------------------------------------------------------------

Page 50: Fujitsu Programing

This function has a capability to get unique ID of each unit.

(1) Files to be used

- fhtUinfo.vb ------- Class file for device information DLL

(2) Function

Declare Function fhtGetUniqueID Lib "fhtUinfo.dll" ( _

ByVal pwic() As Byte _

) As Integer

(3) Parameter

pDeviceInfo: Pointer to structure of device information.

- Structure of device information

typedef struct_UNIQUEID_INFO {

BYTE bID[16];

DWORD dwFFSError;

}

bID : Unique ID Code(16 byes fixed)

dwFFSError: Buffer pointer to return error detail code.

(4) Return value

0 : Success

Other : Failure

(5) Example

Dim cLibrary As New fhtApi.fhtUinfo ' fhtUinfo.vb class file

Dim strUniqueID As New fhtApi.UNIQUEID_INFO ' fhtUinfo.vb class file

Dim iReturn As Integer

Dim iCount As Integer

Dim szString As String

iReturn = cLibrary.fhtGetUniqueID(strUniqueID.Data)

If (0 = iReturn And 0 = strUniqueID.dwFFSError) Then

' Display Unique ID

For iCount = 0 To 15

Console.Write("{0:X02}", strUniqueID.bID(iCount))

If (0 = (iCount + 1) Mod 4) Then

Console.Write(" ")

End If

Next

Else

' Display Eror code

Console.WriteLine("Error {0} {1}", iReturn, strUniqueID.dwFFSError)

End If

----------------------------------------------------------------------------

5.4 USB Configuration

----------------------------------------------------------------------------

In this device, LAN communication uses a LAN adaptor (FHTUL581).

However, before implementing LAN communication with the LAN adaptor

(FHTUL581), it is necessary to enable the LAN adaptor beforehand.

- Method to switch between the communication environments of the USB adaptor

(FHTUA571)/LAN adaptor (FHTUL581)

It is possible to switch between communication environments using any of

the following methods.

1) Switch using "Set communication adaptor" in the control panel

Page 51: Fujitsu Programing

2) Switch using "Specify control panel information" in the installation

settings file (CONFIG.HHT)

3) Switch using the select function (fhtGetSetUSBMode) of the LAN adaptor

network environment.

When using the USB adaptor (FHTUA571) after enabling the LAN adaptor

(FHTUL581), set the USB adaptor (FHTUA571) to enabled with any of the

above-mentioned 1) to 3) methods.

*CAUTION==================================================================*

| - When using the USB adaptor (FHTUA571), do not enable the LAN adaptor |

| (FHTUL581) using the function described in "4.4.1 Select USB Adapetor |

| /LAN Adaptor" The USB adaptor (FHTUA571) communication function |

| cannot be used when the LAN adaptor (FHTUL581) is enabled. |

*=========================================================================*

5.4.1 Select USB Adapetor/LAN Adaptor

----------------------------------------------------------------------------

This device provides a function to set network communication with the LAN

adaptor and the USB adaptor through the application program.

(1) Files to be used

- fhtUpow.vb --------- Class file for power control DLL

(2) Function

Declare Function fhtGetSetUSBMode Lib "fhtUpow.dll" ( _

ByVal dwGetSetCmd As Integer, _

ByRef pdwValue As Integer, _

ByRef pdwErrDetail As Integer _

) As Boolean

(3) Parameter

dwGetSetCmd : Specify whether to obtain or set the status of the

LAN adaptor.

0 (POW_GET_STATUS) Obtain the current setting of the

LAN adaptor

1 (POW_SET_STATUS) Set the status of the LAN adaptor

pdwValue : Specify the pointer for the buffer that stores the status

of the LAN adaptor.

When obtaining the status, the status returns to the

specified buffer.

When specifying the status, set the status to be changed.

Furthermore, the values for the LAN adaptor status are as

follows:

0 (USB_SLAVE) USB adaptor (FHTUA571) communication enabled

1 (USB_HOST) LAN adaptor (FHTUL581) communication enabled

pdwErrDetail : Specify the pointer for the buffer that stores the error

code. When NULL is specified, the error code is not

returned.

101 Parameter error

102 System error(Lack of resource or others)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

In case when setting the LAN adaptor communication environment to enabled.

Dim cLibrary As New fhtApi.fhtUpow ' Use fhtUpow.vb class file

Dim iCommand As Integer

Dim iValue As Integer

Dim iErrDetail As Integer

Page 52: Fujitsu Programing

Dim bReturn As Boolean

' Obtain the settings for the LAN adaptor

iCommand = cLibrary.POW_GET_STATUS

bReturn = cLibrary.fhtGetSetUSBMode(iCommand, iValue, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

' For the USB adaptor, set to LAN adaptor

If (cLibrary.USB_SLAVE = iValue) Then

iCommand = cLibrary.POW_SET_STATUS

iValue = cLibrary.USB_HOST

bReturn = cLibrary.fhtGetSetUSBMode(iCommand, iValue, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

End If

5.4.2 Enable/Disable USB Device

----------------------------------------------------------------------------

The function to control the power supply on/off of the USB device is offered.

(1) Files to be used

- fhtUpow.vb --------- Class file for power control DLL

(2) Function

Declare Function fhtGetSetUSBPower Lib "fhtUpow.dll" ( _

ByVal dwGetSetCmd As Integer, _

ByRef pdwValue As Integer, _

ByRef pdwErrDetail As Integer _

) As Boolean

(3) Parameter

dwGetSetCmd : Command which designates to get or set status of USB device

power ON/OFF.

0 (POW_GET_STATUS) Get status of USB device power ON/OFF

1 (POW_SET_STATUS) Set status of USB device power ON/OFF

pdwValue : Designate pointer of buffer to USB device power supply.

0 (USB_OFF) Power off status

1 (USB_ON) Power on status

pdwErrDetail: Specify the pointer for the buffer that stores the error

code. When NULL is specified, the error code is not

returned.

101 Parameter error

102 System error(Lack of resource or others)

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

In case when it is reconnected with the USB device.

Dim cLibrary As New fhtApi.fhtUpow ' fhtUpow.vb is used

Dim iCommand As Integer

Dim iValue As Integer

Dim iErrDetail As Integer

Dim bReturn As Boolean

' Communication abnormality generation

' Get status of USB device power ON/OFF

Page 53: Fujitsu Programing

iCommand = cLibrary.POW_GET_STATUS

bReturn = cLibrary.fhtGetSetUSBPower(iCommand, iValue, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

' USB device is set off once

If (cLibrary.USB_ON = iValue) Then

iCommand = cLibrary.POW_SET_STATUS

iValue = cLibrary.USB_OFF

bReturn = cLibrary.fhtGetSetUSBPower(iCommand, iValue, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

End If

' Set status of USB device power ON

iCommand = cLibrary.POW_SET_STATUS

iValue = cLibrary.USB_ON

bReturn = cLibrary.fhtGetSetUSBPower(iCommand, iValue, iErrDetail)

If (False = bReturn) Then

GoTo Error_Exit

End If

' The communication is restarted

¥

¥

----------------------------------------------------------------------------

5.5 initialization file function

----------------------------------------------------------------------------

In this device, the function of initialization file (ini file) operation is

being offered.

5.5.1 Obtaining the integer correlated to a specific key

----------------------------------------------------------------------------

The fhtGetPrivateProfileInt function retrieves an integer associated with

a key in the specified section of an initialization file. The function

searches the file for a key that matches the name specified by the lpKeyName

parameter under the section name specified by the lpAppName parameter. A

section in the initialization file must have the following form:

[section]

key=value

¥

¥

¥

The fhtGetPrivateProfileInt function is not case-sensitive; the strings in

pszSection and pszKey can be a combination of uppercase and lowercase

letters.

(1) Files to be used

- fhtUini.vb ------- Class file for .ini file DLL

(2) Function

Declare Function fhtGetPrivateProfileInt Lib "fhtUini.dll" ) _

ByVal pszSection As String, _

ByVal pszKey As String, _

ByVal dwDefault As Integer, _

ByVal pszFile As String _

) As Integer

(3) Parameter

pszSection : Pointer to a null-terminated string specifying the name of

the section in the initialization file.

Page 54: Fujitsu Programing

pszKey : Pointer to the null-terminated string specifying the name of

the key whose value is to be retrieved.

dwDefault : Default value to return if the key name cannot be found in

the initialization file.

pszFile : Pointer to a null-terminated string that specifies the name

of the initialization file.

(4) Return value

The return value is the integer equivalent of the string following the

specified key name in the specified initialization file. If the key is not

found, the return value is the specified default value.

(5) Example

When obtaining the integer value correlated to "Key" within the "Section"

section of the \Temp\Sample.ini file:

Dim cLibrary As New fhtApi.fhtUini ' fhtUini.vb is used

Dim iValue As Integer

iValue = cLibrary.fhtGetPrivateProfileInt("Section", "Key", 1, _

"\Temp\Sample.ini")

5.5.2 Obtaining all the keys and values

----------------------------------------------------------------------------

The fhtGetPrivateProfileSection function retrieves all the keys and values

for the specified section of an initialization file. The data in the buffer

pointed to by the pszReturnBuffer parameter consists of one or more

null-terminated strings, followed by a final null character.

Each string has the following format:

key=string

The fhtGetPrivateProfileSection function is not case-sensitive; the string

pointed to by the pszSection parameter can be a combination of uppercase and

lowercase letters. This operation is atomic; no updates to the specified

initialization file are allowed while the key name and value pairs for the

section are being copied to the buffer pointed to by the pszReturnBuffer

parameter.

The comment line that starts by the semicolon is deleted, and it doesn't store

it in the buffer that the pszReturnBuffer parameter indicates.

(1) Files to be used

- fhtUini.vb ------- Class file for .ini file DLL

(2) Function

Declare Function fhtGetPrivateProfileSection Lib "fhtUini.dll" ( _

ByVal pszSection As String, _

ByVal pszReturnBuffer As String, _

ByVal dwBuffer As Integer, _

ByVal pszFile As String _

) As Integer

(3) Parameter

pszSection : Pointer to a null-terminated string specifying the name of

the section in the initialization file.

pszReturnBuff: Pointer to a buffer that receives the key name and value

pairs associated with the named section. The buffer is

filled with one or more null-terminated strings; the last

string is followed by a second null character.

dwBuffer : Size of the buffer pointed to by the pszReturnBuffer

Page 55: Fujitsu Programing

parameter, in TCHARs.

pszFile : Pointer to a null-terminated string that specifies the name

of the initialization file. If this parameter does not

contain a full path to the file, the system searches for

the file in the Windows directory.

(4) Return value

The return value specifies the number of characters copied to the buffer,

not including the terminating null character. If the buffer is not large

enough to contain all the key name and value pairs associated with the

named section, the return value is equal to nSize minus two.

(5) Example

When getting the value correlated to all keys within the "Section" section

of the \Temp\Sample.ini file.

Dim cLibrary As New fhtApi.fhtUini ' fhtUini.vb is used

Dim iValue As Integer

Dim szString As New String(Char.MinValue, 129)

iValue = cLibrary.fhtGetPrivateProfileSection("Section", szString, _

129, "\Temp\Sample.ini")

5.5.3 Obtaining the character string correlated to the key

----------------------------------------------------------------------------

The fhtGetPrivateProfileString function retrieves a string from the specified

section in an initialization file. The fhtGetPrivateProfileString function

searches the specified initialization file for a key that matches the name

specified by the pszKey parameter under the section heading specified by

the pszSection parameter. If it finds the key, the function copies the

corresponding string to the buffer. If the key does not exist, the function

copies the default character string specified by the pszDefault parameter.

A section in the initialization file must have the following form:

[section]

key=string

¥

¥

¥

If pszSection is NULL, fhtGetPrivateProfileString copies all section names in

the specified file to the supplied buffer. If pszKey is NULL, the function

copies all key names in the specified section to the supplied buffer. An

application can use this method to enumerate all of the sections and keys in a

file. In either case, each string is followed by a null character and the

final string is followed by a second null character. If the supplied

destination buffer is too small to hold all the strings, the last string is

truncated and followed by two null characters.

If the string associated with pszKey is enclosed in single or double quotation

marks, the marks are discarded when the fhtGetPrivateProfileString function

retrieves the string.

The fhtGetPrivateProfileString function is not case-sensitive; the strings can

be a combination of uppercase and lowercase letters.

(1) Files to be used

- fhtUini.vb ------- Class file for .ini file DLL

(2) Function

Declare Function fhtGetPrivateProfileString Lib "fhtUini.dll" ( _

ByVal pszSection As String, _

ByVal pszKey As String, _

ByVal pszDefault As String, _

Page 56: Fujitsu Programing

ByVal pszReturnBuffer As String, _

ByVal dwReturnBuffer As Integer, _

ByVal pszFile As String _

) As Integer

(3) Parameter

pszSection : Pointer to a null-terminated string that specifies the name

of the section containing the key name. If this parameter is

NULL, the fhtGetPrivateProfileString function copies all

section names in the file to the supplied buffer.

pszKey : Pointer to the null-terminated string specifying the name of

the key whose associated string is to be retrieved. If this

parameter is NULL, all key names in the section specified by

the lpAppName parameter are copied to the buffer specified

by the pszReturnBuffer parameter.

pszDefault : Pointer to a null-terminated default string. If the

pszKey key cannot be found in the initialization file,

fhtGetPrivateProfileString copies the default string to the

pszReturnBuffer buffer. This parameter cannot be NULL.

pszReturnBuffer: Pointer to the buffer that receives the retrieved string.

Strings containing control characters may be truncated.

dwReturnBuffer: Size of the buffer pointed to by the pszReturnBuffer

parameter, in TCHARs.

pszFile : Pointer to a null-terminated string that specifies the name

of the initialization file. If this parameter does not

contain a full path to the file, the system searches for the

file in the Windows directory.

(4) Return value

The return value is the number of characters copied to the buffer, not

including the terminating null character.

If neither pszSection nor pszKey is NULL and the supplied destination

buffer is too small to hold the requested string, the string is truncated

and followed by a null character, and the return value is equal to

dwReturnBuffer minus one.

If either pszSection or pszKey is NULL and the supplied destination buffer

is too small to hold all the strings, the last string is truncated and

followed by two null characters. In this case, the return value is equal

to dwReturnBuffer minus two.

(5) Example

When getting the character string correlated to the "Key" key within the

"Section" section of the \Temp\Sample.ini file.

Dim cLibrary As New fhtApi.fhtUini ' fhtUini.vb is used

Dim iValue As Integer

Dim szString As New String(Char.MinValue, 129)

iValue = cLibrary.fhtGetPrivateProfileString("Section", "Key", "Default", _

szString, 129, "\Temp\Sample.ini")

5.5.4 Replaces the keys and values for the specified section

----------------------------------------------------------------------------

The fhtWritePrivateProfileSection function replaces the keys and values for

the specified section in an initialization file.

The data in the buffer pointed to by the pszKeysAndValues parameter consists

of one or more null-terminated strings, followed by a final null character.

Each string has the following form:

key=string

Page 57: Fujitsu Programing

The fhtWritePrivateProfileSection function is not case-sensitive; the string

pointed to by the pszSection parameter can be a combination of uppercase and

lowercase letters.

If no section name matches the string pointed to by the pszSection parameter,

fhtWritePrivateProfileSection creates the section at the end of the specified

initialization file and initializes the new section with the specified key

name and value pairs.

fhtWritePrivateProfileSection deletes the existing keys and values for the

named section and inserts the key names and values in the buffer pointed to by

the pszKeysAndValues parameter. The function does not attempt to correlate old

and new key names; if the new names appear in a different order from the old

names, any comments associated with preexisting keys and values in the

initialization file will probably be associated with incorrect keys and

values.

This operation is atomic; no operations that read from or write to the

specified initialization file are allowed while the information is being

written.

(1) Files to be used

- fhtUini.vb ------- Class file for .ini file DLL

(2) Function

Declare Function fhtWritePrivateProfileSection Lib "fhtUini.dll" ( _

ByVal pszSection As String, _

ByVal pszKeysAndValues As System.Text.StringBuilder, _

ByVal pszFile As String _

) As Boolean

(3) Parameter

pszSection : Pointer to a null-terminated string specifying the name

of the section in which data is written.

pszKeysAndValues: Pointer to a buffer containing the new key names and

associated values that are to be written to the named

section. This string is limited to 65,535 bytes.

pszFile : Pointer to a null-terminated string containing the name of

the initialization file. If this parameter does not contain

a full path for the file, the function searches the Windows

directory for the file. However, the specified directory must

already exist.

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

When deleting all the keys of the "Section" section of the \Temp\Sample.ini

file, and the values correlated to that key, and changing to the specified

new key and value.

Dim cLibrary As New fhtApi.fhtUini ' fhtUini.vb is used

Dim bReturn As Boolean

Dim szKeyAndValue As New System.Text.StringBuilder(129)

szString.Append("Key1=String")

szString.Append(Char.MinValue)

szString.Append("Key2=222")

bReturn = cLibrary.fhtWritePrivateProfileSection("Section", _

szKeyAndValue, "\Temp\Sample.ini")

Page 58: Fujitsu Programing

5.5.5 Copies a string into the specified section

----------------------------------------------------------------------------

The fhtWritePrivateProfileString function copies a string into the specified

section of an initialization file.

A section in the initialization file must have the following form:

[section]

key=string

If the pszFile parameter does not contain a full path and file name for the

file, fhtWritePrivateProfileString searches the Windows directory for the

file. If the file does not exist, this function creates the file in the

Windows directory.

(1) Files to be used

- fhtUini.vb ------- Class file for .ini file DLL

(2) Function

Declare Function fhtWritePrivateProfileString Lib "fhtUini.dll" ( _

ByVal pszSection As String, _

ByVal pszKey As String, _

ByVal pszString As String, _

ByVal pszFile As String _

) As Boolean

(3) Parameter

pszSection : Pointer to a null-terminated string containing the name of

the section to which the string will be copied. If the

section does not exist, it is created. The name of the

section is case-independent; the string can be any

combination of uppercase and lowercase letters.

pszKey : Pointer to the null-terminated string containing the name of

the key to be associated with a string. If the key does not

exist in the specified section, it is created. If this

parameter is NULL, the entire section, including all entries

within the section, is deleted.

pszString : Pointer to a null-terminated string to be written to the

file. If this parameter is NULL, the key pointed to by the

pszKey parameter is deleted.

pszFile : Pointer to a null-terminated string that specifies the name

of the initialization file.

(4) Return value

Return processed result

TRUE : Success

FALSE: Failure

(5) Example

When searching for the "Key" key of the "Section" section of the

\Temp\Sample.ini file and changing the value correlated to that key to

the specified new value.

Dim cLibrary As New fhtApi.fhtUini ' fhtUini.vb is used

Dim bReturn As Boolean

bReturn = cLibrary.fhtWritePrivateProfileString("Section", "Key", _

"newvalue", "\Temp\Sample.ini")

-------------------------------------------------------------------------------

5.6 Trace

-------------------------------------------------------------------------------

Page 59: Fujitsu Programing

This device provides a function to output a log to the application program

file.

Enter or edit the settings in the following registry to output the log.

* If no setting are entered in the registry, the device operates with

the default values listed below.

[HKEY_LOCAL_MACHINE\TEAMPADKEY\Trace]

"StringLevel"=dword:2 ;String trace level settings

"FileLog"=dword:1 ;String trace file output enabled flag

"FileName"="\Temp\TraceLog.txt" ;String trace output file name

"FileSize"=dword:200 ;String trace Max file size

; (Kbytes)

"Backup"=dword:1 ;String trace file generation

; Number of backups

Example: When creating TraceLog.txt file in the \FlashDisk folder.

[HKEY_LOCAL_MACHINE\TEAMPADKEY\Trace]

"FileName"="\FlashDisk\TraceLog.txt"

Example: When disabling log output.

[HKEY_LOCAL_MACHINE\TEAMPADKEY\Trace]

"FileLog"=dword:0

5.6.1 TCHAR type String trace log output

-------------------------------------------------------------------------------

In accordance with the settings for the specified TCHAR type String,

output the log data to the specified file.

In the case of the fhtTraceStringW function, output is to the file in a

format where the current date and time are added to the log data.

Moreover, even when the line feed (CR+LF) is not specified,

output is in a format where the line feed code is added.

In the case of the fhtTraceStringw0 function, output is to the file in

a format where the specified log data remains unchanged.

(1) Files to be used

- fhtUtrace.vb ------- Class file for Trace DLL

(2) Function

Declare Function fhtTraceStringW Lib "fhtUtrace.dll"( _

ByVal TraceLevel As Integer, _

ByVal pString As String _

) As Boolean

Declare Function fhtTraceStringW0 Lib "fhtUtrace.dll"( _

ByVal TraceLevel As Integer, _

ByVal pString As String _

) As Boolean

(3) Parameter

TraceLevel : Trace log output level (1 to 3)

When the specified value of this parameter ? the settings

value for the "StringLevel" key of the registry, output the

trace log data to the file.

pString : Pointer to the character string for the TCHAR type ending in

NULL, including the format control specifier (maximum 255

characters).

FormatString can be used in the same way as wprintf.

(4) Return value

Return processed result

TRUE : Success

Page 60: Fujitsu Programing

FALSE: Failure

(5) Example

When outputting trace log data using the fhtTraceStringW function.

Dim cLibrary As New fhtApi.fhtUtrace ' fhtUtrace.vb is used

Dim bReturn As Boolean

szData = String.Format("error = {0}\r\n", _

System.Runtime.InteropServices.Marshal.GetLastWin32Error())

bReturn = cLibrary.fhtTraceStringW(iLevel, szData)

If (False = bReturn) Then

GoTo Error_Exit

End If

- File log output contents

"YYYY/MM/DD HH:MM:SS xxxxxxxx error = 101"

* "xxxxxxxx": Indicates the management pointer.

===============================================================================

6. Cautions

===============================================================================

-------------------------------------------------------------------------------

6.1 Memory Card

-------------------------------------------------------------------------------

This section describes caution items in case of accessing Memory Card.

(1) Reset switch

In case of reset during the Memory Card is accessed to write file,

there is possibility to have to initialize the Memory Card. Do not press

reset switch during the Memory Card is accessed to be written file.

(2) Power off

If you turn off the TeamPad500G during Memory Card is accessed, subsequent

power ON may makes file-copy fail, the error message may be displayed.

We recommend that you restrict the power OFF by pressing 'PWR' key during

file is accessed.

"4.1.1 Enable/Disable 'PWR' key" explain how to restrict pressing 'PWR' key

to power off.

As preparation for power off during file is accessed, Please check error

after file access and if the error happens, please have retry sequence.

(*): When power on, System checks contents of Memory Card.

If at this moment the TeamPad500G is powered off, next power on may make

system to display error message. Then pleas make continue next procedure

with closing the error message window.

(3) Example of the program during file accessing (Arguments is omitted bellow)

BOOL bCopy;

.

.

Retry_Copy:

// Disable 'PWR' key

fhtGetSetPowkeyStatus(POW_SET_STATUS, POW_SW_DISABLE..)

// File copy

bCopy = CopyFile(szFileName1,szFileName2,.....);

Page 61: Fujitsu Programing

// Enable 'PWR' key

fhtGetSetPowkeyStatus(POW_SET_STATUS, POW_SW_ENABLE..)

// Error check

if(bCopy)

{

iRet = MessageBox(hWnd, ....); // Check retry

if(iRet==ID_YES) goto Retry_Copy;

}

.

.

(4) Precautions when accessing the card data file

This device is equipped with two CF card slots.

However, operations in the two card slots differ as mentioned below

when a file on the card is accessed.

a. When power is switched OFF/ON and a file on the card is open:

1) "Storage Card1" folder (CF card slot on the side of the device)

It is possible to continue and use the open file handle of without

closing the handle.

2) "Storage Card2" folder (PCMCIA card slot on the upper side of the

device)

File handles are forcibly closed, it is necessary to reopen the

file to continue to use it.

b. When the device power is OFF and when replacing the CF card with one of

identical capacity made by another manufacturer:

1) "Storage Card1" folder (CF card slot on the side of the device)

Since the information on the CF card is not updated when the power

is turned ON, the information on the CF card prior to replacement

can be used.

2) "Storage Card2" folder (PCMCIA card slot on the upper side of the

device)

The information on the PCMCIA card is updated after power ON and is

updated with the information on the CF card after the replacement.

When using the card in this device, take note of the following contents.

1) See to it that the user data file, which is to be used at application

runtime, is stored in the built-in flash disk or the "Storage Card1"

folder.

2) When storing the user data file, which is to be used at application

runtime, in "Storage Card1," ensure that the CF card is not inserted

or removed.

3) Basically, use the "Storage Card2" folder for application installations.

-------------------------------------------------------------------------------

6.2 TeamPad-Explorer

-------------------------------------------------------------------------------

TeamPad-Explorer is exclusive use for file management for TeamPad500G.

Do not execute the below operation by TeamPad-Explorer.

- Do not Move/Delete back-up file(s).

If you delete back-up file(s), at auto-restore regarding memory trouble

when battery empty, the files are not restored properly, and the

application program does not work.

Page 62: Fujitsu Programing

-------------------------------------------------------------------------------

6.3 Memory Trouble

-------------------------------------------------------------------------------

TeamPad500G has automatic restore function of back-up application program

when RAM disk initialization happens by battery empty and like.

Regarding designation of the auto restore, please refer "2 Application-

Software Installation".

(1) Warning message

In case that RAM disk is initialized by battery empty and like, the below

warning message is displayed at next booting operation system.

"Warning. Power fail detected. The contents of RAM memory has been lost.

Press 'ENT'+'1' to continue."

(2) How to exit the warning message

You can exit the warning message by the follow procedure.

- Press '1' key with 'ENT' key pressed

After the cancellation, automatic restore function is started.

(3) Automatic restore function

Application programs are recovered by the following operation.

- "date and time property" is displayed. Enter date and time again.

- Program files from back-up media (Memory Card) are copied.

- Short-cut key of Application program is restored.

- Operating environment (registry) is restored.

(*) If back-up information on back-up media is failed, application programs

are not recovered and the TeamPad500G goes back to factory setting

(initial setting).

In that case, reinstalling of application program is required.

(*) This function is only relevant for files that are installed using "Setup

Menu". Please refer "2 Application Software Installation".

-------------------------------------------------------------------------------

6.4 When using the LAN adaptor

-------------------------------------------------------------------------------

Below is an explanation of the precautions for using the LAN adaptor over a

LAN.

(1) LAN Connection established time

It takes several seconds from that the device is attached on the LAN

adaptor to that the network connection actually is established.

Usually, it is about 5 seconds but it also depends on your environment.

(2) When there is an error in LAN communication with the LAN adaptor:

Restart communication after disconnecting and reattaching this device

from the LAN adaptor.

(3) Detaching the LAN adaptor

If this device is detached from the LAN adaptor and the same operation is

attempted within a short period of time, there is a possibility that

Page 63: Fujitsu Programing

the LAN connection will fail. When the LAN connection is not possible,

reset the device.

-------------------------------------------------------------------------------

6.5 Regarding the necessity for regular rebooting of the system

-------------------------------------------------------------------------------

Memory leaks indicate that allocated memory could not be released properly.

In programs that leak memory or when the memory leaks accumulate,

the symptoms include deterioration in performance (or continuous

deterioration) to complete memory insufficiency. Even if the amount of each

memory leak is small, the memory leak accumulates and depletes the memory

with continuous operation of the resume function.

So, it is necessary to reboot the system regularly.

To avoid memory depletion from memory leaks, set a work completion button

in the application, and call the exclusive function fhtSetPowerDown()

in the reboot specification. With this, the device is rebooted when the power

is switched ON the next time.