The text of a manual · part 26 of 37
JANUS PSK for Basic, Version 2.1 Reference Manual, pages 251 to 260
Pages 251 to 260 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 251
imNumberPadOn – Visual Basic
3
Example '**************** imNumberPadOn ******************** REM $INCLUDE: 'im20vbas.bi' ' Initializing Variables NumberPadTest$ = "" Temp$ = "" CLS status% = imNumberPadOn(imNumlockOff) PRINT "numpad enable NL OFF" PRINT "<ENTER> when done: " INPUT NumberPadTest$ PRINT status% = imNumberPadOn(imNumlockOn) PRINT PRINT "numpd enable NL ON" PRINT "<ENTER> when done: " INPUT NumberPadTest$ PRINT PRINT "Press any key to quit." INPUT Temp$ END
3-85
Page 252
imPowerStatus – Visual Basic imPowerStatus Purpose:
This function returns the line status, battery status, backup status, and percentage of remaining battery life.
Syntax:
REM $INCLUDE: 'im20vbas.bi' FUNCTION imPowerStatus% (VARPTR(LineStatus), VARSEG(LineStatus) VARPTR(BatteryStatus), VARSEG(BatteryStatus) VARPTR(BackupStatus), VARSEG(BackupStatus) VARPTR(FuelGauge), VARSEG(FuelGauge))
IN Parameters:
None.
OUT Parameters:
The LineStatus parameter returns one of these constants: imAclineNotConnected imAclineConnected imUnknownAcline
AC line is not connected AC line is connected AC line status is unknown
The BatteryStatus parameter returns one of these constants: imHighBat imLowBat imCriticalBat imChargingBat imUnknownBat
Battery charge is high Battery charge is low Battery charge is critical Battery is charging now Battery condition is unknown
The BackupStatus parameter returns one of these constants: imBackupOk imBackupLow
Backup battery is OK Backup battery is low
The FuelGauge parameter returns one of these constants: 0–100 255 Return Value:
3-86
% of full charge in increments of 10% Unknown
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Page 253
imPowerStatus – Visual Basic
3
Example '**************** imPowerStatus ******************** REM $INCLUDE: 'im20vbas.bi' PRINT "imPowerStatus" acLine% = -1 battery% = -1 backup% = -1 fuel% = -1 status% = -1 status% = imPowerStatus(VARPTR(acLine%), VARSEG(acLine%), VARPTR(battery%), VARSEG(battery%), VARPTR(backup%), VARSEG(backup%), VARPTR(fuel%), VARSEG(fuel%)) PRINT "ACLine = ", HEX$(acLine%) PRINT "battery = ", HEX$(battery%) PRINT "backup = ", HEX$(backup%) PRINT "fuel = ", HEX$(fuel%) PRINT "status = ", HEX$(status%) END
3-87
Page 254
imProtocolExtendedStatus – Visual Basic imProtocolExtendedStatus Purpose:
This function gets the protocol extended status from the designated communications port. You allocate the protocol status buffer or radio frequency (RF) status buffer, and then imProtocolExtendedStatus returns the status and setup in hexadecimal values.
Syntax:
REM $INCLUDE: 'im20vbas.bi' FUNCTION imProtocolExtendedStatus% ( PortID , VARPTR(StatusBuffer), VARSEG(StatusBuffer))
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 StatusBuffer parameter is a far pointer to a buffer structure. Use one of these constants: imCommStatusBufferS (as shown in the syntax above) imCommStatusBufferRF OUT Parameters:
None.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
See Also:
imReceiveBufferNoWait, imTransmitBufferNoWait
3-88
Page 255
imProtocolExtendedStatus – Visual Basic
3
Example '**************** imProtocolExtendedStatus ********* REM $INCLUDE: 'im20vbas.bi' 'Extend status protocol buffer DIM statusBuffer AS imCommStatusBufferS 'Initialize status buffer ' Note: Must assign StatusStrVersion as below to return proper ' status statusBuffer.StatusStructureVersion = CHR$(StatusStrVersion) statusBuffer.HandlerVer = STRING$(LEN(statusBuffer.HandlerVer), CHR$(0)) statusBuffer.HandlerType = 0 statusBuffer.Specific.BaudRate = 0 statusBuffer.Specific.Parity = CHR$(0) statusBuffer.Specific.StopBits = CHR$(0) statusBuffer.Specific.DataBits = CHR$(0) statusBuffer.Specific.ModemStatus = CHR$(0) statusBuffer.Specific.PortStatus = CHR$(0) statusBuffer.Specific.ActiveProt = 0 statusBuffer.Specific.LrcEnabled = CHR$(0) statusBuffer.Specific.IntercharDelay = 0 statusBuffer.Specific.TurnaroundDelay = 0 statusBuffer.Specific.ReceiveTimeout = 0 statusBuffer.Specific.TransmitTimeout = 0 statusBuffer.Specific.PolChar = CHR$(0) statusBuffer.Specific.SelChar = CHR$(0) statusBuffer.Specific.ResChar = CHR$(0) statusBuffer.Specific.reqChar = CHR$(0) statusBuffer.Specific.affChar = CHR$(0) statusBuffer.Specific.negChar = CHR$(0) statusBuffer.Specific.somChar = CHR$(0) statusBuffer.Specific.txeomLen = CHR$(0) statusBuffer.Specific.txeomChar1 = CHR$(0) statusBuffer.Specific.txeomChar2 = CHR$(0) statusBuffer.Specific.rxeomLen = CHR$(0) statusBuffer.Specific.rxeomChar1 = CHR$(0) statusBuffer.Specific.rxeomChar2 = CHR$(0) statusBuffer.Specific.flowCtrl = CHR$(0) statusBuffer.Specific.MultiDropAddr = CHR$(0) statusBuffer.Specific.MultiDropEnabled = CHR$(0) statusBuffer.Specific.EofLength = 0 statusBuffer.Specific.EofChar = CHR$(0) statusBuffer.Specific.HaveRecvClientBuffer = 0 statusBuffer.Specific.HaveXmitClientBuffer = 0 statusBuffer.Specific.ProtocolMode = 0 ' Call Intermec routine status% = imProtocolExtendedStatus(ImCom1, VARPTR(statusBuffer), VARSEG(statusBuffer)) ' Function call return status PRINT "Extd Prot Stat" PRINT HEX$(status%) temp$ = INPUT$(1) CLS LOCATE 1,1 ' Print first page of status info PRINT "Extd Status,Pg1of3" PRINT "Strut Ver = ", ASC(statusBuffer.StatusStructureVersion)
3-89
Page 256
imProtocolExtendedStatus – Visual Basic
PRINT "Hd Ver = ", statusBuffer.HandlerVer PRINT "Hd Type = ", statusBuffer.HandlerType PRINT "Baud = ", statusBuffer.Specific.BaudRate PRINT "Parity =", ASC(statusBuffer.Specific.Parity) PRINT "Stop =", ASC(statusBuffer.Specific.StopBits) PRINT "Data =", ASC(statusBuffer.Specific.DataBits) PRINT "Modem =", ASC(statusBuffer.Specific.ModemStatus) PRINT "Port stat = ", ASC(statusBuffer.Specific.PortStatus) PRINT "Ate prot = ", statusBuffer.Specific.ActiveProt PRINT "Lrc enble = ", ASC(statusBuffer.Specific.LrcEnabled) PRINT "Itc dely = ", statusBuffer.Specific.IntercharDelay PRINT "Trnd dely =", statusBuffer.Specific.TurnaroundDelay PRINT "RX tmeout = ",statusBuffer.Specific.ReceiveTimeout PRINT "Xt tmeout = ", statusBuffer.Specific.TransmitTimeout ' Pause between screens PRINT "Any key to cont'" temp$ = INPUT$(1) CLS LOCATE 1,1 PRINT "Extd Status,Pg2of3" ' Print third page of status info PRINT "Pol char = ", ASC(statusBuffer.Specific.PolChar) PRINT "Sel char = ", ASC(statusBuffer.Specific.SelChar) PRINT "Res char = ", ASC(statusBuffer.Specific.ResChar) PRINT "Req char = ", ASC(statusBuffer.Specific.reqChar) PRINT "Aff char = ", ASC(statusBuffer.Specific.affChar) PRINT "Neg char = ", ASC(statusBuffer.Specific.negChar) PRINT "Som char = ", ASC(statusBuffer.Specific.somChar) PRINT "Tx len = ", ASC(statusBuffer.Specific.txeomLen) PRINT "Txchar 1 = ", ASC(statusBuffer.Specific.txeomChar1) PRINT "Txchar 2 = ", ASC(statusBuffer.Specific.txeomChar2) PRINT "Rxlen = ", ASC(statusBuffer.Specific.rxeomLen) PRINT "Rxchar 1 = ", ASC(statusBuffer.Specific.rxeomChar1) PRINT "Rx char 2 = ", ASC(statusBuffer.Specific.rxeomChar2) PRINT "Flow ctrl = ", ASC(statusBuffer.Specific.flowCtrl) ' Pause between screens PRINT "Any key to cont'" temp$ = INPUT$(1) CLS LOCATE 1,1 PRINT "Extd Status,Pg3of3" ' Print second page of status info PRINT "Mul addr = ", ASC(statusBuffer.Specific.MultiDropAddr) PRINT "Mul enble = ", ASC(statusBuffer.Specific.MultiDropEnabled) PRINT "EOF len = ", statusBuffer.Specific.EofLength PRINT "EOF char = ", ASC(statusBuffer.Specific.EofChar) PRINT "Recv clt = ", statusBuffer.Specific.HaveRecvClientBuffer PRINT "Xmit clt = ", statusBuffer.Specific.HaveXmitClientBuffer PRINT "Prot mode = ", statusBuffer.Specific.ProtocolMode END
3-90
Page 257
imReceiveBuffer – Visual Basic
3 imReceiveBuffer Purpose:
This function receives the contents of a data buffer from a designated communications port.
Syntax:
REM $INCLUDE: 'im20vbas.bi' FUNCTION imReceiveBuffer% (PortID, UserLength, VARPTR(DataBuffer), VARSEG(DataBuffer) Timeout, VARPTR(CommLength), VARSEG(CommLength))
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 receive and must be at least 256 bytes. The DataBuffer parameter is a far pointer to the array where you want to place the received data. This buffer must hold at least 256 bytes. The Timeout parameter is the receive timeout period. 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.
3-91
Page 258
imReceiveBuffer – Visual Basic
OUT Parameters:
The CommLength is the actual number of bytes received upon completion of the call.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
This function does not return a parameter value until an end of message, a buffer is full, a timeout, or an error occurs. You must install a protocol handler to use this function.
See Also:
imReceiveBufferNoWait, imReceiveBufferNoprot, imCancelRxBuffer, imRxCheckStatus
Example '**************** imReceiveBuffer ****************** ' Note: You must have reader services and a communication 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' ' Data buffer size must be at least 256 bytes CONST buffsize = 300 ' Define fixed length strings of 300 bytes (256 is minimum string buffer) DIM str1 AS STRING * buffsize ' Actual length returned by imReceiveBuffer DIM commLength ' Must be run with Phimec protocol installed PRINT "imReceiveBuffer" PRINT "Phimec protocol" PRINT "Default - 9600 E 7 1" ' Quit with <CR><LF> sequence PRINT "Ctrl JM to quit" PRINT "(<CR><LF>)" ' Init the string str1 = STRING$(buffsize, CHR$(0)) ' Call Intermec function status% = imReceiveBuffer(imCom1, LEN(str1), VARPTR(str1), VARSEG(str1), 10000, VARPTR(commlength), VARSEG(commlength) ' Print results PRINT str1 ' Print return status(s) PRINT
3-92
Page 259
imReceiveBuffer – Visual Basic
3
PRINT "Actual len = ", commlength PRINT "status = ", HEX$(status%) END
3-93
Page 260
imReceiveBufferNoprot – Visual Basic imReceiveBufferNoprot Purpose:
This function receives a text string from the designated port without using the active protocol. Only the PHIMEC.EXE protocol handler supports this function, which is often used to receive a host initialization string before beginning transmission.
Syntax:
REM $INCLUDE: 'im20vbas.bi' FUNCTION imReceiveBufferNoprot% (PortID , UserLength , VARPTR(DataBuffer), VARSEG(DataBuffer) Timeout , EomChar , VARPTR(CommLength), VARSEG(CommLength))
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 you can receive and must be at least 256 bytes. The DataBuffer parameter is a far pointer to the data array where you want to place the received data. This buffer must hold at least 256 bytes. The Timeout parameter is the receive timeout period. 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.
3-94