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 40

2D JANUS PSK for C/C++ Reference Manual, pages 101 to 110

Pages 101 to 110 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 101

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

Page 102

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

Page 103

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

Page 104

im_irl_y

/*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-78

Page 105

IM_ISERROR

2

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" #include <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-79

Page 106

IM_ISGOOD

IM_ISGOOD Purpose:

This macro determines if the return status code from another PSK function is success.

Syntax:

#include <im20lib.h> IM_ISGOOD(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_ISERROR, IM_ISSUCCESS, IM_ISWARN

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

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

2-80

Page 107

IM_ISSUCCESS

2

IM_ISSUCCESS Purpose:

This macro determines if the return status code from another PSK function is either success or warning.

Syntax:

#include <im20lib.h> IM_ISSUCCESS(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_ISERROR, IM_ISGOOD, IM_ISWARN

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

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

2-81

Page 108

IM_ISWARN

IM_ISWARN Purpose:

This macro determines if the return status code from another PSK function is a warning.

Syntax:

#include <im20lib.h> IM_ISWARN(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_ISERROR, IM_ISGOOD, IM_ISSUCCESS

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

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

2-82

Page 109

im_link_comm

2 im_link_comm Purpose:

This function establishes a link between the Reader Wedge function and a designated communications port. The following figure lists the different modes and the functions to use when linked or unlinked. Note: Programmer mode and desktop mode differ in how they handle keypad inputs. When the reader is in Programmer mode, the Enter key terminates keypad input. When the reader is in Desktop mode, keypad entry terminates when you press each key.

Linking Specific Modes and Functions

IM_DESKTOP or or

(do not link)

IM_PROGRAMMER

IM_PROGRAMMER

(not linked)

(linked, protocol handler loaded)

Key Label

IM_DESKTOP

IM_WEDGE im_receive_input Standard Input Functions (i.e., KBHIT, GETCH, etc.)

Key Label

Source = IM_KEYBOARD_SELECT Source = IM_LABEL_SELECT im_receive_input Key Label COM

With a protocol handler loaded (to use Intermec protocols) COM im_receive_buffer (etc.)

COM

COM

Standard Receive Functions (i.e., INT 14H, _BIOS_SERIALCOM) Standard Transmit Functions (i.e., INT 14H, _BIOS_SERIALCOM)

Source = IM_COMx_SELECT im_receive_buffer (etc.) im_transmit_buffer (etc.)

COM

Without a protocol handler loaded COM

Source = IM_LABEL_SELECT

With a protocol handler loaded (to use Intermec protocols)

im_transmit_buffer (etc.) COM

Source = IM_KEYBOARD_SELECT

COM im_transmit_buffer (etc.)

Without a protocol handler loaded COM

COM

Standard Receive Functions (i.e., INT 14H, _BIOS_SERIALCOM) Standard Transmit Functions (i.e., INT 14H, _BIOS_SERIALCOM)

AIT-24

2-83

Page 110

im_link_comm

Syntax:

#include <im20lib.h> IM_STATUS im_link_comm (IM_COM_PORT port_id, void *buffer, IM_USHORT buffer_size);

IN Parameters:

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 buffer parameter is a pointer to a memory area used by the Reader Wedge. Your application should not use this buffer. The buffer_size parameter is the number of bytes to allocate for the buffer array. The suggested size is 300 bytes. OUT Parameters:

None.

Return Value:

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

Notes:

Use this function if you want to receive data with the Reader Wedge input function im_irl_y or to use the communications port with im_receive_input and im_irl_v. This function needs to be called only once. You must unlink at the end of your application. 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_unlink_comm, im_receive_input, im_irl_v, im_irl_y, im_serial_protocol_control

Example See example for im_receive_input.

2-84