PA-2400W C Library Manual (Version 1.00) CASIO Computer Co., Ltd. Copyright ©1999. All rights reserved.
Table of Contents Chapter 1 1.1 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 Chapter 2 Chapter 3 3.1 3.2 Chapter 4 4.1 4.2 4.3 4.4 4.5 4.5.1 4.5.2 Chapter 5 5.1 5.2 5.3 5.4 5.5 Chapter 6 6.1 6.2 Chapter 7 7.1 7.2 7.3 7.4 7.5 7.
7.7 7.8 7.8.1 7.9 7.9.1 7.9.2 7.10 7.11 7.12 7.13 Chapter 7.14 7.15 7.15.1 7.15.2 7.15.3 8 8.1 8.2 8.3 8.4 8.4.1 8.4.2 8.5 8.6 8.6.1 8.6.2 8.7 8.8 8.9 8.10 8.
Preface This manual describes the C language-dedicated library functions and utilities that run on the CASIO PA-2400W (hereinafter referred to as "H/PC", which stands for Handheld PC). The PA-2400W uses the Windows CE operating system (Ver. 2.11), and uses the Win32 API functions to generate user application programs. However, more functions may be required if generating a business application, etc.
1. Supported Files The following files will be supported by the C-library functions and utilities described in this manual. Table 1.1 File System Library CasioSys.lib CasioSys.h Function Description CA_BacklightOn CA_BacklightOff CA_BacklightCheck SyncPowerOff DisablePowerOff EnablePowerOff StatusPowerOff Turns on the backlight. Turns off the backlight. Acquires the status of the backlight. Turns off the power after completion of access to card. Disables power off with the power button.
Notes: 1. Since the “SIPanel.dll” and “SIPanel.exe” in English version are pre-installed in the ROM, you do not need to install it every time you use the software input panel. However, if you use other language versions of the SIPanel, you need to replace them. 2. Each library function or utility command can be made available to the user when the DLL/EXE file is copied into the Windows directory on the PA-2400W (see the figure below). Host PC PA-2400W Copy Fig. 1.
1.1 Dedicated Library and Utility 1.1.1 System Library Table 1.2 No. Function CA_BacklightOn 1 CA_BacklightOff 2 CA_BacklightCheck 3 SyncPowerOff 4 DisablePowerOff 5 EnablePowerOff 6 StatusPowerOff 7 8 9 10 11 12 13 1.1.2 ApoCountReset SoftReset SetPowerOnAlarm GetPowerOnAlarm SetPowerEventStat GetPowerEventStat Description Turns on the backlight. Turns off the backlight. Acquires the status of backlight. Turns off after completion of access to a card. Disables power off with the power button.
1.1.4 File Transfer Utility Table 1.5 No. 1 2 3 4 5 6 7 8 File transfer utility Command FLCE /Y FLCE /S FLCE /R FLCE /A FLCE /D FLCE /N FLCE /T FLCE Description Communication environment setup/Idle start File transmission File reception File transmission (append) File deletion File move/File name modification Time transmission Idle start Page 58 59 60 61 62 63 64 65 Description Generation of a list file Comparison of list files Page 81 83 1.1.5 File Check Utility Table 1.6 File check utility No.
2. Development Environment Your own application program can be developed by implementing the CASIO’s dedicated library functions and utility commands listed in the previous pages under the following software development environment. Microsoft Visual C/C++ version 6.0 Microsoft Windows CE Toolkit for Visual C/C++ 6.0 Windows CE version 2.
3. System Library 3.1 Overview This System Library functions can provide you with various dedicated functions such as backlight control, power OFF supplement control, power-ON control with alarm, etc. These functions to be described in the next pages are developed only for the PA-2400W and therefore not guaranteed for use with other hardware platforms. Also, please note that it is not a Windows CE generalpurpose library.
3.2 Details of Function Title Function CA_BacklightOn Turns on the backlight. If this function is called while the backlight is already on, nothing will happen. C Language Interface Calling Sequence BOOL CA_BacklightOn () Parameters None Return Values TRUE Header : Normal end #include Remarks The automatic backlight off will be remained active after this function is called. Duration of the automatic backlight off can be set at the control panel.
Title Function CA_BacklightOff Turns off the backlight. C Language Interface Calling Sequence BOOL CA_BacklightOff() Parameters None Return Values TRUE Header : Normal end #include Remarks This function can turn off the backlight which is turned on by a keyboard operation.
Title Function Acquires the status of the backlight if it is set to on or off. C Language Interface Calling Sequence BOOL CA_BacklightCheck() Parameters None Return Values TRUE FALSE Header : Backlight is on. : Backlight is off. #include
Title Function Turns off the power after access to an installed card is complete. C Language Interface Calling Sequence BOOL SyncPowerOff() Parameters None Return Values TRUE Header : Normal end. #include
Title Function DisablePowerOff Disables power-off with the power button. This setting is cleared when the power is turned on. C Language Interface Calling Sequence BOOL DisablePowerOff() Parameters None Return Values TRUE Header : Normal end. #include
Title Function Enables the power to be turned off with the power button. C Language Interface Calling Sequence BOOL EnablePowerOff() Parameters None Return Values TRUE Header : Normal end. #include
Title Function StatusPowerOff Acquires the status of “enable/disable the power to be turned off with the power button”. C Language Interface Calling Sequence BOOL StatusPowerOff() Parameters None Return Values FALSE TRUE Header : Disable “the power to be turned off with the power button.” : Enable “the power to be turned off with the power button.” #include
Title Function ApoCountReset Resets the counter of APO time. By calling this function before elapse of the APO time set at the control panel, APO can be disabled. C Language Interface Calling Sequence BOOL ApoCountReset() Parameters None Return Values TRUE Header : Normal end. #include
Title Function SoftReset Resets the system. After this function is called, a worm-bootup is performed. C Language Interface Calling Sequence void SoftReset() Parameters None Return Values None Header #include Remarks When this function is called, a warm-bootup is immediately performed. This will cause file and data being accessed to be erased. All files and devices being currently opened must be closed before this function is activated.
Title Function SetPowerOnAlarm Enables or disables “the automatic power-on to be activated with the alarm”. C Language Interface Calling Sequence BOOL SetPowerOnAlarm ( BOOL bMode); Parameters BOOL bMode Return Values TRUE FALSE Header FALSE TRUE : Disables “automatic power-on with the alarm”. : Enables “automatic power-on with the alarm”. (default) : Normal end : Internal error #include
Title Function GetPowerOnAlarm Acquires the status of “automatic power-on with the alarm” if it is disabled or enabled. C Language Interface Calling Sequence BOOL GetPowerOnAlarm() Parameters None Return Values TRUE FALSE Header : Enable “automatic power-on with the alarm”. : Disable “automatic power-on with the alarm”. #include
Title Function SetPowerEventStat Sets “power-on event notification” enabled or disabled. C Language Interface Calling Sequence BOOL SetPowerEventStat( BOOL bMode) Parameters BOOL bMode Return Values Header TRUE FALSE : Enable “power-on event notification”. : Disable “power-on event notification”. (default) TRUE FALSE : Normal end : Failure in opening registry #include Remarks Settings by using this function remain active even after a RESET is performed.
Sample program to acquire power-on event notification #include
Title Function Acquires the status of “power-on event notification” if it is enabled or disabled. C Language Interface Calling Sequence BOOL GetPowerEventStat() Parameters None Return Values TRUE FALSE Header : Enable notification. : Disable notification. #include
4. SIPanel Library 4.1 Overview In this chapter, the SIPanel which is executed on the Windows CE Ver.2.11 (on PA-2400W), and the DLL (Dynamic Link Library) which is called from a user application are described. Fig. 4.1 System configuration (Windows CE Ver. 2.11) User application Output to windows Input by tapping with forcus SIPanel SIPANEL.DLL keyboard screen SIPANEL.EXE Operation of this library requires the following files: Table 4.1 File Name sipanel.dll sipanel.
4.2 Use of SIPanel Library Program for starting up the library Before use of the SIPanel library, a dedicated program must be created to start up the library. The following is the method to call. Create a dedicated program to call the library, separate from application program for business use. This dedicated program must be programmed so that the SIPanel library is called when a message is released by the application program to the dedicated program.
4.4 Details of Function SIP_ExecutePanel Title Function Initiation of the SIPanel Initiates the SIPanel in the non-display mode. If it has already been initiated, it will be displayed as specified by the parameters. C Language Interface Calling Sequence int SIP_ExecutePanel (LPCTSTR lpParam) Parameters LPCTSTR lpParam: Pointer to the parameters string. One specification unit consists of a '/' and an alphabet (not case-sensitive) plus a numeral.
Title Display/Non-display of the SIPanel Sets the SIPanel to display mode or non-display mode. Function SIP_ShowPanel C Language Interface Calling Sequence int SIP_ShowPanel (int iCmdShow) Parameters int iCmdShow Return Values Header SIP_SHOW SIP_HIDE : Displays the SIPanel if it is in the non-display mode. : Hides the SIPanel if it is in the display mode. SIP_NOT_FOUND : SIPanel is not initiated. SIP_SHOW : SIPanel is being displayed. SIP_HIDE : SIPanel is hidden (not displayed).
Sample program to start up the SIPanel This is a source program of SipTsr.exe which must be used together with “CallSip.exe”. // SipTsr.cpp : Defines the entry point for the application. // #include “stdafx. h” #include “SIPanel.
if (hWnd == 0) return (FALSE); if (lsWindow(hWnd) != TRUE) return (FALSE); // Check whether values returned by CreateWindow() are valid. return(TRUE); // Window handle hWnd is valid. } // ****************************************************************************************// // WinMain // // ****************************************************************************************// int WINAPI WinMain( HINTANCE hInstance.
Sample program of application software for business use Install “SipTsr.exe”, and execute the following program. // CallSip.cpp : Defines the entry point for the application.// #include #include "stdafx.
wc.style = CS_HREDRAW | CS_VREDRAW; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = DLGWINDOWEXTRA; wc.hInstance = hInstance; wc.hIcon = NULL; wc.hCursor = NULL; wc.hbrBackground = (HBRUSH) GetStockObject(LTGRAY_BRUSH); wc.lpszMenuName = NULL; wc.
BOOL CallSip( HWND hWnd, WPARAM wId) { HWND hSip; UINT CmdMessage = WM_USER; hSip = FindWindow( ClassName_TSR, NULL); if ( hSip == NULL) { MessageBox( hWnd, TEXT("Error: FindWindow failed!"), TEXT("SIPanel Sample"), MB_OK); return FALSE; } switch( wId) { case IDC_BTN_TEXT: CmdMessage++; case IDC_BTN_TEN: CmdMessage++; break; default: return FALSE; } SendMessage( hSip, CmdMessage, 0, 0); return TRUE; // Find "SipTsr" // Send message to SipTsr } 33
4.5 SIPANEL.EXE 4.5.1 Overview Initiate SIPANEL.EXE and call SIPANEL.DLL to control the SIPanel. The SIPanel will be initiated in the non-display mode. If it has already been initiated, it will be displayed as specified by the command line options. If it has already been displayed, it will be set to non-display and all parameters other than /Q will be ignored. 4.5.2 Options of Command Line Format: sipanel.
5. I/O Bootup Library 5.1 Overview The I/O bootup library monitors the connection status of dedicated I/O Box and notifies user of the status. 5.2 Function This library supports only one function, iobox_chk(). The iobox_chk() function monitors and detects, for a specified period, whether PA-2400W is mounted on I/O Box, and returns the result (mounting detected, timeout error, or error).
5.3 Details of Function Title Function iobox_chk This function monitors the connection and mounting status of PA-2400W terminal on I/O Box for a specified period of time and returns a result of it. When the power of I/O Box is turned off, the status is considered as improper connection of PA-2400W with I/O Box. It returns also an error if other program uses this function at the same time.
5.4 Use of iobox_chk Internally, this function creates an event object of I/O Box and waits for the object for a specified time. During the wait time, it is possible to dispatch another task. Therefore, there are two ways of usage as stated below. Sequential Mode This mode is to call the function and check if the PA-2400W is connected to I/O Box. After a confirmation on the session establishment, the process continue to a next job. Place PA-2400W on I/O Box.
5.5 Sample Program This sample program is created with the method of “Multiple-Thread Mode” under development environment of Visual C++ 5.0 plus and Windows CE SDK/DDK. It introduces the IOBOX1.C program and its reference sources, and shows a list of environment variables. // windows ce iobox sample file #include #include #include "iobox1.
InitCommonControls(); // Initialize common controls - command bar hInst = hInstance; // Save handle to create command bar hWnd = CreateWindow(szAppName, szTitle, WS_OVERLAPPED, 100, 50, WINDOW_WIDTH/2, WINDOW_HEIGHT/2, NULL, NULL, hInstance, NULL); // Class // Title // Style // x-position // y-position // x-size // y-size // Parent handle // Menu handle // Instance handle // Creation ShowWindow(hWnd, SW_SHOW); UpdateWindow(hWnd); while ( GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMess
case WM_PAINT: hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &rect); rect.
default: return (DefWindowProc(hWnd, message, uParam, lParam)); } return (0); } VOID ioProc() { int ret; // ret=iobox_chk( INFINITE); ret=iobox_chk( 5*1000); // Wait for infinite // Wait for 5 seconds PostMessage( hWnd, WM_USER, ret, 0L); } // End of Hello Windows CE program.
6. Registry of Libraries In this chapter, registries which are used by the libraries of System and SIPanel are described. The I/O Startup Library does not use any registry. 6.1 System Library The System Library uses the following registries. The values of each registry are automatically updated by dedicated API functions. User is required not to edit the values. 6.2 Localmachine\HARDWARE\DEVICEMAP\AlarmWakeUp Set up “enable” or “disable” of the power ON by alram. Table 6.
7. File Transfer Utility 7.1 Overview This file utility performs file transfer either between a host PC and PA-2400W or between two PA-2400W terminals. The dedicated upload/download utility (LMWIN) must run on the host PC. As a result, functions that can be implemented by this utility depend on the upload/download utility dedicated for the host PC, as well as the file transfer protocol used between two FLCEs.
7.2 List of Supported Commands Among file transmission protocol, this file transfer utility (FLCE) can support the following specific commands. Table 7.1 List of supported commands No. Command Supported Specify on Request by FLCE’s comm.
7.3 Use of FLCE The FLCE is an execution program, and there are two methods for the use. FLCE individually FLCE as child-process in user application In the individual use mode, it can be started up by a shortcut in which necessary parameters are set as argument. Or in case it is started up in IDLE startup mode, FLCE.EXE icon can be accessed for direct access. In user application, the FLCE can be started up as child-process with argument for file transmission and etc.
7.5 Restrictions The file transfer utility (FLCE) is subject to the following restrictions: The FLCE does not support communication with a 3-pin interface or PCMCIA card. The COM1 port and IrDA port cannot be used concurrently because they must use the same hardware. Before initiating the FLCE, terminate the other program that is using the COM1 or IrDA port. As the return value from the FLCE the termination codes which request formatting of a drive or resetting of the machine are defined.
7.6 Communication Commands Operational specifications for the FLCE should be made by initiating an appropriate command together with the following arguments. A maximum of twenty commands can be described at one time, and they will be processed sequentially in the order in which they are described. If a command encounters an error, communication is immediately terminated from the error and subsequent commands will no longer be processed.
7.7 Method of Describing Pathname Enclose every pathname in a pair of parentheses. A pathname must have a length of 255 characters or less including the two parentheses. A 2-byte code character is counted as one character. Example: FLCE /S "\asio data\*.dat" "d:\data\" Pathnames must be described in accordance with the path naming rules supported by OS of the machine on which the specified path is to be placed. Observe the following rules on drive letters when describing pathnames: 1.
Reference: Windows CE has no concept of a drive letter. Accordingly, an additional drive is assigned a directory directly under the root directory.
7.8 Conditions at Communication Partner 7.8.1 Rules of Naming File and Directory Pathname Specify the pathname of file or directory at the communication partner according to the naming rules of communication partner-side OS. Table 7.4 Communication partner Windows95 /Windows NT DOS Windows CE 8.
7.9 Setting Up Registry By rewriting values in the registry it is possible to modify the default values of commands’ parameters for communication environment, etc. However, use the command line argument (/Y) to specify the communication line or baud rate during normal use. Use this registry setup only if the default values require modification.
7.9.2 Setting Up Registry with User Application Modify the registry as required from your application while referencing the following sample program. /***********************************************/ /* Registry Registration Program */ /***********************************************/ #include #include #include
err=FALSE; } else { err=FALSE; } if( err==TRUE) MessageBox( NULL, TEXT( "Success setting registry!") , TEXT( "This is MessageBox"), MB_OK); else MessageBox( NULL, TEXT( "Fail setting registry!") , TEXT( "This is MessageBox"), MB_OK); return( err); } 53
7.10 Termination Codes The FLCE returns one of the codes listed in Table 7.6 as the termination code when communication is complete. Upper-level programs should perform an appropriate action to reference these values. The communication function may return a code other than that described in the termination codes list. Such a code is received from the communication partner and specific (i.e. outside the standard protocol) to the software used on the communication partner side.
Table 7.6 List of termination codes Error Code Category Detail code code 00h 00h DCh to 00h F5h Meaning Possible Cause Normally terminated Normally terminated Normal. Formatting of drive a:between 'A' and 'Z' is specified from the partner station. (For drive letter definitions, refer to Chapter 7.7 “Method of Describing Pathname”.) Power-off is specified from the partner station. Resetting the power is specified from the partner station.
7.11 Log File The FLCE will create a log file to record communication logs. Log File Name The current log file name is fixed to "FLCE.LOG". This specification cannot be modified. Therefore, if the current log file needs to be stored, use another file name. Location of Log File A log file is created under the "\Windows\" directory. Method of Creation Even if a log file already exists, a new log file is created (i.e. overwrites the old one). Append to the existing log file is not attempted.
7.12 Precautions Under the state where the file transfer utility is operating, if a file is transmitted out or received in a folder that is opened by the Explorer, the transfer speed is reduced considerably. To avoid this close the folder that was opened by the Explorer and that contains the file to be transmitted before initiating the file transfer utility. Otherwise create a folder, other than the one opened by the Explorer, for file reception.
7.13 Details of Command and Option Title Command FLCE /Y This command sets up the device, baud rate, and communication mode used for communication. If this command is omitted, the default value {IrDA, , } is used. Any of the parameters can be omitted. If this is done, the default values for each parameter will be used. Always insert this command directly after the word “FLCE”. Placing it in another place will result in a parameter error.
Title Command FLCE /S This command transfers a file on the PA-2400W to the communication partner side of PA-2400W. If an identical file name exists in the destination directory of the partner side, it will be overwritten. If the directory that is specified as the destination directory does not exist, it will be automatically created. The progress of file transfer will be displayed. File pathnames will be processed in order from the left of the command line.
Title Command FLCE /R This command uses a pathname request to specify file that exists on the communication partner side, then receive the file. If an identical file name exists in the reception directory of the PA-2400W, it will be overwritten. If the directory that is specified as the reception directory does not exist, it will be automatically created. The progress of file transfer will be displayed.
Title Command FLCE /A This command transfers the contents of file that exists on the PA-2400W and specified by the append file pathname to the communication partner side of PA-2400W, and append the contents to file that exists on the communication partner side. If file specified by the target file pathname does not exist on the communication partner side, it will be automatically created.
Title Command FLCE /D This command deletes a specified file or directory that exists on the communication partner side. For all other operations which must follow the conditions at the communication partner side, refer to Chapter 7.8 “Conditions at Communication Partner”. The progress of file transfer will not be displayed. C Language Interface Calling Sequence FLCE /D[
Title Command FLCE /N This command moves a file that is specified by the move source pathname and that exists on the communication partner side to the move destination-side path. Specify a file name for the move destination-side pathname. The move source file will be saved by specified file name on the move destination side. For all operations which must follow the conditions at communication partner side, refer to Chapter 7.8 “ Conditions at Communication Partner”.
Title Command FLCE /T This command transfers the system date and time of the PA-2400W to the communication partner side for setting. Transmitted date and time is a local time. Depending on the line condition, a few seconds of error may result. C Language Interface Calling Sequence FLCE /T Parameters None Setup Example FLCE /SR "\casio ap\*.
Title Command FLCE (Idle Start) This command passes the request right to the communication partner side and operates according to a command that is requested by the communication partner. If starting up the PA-2400W with this mode, only the /Y command can be specified. (If this is done, the normal mode instead of the idle start mode is entered. In other cases, if script file name is specified, a parameter error results and the function is terminated.
7.14 Command and Status Table 7.8 No.
7.15 Retry Process When Downloading File In this chapter, retry process for downloading files by the FLCE at time of a communication error is explained. 7.15.1 Overview The retry process for file transmission can be implemented by the file transmission command with update option of the LMWIN. The update option enables file transmission only if a file to be transmitted by the PA-2400W is not existed at the communication partner side of PA-2400W.
Preparation at PA-2400W The flow of retry operation is as follows. The operation is recommended only if such error as 0x0100 protocol error (data error on line) or 0xA020 line broken error occurs. FLCE “normal transmission.scr” Return value = 0x0100 or 0xA020 ? Fig. 6.xx Yes No FLCE “retry.scr” Retry counter +=1 Return value = 0x0100 or 0xA020 ? Yes and retry counter < limited value ? Yes Fig. 7.1 According to the flow chart above, another retry after the initial retry operation can be possible.
8. File Check Utility 8.1 Overview The file check utility is used to check if an objective file has been successfully installed on the communication partner-side of PA-2400W. This utility has the capability to detect an installation error irrespective of file transfer method used. The transfer method involves a file transferred either between a host PC and PA-2400W or between two PA-2400Ws. It also includes copy operations from the card.
8.3 Operation Method This File Check Utility is to check if a file has been correctly copied to other PA-2400W or not. In this chapter, operating method to copy a file from PC to PA-2400W via RS-232C interface is described. Downloading file from PC to PA-2400W Transmission side (PC) Reception side (PA-2400W) RS-232C Interface Fig. 8.1 Operation: 1) Set a file correctly at the PC side which is to be downloaded to PA-2400W. 2) Specify the file at command line and creation of list file (FCHK.LOG).
Copying file with PC card (from PA-2400W to PA-2400W) Reception side (PA-2400W) Transmission side (PA-2400W) Copy Copy PC card PC card Fig. 8.2 Operation: 1) 2) 3) 4) 5) Set a file correctly at the transmission side of PA-2400W. Specify a file (to be copied) in script file and creation of list file (FCHK.LOG) in the same script file. Create list file on the transmission side of PA-2400W by using the File Check utility. FCHK /G /SC