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 15 of 25

JANUS PSK for Ada Reference Manual, pages 141 to 150

Pages 141 to 150 of 250

The original document is the PDF (415 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 141

im_receive_input

OUT Parameter:

3

The returned_source parameter specifies the actual input source and is one of the following constants: IM_NO_SELECT IM_LABEL_SELECT IM_KEYBOARD_SELECT IM_COM1_SELECT IM_COM2_SELECT IM_COM4_SELECT

No selection made Label selected Keypad selected COM1 selected COM2, scanner (2010 and 2050) COM4 selected (RF only)

The ret_string parameter retrieves the string received. The status_code parameter is a standard status code listed in Appendix A, “Status Codes.” Return Value:

None.

Notes:

If input from more than one source is received before this function is called, the first available input is returned in this order: label, keypad, COM1, COM2, and COM4. If you are using a communications port, you must install a protocol handler and call im_link_comm. You must install the Reader Wedge to use this function. For information on loading RWTSR.EXE, see “Runtime Requirements” in Chapter 2, “Working With Ada.”

See Also:

im_get_length, im_get_label_symbology, im_link_comm

Example With System, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Text_IO, Intrmecd_IO, Intrmecp_IO; procedure recinput Is package SYSWORD_IO is new INTEGER_IO (System.Word); package SYMBOL_IO is new ENUMERATION_IO(enum => IM_DECTYPE); symbol : IM_DECTYPE; status : System.Word; selected_origin : IM_ORIGIN := IM_LABEL_SELECT + IM_KEYBOARD_SELECT; returned_origin : IM_ORIGIN; label : String (1..256); len : System.Word;

3-101

Page 142

im_receive_input begin Put_Line(" "); Put_Line(" Janus 2010"); Put_Line("Receive input from"); Put_Line("Keypad or Label"); Put_Line("q to quit"); New_Line; im_set_input_mode (IM_PROGRAMMER); loop -- Clear input label := (others=>Ascii.NUL); -- Call Intermec procedure im_receive_input (selected_origin, IM_INFINITE_TIMEOUT, returned_origin, label, status); New_Line; if im_isgood(status) then -- receive input successful New_Line; -- Get the length of the label or keypad input len := im_get_length (returned_origin); Put ("Length of input:"); SYSWORD_IO.Put (len, Width => 3); New_Line; -- Display input for i in Integer range 1..Integer(len) loop Put(label(i)); end loop; New_Line; -- If label is read then get the symbology and display it if returned_origin = IM_LABEL_SELECT then im_get_label_symbology (symbol, status); if im_isgood(status) then Put_Line("Symbology read:"); SYMBOL_IO.Put (symbol); New_Line; else Put_Line ("Label errors"); im_message (status); New_Line; end if; end if; else -- im_receive_input error or warning Put_Line("Receive input error"); im_message(status); New_Line; end if; exit when label(1) = 'q' or label(1) = 'Q'; end loop; im_set_input_mode (IM_WEDGE); end recinput;

3-102

Page 143

im_rs_installed

3 im_rs_installed Purpose:

This function determines whether or not the reader services (RSERVICE.EXE) program is installed.

Syntax:

With Intrmecd_IO, Intrmecp_IO; Use Intrmecd_IO, Intrmecp_IO; function im_rs_installed return IM_RS_INSTALL_STATUS;

IN Parameters:

None.

OUT Parameters:

None.

Return Value:

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

Example With System, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Text_IO, Intrmecd_IO, Intrmecp_IO; procedure rsinstal Is rs_status : System.Word; begin rs_status := im_rs_installed; case rs_status is when IM_RS_ALL_SUCCESS => Put_Line("RS request successful"); when IM_RS_NOT_INSTALLED => Put_Line("RS not installed"); when others => Put("Invalid: "); im_message(rs_status); New_Line; end case; New_Line; end rsinstal;

3-103

Page 144

im_rx_check_status im_rx_check_status Purpose:

This function directs the active protocol handler to check the communications port buffer status variable to determine if the application program has accepted the previous data. Use this function with the im_receive_buffer_no_wait function to receive input from multiple buffers.

Syntax:

With Intrmecd_IO, Intrmecp_IO; Use Intrmecd_IO, Intrmecp_IO; function im_rx_check_status ( port : IN IM_COM_PORT ) return System.Word;

IN Parameter:

The port parameter identifies the communications port as follows: IM_COM1 IM_COM2 IM_COM4

COM1 COM2, scanner (2010 and 2050) COM4 (RF only)

OUT Parameter:

None.

Return Value:

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

Notes:

You must install a protocol handler to use this function.

See Also:

im_receive_buffer_no_wait

Example See example for im_receive_buffer_no_wait.

3-104

Page 145

im_serial_protocol_control

3 im_serial_protocol_control Purpose:

This function controls the protocol mode for a designated communications port and determines whether the receive mode is with or without protocol according to the input parameter. Any change clears the input buffer and resets the reader command parser. Use this function to set protocol when connected to a communications port. The return value indicates a success if the port is currently linked to the Reader Wedge. If the port is not currently linked to the Reader Wedge, the function returns an error.

Syntax:

With Intrmecd_IO, Intrmecp_IO; Use Intrmecd_IO, Intrmecp_IO; function im_serial_protocol_control ( port : IN IM_COM_PORT; prot_mode : IN IM_PROTOCOL_CMD; term_char : IN Character ) return System.Word;

IN Parameter:

The port parameter identifies the communications port as follows: IM_COM1 IM_COM2 IM_COM4

COM1 COM2, scanner (2010 and 2050) COM4 (RF only)

The prot_mode parameter affects how incoming messages are received and is one of the following constants: IM_NO_CHANGE IM_PROTOCOL_ON IM_PROTOCOL_OFF IM_NEW_TERM_CHAR

The protocol is unchanged Turns the protocol off Turns the protocol on Indicates a new termination character

The prot_mode 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_ON is specified, the incoming message is terminated with the end of message character of the active protocol.

3-105

Page 146

im_serial_protocol_control

• 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_OFF is used, you must specify a termination character, otherwise the data is returned in individual bytes. • 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. The term_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 character. This parameter is required for IM_PROTOCOL_OFF and IM_NEW_TERM_CHAR. OUT Parameter:

None.

Return Value:

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

Notes:

Requires im_link_comm. 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.

See Also:

im_link_comm

Example With System, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Text_IO, Intrmecd_IO, Intrmecp_IO; procedure protctrl Is package IM_ORIGIN_IO is new INTEGER_IO (IM_ORIGIN); comm_buff : Im_Buffer; comm_buff_ptr : System.Address := comm_buff(comm_buff'First)'Address; comm_buff_size : System.Word := comm_buff'Length; ans : Character := ' '; status : System.Word; receive_status : System.Word; eom : Character := Ascii.CR; label : String(1..16) := (others => Ascii.NUL);

3-106

Page 147

im_serial_protocol_control timeout : System.Word := 10000; returned_origin: IM_ORIGIN;

3

-- 10 seconds begin status := im_link_comm(IM_COM1, comm_buff_ptr, comm_buff_size); Put("Link status:"); im_message (status); New_Line; im_set_input_mode(IM_DESKTOP); -- turn off protocol and make a <CR> the end of message char Put_Line ("setting protocol"); status := im_serial_protocol_control(IM_COM1, IM_PROTOCOL_OFF, eom); im_message (status); New_Line; label := (others => Ascii.NUL); Put_Line ("Waiting for COM1 input"); im_receive_input(IM_COM1_SELECT, timeout, returned_origin, label, receive_status); im_set_input_mode (IM_WEDGE); if IM_ISSUCCESS(receive_status) then Put_Line("Rec status: "); im_message (receive_status); New_Line; Put("Origin: "); IM_ORIGIN_IO.Put(returned_origin, WIDTH => 8, BASE => 16); New_Line; Put_Line("Label:"); for i in Integer range 1..16 loop exit when label(i) = Ascii.NUL; if label(i) in ' '..'~' then Put(label(i)); else New_Line; Put_Line("Unprintable char"); end if; end loop; New_Line; else Put_Line("Rec error"); im_message (receive_status); New_Line; end if; -- turn off protocol status := im_serial_protocol_control(IM_COM1, IM_PROTOCOL_OFF, Ascii.CR); status := im_unlink_comm(IM_COM1); end protctrl;

3-107

Page 148

im_set_contrast im_set_contrast Purpose:

This function sets the reader’s display contrast level. There are eight levels of contrast from very light (level 0) to very dark (level 7).

Syntax:

With Intrmecd_IO, Intrmecp_IO; Use Intrmecd_IO, Intrmecp_IO; function im_set_contrast ( contrast_level_requested: IN System.Byte ) return System.Word;

IN Parameter:

The contrast_level_requested parameter is one of the following constants: IM_MIN_CONTRAST Level 0 IM_AVE_CONTRAST Level 4 IM_MAX_CONTRAST Level 7

OUT Parameter:

None.

Return Value:

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

Notes:

The functions im_set_contrast and im_get_contrast use a scale of 0 to 7 that is related to the scale of 0 to 31 used by im_increase_contrast and im_decrease_contrast. The following table shows the equivalent values for the 0 to 7 scale.

See Also:

3-108

Scale 0 to 7

Scale 0 to 31

Level

0 1 2 3 4 5 6 7

10 12 14 16 18 20 22 24

Very light

Very dark im_get_contrast, im_decrease_contrast, im_increase_contrast

Page 149

im_set_contrast

3

Example With System, Bit, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Bit, Text_IO, Intrmecd_IO, Intrmecp_IO; procedure setcontr Is package SYSBYTE_IO is new INTEGER_IO (System.Byte); package SYSWORD_IO is new INTEGER_IO (System.Word); status : System.Word; level : System.Byte; begin Put_Line ("Enter Contrast (0-7)"); Put (">>> "); SYSBYTE_IO.Get (level); Skip_Line; status := im_set_contrast (level); if Tstbit(status, 15) then Put ("Set Contrast Error = "); SYSWORD_IO.Put (status, WIDTH => 8); New_Line; end if; end setcontr;

3-109

Page 150

im_set_control_key im_set_control_key Purpose:

This function enables or disables the Ctrl key setting. When disabled, none of the key combinations that use the Ctrl key work. For example, the warm boot key sequence Ctrl-Alt-Del will not work.

Syntax:

With Intrmecd_IO, Intrmecp_IO; Use Intrmecd_IO, Intrmecp_IO; function im_set_control_key ( control_key : IN IM_CONTROL ) return System.Word;

IN Parameter:

The control_key parameter is set to one of the following constants: IM_ENABLE IM_DISABLE

Enable the Ctrl key Disable the Ctrl key

Return Value:

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

See Also:

im_get_control_key

Example With System, Bit, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Bit, Text_IO, Intrmecd_IO, Intrmecp_IO; procedure setclkey Is package SYSWORD_IO is new INTEGER_IO (System.Word); status : System.Word; in_char : Character := ' '; begin status := im_set_control_key (IM_DISABLE); if im_isgood (status)then Put_Line ("Control Key DISABLED"); Put_Line ("q to quit"); loop exit when in_char = 'q'; Get(in_char); end loop; else Put ("Disable Ctrl Key error = "); SYSWORD_IO.Put (status, Width => 8); New_Line; end if; in_char := ' '; New_Line; status := im_set_control_key (IM_ENABLE);

3-110