The text of a manual · part 10 of 38
PEN*KEY 6100 Computer Programmer's Reference Guide: Section 3: Supporting Windows Applications, pages 78 to 86
Pages 78 to 86 of 328, from PEN*KEY 6100 Computer Programmer's Reference Guide
The original document is the PDF (1.2 MB). This is its text as extracted, unedited; tables and drawings read best in the PDF, and each page heading opens it at that page.
For the Norand 6100
Page 78
Supporting Windows Applications
SECTION 3
NORWINPM.DRV SYSTEM.INI Configuration Example To display only warnings (the typical mode), turn on the power miser, and allow other windows to cover the fuel gauge, place the lines shown below into SYSTEM.INI: [Power Driver] MsgLevel=1 Miser=1 OnTop=1
User Notifications Installation Messages The following messages are displayed in a dialog box when an error occurs while NORWINPM.DRV is initializing. Could not find APM BIOS, Windows power management not installed! APM BIOS connect failed! Power management disabled! Could not allocate a timer for polling APM BIOS! Power management disabled!
The message below appears in a dialog when the user presses the (SusĆ pend/Resume) button and the system cannot suspend because a Windows apĆ plication, driver, or DOS TSR refused the suspend request. An application or driver is refusing to suspend
Informational Messages The messages below appear in a dialog box whenever the ApmEventDialogs entry in SYSTEM.INI (see above) is set to the value of 2, or higher. They are inĆ tended for power management debugging. See the Standard APM Event Codes paragraph, on page 3-13, for descriptions of APM event codes. 3. Windows Applications
APM Event <Hex APM Event ID>. APM OEM Event <Hex OEM Event ID>.
Fuel Gauge Display The NORWINPM.DRV fuel gauge icon, depicted below, shows all of the possible elements: The battery (on right side of gauge) displays the charge level. When it is completely filled in, the battery is fully charged. " The top terminal of the battery contains a symbol when charging. " The smaller column to the left of the battery is the Meter". It conĆ tains a bar that moves up when the system is busy. If the bar a blinking dash " symbol appears at the top of the bar to show that the sysĆ tem is not idling. The optional text below the battery and busy meter can be enabled or disabled with the TextOptions SYSTEM.INI entry. "
Keep in mind that the position of the fuel gauge on the screen is controlled by parameters in the SYSTEM.INI file. And, is therefore under application control. It can be located anywhere on the screen or can be moved off of the screen, using the parameters in the SYSTEM.INI file. In addition, the user can move it around at will, simply by dragging it around with the finger or stylus. 3-10
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 79
SECTION 3
Supporting Windows Applications
Also, the on Top" feature can be enabled or disabled, using the setting in the Driver]" section of the SYSTEM.INI file.
Figure 3-1 Fuel Gauge Display
Figure 3-1 depicts a 6100 Computer screen with a typical location for the fuel gauge, showing an expanded view of the gauge details to the right of the screen.
NORAND Power Management Programming Interface for Windows Windows Power Management The APM operating system driver, NORWINPM.DRV, cooperates with the APM BIOS, to save as much power as possible without application or driver intervenĆ tion. This allows a system to be built with reasonable power consumption, withĆ out needing to create powerĆaware drivers and applications. Even better power management can often be achieved by cooperating with applications and drivers.
CPU Power Management
Power Management by Windows Applications Windows applications can benefit from system power management, because it frees up the Windows kernel and allows NORWINPM.DRV to idle the CPU. Avoiding busy loops is a requirement to maintain system response in a cooperaĆ tive multitasking system like Windows;. but busy loops also waste system power. Applications should be careful to never perform busyĆwait when implementing timeĆouts or polling routines. Instead, use an eventĆbased approach. Perhaps by acquiring a system timer, so the system can idle during periods of inactivity. PeekMessage() loops are often used instead of the usual GetMessage() loop whenĆ ever an application has background processing to do. An application that uses PeekMessage() must be careful to call GetMessage() or WaitMessage() whenever there are no messages waiting and there is no background processing to do. ApĆ plications that call PeekMessage() continuously does allow other Windows apĆ PEN*KEY R 6100 Computer Programmer’s Reference Guide
3-11
3. Windows Applications
NORWINPM.DRV monitors the Windows task scheduler to determine when the CPU is idle. When idleness is detected, the CPU and other components are placed into a low power state until the next hardware interrupt occurs. The sysĆ tem then returns to full speed to process the interrupt and any Windows events created by the interrupt. When an application is idle, 95% of CPU current can usually be saved.
Page 80
Supporting Windows Applications
SECTION 3 plications to run if they have messages, which keeps your application WindowsĆ friendly. But if there are no pending message for anyone, PeekMessage() immediately returns to its caller and does not allow the Windows kernel to beĆ come idle. The result is an application that calls PeekMessage() more or less conĆ tinuously with short breaks while other applications process their messages. In other words, a busy loop" is the result. The powerĆfriendly way to implement a PeekMessage() loop is to implement the following: Call PeekMessage() if no messages, perform background processing if there is no background processing to do, then call GetMessage() or call WaitMessage() " NOTE:
Some Windows application libraries are not written with mobile computing in mind and may make use of PeekMessage() busy-loops in their message handlers.
Holding Off Suspend Time-outs If an application is busy with communication or processing, for extended periods of time with no user interaction, the system might time out into suspend during processing. In order to prevent this, the application should fail SUSPENDREĆ QUEST broadcasts while performing CPUĆbound tasks. As mentioned above, USERSUSPEND requests can also be failed, but the application should inform the user about this type of action, otherwise the user may think that the system is locked up (since the Suspend/Resume button does not work) and might reset the system or take some other drastic measure.
APM Event Broadcasts
3. Windows Applications
The APM BIOS specification defines event codes for various power management events. NORWINPM.DRV collects these events from the APM BIOS and either handles them directly or broadcasts them to the system components (Windows drivers, applications and DOS TSRs). System components can use the events to monitor system power state changes. Some APM events have responses which can implement cooperative power management. Receiving APM Event Broadcasts
NORWINPM.DRV broadcasts APM events to Windows applications, system drivĆ ers, installable drivers, VxDs, DOS drivers, and DOS TSRs loaded installed in the System VM. Each device has a different broadcast API. The most common APIs are documented below. Windows Applications
Windows applications receive APM event broadcasts via the message procedures of any topĆlevel windows that they own. The message format is: Msg: wParam: lParam: Returns:
3-12
WM_POWER (defined in WINDOWS.H) PWR_* event code defined in APMCODES.H or WINDOWS.H. Undefined Application should return PWR_FAIL (from WINDOWS.H) if it wishes to reject an event. Otherwise, PWR_OK should be returned.
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 81
SECTION 3
Supporting Windows Applications
Windows Installable Drivers
Windows installable drivers receive APM event broadcasts via their DriverProc entry points. The message format is: Msg: lParam1: lParam2: Returns:
DRV_POWER (defined in WINDOWS.H) PWR_* event code defined in APMCODES.H or WINDOWS.H. Undefined The driver should return PWR_FAIL or PWR_OK
DOS Real-Mode Drivers and TSRs
DOS realĆmode system components receive APM event broadcasts through softĆ ware interrupt 2Fh. A driver or TSR that hooks the broadcast should nest to previous owners of the interrupt before handling it; even if it wants to fail the call. This approach allows other drivers an opportunity to see the event; even if it results in failing. The message format is: AX: BX: CX:DX: Returns BX:
530Bh, the APM event broadcast ID APM_* event code defined in APMCODES.H. Optional 32Ćbit Norand APM event parameter Set BX to 0 for success or 80h to fail the event.
Windows System Drivers
Windows system drivers receive APM event broadcasts through a defined entry point. NORWINPM.DRV does not currently broadcast to system drivers, since none of them has this entry point.
Standard APM Event Codes
SUSPENDREQUEST, System Suspend Request Notification A suspend timeĆout is pending. Drivers and applications should fail the event if they are busy. If the event is failed, NORWINPM.DRV restarts the suspend timeĆ out suspend request but does not suspend the system. SUSPENDRESUME, Normal Resume System Notification The system has returned from a suspend timeĆout or a user suspend. Drivers and applications should respond to system changes at this time. PWRCHANGE, Power Status Change Notification Power status has changed. The optional parameter of this event message conĆ tains the first four bytes of the current tagPOWER_STATUS (refer to NORAPM.H, in the Tool Kit). You can use the message to determine whether the system is runĆ ning on battery power or line power without having to poll NORWINPM.DRV. PEN*KEY R 6100 Computer Programmer’s Reference Guide
3-13
3. Windows Applications
These are the most common APM event codes defined and is described in the Intel/Microsoft APM Specification, versions 1.0 and 1.1. There are additional events, but these are the ones typically handled by drivers and applications. Events marked are only valid in APM 1.1, and may not be present on open systems that only implement 1.0 events. Additional clarification of NORWINPM.DRV's use of these events is given below. There are other APM codes that may also be broadcast.
Page 82
Supporting Windows Applications
SECTION 3
BATLOW, Battery Low Notification The system battery is running low. The optional parameter of this event mesĆ sage contains the last four bytes of the current tagPOWER_STATUS . Use the message to determine the current battery status without polling NORĆ WINPM.DRV. USERSUSPEND, User System Suspend Request Notification The user has pressed the suspend/resume switch and wants to suspend the sysĆ tem. Drivers or applications that attempt to fail this request probably become an annoyance to the user unless the drivers put up some sort of polite explanaĆ tion as to why the system does not turn off when the switch is pressed. In any case, the driver or application must prepare for an impending suspend because the APM driver is allowed to override the fail request and suspend the system. TIMEUPDATE, Update Time Notification This event is issued whenever the time has been updated to correct for warp" that is not due to a suspend. Applications that perform processing tied to real time should check the time whenever they see this event, in addition to checking the time whenever they see any of the resume events. CRITICALSUSPEND, Critical System Suspend Notification This event is never broadcast. NORWINPM.DRV immediately suspends the sysĆ tem when it receives it and broadcasts a CRITICALRESUME event upon resumĆ ing. CRITICALRESUME, Critical Resume System Notification The system was suspended without sending a notification broadcast in advance. This event is usually caused by a power failure. Drivers should typically disable and reenable themselves when receiving this message. STANDBYREQUEST, System Standby Request Notification 3. Windows Applications
Because of the efficacy of the suspend mode, NORAND systems do not currently implement a standby mode. In addition to STANDBYREQUEST, the USERSTANDBY and USERSTANDBYRESUME messages are also ignored or are never generated.
APM Event Code Broadcast Values Refer to the APM Event Code Broadcast Values paragraph, in Appendix A, SamĆ ple Configuration Files, for a listing of the event codes and their values. Generally, Intermec Technologies Corporation attempts to use APM 1.1 stanĆ dardized event codes whenever appropriate. However, Intermec Technologies Corporation may choose to make additional events available on systems with exĆ tended functionality. The OEM codes listed in APMCODES.H represent currentĆ ly defined codes, but does not imply that all or any OEM events are available on any particular Intermec system.
3-14
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 83
SECTION 3
Supporting Windows Applications
Windows Pen Driver: UCLKPEN.DRV The Windows pen driver (UCLKPEN.DRV) interfaces the pen digitizer to WinĆ dows 3.1. The digitizer may be based on resistive touchĆpanel technology; or it may use active electronics.
Pen Applications When Microsoft Windows for Pen Computing is executing, the driver acts as a pen device. At other times, the driver acts as a mouse device. Usually, the pen simply appears as a mouse device. Any Windows application that can use a mouse can use the pen. Note that is equivalent to pressing the left, or button on a desktop mouse. If Microsoft Windows for Pen Computing is loaded, the pen can appear to be both a mouse and an ink device. The Microsoft Windows for Pen Computing developĆ er's kit documents the inking API that captures and manipulates ink input. Now, which mode should your application use: mouse or inking device? In generĆ al, applications that do not require handwriting recognition should simply treat the pen as a mouse. Mouse input is quite adequate for pointing and drawing tasks such as signature capture. Microsoft Windows for Pen Computing requires additional storage and processing resources; therefore, it should be used when handwriting recognition is a requirement.
Installation Place the files in the following directories: File PENALIGN.EXE NORWINPM.DRV UCLKPEN.DRV PENWIN.DLL
Directory WINDOWS\ WINDOWS\SYSTEM WINDOWS\SYSTEM WINDOWS\SYSTEM
You can configure the Windows pen driver by editing the appropriate entries in SYSTEM.INI. Unless otherwise noted, all entries are placed in the Driver]" section of SYSTEM.INI. To install UCLKPEN.DRV, place a keyword on the line, in the [boot] section of SYSTEM.INI, and add a line to the ]" section of SYSTEM.INI equating the keyword with the actual path to UCLKPEN.DRV. If you are using Microsoft Windows for Pen Computing, place the pen driver entry in the [boot] section of SYSTEM.INI (drivers=...) before the (penwindows) entry, in the [drivers] section of the SYSTEM.INI. Although the following example shows Microsoft Windows for Pen Computing being installed, it is not required for digitizer use.
PEN*KEY R 6100 Computer Programmer’s Reference Guide
3-15
3. Windows Applications
Configuration
Page 84
Supporting Windows Applications
SECTION 3
Required SYSTEM.INI Entries SYSTEM.INI: [boot] drivers= power irda pen penwindows scanner npcp [drivers] power=norwinpm.drv pen=uclkpen.drv penwindows=penwin.dll drivers= tells Windows to load the installable drivers. This list of drivers is the standard driver list (in the required order). The significant driver here, is penwindows. This is just a token name for the driver. The actual driver name is specified in the [drivers] section of the SYSTEM.INI file: pen=UCLKPEN.DRV tells Windows the actual name of the installable driver named in the [boot] section of the SYSTEM.INI file. penwindows= tells Windows the name of the installable PENWIN driver. Refer to the example in the SYSTEM.INI Configuration Example paragraph or see the [Pen Driver] section in the example SYSTEM.INI file, in Appendix A, Sample Configuration Files, for further details on how to configure the Windows Pen driver.
Hardware Interface These entries, in the SYSTEM.INI file, initialize the hardware interface for the PEN*KEY 6000 Series Computer. Unless otherwise specified, any of these entries used should go into the [pen drivĆ er] section of the SYSTEM.INI file. Most of these hardware interfaces default to the values needed for the PEN*KEY 6000 Series Computer and should not need to be set. Note the values". PortAddr
3. Windows Applications
Valid values:
0 to 1023
Default value:
520
Required value for 6100 Computer: 512 This entry sets the decimal digitizer base I/O port address. IrqLevel Valid values:
0 to 15
Default value:
12
Required value for 6100 Computer: 14 This entry sets the decimal IRQ level used by digitizer. BaseClock
" NOTE:
3-16
Valid values:
0 = 33 MHz 1 = 2 MHz 2 = 14 MHz
Default value:
0
This entry sets the base clock value for Gazelle/Logitech digitizer. The only value that is supported by the PEN*KEY 6000 Series Computer is the default value of 0.
PEN*KEY R 6100 Computer Programmer’s Reference Guide
Page 85
SECTION 3
Supporting Windows Applications
PointsPerSecond Valid values: 1 to approximately 200 Default value: 50 This entry sets the initial digitizing rate, in packets per second. The default valĆ ue is sufficient when using the pen only as a pointing device. Values between 100 and 150 give better results, when using handwriting recognition, such as when Microsoft Windows for Pen Computing is installed. This value must be in the range of 120-150 for handwriting recognition. MaxIPS Valid values: 0 to approximately 150 Default value: 75 This entry sets the fastest movement allowed, in inches per second. The default value should be adequate for PEN*KEY 6000 Series Computers.
Digitizer Calibration These entries, in the SYSTEM.INI file, set the calibration of the digitizer for the PEN*KEY 6000 Series Computer. Unless otherwise specified, any of these entries used should go into the [pen driver] section of the SYSTEM.INI file. Most of these hardware interfaces deĆ fault to the values needed for the PEN*KEY 6000 Series Computer, and should not need to be set. Note the values". cxRawWidth Valid values: 0 to 32767 Default value: 4500 This entry sets the physical width of the digitizer, in thousandths of an inch, in the display's native (nonĆrotated) hardware orientation. The default value should be adequate for PEN*KEY 6000 Series Computers. Valid values: 0 to 32767 Default value: 3000 This entry sets the actual height of the digitizer, in thousandths of an inch, in the display's native (nonĆrotated) hardware orientation. It should not need to be specified for the PEN*KEY 6000 Series Computers. wDistinctWidth Valid values: 0 to 32676 Default value: 3500 This entry sets the width of the display, in its nonĆrotated orientation, in digitizĆ ing units. It is set by the PENALIGN.EXE calibration applet. wDistinctHeight Valid values: 0 to 32767 Default value: 3045 This entry sets the height of the display, in its nonĆrotated orientation, in digitizĆ ing units. It is set by the PENALIGN.EXE calibration applet. PEN*KEY R 6100 Computer Programmer’s Reference Guide
3-17
3. Windows Applications cyRawHeight
Page 86
Supporting Windows Applications
SECTION 3 wOffsetX Valid values: Default value:
0 to 32767 1000
This entry sets the digitizer value that corresponds to the leftmost point on the rotated display, plus 1000. Negative offsets, to 1000, are specified by using valĆ ues less than 1000. wOffsetY Valid values: 0 to 2767 Default value: 1000 This entry sets the digitizer value that corresponds to the uppermost point on the rotated display, plus 1000. Negative offsets to -1000 are specified by using values less than 1000. UseNV Valid values: 0, 1 Default value: 1 When this entry is nonzero, Norand nonvolatile memory reads and stores the digitizer calibration information. When this entry is set to 0, it overrides the calibration stored in nonvolatile storĆ age, with the calibration values from SYSTEM.INI.
Display Orientation These entries, in the SYSTEM.INI file, match the orientation of the PEN*KEY 6000 Series digitizer to the screen display. The Pen driver must take into acĆ count any rotation of the screen display, as well as additional rotational offset of the digitizer relative to the display. The calibration values given above are swapped and flipped to match the final user orientation of the digitizer. 3. Windows Applications
Unless otherwise specified, any of these entries used should go into the [pen drivĆ er] section of the SYSTEM.INI file. DisplayOrientation Valid values for degrees of rotation: 0 = 0 1 = 90 (default) 2 = 180 3 = 270 This entry specifies the value for the orientation of the display. 0 is the default hardware orientation. Values from 1 to 3 indicate successive 90Ćdegree clockwise rotations. Locate this entry in the [display driver] section of SYSTEM.INI. PenOrientation Valid values for degrees of rotation: 0 = 0 1 = 90 2 = 180 (default) 3 = 270 This entry specifies additional rotation of the pen digitizer orientation relative to the display, which may already be rotated by the preceding DisplayOrientation value. The pen orientation, relative to the default hardware display orientation, is the DisplayOrientation value (preceding) added to the PenOrientation value. 3-18
PEN*KEY R 6100 Computer Programmer’s Reference Guide