The text of a manual · part 16 of 37
JANUS PSK for Basic, Version 2.1 Reference Manual, pages 151 to 160
Pages 151 to 160 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 151
imTransmitBufferNoWait – QuickBasic
2
Example '**************** imTransmitBufferNoWait *********** 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) DIM str3 AS STRING * buffsize 'fixed length string ' PHIMEC protocol handler must be installed to run this routine PRINT "imTransmitBufferNoWait" ' 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-125
Page 152
imTransmitBufferNoprot – QuickBasic imTransmitBufferNoprot Purpose:
This function transmits a buffer without protocol and sends only the specified number of characters.
Syntax:
REM $INCLUDE: 'im20bas1.bi' FUNCTION imTransmitBufferNoprot% CDECL (BYVAL PortID AS INTEGER, BYVAL UserLength AS INTEGER, BYVAL DataBuffer AS INTEGER, BYVAL Timeout 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)
The UserLength parameter is the maximum number of bytes to be transmitted. The DataBuffer parameter is a far pointer to the data array that you want to transmit. The Timeout parameter is the transmission timeout period. You can exit the function before data is sent or before the timeout occurs by performing an application break sequence (see your JANUS user’s manual). The return status indicates whether the function was successful, a timeout occurred, or the application break was received. The Timeout parameter is a number or one of these constants: 0 to 65,534 ms imZeroTimeout imInfiniteTimeout
Numeric range No wait Wait forever
If you select imInfiniteTimeout, the function will not return until the end of message character has been received. OUT Parameters:
2-126
None.
Page 153
imTransmitBufferNoprot – QuickBasic
2
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
You must install a protocol handler other than PHPCSTD.EXE to use this function. If an existing transmit client is linked to the host, you must issue a cancel command first.
See Also:
imTransmitBufferNoWait, imCancelTxBuffer, imTransmitBuffer
Example '**************** imTransmitBufferNoprot *********** REM $INCLUDE: 'im20bas1.bi' PRINT "Transmit Noprot" ' Get the transmit environment ready status%= imCancelTxBuffer(ImCom1) ' Define transmit string temp$ = "Intermec" ' Call Intermec routine status%= imTransmitBufferNoprot(ImCom1, LEN(temp$), SADD(temp$), 1000) PRINT PRINT "Status = ", HEX$(status%) ' Check for success IF status% < 16384 AND status% > 0 THEN PRINT "Buffer transmitted" ELSE PRINT "Buffer not sent" END IF ' Release resources status%= imCancelTxBuffer(ImCom1) END
2-127
Page 154
imTransmitByte – QuickBasic imTransmitByte Purpose:
This function transmits one byte of data out through a designated communications port. This function is identical to MS-DOS INT 14H Service 01H.
Syntax:
REM $INCLUDE: 'im20bas1.bi' FUNCTION imTransmitByte% CDECL (BYVAL PortID AS INTEGER, BYVAL TransmitByte 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)
The TransmitByte parameter is the byte of data to transmit. OUT Parameters:
None.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
This function requires the PC standard protocol handler PHPCSTD.EXE. Intermec recommends using imTransmitBuffer (with a UserLength of one) instead of using this function. You can use this function for an acknowledgment.
See Also:
2-128 imReceiveByte, imTransmitBuffer
Page 155
imTransmitByte – QuickBasic
2
Example '**************** imTransmitByte ******************* REM $INCLUDE: 'im20bas1.bi' PRINT "imTransmitByte" ' If the Mode command is used, DO NOT install the Phpcstd protocol ' If the Phpcstd protocol is installed DO NOT use the mode commmand ' Set up comm port SHELL "MODE COM1:9600 E 7 1" ' Get keypad char and transmit to COM1 DO outstr$ = INKEY$ IF outstr$ <> "" THEN ' Call Intermec function status% = imTransmitByte (imCom1, SADD(outstr$)) PRINT USING "!"; outstr$; END IF ' Loop until Esc is pressed LOOP UNTIL outstr$ = CHR$(27) PRINT "status = ", HEX$(status%) PRINT "Press any key" PRINT " to continue" END
2-129
Page 156
imUnlinkComm – QuickBasic imUnlinkComm Purpose:
This function removes the link between the Reader Wedge function and a designated communications port. After this function excutes, the Reader Wedge is not notified of receive buffer functions. You only need to use this procedure one time, at the end of your program.
Syntax:
REM $INCLUDE: 'im20bas1.bi' FUNCTION ImUnLinkComm% 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. 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:
imLinkComm
Example See example for imReceiveInput, imIrlY, and imSerialProtocolControl.
2-130
Page 157
imViewportEnd – QuickBasic
2 imViewportEnd Purpose:
This function sets the viewport to the lower right corner (end) of the virtual display.
Syntax:
REM $INCLUDE: 'im20bas1.bi' SUB imViewportEnd CDECL ()
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
None.
Notes:
This function has no effect on the JANUS 2050.
See Also:
imCursorToViewport, imViewportHome, imViewportPageDown, imViewportPageUp, imViewportToCursor, imViewportMove
Example '**************** imViewportEnd ******************** REM $INCLUDE: 'im20bas1.bi' ' Set viewport to lower right corner imViewportEnd SLEEP 5 END
2-131
Page 158
imViewportGetxy – QuickBasic imViewportGetxy Purpose:
This function retrieves the column and row of the upper left corner of the viewport.
Syntax:
REM $INCLUDE: 'im20bas1.bi' FUNCTION imViewportGetxy% CDECL (Row AS INTEGER, Column AS INTEGER)
IN Parameters:
None.
OUT Parameters:
The Row parameter returns the row value (Y-coordinate) of the viewport. The Column parameter returns the column value (X-coordinate) of the viewport.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
This function is valid only when the display is in 80 x 25 mode. This function has no effect on the JANUS 2050.
See Also:
imViewportSetxy, imViewportMove, imViewportPageUp, imViewportPageDown, imViewportToCursor, imViewportEnd, imViewportHome
Example '**************** imViewportGetxy ****************** REM $INCLUDE: 'im20bas1.bi' row% = 3 col% = 3 status% = imViewportSetxy(row%,col%) print "Row =";row% print "Col =";col% input "Waiting>>",response$ status% = imViewportGetxy(row%,col%) print "Row =";row% print "Col =";col% END
2-132
Page 159
imViewportHome – QuickBasic
2 imViewportHome Purpose:
This function sets the viewport to the upper left corner (home) of the virtual display.
Syntax:
REM $INCLUDE: 'im20bas1.bi' SUB imViewportHome CDECL ()
IN Parameters:
None.
OUT Parameters:
None.
Return Value:
None.
Notes:
This function has no effect on the JANUS 2050.
See Also:
imCursorToViewport, imViewportEnd, imViewportPageDown, imViewportPageUp, imViewportToCursor, imViewportMove
Example '**************** imViewportHome ******************** REM $INCLUDE: 'im20bas1.bi' ' Home imViewportHome SLEEP 5 END
2-133
Page 160
imViewportMove – QuickBasic imViewportMove Purpose:
This function moves the viewport the specified distance and direction.
Syntax:
REM $INCLUDE: 'im20bas1.bi' FUNCTION imViewportMove% CDECL (BYVAL Direction AS INTEGER, BYVAL Distance AS INTEGER, Row AS INTEGER, Column AS INTEGER)
IN Parameters:
The Direction parameter is one of these constants: imViewportLeft imViewportRight imViewportUp imViewportDown
Move left Move right Move up Move down
The Distance parameter indicates the number of units to move the viewport and is either a numeric value between 1 and 70 or is imDefaultDistance. If the distance parameter is imDefaultDistance, the default step size is used. The distance moved is a configurable parameter. For more information on configuring the viewport, see your JANUS user’s manual. OUT Parameters:
The Row parameter returns the row number to which the viewport has moved. The Column parameter returns the column number to which the viewport has moved.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
The (Row, Column) pair represents the upper left corner of the viewport being displayed. The minimum value for both the Row and Column is (0,0), which is the upper left corner of the virtual window. The maximum value is determined by the video mode and the number of lines and columns displayed.
2-134