The text of a manual · part 6 of 37
JANUS PSK for Basic, Version 2.1 Reference Manual, pages 51 to 60
Pages 51 to 60 of 362
The original document is the PDF (601 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 Intermec J2020, Intermec J2010 and Intermec J2050
Page 51
imCancelRxBuffer – QuickBasic
2
END IF ’ Quit if first char in buffer is a ’Q’ or a ’q’ ’ or Esc has been pressed IF UCASE$(LEFT$(str3, 1)) = "Q" OR temp$ = CHR$(27) THEN done = TRUE ELSE ’ Zero out string and loop str3 = STRING$(buffsize, CHR$(0)) ENDIF LOOP WHILE done = FALSE ’ Release resources status%= imCancelRxBuffer(ImCom1) END
2-25
Page 52
imCancelTxBuffer – QuickBasic imCancelTxBuffer Purpose:
This function clears the contents of the transmit buffer for a designated communications port, stops transmission in progress, and resets the communications port. Use this function with Polling Mode D to clear out the buffer. Other protocols clear the buffer automatically. You can also use this function to clear a busy port.
Syntax:
REM $INCLUDE: ’im20bas1.bi’ FUNCTION imCancelTxBuffer% CDECL (BYVAL PortID AS INTEGER)
IN Parameters:
The PortID parameter identifies the communications port as follows: imCom1 imCom2 imCom4
COM1 COM2, scanner port (2010 and 2050) COM4 (RF only)
OUT Parameters:
None.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
You must install a protocol handler to use this function.
See Also:
imTransmitBufferNoWait, imTransmitBufferNoprot, imTransmitBuffer
Example ’**************** imCancelTxBuffer ****************** REM $INCLUDE: ’im20bas1.bi’ ’ Define communication status messages CONST imCuSuccess = 1536 CONST imInuse = -31230 ’ Data buffer size must be at least 256 bytes CONST buffsize = 300 ’ Data buffer structure for receive/transmit again and noprot DIM farcomBuffStruct AS imFarComDataStruct ’ Define fixed length strings of 300 bytes (256 is minimum string buffer)
2-26
Page 53
imCancelTxBuffer – QuickBasic
DIM str3 AS STRING * buffsize
2
’fixed length string
DIM done AS INTEGER ’ PHIMEC protocol handler must be installed to run this routine ’ Get the transmit environment ready status%= imCancelTxBuffer(ImCom1) ’ Make a null terminated string to transmit str3 = "Hi There" + CHR$(0) ’ Set up comm buffer parameters farcomBuffStruct.command = imPhTransmit farcomBuffStruct.protocolXferStatus = imInuse ’ Get length not including the null terminator farcomBuffStruct.userLength = INSTR(str3, CHR$(0)) - 1 farcomBuffStruct.commLength = 0 farcomBuffStruct.SegDataPtr = VARSEG(str3) farcomBuffStruct.OffSetDataPtr = VARPTR(str3) farcomBuffStruct.protocolMode = imNoProtocol ’ Terminator is null character farcomBuffStruct.eomChar = CHR$(0) ’ Call Intermec routine status%= imTransmitBufferNoWait(ImCom1, farcomBuffStruct) PRINT "Status = ", HEX$(status%) IF status% = imCuSuccess THEN ’ Wait for data transfer to complete DO WHILE farcomBuffStruct.protocolXferStatus = imInuse AND INKEY$ <> CHR$(27) LOOP PRINT "Buffer transmitted" ELSE PRINT "Buffer not sent" END IF ’ Release resources status%= imCancelTxBuffer(ImCom1) END
2-27
Page 54
imCommand – QuickBasic imCommand Purpose:
This function modifies the reader’s configuration. For example, you can use the function to set a specific communications port’s baud rate.
Syntax:
REM $INCLUDE: ’im20bas1.bi’ FUNCTION ImCommand% CDECL (BYVAL Command AS INTEGER, BYVAL CommandLength AS INTEGER)
IN Parameters:
The Command parameter is a reader command string. The command string may include more than one reader command. For example, the command string %.1$+BV9 turns on the backlight and raises the beep volume. Reader commands are listed in your JANUS user’s manual. The CommandLength parameter is the length of the reader command string.
OUT Parameters:
None.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
For more information on using reader commands, see your JANUS user’s manual. You must install the Reader Wedge to use this function. For information on loading RWTSR.EXE, see “Runtime Requirements” earlier in this chapter.
See Also:
2-28
None.
Page 55
imCommand – QuickBasic
2
Example ’**************** imCommand ************************* ’ $INCLUDE: ’im20bas1.bi’ CLS
’ Clear the screen str1$ = "$+DJ7" str2$ = "$+DJ0" str3$ = "$+DJ3" PRINT "Set high contrast" status% = imCommand(SADD(str1$), LEN(str1$)) status% = imStandbyWait(2000) ’ Wait two seconds PRINT "Set low contrast" status% = imCommand(SADD(str2$), LEN(str2$)) status% = imStandbyWait(2000) ’ Wait two seconds PRINT "Set normal contrast" status% = imCommand(SADD(str3$), LEN(str3$)) status% = imStandbyWait(2000) ’ Wait two seconds PRINT "Wait status >>";HEX$(status%) imMessage(status%) END
2-29
Page 56
imCursorToViewport – QuickBasic imCursorToViewport Purpose:
This function moves the cursor to the center of the current viewport. Since the viewport can move around with or without the cursor, you can use this function to recenter the cursor.
Syntax:
REM $INCLUDE: ’im20bas1.bi’ SUB imCursorToViewport CDECL ()
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
None.
Notes:
This function has no effect on the JANUS 2050.
See Also:
imViewportEnd, imViewportHome, imViewportPageDown, imViewportPageUp, imViewportToCursor, imViewportMove
Example ’**************** imCursorToViewport***************** REM $INCLUDE: ’im20bas1.bi’ ’ Call cursor to viewport imCursorToViewport END
2-30
Page 57
imDecreaseContrast – QuickBasic
2 imDecreaseContrast Purpose:
This function decreases the LCD display contrast by one level. The display contrast is the lightness or darkness of the characters against the reader display. The reader display has 32 levels of contrast (0 to 31), where 0 is very light, and 31 is very dark.
Syntax:
REM $INCLUDE: ’im20bas1.bi’ FUNCTION imDecreaseContrast% CDECL ()
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
The 0 to 31 scale fine tunes the contrast more precisely than using the keypad to adjust the contrast. The functions imSetContrast and imGetContrast use a scale of 0 to 7 that is related to the scale of 0 to 31 used by imIncreaseContrast and imDecreaseContrast. The following table compares the two scales. This Value on Scale 0 to 7
Equates to This Value on Scale 0 to 31
Contrast Level
0 1 2 3 4 5 6 7
10 12 14 16 18 20 22 24
Very light
Very dark
This function has no effect on the JANUS 2050. See Also:
imIncreaseContrast, imSetContrast, imGetContrast
2-31
Page 58
imDecreaseContrast – QuickBasic
Example ’**************** imDecreaseContrast *************** REM $INCLUDE: ’im20bas1.bi’ PRINT "imDecreaseContrast" ’ Call Intermec function status% = imDecreaseContrast ’Pause for keypad input temp$ = INPUT$(1) PRINT "imDecreaseContrast" ’ Call Intermec function status% = imDecreaseContrast END
2-32
Page 59
imGetConfigInfo – QuickBasic
2 imGetConfigInfo Purpose:
This function retrieves the current reader configuration information string and its length.
Syntax:
REM $INCLUDE: ’im20bas1.bi’ FUNCTION imGetConfigInfo% CDECL () (conString AS STRING length AS INTEGER)
IN/OUT Parameters:
The conString parameter is the configuration information string. The first two characters specify the type of configuration information returned. For example, to get the beep duration setting, pass in “BD” for conString. The function returns BD and the current configuration for beep duration. The length parameter is the length of the configuration information string. For a list of the configuration commands, see your JANUS user’s manual.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
This function differs from imCommand in that you only pass the twocharacter command identifier. The imCommand function passes an entire command string.
See Also:
imCommand
Example ’**************** imGetConfigInfo ****************** REM $INCLUDE: 'im20bas1.bi' DIM outstr AS STRING *300 outstr = STRING$(300, CHR$(0)) outstr$ = "BV" + CHR$(0) PRINT "ImGetConfigInfo example: " status% = imGetConfigInfo(VARPTR(outstr), count%) PRINT "Beep Volume: "; outstr PRINT "Length: "; count% PRINT "Status: "; HEX$(status%) END
2-33
Page 60
imGetContrast – QuickBasic imGetContrast Purpose:
This function gets the reader’s LCD display contrast level. There are eight levels of contrast (0 to 7) from very light to very dark, which are the most frequently used contrast settings.
Syntax:
REM $INCLUDE: ’im20bas1.bi’ FUNCTION imGetContrast% CDECL (DisplayContrastLevel AS INTEGER)
IN Parameters:
None.
OUT Parameters:
The DisplayContrastLevel parameter is a number from 0 to 7 or is one of these constants defined in IM20LIB.H: imMinContrast imMaxContrast
0 1
Minimum contrast Maximum contrast
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
The functions imSetContrast and imGetContrast use a scale of 0 to 7 that is related to the scale of 0 to 31 used by imIncreaseContrast and imDecreaseContrast. The following table compares the two scales. This Value on Scale 0 to 7
Equates to This Value on Scale 0 to 31
Contrast Level
0 1 2 3 4 5 6 7
10 12 14 16 18 20 22 24
Very light
This function has no effect on the JANUS 2050. See Also:
2-34 imSetContrast, imDecreaseContrast, imIncreaseContrast
Very dark