The text of a manual · part 12 of 40
2D JANUS PSK for C/C++ Reference Manual, pages 111 to 120
Pages 111 to 120 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 111
fim_message
2 fim_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-85
Page 112
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 See example for Im_number_pad_on.
2-86
Page 113
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-87
Page 114
im_number_pad_on
Example /******************** im_number_pad_on /*Also with: im_number_pad_off */
******************************/
#include <stdio.h> #include <conio.h> #include <stdlib.h> #include <ctype.h> #include "im20lib.h" void main (void) { int inchar; /* Numlock control */ printf("\nTurn numlock ON/OFF\n"); printf(“Enter numbers.\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"); printf(“Try to enter numbers.\n”); printf("'Q' or ‘3’ to quit\n"); inchar = '\0'; im_number_pad_on( IM_NUMLOCK_OFF); while (inchar != 'Q') { inchar = toupper( getche()); } }
2-88
Page 115
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-89
Page 116
im_parse_host_response
Return Value:
This function returns one of the status codes from the following table. For more information on these return codes, see Chapter 5, “Using the PSK With DCM.” IM_DCM_ACK_RCD IM_DCM_MSG_RCD IM_DCM_NAK_RCD IM_DCM_TRUNCATED IM_DCM_EXCESSFIELD IM_DCM_TIMEOUT IM_DCM_HEAD_ERR
1A01 1A10 5A02 5A11 5A12 9A04 9A05
Transaction successful, ACK received Data received Transaction failed, NAK received Received data was truncated Too many fields Receive timeout Packet header error
Notes:
See Chapter 5, “Using the PSK With DCM.”
See Also:
im_setup_trx, im_standard_trx
Example See the sample program in Chapter 5, “Using the PSK With DCM.”
2-90
Page 117
im_power_status
2 im_power_status Purpose:
This function returns the line status, battery status, backup status, and percentage of remaining battery life.
Syntax:
#include <im20lib.h> IM_STATUS im_power_status (IM_LINE_STATUS *line_status, IM_BATTERY_STATUS battery_status, IM_BACKUP_STATUS *backup_status, IM_UCHAR fuel_gauge);
IN Parameters:
None.
OUT Parameters:
The line_status parameter returns one of these constants: IM_ACline_NOT_CONNECTED IM_ACline_CONNECTED IM_UNKNOWN_ACline
AC line is not connected AC line is connected AC line status is unknown
The battery_status parameter returns one of these constants: IM_HIGH_BAT IM_LOW_BAT IM_CRITICAL_BAT IM_CHARGING_BAT IM_UNKNOWN_BAT
Battery charge is high Battery charge is low Battery charge is critical Battery is charging now Battery condition is unknown
The backup_status parameter returns one of these constants: IM_BACKUP_OK IM_BACKUP_LOW
Backup battery is OK Backup battery is low
The fuel_gauge parameter returns one of these constants: 0 to 100 255 Return Value:
% of full charge in increments of 10% Unknown
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
2-91
Page 118
im_power_status
Example /******************** im_power_status ******************************/ #include <stdio.h> #include <stdlib.h> #include "im20lib.h" IM_LINE_STATUS ac_line; IM_BATTERY_STATUS battery; IM_BACKUP_STATUS backup; IM_UCHAR fuel; IM_STATUS status; void main (void) { /* Call Intermec function */ status = im_power_status( &ac_line, &battery, &backup, &fuel); printf ("Status: %4X\n", status); printf ("Line status:\n "); switch (ac_line) { case IM_ACline_NOT_CONNECTED: printf ("Not connected\n"); break; case IM_ACline_CONNECTED: printf ("Connected\n"); break; case IM_UNKNOWN_ACline: printf ("Unknown\n"); break; default: printf ("Invalid return value\n"); break; } /* End switch */ printf ("Battery status:\n "); switch (battery) { case IM_HIGH_BAT: printf ("Charge high\n"); break; case IM_LOW_BAT: printf ("Charge low\n"); break; case IM_CRITICAL_BAT: printf ("Charge critical\n"); break; case IM_CHARGING_BAT: printf ("Charging battery\n"); break; case IM_UNKNOWN_BAT: printf ("Unknown\n"); break;
2-92
Page 119
im_power_status
2 default: printf ("Invalid return value\n"); break; } /* end switch */ printf ("Backup status:\n "); switch (backup) { case IM_BACKUP_OK: printf ("Backup battery OK\n"); break; case IM_BACKUP_LOW: printf ("Backup battery low\n"); break; default: printf ("Invalid return value\n"); break; } /* end switch */ if (fuel <= 100) printf ("Fuel gauge:\n %u percent\n", fuel); else if (fuel == 255) printf ("Fuel gauge unknown\n"); else printf ("Invalid return value\n"); }
2-93
Page 120
im_protocol_extended_status im_protocol_extended_status Purpose:
This function gets the protocol extended status from the designated communications port. You allocate the protocol status buffer or RF status buffer, and then im_protocol_extended_status returns the status and setup in hexadecimal values.
Syntax:
#include <im20lib.h> IM_STATUS im_protocol_extended_status (IM_COM_PORT port_id, IM_COMM_STATUS_BUFFER_s far *status_buffer);
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 status_buffer parameter is a far pointer to the status buffer structure IM_COMM_STATUS_BUFFER_s. OUT Parameters:
None.
Return Value:
This function returns one of the standard status codes defined in Appendix A, “Status Codes.”
See Also:
im_receive_buffer_no_wait, im_transmit_buffer_no_wait
Example /******************** im_protocol_extended_status **********************/ #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <string.h> #include <im20lib.h> void main (void) { IM_STATUS status; IM_COMM_STATUS_BUFFER_s status_buffer; /* First format string for extended protocol status */ IM_UCHAR *format_str1 = "Strut Ver = %d\nHd Ver = %s\nBaud = %lu\nParity=%XH\nStop=%XH\nData=%XH\n" "Modem=%XH\nPort stat = %XH\nActive prot = %d\n"
2-94