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

JANUS PSK for C/C++ Reference Manual, Version 2.1, pages 71 to 80

Pages 71 to 80 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 71

im_get_keyclick

2 im_get_keyclick Purpose:

You can configure the reader to emit a click each time a key is pressed. This function returns the current setting (enabled or disabled) of the keyclick.

Syntax:

#include "im20lib.h" IM_STATUS im_get_keyclick (IM_CONTROL *keyclick);

IN Parameters:

None.

OUT Parameters:

The keyclick parameter is one of these constants: IM_ENABLE IM_DISABLE

Keyclick is enabled Keyclick is disabled

Return Value:

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

See Also:

im_set_keyclick

2-43

Page 72

im_get_keyclick

Example /******************** im_get_keyclick *******************************/ /* Also with: im_set_keyclick */ #include <stdio.h> #include <conio.h> #include <stdlib.h> #include <ctype.h> #include "im20lib.h" void main (void) { IM_UCHAR user_option; IM_CONTROL old_keyclick; IM_CONTROL new_keyclick; clrscr(); gotoxy(1,1);

/* Clear screen */ /* Position message */

/* Get the current status of keypad clicker */ im_get_keyclick(&old_keyclick); /* Display keypad clicker's status */ if (old_keyclick == IM_ENABLE) printf("Keypad clicker ON!"); else printf("Keypad clicker OFF!"); /* Get user's input option, 'y' for enabling keypad clicker */ printf("\n\nEnabling keyclick(y)?"); user_option = getche(); user_option = toupper(user_option); if (user_option == 'Y') { /* Keypad clicker enable */ im_set_keyclick(IM_ENABLE); } else { /* Keypad clicker disable */ im_set_keyclick(IM_DISABLE); } /* Get new keypad clicker's status after setting */ im_get_keyclick(&new_keyclick); /* Display user's input setting */ if (new_keyclick == IM_ENABLE) printf("\nKeypad clicker ON!"); else printf("\nKeypad clicker OFF!"); printf("\nTest it>>\n"); }

2-44

Page 73

im_get_label_symbology

2 im_get_label_symbology Purpose:

This function gets the symbology, such as Code 39, from the most recently scanned label. Call this function after receiving the data using im_receive_input.

Syntax:

#include "im20lib.h" IM_STATUS im_get_label_symbology (IM_DECTYPE *symbology);

IN Parameters:

None.

OUT Parameters:

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 install the Reader Wedge to use this function. For information on loading RWTSR.EXE, see “Runtime Requirements” earlier in this chapter.

See Also:

im_receive_input

2-45

Page 74

im_get_label_symbology

Example /******************** im_get_label_symbology ************************/ /* im_receive_input */ /* im_set_input_mode */ #include <stdio.h> #include <conio.h> #include "im20lib.h" #include "immsg.h" static char *bar_code[] = { "unknown", "Code 39", /* See typedef enum { ...} IM_DECTYPE in im20lib.h*/ "Code 93", "Code 49", "I 2 of 5", "Codabar", "UPC and EAN", "Code 128", "Code 16K", "Plessey/Anker", "Code 11", "MSI" }; void main (void) { IM_UCHAR input[256]; IM_ORIGIN source; IM_DECTYPE symbol; window(1, 1, 20, 16); clrscr();

/* Set the application text window */ /* Clear the screen */ printf("Demo im_get_label_symbology\n'q' to quit\n"); /* Set Reader Wedge into PROGRAMMER mode im_set_input_mode(IM_PROGRAMMER);

*/

/* Input loop */ do { source = IM_LABEL_SELECT | IM_KEYBOARD_SELECT; /* Request input from Reader Wedge */ im_receive_input(source, IM_INFINITE_TIMEOUT, &source, input); /* Get most recently read label input */ /* im_get_label_symbology only works with im_receive_input */ im_get_label_symbology( &symbol); printf("\n%s\n", input);

/* Display input data */

/* Display symbology */ printf("\nSYMBOLOGY: %d\n%s\n", symbol, bar_code[symbol]); } while (input[0] != 'q' && input[0] != 'Q');

/* 'q' to quit */

/* Switch the Reader Wedge back to virtual wedge mode */ im_set_input_mode(IM_WEDGE); }

2-46

Page 75

im_get_length

2 im_get_length Purpose:

This function returns the length of the string received from the designated source by the most recent im_receive_input function.

Syntax:

#include "im20lib.h" IM_USHORT im_get_length (IM_ORIGIN source);

IN Parameters:

The source parameter is one of these constants: IM_LABEL_SELECT IM_KEYBOARD_SELECT IM_COM1_SELECT IM_COM2_SELECT IM_COM4_SELECT

Label selected Keypad selected COM1 selected COM2, scanner port selected (2010 and 2050) COM4 selected (RF only)

OUT Parameters:

None.

Return Value:

This function returns the length of the last input string read from the designated source.

Notes:

All input using im_receive_input has a null termination character added to the end of the string so that it can be used as a normal C string. However, some data might contain embedded null characters. If so, this function supplies the true data length. For this function, all COM input is considered to be from the same source. For example, if you call im_receive_input with IM_COM1_SELECT and again with IM_COM4_SELECT, then a call to im_get_length with a source of IM_COM1_SELECT returns the length of the message received from COM4 because that was the last message read from a communications port. 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_receive_input

Example See example for im_receive_input.

2-47

Page 76

im_get_postamble im_get_postamble Purpose:

This function retrieves the currently configured postamble string and its length.

Syntax:

