The text of a manual · part 20 of 37
JANUS PSK for Basic, Version 2.1 Reference Manual, pages 191 to 200
Pages 191 to 200 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 191
imBacklightToggle – Visual Basic
3 imBacklightToggle Purpose:
This function toggles the display backlight ON and OFF.
Syntax:
REM $INCLUDE: ’im20vbas.bi’ SUB imBacklightToggle()
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
None.
Notes:
You can program the backlight to automatically turn off after a specified time to save battery power. The length of time depends on the backlight timeout configuration parameter. The configuration parameter is set in 1 second increments. The default is 10 seconds. This function has no effect on the JANUS 2050.
See Also:
imBacklightOn, imBacklightOff
Example ’**************** imBacklightToggle ******************** REM $INCLUDE: ’im20vbas.bi’ ’ Backlight toggle CALL imBacklightToggle PRINT "Backlight switched on/off " END
3-25
Page 192
imCancelRxBuffer – Visual Basic imCancelRxBuffer Purpose:
This function clears the receive buffer of the designated communications port.
Syntax:
REM $INCLUDE: ’im20vbas.bi’ FUNCTION imCancelRxBuffer%(PortID)
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.” If there is no input pending to receive, this function returns 4602H (no client).
Notes:
You must install a protocol handler to use this function.
See Also:
imReceiveBufferNoWait, imReceiveBufferNoprot
Example ’**************** imCancelRxBuffer ***************** REM $INCLUDE: ’im20vbas.bi’ CONST buffsize = 300 ’ Data buffer must be at least 256 bytes DIM farcomBuffStruct AS imFarComDataStruct ’ Data buffer structure DIM str3 AS STRING * buffsize ’ Fixed length strings of 300 bytes DIM done ’ The difference between imReceiveBufferNoWait and the ReceiveBufferNoprot ’ is that the user must set up the imReceiveBufferNoWait comm ’ struct and pend on the results. Whereas, in the Noprot receive, the ’ user sets up the length of the buffer, points at that buffer and ’ sends it off and returns. There is no pending on this level for the ’ imReceiveBufferNoprot routine ’ Phimec protocol handler must be installed to run this routine ’ Get the receive environment ready status%= imCancelRxBuffer(imCom1)
3-26
Page 193
imCancelRxBuffer – Visual Basic
3
’ Zero out string str3 = STRING$(buffsize, CHR$(0)) ’ Set up communication buffer structure farcomBuffStruct.command = imPhReceive farcomBuffStruct.protocolMode = imNoProtocol farcomBuffStruct.eomChar = CHR$(13) ’CR for terminating char farcomBuffStruct.userLength = buffsize farcomBuffStruct.SegDataPtr = VARSEG(str3) farcomBuffStruct.OffSetDataPtr = VARPTR(str3) farcomBuffStruct.protocolXferStatus = imCuInuse farcomBuffStruct.CommLength = 0 done = FALSE ’ Call Intermec function status%= imReceiveBufferNoWait(ImCom1, VARPTR(farcomBuffStruct), VARSEG(farcomBuffStruct)) PRINT "Func1= ", HEX$(status%) ’ Loop until first character in buffer is a ’Q’ or Esc is pressed DO ’ ’ Check for receive errors: ’ Print the error status IF status%= imIserror THEN PRINT "Rx Again err = ", HEX$(status%) done = FALSE ELSE ’ Keyboard char temp$ = " " ’ Get the receive data PRINT "Input chars" PRINT "Enter ’Q’" PRINT "or Esc to exit" ’ Check to see if any characters are in buffer DO WHILE farcomBuffStruct.protocolXferStatus = imCuInuse AND temp$ <> CHR$(27) temp$ = INKEY$ ’ Pick up any keypad input LOOP PRINT "Comm done" PRINT str3
’ Print the input string
’ Update buffer for next block then call imRxCheckStatus to ’ get protocol handler to reset status. farcomBuffStruct.command = imPhRecvAgain farcomBuffStruct.protocolXferStatus = imCuInuse farcomBuffStruct.commLength = 0 status%= imRxCheckStatus(ImCom1) 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
3-27
Page 194
imCancelTxBuffer – Visual Basic 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: ’im20vbas.bi’ FUNCTION imCancelTxBuffer%(PortID)
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
3-28
Page 195
imCancelTxBuffer – Visual Basic
3
Example ’**************** imCancelTxBuffer ****************** REM $INCLUDE: ’im20vbas.bi’ ’ PHIMEC protocol handler must be installed to run this routine ’ Define communication status messages CONST imCuSuccess = 1536 CONST imInuse = -31230 CONST buffsize = 300
’ Data buffer must be at least 256 bytes
’ Data buffer structure for receive/transmit again and noprot DIM farcomBuffStruct AS imFarComDataStruct DIM str3 AS STRING * buffsize
’fixed length string of 300 bytes
DIM done ’ 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, VARPTR(farcomBuffStruct), VARSEG(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
3-29
Page 196
imCommand – Visual Basic 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: ’im20vbas.bi’ FUNCTION ImCommand%(SSEGADD(Command), Length)
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 Length 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:
3-30
None.
Page 197
imCommand – Visual Basic
3
Example ’**************** imCommand ************************* ’ $INCLUDE: ’im20vbas.bi’ CLS
’ Clear the screen str1$ = "$+DJ7" str2$ = "$+DJ0" str3$ = "$+DJ3" PRINT "Set high contrast" status% = imCommand(SSEGADD(str1$), LEN(str1$)) status% = imStandbyWait(2000) ’ Wait two seconds PRINT "Set low contrast" status% = imCommand(SSEGADD(str2$), LEN(str2$)) status% = imStandbyWait(2000) ’ Wait two seconds PRINT "Set normal contrast" status% = imCommand(SSEGADD(str3$), LEN(str3$)) status% = imStandbyWait(2000) ’ Wait two seconds PRINT "Wait status >>";HEX$(status%) imMessage(status%) END
3-31
Page 198
imCursorToViewport – Visual Basic 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: ’im20vbas.bi’ SUB imCursorToViewport()
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: ’im20vbas.bi’ ’ Call cursor to viewport imCursorToViewport END
3-32
Page 199
imDecreaseContrast – Visual Basic
3 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: ’im20vbas.bi’ FUNCTION imDecreaseContrast()
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 im_set_contrast and im_get_contrast use a scale of 0 to 7 that is related to the scale of 0 to 31 used by im_increase_contrast and im_decrease_contrast. 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
3-33
Page 200
imDecreaseContrast – Visual Basic
Example ’**************** imDecreaseContrast *************** REM $INCLUDE: ’im20vbas.bi’ PRINT "imDecreaseContrast" ’ Call Intermec function status% = imDecreaseContrast ’Pause for keypad input temp$ = INPUT$(1) PRINT "imDecreaseContrast" ’ Call Intermec function status% = imDecreaseContrast END
3-34