The text of a manual · part 30 of 37
JANUS PSK for Basic, Version 2.1 Reference Manual, pages 291 to 300
Pages 291 to 300 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 291
imSound – Visual Basic
3 imSound Purpose:
This function generates a beep of specified pitch and duration. For example, use a soft beep for library use, a loud beep for manufacturing use, or a unique beep to distinguish between other readers.
Syntax:
REM $INCLUDE: 'im20vbas.bi' FUNCTION imSound% (Pitch, Duration, Volume)
IN Parameters:
The Pitch parameter is the frequency of the beep you want the reader to make. The numeric range for Pitch is from 20 to 20,000 Hz. You can also use one of these constants: imHighPitch imLowPitch imVeryLowPitch
2400 Hz 1200 Hz 600 Hz
The Duration parameter is the length of the beep. The numeric range for Duration is from 1 to 65,000 ms. You can also use one of these constants: 1 to 32,767 ms Integer range 32,768 to 65,534 ms See “Setting Timeout Values” in this chapter. imBeepDuration 50 ms imClickDuration 4 ms The Volume parameter is one of these constants: imOffVolume imQuietVolume imNormalVolume imLoudVolume imExtraLoudVolume imCurrentVolume
Volume is off Volume is quiet Volume is normal Volume is loud Volume is extra loud Volume is the current volume
OUT Parameters:
None.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
3-125
Page 292
imSound – Visual Basic
Example '**************** imSound ************************** REM $INCLUDE: 'im20vbas.bi' RESTORE duration% = 0 pitch% = -1 volume% = imCurrentVolume ' Play a song ' Read data and play song until end of data DO WHILE pitch% <> 0 'Read in pitch and duration READ pitch%, duration% ' Call the Intermec function status% = imSound(pitch%, duration%, volume%) LOOP PRINT "status = ", HEX$(status%) ' Sound data DATA 523, 500, 392, 500, 440, 500, 330, 500, 349, 500, 330, 250 DATA 296, 250, 262, 1000, 0 ,0 ' Enumeration of notes and frequencies ' C0 = 262, D0 = 296, E0 = 330, F0 = 349, G0 = 392, A0 = 440, B0 = 494, ' C1 = 523, D1 = 587, E1 = 659, F1 = 698, G1 = 784, A1 = 880, B1 = 988, ' EIGHTH = 125, QUARTER = 250, HALF = 500, WHOLE = 1000, END = 0 ' Above sound DATA ' C1, HALF, G0, HALF, A0, HALF, E0, HALF, F0, HALF, E0, QUARTER, ' D0, QUARTER, C0, WHOLE, END END
3-126
Page 293
imStandbyWait – Visual Basic
3 imStandbyWait Purpose:
This function requests that reader services wait in standby mode for a specific period of time. You can use this function to suspend the reader for a length of time to save the battery power.
Syntax:
REM $INCLUDE: 'im20vbas.bi' FUNCTION ImStandbyWait%(Timeout)
IN Parameters:
The Timeout parameter is the amount of time to wait in standby mode. You can exit the function before data is received 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 32,767 ms 32,768 to 65,534 ms imZeroTimeout imInfiniteTimeout
Integer range See “Setting Timeout Values” in this chapter. No wait Wait forever
If you select imInfiniteTimeout, the function will not return until the end of message character has been received. OUT Parameters:
None.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
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:
None.
Example See example for imCommand.
3-127
Page 294
imTransmitBuffer – Visual Basic imTransmitBuffer Purpose:
This function transmits the contents of a data buffer through a designated communications port. This function continues operating until the buffer transmission is complete or until an error status is detected.
Syntax:
REM $INCLUDE: 'im20vbas.bi' FUNCTION imTransmitBuffer% (PortID, UserLength , SSEGADD(DataBuffer), Timeout)
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 length of the data string that you want to transmit. 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 32,767 ms 32,768 to 65,534 ms imZeroTimeout imInfiniteTimeout
Integer range See “Setting Timeout Values” in this chapter. No wait Wait forever
If you select imInfiniteTimeout, the function will not return until the end of message character has been received.
3-128
Page 295
imTransmitBuffer – Visual Basic
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:
imReceiveBuffer, imTransmitBufferNoWait, imTransmitBufferNoprot
3
Example '**************** imTransmitBuffer ***************** ' Note: Must have reader services and comm protocol handler installed ' to enable send/receive buffer functions ' Run these TSR's at DOS prompt before running these tests: ' rservice ' phimec 1 ( 1 is COM1) REM $INCLUDE: 'im20vbas.bi' ' Must be run with Phimec protocol installed PRINT "imTransmitBuffer" outstr$ = "Hi There" ' Call Intermec function status% = imTransmitBuffer (imCom1, LEN(outstr$), SSEGADD(outstr$), 1000) PRINT "com = ", imCom1 PRINT "str = ", outstr$ PRINT "len = ", LEN(outstr$) PRINT "status = ", HEX$(status%) END
3-129
Page 296
imTransmitBufferNoWait – Visual Basic imTransmitBufferNoWait Purpose:
This function transmits the contents of a buffer and passes control back to its client.
Syntax:
REM $INCLUDE: 'im20vbas.bi' FUNCTION imTransmitBufferNoWait% (PortID, VARPTR(DataStruct), VARPTR(DataStruct))
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 DataStruct parameter is a far pointer to the data array that you want to transmit. 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. This function differs from imTransmitBuffer in that the client must set the buffer structure and monitor the buffer status until transmission is complete. Use this function for multiple buffer transmissions in conjunction with checking the status in DataStruct. You must build and maintain a DataStruct of the type imFarComDataStruct as described in IM20VBAS.BI.
See Also:
3-130 imTransmitBufferNoprot, imCancelTxBuffer
Page 297
imTransmitBufferNoWait – Visual Basic
3
Example '**************** imTransmitBufferNoWait *********** REM $INCLUDE: 'im20vbas.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, (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-131
Page 298
imTransmitBufferNoprot – Visual Basic imTransmitBufferNoprot Purpose:
This function transmits a buffer without protocol and sends only the specified number of characters.
Syntax:
REM $INCLUDE: 'im20vbas.bi' FUNCTION imTransmitBufferNoprot% (PortID, UserLength, SSEGADD(DataBuffer), Timeout)
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 32,767 ms 32,768 to 65,534 ms imZeroTimeout imInfiniteTimeout
Integer range See “Setting Timeout Values” in this chapter. No wait Wait forever
If you select imInfiniteTimeout, the function will not return until the end of message character has been received. OUT Parameters:
3-132
None.
Page 299
imTransmitBufferNoprot – Visual Basic
3
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: 'im20vbas.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$), SSEGADD(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
3-133
Page 300
imTransmitByte – Visual Basic 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: 'im20vbas.bi' FUNCTION imTransmitByte% (PortID, TransmitByte)
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:
3-134 imReceiveByte, imTransmitBuffer