The text of a manual · part 5 of 11
PSM20i Bar Code Scanner Attachment Programmer's Guide: Chapter 2 Function Definitions, pages 25 to 34
Pages 25 to 34 of 80, from PSM20i Bar Code Scanner Attachment Programmer's Guide
The original document is the PDF (773 KB). 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 PSM20i
Page 25
Function Definitions setDataTransFormat Class BarCodeReader
Description Determines the format of the decoded data which is returned to the application. Also see setPrefix, setSuffix1 and setSuffix2.
Invocation boolean setDataTransFormat(byte val) val valid range 0-7 0 data as is
1
<data><suffix1>
2
<data><suffix2>
3
<data><suffix1><suffix2>
4
<prefix><data>
5
<prefix><data><suffix1>
6
<prefix><data><suffix2>
7
<prefix><data><suffix1><suffix2>
Return Value true set data transmit format successfully.
false failed to set data transmit format.
Example import com.symbol.j2me.midlets.ascanner.BarCodeReader; BarCodeReader barCodeReader = new BarCodeReader(); boolean response = barCodeReader.setSuffix1((byte)0x07); Sets the format of data to: <prefix><data><suffix2><suffix2>.
2-11
Page 26
PSM20i Bar Code Scanner Attachment Programmer’s Guide setLaserOnTime Class BarCodeReader
Description Sets the amount of time the decoder will try to decode a barcode. The scanner must be enabled and configured before calling this function. By default, this value is 3.0 seconds.
Invocation void setLaserOnTime(int seconds, int fraction) seconds the whole number of seconds; valid range 0-9 fraction the tenths of second; valid range 0-9
Valid range is 0.5 seconds to 9.9 seconds.
Return Value None
Example import com.symbol.j2me.midlets.ascanner.BarCodeReader; BarCodeReader barCodeReader = new BarCodeReader(); barCodeReader.setLaserOnTime((int )0x05, (int )0x09); Sets the laser on time to 5.9 seconds.
2-12
Page 27
Function Definitions setLinearSecurity Class BarCodeReader
Description For security levels 1-3, determines which linear code types and lengths must be read twice before being decoded. For security level 4 determines which linear codes must be read three times before being decoded. There is an inverse relationship between security and scanner aggressiveness, so be sure to set only that level of security necessary for any given application.
Invocation boolean setLinearSecurity(byte level) level valid range 1-4 Level 1
Level 2
Level 3
Level 4
Code Type
Length
Codabar
All
MSI Plessey
4 or less
Discrete 2 of 5
8 or less
Interleaved 2 of 5
8 or less
Code Type
Length
All
All
Code Type
Length
MSI Plessey
4 or less
Discrete 2 of 5
8 or less
Interleaved 2 of 5
8 or less
Code Type
Length
All
All
2-13
Page 28
PSM20i Bar Code Scanner Attachment Programmer’s Guide
Return Value true security level set successfully.
false failed to set security level.
Example import com.symbol.j2me.midlets.ascanner.BarCodeReader; BarCodeReader barCodeReader = new BarCodeReader(); boolean response = barCodeReader.setLinearSecurity((byte)0x02); Sets the linear security level to 2 which requires all codes to be read twice before being decoded.
2-14
Page 29
Function Definitions setPrefix Class BarCodeReader
Description Set the hex value of the character to be used as the prefix to any decoded data. Note that setDataTransFormat determines if the prefix will actually be sent or not.
Invocation boolean setPrefix(byte val) val hex value of the ASCII character to be used as the prefix to the decoded data. Default value = NULL.
Return Value true set prefix successfully.
false failed to set prefix.
Example import com.symbol.j2me.midlets.ascanner.BarCodeReader; BarCodeReader barCodeReader = new BarCodeReader(); boolean response = barCodeReader.setPrefix((byte)0x25); Sets the prefix for decoded data to ’%’.
2-15
Page 30
PSM20i Bar Code Scanner Attachment Programmer’s Guide setSuffix1 Class BarCodeReader
Description Set the hex value of the character to be used as the first suffix to any decoded data. Note that setDataTransFormat determines if the first suffix will actually be sent or not.
Invocation boolean setSuffix1(byte val) val hex value of the ASCII character to be used as the first suffix to the decoded data. Default value = LF (0x0a).
Return Value true set suffix1 successfully.
false failed to set suffix1.
Example import com.symbol.j2me.midlets.ascanner.BarCodeReader; BarCodeReader barCodeReader = new BarCodeReader(); boolean response = barCodeReader.setSuffix1((byte)0x21); Sets the suffix1 for decoded data to ’!’.
2-16
Page 31
Function Definitions setSuffix2 Class BarCodeReader
Description Set the hex value of the character to be used as the second suffix to any decoded data. Note that setDataTransFormat determines if the second suffix will actually be sent or not.
Invocation boolean setSuffix2 (byte val) val
Set the hex value of the character to be used as the second suffix to any decoded data. Note that setDataTransFormat determines if the second suffix will actually be sent or not. Default value = CR (0x0d).
Return Value true set suffix2 successfully.
false failed to set suffix2.
Example import com.symbol.j2me.midlets.ascanner.BarCodeReader; BarCodeReader barCodeReader = new BarCodeReader(); boolean response = barCodeReader.setSuffix2((byte)0x24); Sets the suffix2 for decoded data to ’$’.
2-17
Page 32
PSM20i Bar Code Scanner Attachment Programmer’s Guide startDecode Class BarCodeReader
Description Returns a string containing the decoded text. Returns after a successful decode or timeout. Note: To guarantee an accurate decode, ensure that the startDecode function is not called while the phone is transmitting.
Invocation String startDecode()
Return Value String containing decoded text. Returns ‘NR’ if failed to decode, or timeout
Example import com.symbol.j2me.midlets.ascanner.BarCodeReader; BarCodeReader barCodeReader = new BarCodeReader(); String labeltext = barCodeReader.startDecode();
2-18
Page 33
Function Definitions transmitCodeId Class BarCodeReader
Description Returns an ID character along with the decoded barcode data. The code ID will be placed in front of the decoded barcode data. Note that if a prefix is being returned (see setDataTransFormat) the code ID will follow the prefix and immediately precede the decoded data. See Appendix A, Programming Reference for a list of code IDs.
Invocation boolean transmitCodeId(byte val) val valid range 0-2 0 do not send Code ID.
1 send AIM code ID.
2 send Symbol code ID.
Return Value true code ID sent successfully.
false failed to send code ID.
Example import com.symbol.j2me.midlets.ascanner.BarCodeReader; BarCodeReader barCodeReader = new BarCodeReader(); boolean response = barCodeReader.transmitCodeId((byte)0x02); Send the Symbol code ID along with the barcode data and any prefix and suffix character(s).
2-19
Page 34
PSM20i Bar Code Scanner Attachment Programmer’s Guide
Decode Configuration Commands booklandEAN Class BarCodeReader
Description Enable or disable decoding of Bookland-EAN barcodes and set label options.
Invocation boolean upcBooklandEAN(boolean enable) enable
= false - Disable Bookland-EAN decoding = true - Enable Bookland-EAN decoding
Return Value true if configuration was successful.
false if configuration failed.
Example import com.symbol.j2me.midlets.ascanner.BarCodeReader; BarCodeReader barCodeReader = new BarCodeReader(); boolean response = barCodeReader.booklandEAN (true); Enable Bookland-EAN type barcodes.
2-20