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 12 of 42

JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 111 to 120

Pages 111 to 120 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 111

IM_ISGOOD

2

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" #inclide <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-83

Page 112

IM_ISSUCCESS

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" #inclide <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-84

Page 113

IM_ISWARN

2

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" #inclide <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-85

Page 114

im_link_comm 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-86

Page 115

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

2

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

Page 116

im_message

2 im_message Purpose:

This function displays the error message associated with a specific status code returned by an Intermec function. These status codes are listed in Appendix A. Use this function to display additional information about status codes during application development.

Syntax:

#include "im20lib.h" void im_message(IM_STATUS status_code);

IN Parameters:

The status_code parameter is a standard status code returned from various PSK functions.

OUT Parameters:

None.

Return Value:

None.

Notes:

The status message is displayed at the current cursor location without any formatting.

Example See example for im_set_contrast.

2-87

Page 117

im_number_pad_off im_number_pad_off Purpose:

This function disables the number pad feature. When the number pad is disabled, the numeric keys function the same as the 1 through + keys above the “QWERTY” keys on a normal PC keyboard. When the number pad is disabled, you cannot type characters from the extended ASCII character set or use the number pad to move the cursor. For more information, refer to your JANUS user’s manual.

Syntax:

#include <im20lib.h> IM_STATUS im_number_pad_off (void);

IN Parameters:

None.

OUT Parameters:

None.

Return Value:

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

See Also:

im_number_pad_on

Example /******************* im_number_pad_off *******************************/ #include <stdio.h> #include <conio.h> #include <stdlib.h> #include "im20lib.h" void main (void) { int inchar; printf ("\nNumpad disabled\n"); inchar = '\0'; /* This turns the numeric pad functions off */ im_number_pad_off(); /* Any numeric key combination with [CAPS] key produces scan codes */ while (inchar != 'Q') { inchar = toupper( getche()); } }

2-88

Page 118

im_number_pad_on

2 im_number_pad_on Purpose:

This function enables the reader’s number pad. When enabled, the number pad functions the same way as the 10-key number pad on a standard PC keyboard. The numeric keys then provide cursor movement and editing keys, numbers, and access to the extended ASCII character set. When you enable the number pad, you also turn the Num Lock key off or on. When Num Lock is on, the number pad keys produce only numbers or extended ASCII characters with the same scan codes as the numeric keypad on a PC. The numeric keys always generate the same ASCII characters for numbers, but the scan codes depend on the status of the number pad and the Num Lock setting. When Num Lock is off, the number pad keys move the cursor (Home) or edit text (Del). Refer to your JANUS user’s manual for more information on the number pad.

Syntax:

#include <im20lib.h> IM_STATUS im_number_pad_on (IM_NUMBER_LOCK numlock);

IN Parameters:

The numlock parameter indicates whether the Num Lock key is ON or OFF. Use one of these constants: IM_NUMLOCK_ON IM_NUMLOCK_OFF

Enable the number pad with Num Lock ON Enable the number pad with Num Lock OFF

OUT Parameters:

None.

Return Value:

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

See Also:

im_number_pad_off

2-89

Page 119

im_number_pad_on

Example /******************** im_number_pad_on #include <stdio.h> #include <conio.h> #include <stdlib.h> #include "im20lib.h"

******************************/ void main (void) { int inchar; /* Numlock control */ printf("\nTurn numlock ON/OFF\n"); printf("'Q' to quit\n"); /* Number Lock On */ /* IM_NUMLOCK_ON : Enables numeric pad with NUMLOCK ON */ printf ("Numpad enable NL ON\n"); inchar = '\0'; im_number_pad_on( IM_NUMLOCK_ON); while (inchar != 'Q') { inchar = toupper( getche()); } /* IM_NUMLOCK_OFF : Enables numeric pad with NUMLOCK off */ printf ("\nNumpad enable NL OFF\n"); inchar = '\0'; im_number_pad_on( IM_NUMLOCK_OFF); while (inchar != 'Q') { inchar = toupper( getche()); } }

2-90

Page 120

im_parse_host_response

2 im_parse_host_response Purpose:

This function parses the host response for a DCM transaction. For a detailed discussion of programming database transactions, see Chapter 5, “Using the PSK With DCM.”

Syntax:

#include <im20lib.h> IM_USHORT im_parse_host_response (IM_USHORT max_ret_length; IM_UCHAR *ret_string; IM_DCMSTRN ret_array[]; IM_UCHAR oper_type);

IN Parameters:

The max_ret_length parameter sets the maximum length for the return string buffer. The *ret_string parameter is a pointer to the return string buffer. The buffer contains the database server’s transaction message unless a timeout occurs. If the reader receives IM_DCM_TIMEOUT, then the communication error status is placed in the first two bytes of the return buffer. The return string buffer must be large enough to hold a complete packet from the controller.

OUT Parameters:

The ret_array[] parameter is the array containing pointers to the variables that hold the data returned from the database. The received field data is parsed and then placed into the variables. The *oper_type parameter is a pointer to the operation type and is one of these constants: IM_DB_READ IM_DB_INSERT IM_DB_UPDATE IM_DB_DELETE IM_DB_UNKNOWN

R W U D X

Read records from the database Write records to the database Update records in the database Delete records from the database Unknown

2-91