#include "im20lib.h" IM_STATUS im_get_postamble (IM_UCHAR *post_string, IM_USHORT *length);

IN Parameters:

None.

OUT Parameters:

The post_string parameter is the postamble string. The length parameter is the length of the postamble string.

Return Value:

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

Notes:

You can set the postamble with IC.EXE, with the im_command function and $+AE command, or by scanning a postamble. Refer to your JANUS user’s manual for more information on configuring a postamble.

See Also:

im_get_postamble, im_get_config_info

Example /******************** im_get_postamble *******************************/ #include <stdio.h> #include <string.h> #include "im20lib.h" void main(void) { IM_STATUS status; IM_USHORT length; IM_UCHAR post_string[128]; // Use im_get_postamble to get the Postamble string printf("\nim_get_postamble example: \n"); status = im_get_postamble(post_string, &length); // Print the results printf("\nPostamble: %s", post_string); printf("\nlength : %d", length); printf("\nstatus : %d", status); }

2-48

Page 77

im_get_preamble

2 im_get_preamble Purpose:

This function retrieves the currently configured preamble string and its length.

Syntax:

#include "im20lib.h" IM_STATUS im_get_preamble (IM_UCHAR *pre_string, IM_USHORT *length);

IN Parameters:

None.

OUT Parameters:

The pre_string parameter is the preamble string. The length parameter is the length of the preamble string.

Return Value:

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

Notes:

You can set the preamble with IC.EXE, with the im_command function and $+AE command, or by scanning a preamble. Refer to your JANUS user’s manual for more information on configuring a preamble.

See Also:

im_get_postamble, im_get_config_info

Example /******************** im_get_preamble *******************************/ #include <stdio.h> #include <string.h> #include "im20lib.h" void main(void) { IM_STATUS status; IM_USHORT length; IM_UCHAR pre_string[128]; // Use im_get_preamble to get the Preamble string printf("\nim_get_preamble example: \n"); status = im_get_preamble(pre_string, &length); // Print the results printf("\nPreamble: %s", pre_string); printf("\nlength : %d", length); printf("\nstatus : %d", status); }

2-49

Page 78

im_get_reboot_flag im_get_reboot_flag Purpose:

This function determines if the reader received a “Prepare For Reboot” command (..+%1) from a host for binary file transfer (BFT). Your application should periodically check if it has received a “Prepare for Reboot” command.

Syntax:

#include "im20lib.h" IM_USHORT im_get_reboot_flag( )

IN Parameters:

None.

OUT Parameters:

None.

Return Value:

This function returns one of the following:

Notes:

1

“Prepare for Reboot” (..+%1) has been received from the host.

0

“Prepare for Reboot” (..+%1) has not been received from the host. or “Cancel Reboot Preparation” (..+%0) has been received from the host.

When a host initiates a binary file transfer (BFT), the JANUS reader must reboot with a server session open to establish a transfer session. The application should close any open files and perform cleanup tasks before rebooting. Input functions such as im_receive_input terminate when the “Prepare for Reboot” command is received. The application should check the return status from input functions to determine if “Prepare for Reboot” terminated the input function.

See Also:

2-50 im_ready_for_reboot

Page 79

im_get_reboot_flag

2

Example //******************im_get_reboot_flag************************************* #include <conio.h> #include <stdio.h> #include "im20lib.h" void main (void) { char inString[300]; // Buffer used by application char comString[300]; // Buffer used by comm utilities int done = 0; int length; int valid_source; IM_USHORT status; IM_USHORT reboot_flag; IM_ORIGIN source; IM_DECTYPE symbology; /* FUNCTION BODY */ clrscr(); im_set_input_mode(IM_PROGRAMMER); im_set_display_mode(IM_SIZE_MODE_20X16, IM_STD_VIDEO_MODE_3, IM_LCD_SCROLL_AT_16, IM_STANDARD_CHAR_HEIGHT); im_link_comm(IM_COM1, comString, 300); while (!done) { valid_source = 1; // assume source will be valid printf("\nEnter>>"); printf("\nPress Q to quit>>"); status = im_receive_input(IM_ALL_SELECT, IM_INFINITE_TIMEOUT, &source, inString); printf("\nStatus>%4x",status); if (source == IM_KEYBOARD_SELECT) { printf("\nFrom Keyboard"); } else if (source == IM_LABEL_SELECT) { printf("\nFrom Label"); im_get_label_symbology(&symbology); if (symbology == IM_CODE_39) { printf("\nCode 39"); } else { printf("\nWrong code!"); } } else if (source == IM_COM1_SELECT) { printf("\nFrom Serial"); } else { printf("\nUnknown source"); // Source = Unknown if reboot // command or abort command // received valid_source = 0; } if (valid_source) { length = im_get_length(source); printf("\nRecvd>>%s",inString);

2-51

Page 80

im_get_reboot_flag printf("\nLength>%d",length); if (inString[0] == 'Q' || inString[0] == 'q') done = 1; } else { reboot_flag = im_get_reboot_flag(); if (reboot_flag) { printf("\nReboot flag is set"); status = im_ready_for_reboot(IM_TRUE); } else { printf("\nReboot flag not set"); status = im_ready_for_reboot(IM_FALSE); } } } im_unlink_comm(IM_COM1); im_set_display_mode(IM_SIZE_MODE_80X25, IM_STD_VIDEO_MODE_3, IM_LCD_SCROLL_AT_16, IM_STANDARD_CHAR_HEIGHT); im_set_input_mode(IM_WEDGE); }

2-52