The text of a manual · part 3 of 21
Symbol Palm Terminal Scanner System Software Manual: Chapter 1 Using the Scan Manager Shared Library
Pages 11 to 16 of 168, from Symbol Palm Terminal Scanner System Software Manual
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 Symbol SPT-1700
Page 11
Chapter 1 Using the Scan Manager Shared Library Using the API The Scan Manager software development kit (SDK) is used by third-party developers to create scanner-enabled applications for the terminal. The Scan Manager shared library API allow terminal applications to control and receive data from the scanner hardware. A typical application uses the Scan Manager shared library to do the following, in the order listed below: 1. Open the scanner. 2. Enable the scanner to initiate scans through either the hardware or the application. 3. Handle any decoded data or error messages received from the decoder. 4. Shut down the scanner. Refer to Chapter 6 for a detailed walk-through of SScan, a sample scanner-enabled application. The following snippets of code are a simple construct of a typical third-party application: #include "Pilot.h"
// all the system toolbox headers
#include <Menu.h> ... ... #include "ScanMgrDef.h" // Scan Manager constant definitions #include "ScanMgrStruct.h"
// Scan Manager structure definitions 1-1
Page 12
Symbol Palm Terminal Scanner System Software Manual
#include "ScanMgr.h"
// Scan Manager API function definitions
... #include "SScanRsc.h" #include "Utils.h"
// application resource defines // miscellaneous utility functions
DWord PilotMain(Word cmd, Ptr cmdPBP, Word launchFlags) { // Check for a normal launch. if (cmd == sysAppLaunchCmdNormalLaunch) { Err error = STATUS_OK;
// Set up Scan Manager and the initial (Main) form. StartApplication();
// Start up the event loop. EventLoop();
// Close down Scan Manager, decoder StopApplication(); } return(0); }
1-2
Page 13
Using the Scan Manager Shared Library
/***************************************************************** * * FUNCTION:
StartApplication
* * DESCRIPTION:
This routine sets up the initial state of the
* application.
* *****************************************************************/ static void StartApplication(void) { Err error;
// Call up the main form. FrmGotoForm( MainForm );
// Now, open the scan manager library error = ScanOpenDecoder();
// Set decoder parameters we care about... // enable scanning ScanCmdScanEnable(); // allow software-triggered scans ScanSetTriggeringModes( HOST ); // Enable any barcodes to be scanned ScanSetBarcodeEnabled( barUPCA, true ); ScanSetBarcodeEnabled( barUPCE, true );
1-3
Page 14
Symbol Palm Terminal Scanner System Software Manual
ScanSetBarcodeEnabled( barUPCE1, true ); ScanSetBarcodeEnabled( barEAN13, true ); ScanSetBarcodeEnabled( barEAN8, true ); ScanSetBarcodeEnabled( barBOOKLAND_EAN, true); ScanSetBarcodeEnabled( barCOUPON, true);
// We've set our parameters... // Now call "ScanCmdSendParams" to send them to the decoder ScanCmdSendParams( No_Beep); }
/***************************************************************** * * FUNCTION:
StopApplication
* * DESCRIPTION:
This routine does any cleanup required, including
* shutting down the decoder and Scan Manager shared
* library.
* *****************************************************************/ static void StopApplication(void) { // Disable the scanner and Close Scan Manager shared library ScanCmdScanDisable(); ScanCloseDecoder(); }
1-4
Page 15
Using the Scan Manager Shared Library
To start the scanner: 1. Call the ScanOpenDecoder() function to open the Scan Manager shared library, and to initialize the scanner. You must call this function first, before any other function in the shared library can be called. 2. Use the appropriate Scan Manager functions to set any of the other scanner parameters, such as barcode formats. The specified parameters are only set locally. To send the new parameters to the scanner, you must call ScanCmdSendParams(). The new parameters remain in effect until you or another application changes them, or ScanCmdParamDefaults() is called. 3. Call the ScanCmdScanEnable() function to allow scanning to be performed. To set the scan trigger: Call the ScanSetTriggeringModes() function to identify the type of trigger that will initiate scans. The typical application passes this function to the LEVEL parameter. To handle scanner data and errors: 1. In your event handling code, respond to any scanDecodeEvent by storing or displaying the decoded data. 2. Respond to error conditions (such as scanBatteryErrorEvent) by alerting the user or performing appropriate recovery routines. To shut down the scanner: 1. Call the ScanCmdScanDisable() function to shut down the scanner. 2. Call the ScanCloseDecoder() function at the conclusion of the program. If you don’t, you’ll get system errors and unexpected results.
1-5
Page 16
Symbol Palm Terminal Scanner System Software Manual
Using the Scan Demo Application Scan Demo is a demo application included with the Scan Manager shared library. Scan Demo exercises nearly all of the API, and shows you how to: ! ! !
Use the API to set and get scanner parameters Handle decoded scanner data Handle scan errors and a low-battery condition
This demo application also allows you to use the terminal’s graphical interface to display and change scanner settings. Refer to the Scan Manager library for the location of Scan Demo.
1-6