The text of a manual · part 10 of 40
2D JANUS PSK for C/C++ Reference Manual, pages 91 to 100
Pages 91 to 100 of 400
The original document is the PDF (793 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 91
im_irl_k
See Also:
2 im_irl_a, im_irl_n, im_irl_v, im_irl_y, im_set_display_mode, im_set_input_mode
Example /******************** im_irl_k ***************************************/ /* Also with: im_set_input_mode and im_standby_wait */ #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <ctype.h> #include "im20lib.h" IM_LENGTH_SPEC length_table[IM_LENGTH_SPEC_MAX] = { {IM_LENGTH, 0, 0, 2}, {IM_RANGE, 7, 10, 0}, {IM_LENGTH, 0, 0, 4}, {IM_RANGE, 15, 17, 0}, {IM_LENGTH, 0, 0, 6} }; IM_UCHAR mix_mask[] = "?#@#"; void main (void) { IM_UCHAR input[256]; IM_USHORT cc; window(1, 1, 20, 16); /* Set the reader services text window */ clrscr(); /* Clear the screen */ printf("Demo IRL K Bar Code\n"); st printf(" 'Q' = 1 char to quit\n"); printf("Example: ‘Q1q2’ \n"); /* Set Reader Wedge into PROGRAMMER mode */ im_set_input_mode(IM_PROGRAMMER); /* Input loop --Display IRL K mask pattern */ do { printf("IRL K test mask:\n"); printf( " = %s \n", mix_mask); printf("Example: ‘A5a3’\n\n"); /* Request input from Reader Wedge */ im_irl_k(IM_INFINITE_TIMEOUT, length_table, mix_mask, input, &cc); printf("\n%s\n", input); /* Upper case first char of input for testing quit */ input[0] = toupper(input[0]); } while (input[0] != 'Q'); /* 'Q' to quit */ /* Switch the Reader Wedge back to virtual wedge mode */ im_set_input_mode(IM_WEDGE); }
2-65
Page 92
im_irl_n im_irl_n Purpose:
This function receives numeric input from the keypad or a label in the same manner as IRL numeric input command N. Nonnumeric data is ignored. This function clears any data existing in the keypad or label buffers before the function was called, edits reader commands from input, and displays input data. For more information on IRL and command N, refer to the IRL Programming Reference Manual.
Syntax:
#include <im20lib.h> IM_STATUS im_irl_n (IM_USHORT timeout, IM_LENGTH_SPEC test_table[], IM_UCHAR *instring, IM_USHORT *cmd_count, IM_DECTYPE *symbology);
IN Parameters:
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: 1 to 65,534 ms IM_ZERO_TIMEOUT IM_INFINITE_TIMEOUT
Numeric range No wait Wait forever
If IM_INFINITE_TIMEOUT is selected, the function will not return until the end of message character has been received. Data is returned only if its length matches one of the five lengths specified in the test_table. The test_table parameter must be a matrix of the following form: {a, b, c, d}, {a, b, c, d}, {a, b, c, d}, {a, b, c, d}, {a, b, c, d},
2-66
Page 93
im_irl_n
2
The a position in the matrix is one of the following: IM_NO_LENGTH IM_LENGTH IM_RANGE
Accept data of any length Accept data of a specific length Accept data within a length range
If IM_LENGTH is specified in the a position, the actual length of the data string is placed in the d position (and b and c are not used). If IM_RANGE is specified in the a position, the data length must be within the range of b and c (and d is not used). Set any unused table entries to {IM_NO_LENGTH,0,0,0}. OUT Parameters:
The instring parameter is the input string. You must allocate at least 256 bytes for instring. The cmd_count returned is 0 unless an abort command is passed in the string. The symbology parameter is one of these constants: IM_UNKNOWN_DECODE IM_CODABAR IM_CODE_11 IM_CODE_16K IM_CODE_39 IM_CODE_49 IM_CODE_93 IM_CODE_128 IM_I_2_OF_5 IM_MSI IM_PDF_417 IM_PLESSEY IM_UPC
Unknown bar code Codabar bar code Code 11 bar code Code 16K bar code Code 39 bar code Code 93 bar code Code 49 bar code Code 128 bar code Interleaved 2 of 5 MSI bar code PDF 417 bar code Plessey bar code Universal Product code
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
You must set the reader to Programmer mode with im_set_input_mode.
2-67
Page 94
im_irl_n
You must install the Reader Wedge to use this function. For information on loading RWTSR.EXE, see “Runtime Requirements” earlier in this chapter. Data does not display correctly on the screen if the display is in the 80 x 25 mode after the cursor has scrolled off the bottom of the display. Set the display to one of the other modes using im_set_display_mode. See Also:
im_irl_a, im_irl_k, im_irl_v, im_irl_y, im_set_input_mode
Example /******************** im_irl_n **************************************/ #include <stdio.h> #include <conio.h> #include "im20lib.h" IM_LENGTH_SPEC length_table[IM_LENGTH_SPEC_MAX] = { {IM_LENGTH, 0, 0, 2}, {IM_RANGE, 7, 10, 0}, {IM_LENGTH, 0, 0, 4}, {IM_RANGE, 15, 17, 0}, {IM_LENGTH, 0, 0, 6} }; void main (void) { IM_UCHAR input[256]; IM_USHORT cc; IM_DECTYPE symbol; window(1, 1, 20, 16); /* Set the reader services text window */ clrscr(); /* Clear the screen */ printf("Demo IRL N Bar Code\n"); printf(" '9' to quit\n"); /* Set Reader Wedge mode to program interface */ im_set_input_mode(IM_PROGRAMMER); /* Input loop */ do { /* Display IRL N test */ printf("IRL N test\n"); /* Request input from Reader Wedge */ im_irl_n(IM_INFINITE_TIMEOUT, length_table, input, &cc, &symbol); printf("\n%s\n",input); } while (input[0] != '9' );
/* '9' to quit */
/* Switch the Reader Wedge back to virtual wedge mode im_set_input_mode(IM_WEDGE); }
2-68
*/
Page 95
im_irl_v
2 im_irl_v Purpose:
This function receives input from any specified source in any format, in the same manner as an IRL universal input command V. For more information on IRL and command V, refer to the IRL Programming Reference Manual.
Syntax:
#include <im20lib.h> IM_STATUS im_irl_v (IM_USHORT timeout, IM_CONTROL edit, IM_LABEL_BEEP_CONTROL beep, IM_CONTROL display, IM_ORIGIN *source, IM_UCHAR *instring, IM_USHORT *cmd_count, IM_DECTYPE *symbology);
IN Parameters:
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: 1 to 65,534 ms IM_ZERO_TIMEOUT IM_INFINITE_TIMEOUT
Numeric range No wait Wait forever
If IM_INFINITE_TIMEOUT is selected, the function will not return until the end of message character has been received. The edit parameter determines whether the Reader Wedge parses reader commands. Use one of these constants: IM_DISABLE IM_ENABLE
Disable reader command parsing Enable reader command parsing
If edit is IM_DISABLED, reader commands are treated as data.
2-69
Page 96
im_irl_v
The beep parameter determines whether the IRL V command beeps or not when data is entered. If beep is set to IM_APPLI_BEEP, the Reader Wedge does not control the beep. Instead, you code the application to sound a beep when your program design requires one. If beep is set to IM_WEDGE_BEEP, the reader always beeps when data is entered. The beep parameter is one of these constants: IM_APPLI_BEEP IM_WEDGE_BEEP
Application controls the beep Beeps occur automatically
The display parameter determines if the data is displayed as it is entered. The display parameter is one of these constants: IM_DISABLE IM_ENABLE IN/OUT Parameters:
Disable display of data Enable display of data
The source parameter determines which input sources are allowed. When the IRL V command returns, source indicates where the data came from. When both keypad and label inputs are allowed, the source always returns keypad because it is possible for keyed and scanned data to be intermixed. Although intermixing is possible, it is not likely to occur. If you have both the keypad and scanner enabled, and you want to know where the data came from, first check the symbology: • If the symbology is IM_UNKNOWN_DECODE, then the data came from the keypad. • If the symbology is one of the other values (such as IM_CODE_39), then some or all of the data came from the scanner. • If only the scanner is enabled, then all of the data came from the scanner.
2-70
Page 97
im_irl_v
2
The source parameter is one of these constants: IM_NO_SELECT IM_LABEL_SELECT IM_KEYBOARD_SELECT IM_COM1_SELECT IM_COM2_SELECT IM_COM4_SELECT IM_ALL_SELECT OUT Parameters:
No source selected Label selected Keypad selected COM1 selected COM2, scanner port selected (2010 and 2050) COM4 selected (RF only) All sources are selected
The instring parameter is the input string. You must allocate at least 256 bytes for instring. The cmd_count returned is 0 unless an abort command is passed in the string. The symbology parameter is one of these constants: IM_UNKNOWN_DECODE IM_CODABAR IM_CODE_11 IM_CODE_16K IM_CODE_39 IM_CODE_49 IM_CODE_93 IM_CODE_128 IM_I_2_OF_5 IM_MSI IM_PDF_417 IM_PLESSEY IM_UPC
Unknown bar code Codabar bar code Code 11 bar code Code 16K bar code Code 39 bar code Code 93 bar code Code 49 bar code Code 128 bar code Interleaved 2 of 5 MSI bar code PDF 417 bar code Plessey bar code Universal Product code
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
Notes:
You must set the reader to Programmer mode with im_set_input_mode. To receive data from a communications port, you must install a protocol handler. You must install the Reader Wedge to use this function. For information on loading RWTSR.EXE, see “Runtime Requirements” earlier in this chapter.
2-71
Page 98
im_irl_v
Data is automatically cleared from both the scanner and the keypad buffers but not from any communications port buffer. Use the im_link_comm function to establish a link between the Reader Wedge function and a communications port, and use the im_unlink_comm function to remove the link. Data does not display correctly on the screen if the display is in the 80 x 25 mode after the cursor has scrolled off the bottom of the display. Set the display to one of the other modes using im_set_display_mode. See Also:
2-72 im_irl_a, im_irl_k, im_irl_n, im_irl_y, im_set_input_mode
Page 99
im_irl_v
2
Example /******************** im_irl_v ***************************************/ /* Also with: im_link_comm im_unlink_comm im_set_input_mode */ /* Note: Load PHIMEC.EXE protocol handler before using this program. */ #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <ctype.h> #include "immsg.h" #include "im20lib.h" #define
COM_BUFSIZE 300
/* allocate 300 bytes for comm buffer */ void main (void) { IM_UCHAR *com_buffer; IM_UCHAR input[256]; IM_ORIGIN source; IM_USHORT cc; IM_DECTYPE symbol; /* FUNCTION BODY */ window(1, 1, 20, 16); /* Set the reader services text window */ clrscr(); /* Clear the screen */ printf("Demo IRL V Bar code\n'C' to clear screen\n'Q' to quit\n"); /* Allocate a comm buffer */ com_buffer = (char *) malloc(COM_BUFSIZE); /* Set Reader Wedge mode to program interface */ im_set_input_mode(IM_PROGRAMMER); /* Link com_buffer to com1 */ im_link_comm(IM_COM1, com_buffer, COM_BUFSIZE); /* im_irl_v input loop */ do { /* Display IRL V test */ printf("IRL V test\n"); /* Set up input source with labels, keypad, and com1 */ source = IM_LABEL_SELECT | IM_KEYBOARD_SELECT | IM_COM1_SELECT; /* Request input from Reader Wedge */ im_irl_v(IM_INFINITE_TIMEOUT, IM_ENABLE, IM_WEDGE_BEEP, IM_ENABLE, &source, input, &cc, &symbol); /* Display input data */ printf("\n%s\n", input); /* Upper case first char of input for simplifying to test input */ input[0] = toupper(input[0]); /* If the first char in string is 'C', then clear screen.*/ if (input[0] == 'C') clrscr(); } while (input[0] != 'Q'); /* 'Q' for quit */ /* Unlink from comm port */ im_unlink_comm(IM_COM1); /* Free allocated memory */ free(com_buffer); /* Switch the Reader Wedge back to virtual wedge mode */ im_set_input_mode(IM_WEDGE); im_set_beep_control(IM_WEDGE_BEEP); }
2-73
Page 100
im_irl_y im_irl_y Purpose:
The im_irl_y function receives input from the designated communications port the same as IRL ASCII input command Y. This function receives a single block, not an entire file. This function always clears input from the host and edits reader commands from input. Unlike the other IRL instructions, the data is not automatically displayed. For more information on IRL and command Y, refer to the IRL Programming Reference Manual.
Syntax:
#include <im20lib.h> IM_STATUS im_irl_y (IM_USHORT timeout, IM_COM_PORT port_id, IM_UCHAR *eom_char, IM_PROTOCOL_CMD protocol, IM_UCHAR *instring, IM_USHORT *cmd_count);
IN Parameters:
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: 1 to 65,534 ms IM_ZERO_TIMEOUT IM_INFINITE_TIMEOUT
Numeric range No wait Wait forever
If IM_INFINITE_TIMEOUT is selected, the function will not return until the end of message character has been received. The port_id parameter identifies the communications port as follows: IM_COM1 IM_COM2 IM_COM4
COM1 COM2, scanner port (2010 and 2050) COM4 (RF only)
The eom_char parameter is the end of message character needed to terminate input from the communications port. The character is normally a carriage return, but you can set it to any other character.
2-74