Casio PA-2400 User Manual

PA-2400
C Library Manual
(Version 1.00 )
March 1998
Casio Computer Co., Ltd.
Copyright ©1998. All rights reserved.
Preface 4
Chapter 1. Supported Files 5
1.1 List of Dedicated Libraries 6
1.1.1 I/O Bootup Library Function 6
1.1.2 File Transfer Utility 6
1.1.3 File Check Utility 6
Chapter 2. I/O Bootup Library 7
2.1 Overview 7
2.2 Function 7
2.3 Detail of Function 9 iobox_chk 9
2.4 Source List 11
Chapter 3. File Transfer Utility 15
3.1 Overview 15
3.2 List of Functions 16
3.3 Communication Functions 17
3.4 Pathname Description Method 18
3.5 Rules of Describing Arguments 20
3.6 Conditoons on Communication Partner 21
3.6.1 Rules of Naming Files and Directory Paths 21
3.6.2 Specifying on Non-Existing File 21
3.6.3 /D (delete) Command Option 22
3.7 Setting Up Registry 22
3.7.1 Setup Items 22
3.7.2 Setting Up Registry with User Application 24
3.8 Termination Codes 26
3.9 Log File 29
3.10 Restrictions 30
3.11 Precautions 30
3.12 Details of Functions 31 FLCE /Y 31 FLCE /S 33 FLCE /R 35 FLCE /A 37 FLCE /D 39 FLCE /N 41 FLCE /T 42 FLCE (Idle Start) 43
2
Chapter 4. File Check Utility 45
4.1 Overview 45
4.2 List of Functions 45
4.3 Pathname Describing Method 45
4.3.1 Description of Pathnames 45
4.3.2 Rules of Naming Files and Directory Paths 46
4.4 Rules of Describing Arguments 46
4.5 Functions 47
4.5.1 List File Generating Function 47
4.5.2 List File Comparison 48
4.6 Format of List Files 49
4.7 Syntax Analysis of Script Fil es 50
4.8 Error Messages/Codes 52
4.9 Restrictions 53
4.10 Details of Functions 54 FCHKCE /G 54 FCHKCE /C 56
3
Preface
This manual describes the C language-dedicated library functions and utilities that run on the Casio PA-2400 (hereinafter referred to as "H/PC", which stands for Handheld PC).
The PA-2400 uses the Windows CE operating system, and uses the Win32 API functions to generate user application programs. However, more functions may be required if generating a business application, etc. The C language-dedicated library functions and utilities described in this manual are used to support functions that are not supported by the API functions.
Information about the Win32 API functions can be retrieved using the Help function in the Windows 95 system.
Win32 API Function
C language dedicated library, utility (I/O bootup, FLCE, FCHKCE)
Available from Microsoft
Available from Casio
4
1. Supported Files
The following files will be supported by the C-library functions and utilities described in this document.
I/O Bootup Library
1) IOBOX1.H Function header file
2) IOBOX1.LIB Import library for linking
File Transfer Utility
1) FLCE.EXE Execution file
2) SND.LNK Shortcut for PA-2400-to-PA-2400 communication
3) RCV.LNK Shortcut for PA-2400-to-PA-2400 communication
4) IDLE.LNK Shortcut for idle
File Check Utility
1) FCHKCE.EXE Execution file
2) MAKE.LNK Shortcut for PA-2400-to-PA-2400 communication
3) CHECK.LNK Shortcut for downloading AP
Files that can be placed in any directory (shortcut)
Files that are required for building
Each library function or utility can be made available to the user when the DLL/EXE file is copied into the Windows directory on the PA-2400 (see the figure below).
Host PC
PA-2400
Copy
Fig.1.1 System configuration
5
1.1 List of Dedicated Libraries
1.1.1 I/O Bootup Library Function
Table 1.1 I/O Bootup libraru function
No. Function Description Page
1 iobox_chk Monitoring the connection status of I/O BOX 9
1.1.2 File Transfer Utility
Table 1.2 File transfer utility
No. Function (command) Description Page
1 FLCE /Y Communication environment setup/Idle start 31 2 FLCE /S File transmission 33 3 FLCE /R File reception 35 4 FLCE /A File transmission (append) 37 5 FLCE /D File deletion 39 6 FLCE /N File move/File name modification 41 7 FLCE /T Time transmission 42
1.1.3 File Check Utility
Table 1.3 File check utility
No. Function(Command) Description Page
1 FCHKCE /G Generation of a list file 54 2 FCHKCE /C Comparison of list files 56
6
2. I/O Bootup Library
2.1 Overview
The I/O bootup library monitors the connection status of the dedicated I/O Box and notifies the user of the status.
2.2 Function
This library supports only one function, iobox_chk(). The iobox_chk() function monitors and detects, for a specified period, whether I/O Box is mounted, and returns the result (mounting detected, time-out error, or error). Each time this function is used, it is necessary to also execute "Permit interrupt, Wait for interrupt and time-out, and Prohibit interrupt". The following diagram shows the range covered by this library. Fig. 2.1
PA-2400
User Application
(1) iobox_chk ( TIME_OUT_SEC ) ;
(5) Return
Detection, Timeout Error
IOBOX1.DLL
I/O PORT: 0
(2) Mounting
(4) Timeout
I/O Box
(3) I/O Box ON Signal
7
Because the interrupt signals are detected by their signal levels, they can be detected even if the order of and 2) is changed. (The connection status can be detected whether this function is called before or after I/O Box is mounted, unless a time-out occurs.)
8
2.3 Details of Function
iobox_chk
< Description >
Monitors the connection status between two PA-2400 terminals and I/O Box for a specified period of time and returns the result.
< Format >
int iobox_chk ( DWORD time_out );
< Parameter >
DWORD time_out : Maximum time to monitor the connection status (1 to 4,294,967,295 (ms) ) No time-out = INFINITE (4,294,967,295 (ms) equals to INFINITE.)
< Return value >
int
< Return code >
0 : Connection detected 1 : Time-out
-1 : Used exclusively by other program
Other : Function call fails.
< Include file >
iobox1.h
< Remarks >
If the main program calls this function, it must subsequently acquire a return from this function. If the main program is terminated without acquiring a return, it can no longer be called on and after the next call, since the interrupt event object of I/O Box that has been generated in this function is not closed. (In order to restore it to normal operation, it is necessary to reset the whole system.) To avoid this problem set a short time-out for this function call and always receive the return of time-out, then execute the cancellation process if, for example, programming the cancellation process after waiting for connection. If the system power is turned off while this function is in the process of waiting for connection to I/O Box , the monitoring operation can be resumed from the state that immediately preceded the point
9
where the system power was turned off by the Power-ON resume function. A disconnection from I/O Box should be judged by means of a communication error that is detected by the user application or a time-out return error with this function after the PA-2400 is connected to I/O Box. Always include iobox1.lib with the import library to be used for developing user applications.
10
2.4 Source List
This section introduces the IOBOX1.C program and its reference sources, and show a list of environment variables.
// windows ce iobox sample file
#include <windows.h> #include <commctrl.h> #include "iobox1.h"
VOID ioProc( void);
TCHAR szAppName[ ] = TEXT("Hello Windows CE"); TCHAR szTitle[ ] = TEXT("PA-2400 I/O BOX TEST");
LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
HINSTANCE hInst = NULL; HWND hWndCB = NULL;
HANDLE hWnd; HANDLE h;
const int WINDOW_WIDTH = 480; const int WINDOW_HEIGHT = 214;
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { // HWND hWnd; MSG msg; WNDCLASS wc;
wc.style = 0L; wc.lpfnWndProc = (WNDPROC) WndProc; wc.cbClsExtra = 0;
11
wc.cbWndExtra = 0; wc.hInstance = hInstance; wc.hIcon = NULL; wc.hCursor = NULL; wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = szAppName;
RegisterClass(&wc);
InitCommonControls(); // Initialize common controls - command bar hInst = hInstance; // Save handle to create command bar
hWnd = CreateWindow(szAppName, // Class szTitle, // Title
WS_OVERLAPPED, // Style 100, // x-position 50, // y-position WINDOW_WIDTH/2, // x-size WINDOW_HEIGHT/2, // y-size NULL, // Parent handle NULL, // Menu handle hInstance, // Instance handle NULL); // Creation
ShowWindow(hWnd, SW_SHOW); UpdateWindow(hWnd);
while ( GetMessage(&msg, NULL, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); }
return(msg.wParam); }
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM uParam, LPARAM lParam )
12
{ HDC hdc; PAINTSTRUCT ps; RECT rect;
DWORD ThreadID;
switch (message) { case WM_CREATE: sndPlaySound(TEXT("OpenProg"), SND_NODEFAULT | SND_ASYNC);
hWndCB = CommandBar_Create(hInst, hWnd, 1); CommandBar_AddAdornments( hWndCB, 0L, 0L); return 0;
case WM_PAINT: hdc = BeginPaint(hWnd, &ps); GetClientRect(hWnd, &rect); rect.top += CommandBar_Height(hWndCB); DrawText(hdc, TEXT("Hello Windows CE!"), -1, &rect, DT_SINGLELINE | DT_CENTER | DT_VCENTER); EndPaint(hWnd, &ps); return 0;
case WM_LBUTTONDOWN:
h = CreateThread(NULL, 0, ( LPTHREAD_START_ROUTINE)ioProc, NULL, 0, ( LPDWORD)&ThreadID); return 0;
case WM_USER:
switch( ( int)uParam) {
case 0:
MessageBox( hWnd, TEXT( "Connected!") , TEXT( "MessageBox"), MB_OK);
break;
case 1:
MessageBox( hWnd, TEXT( "Time Out!") , TEXT( "MessageBox"), MB_OK); break;
case -1:
MessageBox( hWnd, TEXT( "Other program is using!") , TEXT( "MessageBox"), MB_OK); break;
13
default:
MessageBox( hWnd, TEXT( "Function call Failed!") , TEXT( "MessageBox"), MB_OK); break;
} // TerminateThread( h,0); // Close because thread is no longer required. // ExitThread( 0L);
CloseHandle( h);
return 0;
case WM_CLOSE: sndPlaySound(TEXT("Close"), SND_NODEFAULT | SND_ASYNC); DestroyWindow(hWnd); return 0;
case WM_DESTROY: PostQuitMessage(0);
return 0;
default:
return (DefWindowProc(hWnd, message, uParam, lParam)); } return (0); }
VOID ioProc() {
int ret;
// ret=iobox_chk( INFINITE); // Wait for infinite
ret=iobox_chk( 5*1000); // Wait for 5 seconds
PostMessage( hWnd, WM_USER, ret, 0L); }
// End of Hello Windows CE program.
14
3. File Transfer Utility
3.1 Overview
This file utility performs file transfer either between a PC and PA-2400 or between two PA-2400 terminals. The dedicated up/download utility should be running on this PC. As a result, functions that can be implemented by this utility depend on the up/download utility dedicated for the host PC, as well as the file transfer protocol used between two FLCEs.
For this operation the following I/O interfaces can be used: (For more information about the hardware configuration of the I/O Box system, refer to the Hardware Manual.)
1) RS-232C
Interface via the 16-pin cable (using the communication cable supplied with PA-2400)
Direct interface to the host PC
2) IrDA 1.0
Interface to the host PC via the master or satellite I/O Box
Interface between two H/PCs
15
3.2 List of Functions
With this file transfer utility the following functions related to the file transfer protocol can be specified:
Table 3.1 List of Functions
Function Description Communication environment setup File transmission Transfers a file from the local machine to the communication partner. File reception Receives a file from the communication partner. File transmission (append) File deletion Deletes a file or directory existing on the communication partner. File move/File name modification Time transmission Sets the system date and time of the communication partner.
Sets the device, baud rate, and communication mode to be used for communication.
Appends a file existing on the local machine to a file existing on the communication partner.
Moves or modifies the name of a file existing on the communication partner.
16
3.3 Communication Functions
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. When the communication environment setup command is not specified, the default value is used.
Table 3.2 Types of Arguments
Type Function Command Applicable Option Example of Input Setup command Operation command
Communication environment setup File transmission / S O, R / SOR File reception / R O, R / ROR File transmission (append) File deletion / D O, R / D File move / N None / N Time transmission / T None / T Idle start None Script file name
/Y={device, baud rate, mode}
/ A None / A
None /Y={IrDA,
115200, }
Outline of Options
O (Overwrite) : Specification of forced overwrite of a read-only file
If this option is specified, even a read-only file will be overwritten. If an overwrite of a read-only file is attempted and this option is not specified, this function will be abnormally terminated. The attribute of a source file will be duplicated onto a target file which has been overwritten.
R (Recursive call):
All the files that exist under the specified directory are used as the objective of processing. If the specified directory has any sub-directories, the files in these sub-directories are also included as the objective of processing. The hierarchical directory system has a maximum depth of sixteen levels.If this option is not specified, only a file that is designated by its pathname will be the
objective of processing.
17
Loading...
+ 39 hidden pages