Casio Pa 2400W Users Manual
PA-2400W to the manual ed45d792-e01c-4e79-8004-d75e05ed9f34
2015-01-21
: Casio Casio-Pa-2400W-Users-Manual-243527 casio-pa-2400w-users-manual-243527 casio pdf
Open the PDF directly: View PDF .
Page Count: 83
Download | |
Open PDF In Browser | View PDF |
PA-2400W C Library Manual (Version 1.00) CASIO Computer Co., Ltd. Copyright ©1999. All rights reserved. July 1999 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.6 Preface Supported Files Dedicated Library and Utility System Library SIPanel Library I/O Bootup Library File Transfer Utility File Check Utility Development Environment System Library Overview Details of Function CA_BacklightOn CA_BacklightOff CA_BacklightCheck SyncPowerOff DisablePowerOff EnablePowerOff StatusPowerOff ApoCountReset SoftReset SetPowerOnAlarm GetPowerOnAlarm SetPowerEventStat GetPowerEventStat SIPanel Library Overview Use of SIPanel Library Restrictions Details of Function SIP_ExecutePanel SIP_ShowPanel SIPANEL.EXE Overview Options of Command Line I/O Bootup Library Overview Function Details of Function iobox_chk Use of iobox_chk Sample Program Registry of Libraries System Library SIPanel Library File Transfer Utility Overview List of Supported Commands Use of FLCE Termination of FLCE Restrictions Communication Commands 2 4 5 7 7 7 7 8 8 9 10 10 11 11 12 13 14 15 16 17 18 19 20 21 22 24 25 25 26 26 27 27 28 34 34 34 35 35 35 36 36 37 38 42 42 42 43 43 44 45 45 46 47 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.11 Method of Describing Pathname Conditions at Communication Partner Rules of Naming File and Directory Pathname Setting Up Registry Setting Up Items Setting Up Registry with User Application Termination Codes Log File Precautions Details of Command and Option FLCE /Y FLCE /S FLCE /R FLCE /A FLCE /D FLCE /N FLCE /T FLCE (Idle Start) Command and Status Retry Process When Downloading File Overview Retry Method Restriction File Check Utility Overview List of Commands Operation Method Describing Method Pathname Rules of Naming File and Directory Pathname Details about Command and Option Command of FCHKCE Generation of List File Comparison by List File Format of List File Syntax Analysis of Script File Error Messages/Codes Restriction Details of Command and Option FCHKCE /G FCHKCE /C 48 50 50 51 51 52 54 56 57 58 58 59 60 61 62 63 64 65 66 67 67 67 68 69 69 69 70 72 72 72 73 74 74 75 76 77 79 80 81 81 83 Microsoft, MS-DOS, and Windows are registered trademarks of Microsoft Corporation in the USA. Other company, product and service names used in this manual may also be trademarks or service marks of respective companies. 3 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. 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) 4 Available from Microsoft Available from CASIO 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. Enables power off with the power button. Acquires the status of enable/disable power off with the power button. Resets the APO’s counter. Performs soft-reset (warm-bootup). Enables or disables power on with the alarm. Acquires the status of enable/disable power on with the alarm. Enables or disables power-on notification. Acquires the status of enable/disable power-on notification. ApoCountReset SoftReset SetPowerOnAlarm GetPowerOnAlarm SetPowerEventStat GetPowerEventStat SIPanel Library SIPanel.lib SIPanel.h SIPanel.dll (note 1) SIPanel.exe (for individual execution) SIP_ExecutePanel SIP_ShowPanel I/O Bootup Library Iobox1.lib iobox_chk Iobox1.h Iobox1.dll Starts up the SIPanel. Displays the SIPanel on the LCD screen or erases it from the screen. Checks the condition of connection between PA-2400W and I/O Box, and acquires a result of the status. File Transfer Utility FLCE.EXE SND.LNK RCV.LNK IDLE.LNK Execution file Shortcut for PA-2400W-to-PA-2400W communication Shortcut for PA-2400W-to-PA-2400W communication Shortcut for idle File Check Utility FCHKCE.EXE MAKE.LNK CHECK.LNK Execution file Shortcut for PA-2400W-to-PA-2400W communication Shortcut for downloading AP 5 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 System configuration 6 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. Enables power on with the power button. Acquires the status of enable/disable power off with the power button. Resets the APO’s counter. Resets the system and then starts up warm bootup. Enables or disables automatic power on with the alarm. Acquires the status of automatic power on with the alarm. Enables or disables power on event notification. Acquires the status of enable/disable power on event notification. Page 11 12 13 14 15 16 17 18 19 20 21 22 24 SIPanel Library Table 1.3 No. Function SIP_ExecutePanel 1 SIP_ShowPanel 2 Description Starts up the SIPanel. Displays the SIP or erases it from the LCD screen. Page 27 28 1.1.3 I/O Bootup Library Table 1.4 I/O Bootup library function No. Function Description iobox_chk 1 Monitoring the connection status of PA-2400W with I/O Box 7 Page 36 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. Command 1 FCHKCE /G 2 FCHKCE /C 8 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.11 SDK (US version) 9 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. 10 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 #includeRemarks 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. For example, if the automatic backlight off is set to “disable mode” at the control panel, the function cannot be activated. During an event of low battery, the backlight still can be turned on. However, because of inrush current at a time of turning on the backlight, the power of PA-2400W may be turned off. Always observe the battery condition before activation of the backlight. 11 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. 12 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 Remarks 13 CA_BacklightCheck 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 Remarks 14 SyncPowerOff 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 Remarks 15 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 Remarks 16 EnablePowerOff 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 Remarks 17 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 Remarks 18 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. 19 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 Remarks Related operations to the “automatic power-on” after this function is implemented are as follows. Table 3.1 Setup of “SetPowerOnAlarm” “automatic power-on” disabled “automatic power-on” enabled Setup at Control panel Alarm off Alarm on Alarm off Alarm on When the power of PA2400W is turned on Alarm cannot be activated. Alarm can be activated. Alarm cannot be activated. Alarm can be activated. 20 When the power of PA2400W is off No “automatic power-on” No “automatic power-on” No “automatic power-on” Yes “automatic power-on” 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 Remarks 21 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. 22 Sample program to acquire power-on event notification #include static static HANDLE HANDLE hEventOn = NULL; hThreadOn = NULL ; DWORD WINAPI OnThread() { LONG WaitReturn; While(1) { WaitReturn = WaitForSingleObject(hEventon, INFINITE); If (WaitReturn == WAIT_OBJECT_0) { MessageBox(NULL, TEXT(“PowerONEvent”), TEXT(“Event”), MB_OK); } ResetEvent(hEventOn); } return 0; } BOOL Initialize() { DWORD ThreadIDOn; hEventOn = CreateEvent(NULL, TRUE, FALSE, TEXT(“PA_OnEvent”)); if( !hEventOn ) { return(FALSE); } hThreadOn = CreateThread(NULL, 0, OnThread, 0, 0, &ThreadIDOn); if(!hThreadOn) { return(FALSE); } return(TRUE); } int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { if(Initialize() ) { MessageBox(NULL, TEXT(“Initialize Success”), TEXT(“Initialize”), MB_OK); While(1) { Sleep(1000); } return(TRUE); } else { MessageBox(NULL, TEXT(“Initialize Error”), TEXT(“Initialize”), MB_OK); return(FALSE); } } 23 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 Remarks 24 GetPowerEventStat 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.exe Operation environment Windows CE ver. 2.11 (SH3) Windows CE ver. 2.11 (SH3) Description Execution management library for starting up SIPanel Execution program for starting up SIPanel Use the following files if developing a user application that controls the SIPanel with the execution management library of this system. Table 4.2 File Name sipanel.lib sipanel.h Operation environment Windows CE ver. 2.11 (SH3) 25 Description Import library and header file for calling sipanel.dll 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. It should be stored in the root directory of “My Handheld PC”. Avoid having the application program to call directly the SIPanel library. Instead, always use such the method that a message released by the application program can make the dedicated program start up the library. A sample program for the dedicated program mentioned above is on page xxx. You may refer to it to create your own dedicated program of calling the library. Registry After a dedicated program is created, the registry of the SIPanel must be rewritten to the following values. The values can be changed with “RegSetValueEx” function of Win32API. Key name : LocalMachine\Software\Apps\SIPManager SIPExeName = sipanel.exe -> SIPExeName = a name of the dedicated program By having the registry values to be re-written, a user created program to start up the SIPanel can be also possible when the SIP button at upper-left corner of the PA-2400W is pushed. Or, if you wish to disable the startup, delete the values of Key name above. Once user’s own SIPanel startup program is created, the registry must be re-written (or the registry must be deleted). Otherwise, it may crash to the original SIPanel startup program of the built-in ROM when the SIP button is pushed. 4.3 Restrictions The SIPanel function is subject to the following restrictions. The SIPanel screen may be hidden behind a display that is associated with an application, such as PowerPoint, if one is used. If the SIPanel library is called directly by application software, you may not be able to input characters into an object input area. Always follow the method described in Chapter 4.2 “Use of SIPanel Library” when it is called. 26 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. To specify multiple units delimit them with a space (order of specification unit does not matter). All parameters other than those listed below will be ignored (invalid). /T1 /T0 /D1 /D3 /D0 or /D2 /N2 /N1 /N0 /L1 /L0 /Px, y /Sw, h Adds a text area. If keyboard character is touched once it will be temporarily displayed in the text area, and, if the Return key is touched, it will be transferred to a currently active window. If the Return key is touched, it will be transferred to a currently active window. Does not add a text area. (Initial condition default.) Establishes a drag area in the upper section of the screen. This drag area is a range in which a mouse event is detected if the display position of the SIPanel is modified. Note: If the drag area extends beyond the display range, dragging is no longer possible. Does not establish a drag area. Dragging is not possible. Establishes a drag area on the left side of the screen. (Initial condition default.) Displays a panel that only contains numeric keys. Adds numeric keys to the standard keyboard. Does not add numeric keys to the standard keyboard. (Initial condition default.) Activates the Caps Lock key. Deactivates the Caps Lock key. (Initial condition default.) Specifies the coordinates of the top left corner of the SIPanel. "x" should be between 0 and 479 of the X-axis coordinate, and "y" should be between 0 and 239 of the Y-axis coordinate "x" and "y" should be separated by a comma (","). The default values are x=0 and y=0. Specifies the width and height of the SIPanel to be displayed. "w", the width, should be between 1 and 480, and "h", the height, should be between 1 and 240. "w" and "h" should be separated by a comma (","). The default values are w=288 and h=100. Note: If values that are too small are specified, tapping the panel has no effect and, consequently, a key input is not possible. Unless otherwise specified, the parameters will retain their previous values. If SIPanel is initiated without a parameter being specified, the following condition is employed for the defaults. SIP_ExecutePanel (L"/T0 /D0 /N0 /L0 /P0,0 /S288, 100"); Return Values SIP_NO_ERROR SIP_SHOW SIP_HIDE : Normal termination : Normal initiation, the SIPanel is in the display mode. : Normal initiation, the SIPanel is in the non-display mode. Header #include Remarks The SIPanel screen may be hidden (HIDE state) if the function is called while the SIPanel is displayed. During the HIDE state, if the function is called without specifying parameters, the SIPanel will be displayed in the same mode specified by previous setting parameters. 27 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). #include 28 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. h” TCHAR ClassName[] = TEXT(“SipTsr”); // ***************************************************************************************// // WndProc // // ***************************************************************************************// LRESULT CALLBACK WndProc(HWND hwnd, UNIT message, WPARAM wParam, LPARAM IParam) { switch (message) { case (WM_USER + 1): SIP_ExecutePanel( TEXT(“/N2 /T0 /P200.0 /S180, 120”)); break; case (WM_USER + 2); SIP_ExecutePanel( TEXT(“/T1 /N0 /P0, 0 /S320, 120”)); break; case WM_DESTROY: PostQuitMessage(0); return 0; } return defWindowProc(hwnd, message, wParam, lParam); //ten-key SIPanel //SIPanel with text area } // ***************************************************************************************// // InitApplication // // ***************************************************************************************// BOOL InitApplication (HINSTANCE hInstance) { WINDCLASSW wc; BOOL f; 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. lpszClassName = ClassName; f= (RegisterClass(&wc)); return f; } // ***************************************************************************************// // InitInstance // // ***************************************************************************************// BOOL InitInstance(HINSTANCE hIntance, int nCmdShow) { HWND hWnd; hWnd = CreateWindow( ClassName, NULL, WS_OVERLAPPED, 0, 0, 0, 0, NULL, NULL, hInstance, NULL); 29 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. HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int ncmdShow) { MSG msg; HWND hWnd; long lResult; HKEY hKeyResult; TCHAR TsrName[] = TEXT(“SipTsr.exe”); if ( hWnd = FindWindow( ClassName, NULL)) { SIP_ExecutePanel( TEXT(“”)); return FLASE; } if (hPrevInstance == 0) { if (InitApplication(hInstance) == FALSE) return(FALSE); } if (InitInstance(hInstance, nCmdShow) == FALSE) return(FALSE); lResult = RegOpenKeyEx( HKEY_LOCAL_MACHINE, TEXT( “Software\\Apps\\SIPManager”), 0, KEY_WRITE, &hKeyResult); if ( lResult != ERROR_SUCCESS) return(FALSE); // Open Registry lResult = RegSetValueEx( hKeyResult, TEXT( “SIPExeName”), 0, REG_SZ, ( unsigned char *)TsrName , sizeof( TsrName)); if ( lResult !=ERROR_SUCCESS) return(FALSE); // Write Registry RegCloseKey( hKeyResult); // Close Registry While (GetMessage(&msg, NULL, 0, 0) == TRUE) { DispatchMessage (&msg); } return TRUE; } 30 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.h" #define IDC_BTN_TEN #define IDC_BTN_TEXT #define IDC_EDIT 1 2 3 HINSTANCE hInst; TCHAR ClassName[] = TEXT( "CallSip"); TCHAR ClassName_TSR[] = TEXT("SipTsr"); HWND hbCallTen; HWND hbCallText; HWND heText; BOOL CallSip( HWND, WPARAM); // The current instance // Class name of this program // Class name of "SipTsr" // ***************************************************************************************// // WndProc // // ***************************************************************************************// LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { switch (message) { case WM_COMMAND: if ( HIWORD(wParam) == BN_CLICKED) { CallSip( hWnd, LOWORD(wParam)); SetFocus( heText); } break; case WM_CREATE: hbCallTen = CreateWindow( TEXT("button"), TEXT("Ten-key"), ( WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON), 20, 80, 90, 30, hWnd, (HMENU)IDC_BTN_TEN, (HANDLE)hInst, NULL); hbCallText = CreateWindow( TEXT("button"), TEXT("Text Area"), ( WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON), 120, 80, 90, 30, hWnd, (HMENU)IDC_BTN_TEXT, (HANDLE)hInst, NULL); heText = CreateWindow( TEXT("edit"), TEXT("\0"), ( WS_CHILD | WS_VISIBLE | WS_BORDER | ES_NOHIDESEL), 20, 40, 200, 20, hWnd, (HMENU)IDC_EDIT, hInst, NULL); break; case WM_DESTROY: PostQuitMessage(0); return 0; } return DefWindowProc(hWnd, message, wParam, lParam); } // ***************************************************************************************// // InitApplication // // ***************************************************************************************// BOOL InitApplication (HINSTANCE hInstance) { WNDCLASSW wc; 31 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.lpszClassName = ClassName; return (RegisterClass(&wc)); } // ****************************************************************************************// // InitInstance // // ****************************************************************************************// BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) { HWND hWnd; hInst = hInstance; // Store instance handle in our global variable hWnd = CreateWindow(ClassName, ClassName, ( WS_VISIBLE | WS_OVERLAPPED | WS_SYSMENU), 0, 0, CW_USEDEFAULT, CW_USEDEFAULT, NULL, NULL, hInstance, NULL); if (hWnd == 0) // Check whether values returned by CreateWindow() are valid. return (FALSE); if (IsWindow(hWnd) != TRUE) return (FALSE); ShowWindow(hWnd, SW_SHOW); UpdateWindow(hWnd); return(TRUE); // Window handle hWnd is valid. } int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow) { MSG msg; if (hPrevInstance == 0) { if (InitApplication(hInstance) == FALSE) { NKDbgPrintfW( TEXT("CallSip : InitApp failed!\n")); return(FALSE); } } if (InitInstance(hInstance, nCmdShow) == FALSE) { NKDbgPrintfW( TEXT("CallSip : InitInst failed!\n")); return(FALSE); } while (GetMessage(&msg, NULL, 0, 0) == TRUE) { TranslateMessage(&msg); DispatchMessage(&msg); } return(msg.wParam); } 32 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.exe [/Q] [/T|0|1|] [/D|0|1|] [/N|0|1|] [/L|0|1|] [/Px,y] [/Sw,h] One specification unit consists of a ' / ' and an alphabet (not case-sensitive) plus a number. To specify multiple units delimit them by inserting a space after each unit (order of unit specification does not matter). All parameters other than those listed below will be ignored (invalid). /T1 ......... /T0 ........ /D1 ....... /D3 ......... /D0 or /D2 /N2 ........ /N1 ........ /N0 ........ /L1 ........ /L0 ........ /Px,y ..... /Sw,h ...... Adds a text area. If keyboard character is touched once it will be temporarily displayed in the text area, and, if the Return key is touched, it will be transferred to a currently active window. Does not add a text area. (Initial condition default.) Establishes a drag area in the upper section of the screen. This drag area is a range in which a mouse event is detected if the display position of SIPanel is modified. Note: If the drag area extends beyond the display range, dragging is no longer possible. Does not establish a drag area. Dragging is not possible. Establishes a drag area on the left side of the screen. (Initial condition default.) Displays a panel that only contains numeric keys. Adds numeric keys to the standard keyboard. Does not add numeric keys to the standard keyboard. (Initial condition default.) Activates the Caps Lock key. Deactivates the Caps Lock key. (Initial condition default.) Specifies the coordinates of the top left corner of the SIPanel. "x" should be between 0 and 479 of the X-axis coordinate, and "y" should be between 0 and 239 of the Y-axis coordinate. "x" and "y" should be separated by comma (","). The default values are x=0 and y=0. Specifies the width and height of SIPanel to be displayed. "w", the width, should be between 1 and 480, and "h", the height, should be between 1 and 240. "w" and "h" should be separated by a comma (","). The default values are w=320 and h=120. Note: If values that are to small are specified, tapping the panel has no effect and, consequently, a key input is not possible. Unless otherwise specified, the parameters will retain their previous values. If SIPanel is initiated without a parameter being specified, the following condition is employed for the defaults: sipanel.exe /T0 /D0 /N0 /L0 /P0, 0 /S288, 100 34 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). 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. 5.1 User Application PA-2400W (1) iobox_chk ( TIME_OUT_SEC ) ; (5) Return Detection, Timeout Error IOBOX1.DLL Karnel (4) Timeout (4) Interrupt Signal I/O PORT: 0 (2) Mounting (3) I/O Box ON Signal I/O Box Because the interrupt signals are detected by their signal levels, they can be detected even if the order of (1) and (2) is changed. (The connection status can be detected whether this function is called before or after the PA-2400W is mounted on I/O Box is mounted, unless a timeout occurs.) 35 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. If the power switch of I/O Box is turned off during wait specified period, the monitoring can be continued from the state before the power is off. C Language Interface Calling Sequence int iobox_chk ( DWORD time_out ); Parameters DWORD Return Values Header time_out : Maximum time to monitor the session (0 to 4,294,967,295 msec.) INFINITE = No timeout (4,294,967,295 msec. equals to INFINITE.) 0 1 -1 Others : Session establishment detected : Timeout : Used exclusively by other program : Fail to call the function. #include Remarks 36 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. iobox_chk (30) Connected ? Yes Next Job No Error Process Fig. 5.2 Multiple-Thread Mode Main program creates a thread (CreateThread( ) ) for session with I/O Box and calls the function within this thread to wait for the establishment of session with the I/O Box. While the main program waits in the loop, it makes necessary processes of each message. After the created thread confirms the session, the sub-thread throws a message to the main program which makes the main program confirms the session. Refer to Chapter 5.5 “Sample Program” on page 38 for a sample program to use the function in “Multiple-Thread Mode”. 37 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.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 wc.lpfnWndProc wc.cbClsExtra wc.cbWndExtra wc.hInstance wc.hIcon wc.hCursor wc.hbrBackground wc.lpszMenuName wc.lpszClassName = 0L; = (WNDPROC) WndProc; = 0; = 0; = hInstance; = NULL; = NULL; = (HBRUSH) GetStockObject(WHITE_BRUSH); = NULL; = szAppName; RegisterClass(&wc); 38 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); DispatchMessage(&msg); } return(msg.wParam); } LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM uParam, LPARAM lParam ) { 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; 39 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; 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; 40 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. 41 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.1 Key name Form Value Description Satus DWORD 0 Disable the power ON by alarm. 1 Enable the power ON by alarm. (default) LocalMachine\HARDWARE\DEVICEMAP\powerONEvent Set up “enable” or “disable” of the power ON event notification”. Table 6.2 Key name Form Value Description Status DWORD 0 Disable the power ON event notification. 1 Enable the power ON event notification. SIPanel Library The SIPanel Library uses the following registries. User is required to edit the values of each registry. LocalMachine\Software\Apps\SIPmanager Specify a program to start up the SIPanel when the SIP button is pushed by operator. Table 6.3 Key name Form Value SIPExeName SZ (file name) SIPQuitOpt SZ (character string of option) SIPNormOpt SZ (character string of option) Description Specify a file name of program which is started up when the SIP button is pushed. Default is “SIPanel.exe”. Specify a character string of quit option which is attached to the program specified by “SIPExeName”. Default is “/Q”. Specify startup option of the program specified by “SIPExeName”. Default is not available. Note: If you wish to disable the SIP button, delete “SipExeName”. If you create your own startup program for the SIPanel using this library, do not forget to delete or change “SIPExeName”. Refer to Chapter 4.2 “Use of SIPanel Library”. 42 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. For this operation the following I/O interfaces of PA-2400W can be used: (For more information about the hardware configuration of the I/O Box system, refer to the PA-2400W Hardware Manual.) RS-232C Interface Interface (COM1 port) via the 16-pin cable (using the communication cable supplied with PA-2400W) Direct interface to the host PC IrDA 1.0 Interface Interface (IrDA port) to the host PC via the Master or Satellite I/O Box Interface between two PA-2400W terminals 43 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. partner command line 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 File transmission File reception File append File/directory delete File mode/update Directory creation Time setup Time request Message display Buzzer ON File information acquisition File information setup Disk information acquisition Acquisition of session ID and system information (see note 1) IDLE notification (see note 1) Order of termination (see note 1) - ---------- Notes: 1. Functions 14, 15 and 16 are used internally by the protocol. You do not need to specify these commands on the command line. 2. All files are transferred in binary mode with date/time of file creation and attribute. 3. If file transmission fails, a part of the file at reception side is disregarded and none of data in the file will be saved. 44 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. After completion of the transmission, termination code can be acquired as a return value of the process. Before transmission via COM1 port, there is operation you must follow. If you do not follow the operation, PC LINNK automatically starts up as RS-232C cable is connected, which will cause the transmission to fail. The operation continues to be active until the setup is changed or cold-bootup takes place. Operation 1. 2. 3. 4. 5. Select “Set up” in the start menu. Tap “Communication” to open. Select “Connection with PC”. Deselect “Connect with PC if communication is possible” Tap the OK button. If you wish to have a communication by using with H/PC Explore and PC LINK, select the menu stated in operation step 4 above. Input Parameter Command line argument Registry : communication command, communication option, transmission pathname, I/O interface to be used, baud rate, mode : Set up registry only if the following default values must be changed. I/O interface to be used (RS-232C, IrDA), baud rate, drive letter (refer to Chapter7.9 “Setting Up Registry”.) Output Parameter Return value of Winmain : termination code (refer to Chapter 7.10 “Termination Codes”.) 7.4 Termination of FLCE This FLCE utility will terminate if; All specified commands are implemented normally, or notification of normal end is received from partner station. Specified command results abnormal state, or notification of abnormal end is received from partner station. Timeout for session establishment is 1 minute. If the session cannot be established within the period, timeout will cause an error. “INFINITE” of timeout (= no timeout) can be set for continuous session. The cancel button in the status window which appears after the FLCE startup is tapped. 45 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. However, Windows CE Ver 2.11 does not support this function. If this function is required, incorporate it into the user application. 46 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. When the communication environment setup command is not specified, the default value is used. Table 7.2 Types of Arguments Type Setup command Operation command Function Communication environment setup File transmission File reception File transmission (append) File deletion File move Time transmission Idle startup Command /Y={device, baud rate, mode} /S /R /A Applicable Option None Example of Input /Y={COM1, 115200, } O, R O, R None / SOR / ROR /A /D /N /T None O, R None None Script file name /D /N /T 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 read-only file is attempted and this option is not specified, this command will be abnormally terminated. The attribute of source file will be duplicated onto a target file which has been overwritten. R (Recursive call): All files that exist under a 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. 47 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. Describe a pathname on the PA-2400W so it begins with root directory, without including a drive letter. (This rule should also be applied when the pathname of file or directory on the PA2400W is specified from the upload/down utility (LMWIN) for host PC.) 2. If a pathname with a drive letter is specified from the communication partner, the drive letter will be ignored by the FLCE on host PC. (In other words, this pathname specification is treated as being equal to a specification that begins with root directory without a drive letter.) 3. If the communication partner (PC, etc.) runs under an OS that requires drive letter specification, and if the PA-2400W needs to describe the pathname of file or directory on the partner side, always attach an appropriate drive letter. However, as an exception to 2. above, if the communication partner side designates a device on the Windows CE machine for retrieving the format or other disk information, define a drive letter as follows. These setups can be modified as required by making the appropriate description in the registry. Default setting : Internal RAM PC card C: (Define the boot drive as C: to meet with specifications of PC/AT machine.) D: Table 7.3 Summary of drive letter handling Pathname specification on Windows CE Specify file or directory Specify device Not required (ignored if described) Follows the above mentioned rules. Pathname specification on other machines Depends on the OS. Depends on the OS. Drive letters D and E are used for external storage devices if concurrent use of multiple PC cards (compact flash card, ATA flash card) is allowed.. Note: Identification between multiple PC cards depends on the Windows CE’s specifications. Directory names of multiple PC cards are determined according to the order in which they were inserted into each slot, for example, "\Storage Card" and "\Storage Card2", thus no differentiation is made between these two cards in terms of device type. This is why neither of the cards can be assigned a fixed drive letter. 48 Reference: Windows CE has no concept of a drive letter. Accordingly, an additional drive is assigned a directory directly under the root directory. Example Internal RAM “My Documents” Internal RAM “General directory Internal RAM Internal RAM “Storage Card” PC card "My Documents" Internal RAM 49 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.3 format Long file name Drive letter X Required (Error if omitted) Required (Error if omitted) Not required (Ignored if specified) : Specification permitted X : Results in invalid pathname and termination from error if specified. 7.8.2 Specifying Non-existing File If the pathname of file or directory which does not exist at the communication partner side, the following processing is performed; Table 7.5 Communication partner Windows 95/Windows NT DOS Windows CE Reception Delete Move A A C C B B Transmission, Transmission (append) D D Meaning of the alphabets: A: Abnormally terminated if any of the multiple pathnames specified does not exist (even a file that actually exists will not be transferred). B: Abnormally terminated if the specified pathname does not exist (transfer is not achieved). C: If the specified pathname includes a pathname that does not exist, that pathname will be ignored (existing pathnames will be processed). D: A new file will be created. 50 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. In other cases, where the drive letter definition requires modification, create the key (item) of a drive letter and describe on the key the pathname of a device which will be defined according to the specification. If the registry has been set up, it will be remained valid until it is modified again or the system is cold-booted up. For a key (item) that is not set in the registry or a key (item) that has an incorrect setup the original default value will be used. 7.9.1 Setting Up Items Default value if the RS-232C baud rate registry has no setup : 19,200 bps Default value if the IrDA baud rate registry has no setup : 115.2 Kbps Default value if the communication line specification (232C= COM1 or IrDA) registry has no setup: IrDA Default value if the drive letter definition registry has no setup value: C \(Object Store of internal RAM) D \Storage Card\ (storage card) Default value if the command-to-response interval timeout registry has no setup : 30 seconds Registry position \HKEY_CURRENT_USER\FLCE\ Contents Key name Type Value BAUD DWORD Baud rate DEVNM STRING Communication line (I/O device) DRIVE\A STRING Path of a device defined as drive a: DRIVE\B STRING Path of a device defined as drive b: DRIVE\C STRING Path of a device defined as drive c: : : DRIVE\Z STRING Path of a device defined as drive z: Values for communication line and baud rate setups Communication line : COM1, IrDA Baud rate : For RS-232C; 9600, 14400, 19200, 38400, 57600, 115200 : For IrDA; Setting of baud rate cannot be allowed. Only the above permitted baud rates can be set. Setting with other baud rate can cause the default value to be set. Path to device A path to a device should be specified by the directory name to which the device is assigned. Example: Object Store of the internal RAM \ PC card or compact flash \Storage Card\ 51 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 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow ) { HKEY hKey1; // Open Handle LONG lReg1; // Result code DWORD Disp1; int // Create or Open disposition err; const wchar_t SubKey1[] const = TEXT( "FLCE"); // Key for FLCE wchar_t Name[] = TEXT( "RECVWAIT"); // Name for the command-to-response interval timeout const DWORD Value = 1800L; // Time-out value to be set (seconds) err=TRUE; // Open the registry key lReg1=RegCreateKeyEx( HKEY_CURRENT_USER, SubKey1, 0, NULL, 0, 0, 0, &hKey1, &Disp1); if( lReg1 == ERROR_SUCCESS) { // Set the value lReg1=RegSetValueEx( hKey1, Name, 0, REG_DWORD, ( const BYTE *)&Value, sizeof( Value)); if( lReg1 != ERROR_SUCCESS) err=FALSE; // Close the registry key. lReg1=RegCloseKey( hKey1); if( lReg1 != ERROR_SUCCESS) 52 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. For information about these codes refer to the Upload/Download Manual of PA-2400W. Passing of termination code A termination code will be returned as a return value from Winmain. Upper-level programs should reference this return value using the “GetExitCodeProcess()” function. List of termination codes A category code (upper byte) indicates the error category, and an error detail code (lower byte) indicates the detail of the error. Category codes are defined as follows: 00h DCh to F8h 01h 02h 0Fh A0h Normal termination Normal termination and notification of termination. Upper-level programs should take an action that is appropriate to each definition. Protocol error File-related error Argument-related error Communication line-related error 54 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. Communication is terminated because the break key is pressed on the PA-2400W (local station) or partner station. Data anomaly (data error occurred on the communication line). Non-existent file is specified. F6h 00h Normally terminated F7h 00h Normally terminated. F8h 00h Terminated due to interruption. 01h 00h Protocol error 02h 80h File not found 02h 81h Current directory delete error 02h 82h File write error An attempt has been made to delete the current directory. Write to the file is not possible. 02h 83h File read error Read from the file is not possible. 02h 84h Read only access error 0Fh 01h Argument parameter error An attempt has been made to overwrite or delete the read-only file. Incorrect argument description 0Fh 02h Argument too long Argument portion of the command line is too long A0h 10h Communication port open error A0h 20h Line break error or IrDA duplicate open error One of the other programs is using COM1 or IrDA,or FLCE is already initiated. Either the cable was unplugged during communication or the IrDA connection is broken (where the PA-2400W is dismounted from I/O Box). IrDA port is already open. A0h 30h Session-wait timeout error Session was not established within 1 minute of startup. 55 Remedy Refer to Chapter 7.5 “Restrictions”. Turn off the power. Refer to Chapter 7.5 “Restrictions”. Resume communication as required. Check the communication line connection. Check the specified file or directory. Check the objective directory of deletion. Check if the file is ready to be written. Check if the file is ready to be read from. Specify another file name or cancel the read-only attribute. Check the argument parameter. Reduce the length of the argument including FLCE to 255 characters or less. Terminate the program that is using COM1 or IrDA. Check the cable connection and mounting condition of the PA-2400W on I/O Box. Terminate the other program that is using IrDA. Check the cable connection or check if the IrDA is ready for communication. 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. If a new file cannot be created, log file creation is aborted. If an argument of command parameter includes error, a log file will not be created. A log file starts to be created at the point in time when communication with the partner begins. Format 1st line 2nd line 3rd line Version information of FLCE.EXE will be outputted. Version information (1 byte) of the protocol will be outputted. The first version is "1". Communication partner machine code (maximum 3 bytes) will be outputted. AT .... IBM-PC compatible machine 4th line Session ID information will be outputted. This will be outputted in a hexadecimal number (Example: 0x0000). 5th line Last event information will be outputted. 6th line Last phase information will be outputted. 7th line Last status information will be outputted. Outputted as a hexadecimal number (Example: 0x0000). 8th line Last transmission file name will be outputted. 9th line Last reception file name will be outputted. Output will consist of the above eight lines Output will consist of the above nine lines. Since with lines 2 through 4 the information acquired from the communication partner is outputted, this line will be outputted as a blank line for a log file on one of the PA-2400Ws that operates in the PC emulation mode for communication between two PA-2400Ws. One line must be less than 80 bytes in length. Therefore, if a file name inserted in the 8th or 9th line requires 65 bytes or more (15 bytes are used for the item name), characters on and after the 65th byte will not be outputted. 56 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. If attempting PA-2400W-to-PA-2400W communication always use the CASIO AC adaptor to power. 57 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. C Language Interface Calling Sequence FLCE /Y={ [ ], [ ], [ ] } (Comma must be written and no space allowed. Parameters in [ Parameters Device Baud rate Mode Select either "IrDA" or "COM1". If "IrDA" is selected – the baud rate setting can not be allowed. If "COM1" is selected - The following baud rates can be selected for RS-232C communication. 9600, 19200, 38400, 57600, 115200 Combinations other than those described above are not permitted and will cause a parameter error. "H" - PA-2400W-to-PA-2400W command specification mode (Session-wait timeout is 1 minute.) This option is used by one side which specifies the operation command when performing communication between two PA-2400Ws. (The FLCE on the communication partner should operate in the idle start mode.) "I" - Normal mode (Session-wait timeout is infinite.) Only "H" or "I" can be specified. If mode specification is omitted, the normal mode with the session-wait timeout set to 1 minute is automatically specified. Table 7.7 Startup Idle (including script) Designation of Operation command Communication Partner PC (I/O Box)/PA-2400W PC (I/O Box) PA-2400W Startup Examples ] can be omitted.) Session Wait Timeout 1 minute Infinite No mode Mode specification Specification, “I” Mode specification, “H” - FLCE /Y={COM1, 115200, } /S "\casio\*.dat" "d:\casiodat\" Communication is performed using the RS-232C port at a baud rate of 115.2 Kbps. (Session-wait timeout is 1 minute.) FLCE /Y={, , I} /S "\casio\*.dat" "d:\casiodat\" Communication is performed through command specification with the device name and the baud rate are default-set. (Session-wait timeout is infinite.) FLCE /Y={, , H} /S "\casio\*.dat" "d:\casiodat\" Communication is performed between two PA-2400Ws through command specification with the device name and the baud rate are default-set. (Session-wait timeout is 1 minute.) FLCE /Y={, , I} Communication is performed in the idle mode with the device name and the baud rate are default-set. (Session-wait timeout is 1 minute.) FLCE /Y={, , } /S "\casio\*.dat" "d:\casiodat\" Communication is performed under the same conditions (with default values) of which "/Y" is omitted. 58 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. If any of the file pathnames to be transmitted do not exist on the PA-2400W side, the FLCE is immediately terminated by an error, and file pathnames placed at the right of that pathname will no longer be transmitted. C Language Interface Calling Sequence FLCE /S[