Browse
(440) 299-7778
Menu
(440) 299-7778
One-year parts and labor warranty30-day money-back guaranteeEnglishEspañolContact

The text of a manual · part 11 of 42

JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 101 to 110

Pages 101 to 110 of 414

The original document is the PDF (690 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 101

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_PLESSEY IM_UPC

Unknown bar code Codebar 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 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-73

Page 102

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-74 im_irl_a, im_irl_k, im_irl_n, im_irl_y, im_set_input_mode

Page 103

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 "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-75

Page 104

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-76

Page 105

im_irl_y

2

The protocol parameter is one of these constants: IM_NO_CHANGE IM_PROTOCOL_OFF IM_PROTOCOL_ON IM_NEW_TERM_CHAR

Keep the current protocol Turn the protocol OFF Turn the protocol ON Use the new termination character

The protocol parameter affects how incoming messages are received: • If IM_NO_CHANGE is specified, the protocol and end of message settings remain the same as the last time the function was called. • If IM_PROTOCOL_OFF is specified, the incoming data is terminated with the specified end of message character. If the end of message character is null, the function terminates upon receiving the first character. • If IM_PROTOCOL_ON is specified, the incoming message is terminated with the end of message character of the active protocol. • If IM_NEW_TERM_CHAR is specified, IM_PROTOCOL_OFF is assumed and the new end of message character specified in the parameter list is used. 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.

Return Value:

This function returns one of the standard status codes defined in Appendix A, “Status Codes.”

Notes:

The receive buffers are cleared whenever the protocol is turned ON or OFF. To change the termination character (or to not change the setting at all), use IM_NEW_TERM_CHAR or IM_NO_CHANGE instead of toggling the protocol.

Notes

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.

2-77

Page 106

im_irl_y

Set the reader to Programmer mode using im_set_input_mode to use this function. 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:

im_irl_a, im_irl_k, im_irl_n, im_irl_v, im_set_display_mode, im_set_input_mode

Example /******************** im_irl_y ***************************************/ /* Also with: im_link_comm */ /* im_unlink_comm */ /* im_set_input_mode */ /* Note: Load JANUS's PHIMEC protocol before using this sample program. */ #include <stdio.h> #include <conio.h> #include <stdlib.h> #include "immsg.h" #include "im20lib.h" #define COM_BUFSIZE 300 static IM_UCHAR static IM_UCHAR static IM_UCHAR static IM_UCHAR static IM_UCHAR

/* Allocate 300 bytes for comm buffer */ eom_ctrl_a = 1; eom_ctrl_y = 25; eom_ctrl_z = 26; eom_cr = '\r'; eom_null = '\0';

/* Control-A for EOM char */ /* Control-Y for EOM char */ /* Control-Z for EOM char */ /* Carriage Return for EOM char */ /* Null char for EOM char */ void main (void) { IM_UCHAR *com_buffer; IM_UCHAR input[256]; IM_USHORT cc; IM_STATUS status; window(1, 1, 20, 16); clrscr();

/* Set the application text window */ /* Clear the screen */ printf("Demo IRL Y Bar Code\n'Q' to quit\n\'C' to clear screen\n"); /* Allocate a comm buffer */ com_buffer = (char *) malloc(COM_BUFSIZE);

2-78

Page 107

im_irl_y

2

/* Link com_buffer to com1 */ im_link_comm(IM_COM1, com_buffer, COM_BUFSIZE); /* Set Reader Wedge mode to program interface */ im_set_input_mode(IM_PROGRAMMER); /* Using JANUS's protocol by passing IM_PROTOCOL_ON */ printf("\nUsing JANUS's protocol\n"); status = im_irl_y(IM_INFINITE_TIMEOUT, IM_COM1, &eom_null, IM_PROTOCOL_ON, input, &cc); /* Display input data */ printf("\nstatus: %x\n%s", status, input); /***********************************************************************/ /* The following im_irl_y() calls demonstrates that the various types */ /* of EOM chars are used for EOM purpose. If you just use one type EOM */ /* char, then you delete the unwanted im_irl_y() call. */ /***********************************************************************/ /* Not using JANUS's protocol by passing IM_PROTOCOL_OFF and new EOM /* char control-y printf("\nCTRL-Y for EOM\n"); status = im_irl_y(IM_INFINITE_TIMEOUT, IM_COM1, &eom_ctrl_y, IM_PROTOCOL_OFF, input, &cc); /* Display input data */ printf("\nstatus: %x\n%s", status, input);

*/ */

/* Using IM_NEW_TERM_CHAR and changing EOM char to control-z */ printf("\nCTRL-Z for EOM\n"); status = im_irl_y(IM_INFINITE_TIMEOUT, IM_COM1, &eom_ctrl_z, IM_NEW_TERM_CHAR, input, &cc); /* Display input data */ printf("\nstatus: %x\n%s", status, input); /* Using IM_PROTOCOL_OFF and changing EOM char to control-a */ printf("\nCTRL-A for EOM\n"); status = im_irl_y(IM_INFINITE_TIMEOUT, IM_COM1, &eom_ctrl_a, IM_PROTOCOL_OFF, input, &cc); /* Display input data */ printf("\nstatus: %x\n%s", status, input); /* Using JANUS's protocol for input again */ printf("\nUsing JANUS's protocol\n"); status = im_irl_y(IM_INFINITE_TIMEOUT, IM_COM1, &eom_null, IM_PROTOCOL_ON, input, &cc); /* im_irl_y input loop */ do { /* Using JANUS's protocol, If using Pt-to-Pt protocol, EOM is CR */ printf("\nCR is EOM of Pt-to-Pt\n"); status = im_irl_y(IM_INFINITE_TIMEOUT, IM_COM1, &eom_null, IM_NO_CHANGE, input, &cc); /* Display input data */ printf("\nstatus: %x\n%s", status, input); /* Test input Y with protocol and timeout */ /* Upper case first char of input for simplifying to test input */ input[0] = toupper(input[0]);

2-79

Page 108

im_irl_y

2-80

Page 109

im_irl_y

2

/*If the first char in string is 'C', then clear screen.*/ if (input[0] == 'C') clrscr(); } while (input[0] != 'Q');

/* 'Q' to stop */

/* Unlink com_buffer from com1 */ 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); }

2-81

Page 110

IM_ISERROR

IM_ISERROR Purpose:

This macro determines if the return status code from another PSK function is an error (either fatal or nonfatal).

Syntax:

#include <im20lib.h> IM_ISERROR(status);

IN Parameters:

The status parameter is any PSK function that returns a status code.

OUT Parameters:

None.

Return Value:

0 nonzero

See Also:

“Status Code Macros” earlier in this chapter. IM_ISGOOD, IM_ISSUCCESS, IM_ISWARN

Indicates success or warning Indicates an error (either fatal or nonfatal)

Example /******************** IM_ISERROR ***************************************/ #include "im20lib.h" #inclide <stdio.h> printf("IM_ISERROR example:") status = im_sound(IM_LOW_PITCH, IM_BEEP_DURATION, IM_NORMAL_VOLUME) if IM_ISERROR(status) printf("Beep error!"); else printf("Beep success or warning!");

2-82