WaveLinkBarcode Samples

The following sample code demonstrates the implementation and capabilities of the Class WaveLinkBarcode and its associated methods.

/*****************************************************

/*****************************************************

* This source code is for demonstration

* purposes only and should be treated as such.

*

*/package barcodedemo;

import com.wavelink.clientui.*;

public class JavaBarcodeDemo extends WaveLinkApplication {

private static int CLR = 27;

public void WaveLinkMain ( String [] args) {

WaveLinkIO ioIface = new WaveLinkIO ();

WaveLinkBarcode barcodeIface = new WaveLinkBarcode();

String returnData;

// holds the data returned from an RFInput

int lastExtendedType; // set by RFInput

try {

// add two barcodes with type, expand, decode, min, max

barcodeIface.AddBarcode( WaveLinkBarcode.CODE_39, false, true, 1, 32 );

barcodeIface.AddBarcode( WaveLinkBarcode.UPC_A, false, true, 1, 32 );

for ( ;; ) {

ioIface.RFPrint( 0, 0, "Scan CODE_39 ", WaveLinkIO.WLNORMAL | WaveLinkIO.WLCLEAR );

ioIface.RFPrint( 0, 7, " CLR to Exit Demo ", WaveLinkIO.WLREVERSE | WaveLinkIO.WLFLUSHOUTPUT );

// enable CODE_39

barcodeIface.Decode( 0, true );

// disable UPC_A

barcodeIface.Decode( 1, false );

// save config to handheld and disable all other barcodes

barcodeIface.StoreBarcode( "BCDemo", WaveLinkBarcode.BCDISABLED ); ;

returnData = ioIface.RFInput( "", 20, 0, 3, "BCDemo",WaveLinkIO.WLNORMALKEYS, WaveLinkIO.WLBACKLIGHT );

// check for the CLR ( escape ) key

if ( ioIface.LastInputType() == WaveLinkIO.WLCOMMANDTYPE && returnData.charAt(0) == (char)CLR )

return;

lastExtendedType = ioIface.LastExtendedType();

if ( lastExtendedType != WaveLinkBarcode.CODE_39)

{

WaveLinkMessageBox wlmb = new

WaveLinkMessageBox( );

wlmb.SetMessageLine( "Scan CODE_39", 0 );

wlmb.Display( 5 );

continue;

}

ioIface.RFPrint( 0, 0, "Scan UPC_A ", WaveLinkIO.WLNORMAL | WaveLinkIO.WLCLEAR );

// disable CODE_39

barcodeIface.Decode( 0, false );

// enable UPC_A

barcodeIface.Decode( 1, true );

// save config to handheld and disable all other barcodes

barcodeIface.StoreBarcode( "BCDemo", WaveLinkBarcode.BCDISABLED );

returnData = ioIface.RFInput( "", 20, 0, 3, "BCDemo", WaveLinkIO.WLNORMALKEYS, WaveLinkIO.WLBACKLIGHT );

// check for the CLR ( escape ) key

if ( ioIface.LastInputType() == WaveLinkIO.WLCOMMANDTYPE && returnData.charAt(0) == (char)CLR )

return;

lastExtendedType = ioIface.LastExtendedType();

if ( lastExtendedType != WaveLinkBarcode.UPC_A )

{

WaveLinkMessageBox wlmb = new

WaveLinkMessageBox( );

wlmb.SetMessageLine( "Scan UPC_A", 0 );

wlmb.Display( 5 );

continue;

}

}

} catch ( WaveLinkError wlErr ) {

// Do error handling

}

}

}

 


Was this article useful?    

The topic was:

Inaccurate

Incomplete

Not what I expected

Other

Privacy and Legal