The text of a manual · part 11 of 25
JANUS PSK for Ada Reference Manual, pages 101 to 110
Pages 101 to 110 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 101
im_irl_v
3
• If the symbology is IM_UNKNOWN_DECODE, then the data came from the keyboard. • If the symbology is one of the other values (such as IM_CODE_39), then some or all of the data came from the scanner. • If only the scanner is enabled, then all of the data came from the scanner. The source parameter is one of the following constants: IM_NO_SELECT IM_LABEL_SELECT IM_KEYBOARD_SELECT IM_COM1_SELECT IM_COM2_SELECT IM_COM4_SELECT IM_ALL_SELECT OUT Parameters:
No designated source Label Keyboard COM1 COM2, scanner (2010 and 2050) COM4 (RF only) All sources are designated
The irl_string parameter is the returned string containing the IRL commands and must have at least 256 bytes allocated. The cmd_count returned is 0 unless an abort command is passed in the string. The symbology parameter is one of the following 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
3-61
Page 102
im_irl_v
OUT Parameters
The status_code parameter is a standard status code listed in Appendix A, “Status Codes.”
Return Value:
None.
Notes:
You must set the reader to Programmer mode with the im_set_input_mode function. To receive data from a communications port, you must install a protocol handler. 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.” Data is automatically cleared from both the scanner and the keypad buffers but not from any communications port buffer. Use the im_link_comm function to establish a link between the Reader Wedge function and a communications port, and use the im_unlink_comm function to remove the link. Data does not display correctly on the screen if the display is in the 80X25 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.
See Also:
im_irl_a, im_irl_k, im_irl_n, im_irl_y, im_set_input_mode
Example With System, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Text_IO, Intrmecd_IO, Intrmecp_IO; procedure ex_irl_v is cmd_count : System.Word; display_status : System.Word; irl_string : String(1..256); status : System.Word; source : IM_ORIGIN; symbol : IM_DECTYPE; package SYMBOL_IO is new ENUMERATION_IO(enum=>IM_DECTYPE); begin -- Set display mode to something other than 80X25 display_status := im_set_display_mode(IM_SIZE_MODE_20X16,
3-62
Page 103
im_irl_v
3
IM_STD_VIDEO_MODE_0, IM_LCD_SCROLL_AT_16, IM_STANDARD_CHAR_HEIGHT); Put_Line(" Example im_irl_v"); New_Line; Put_Line("Enter AlphaNums"); Put_Line(" from keyboard"); Put_Line(" or read label"); Put_Line("q to quit"); -- Set Reader Wedge mode to program interface im_set_input_mode(IM_PROGRAMMER); loop -- Clear input string irl_string := (others => Ascii.NUL); -- Set input source source := IM_KEYBOARD_SELECT + IM_LABEL_SELECT; -- Read input using im_irl_v im_irl_v (IM_INFINITE_TIMEOUT, IM_ENABLE, IM_WEDGE_BEEP, IM_DISABLE, source, irl_string, cmd_count, symbol, status); exit when irl_string(1) = 'q'; if im_isgood(status) then New_Line; Put("Source: "); if source = IM_LABEL_SELECT then Put("Label"); elsif source = IM_KEYBOARD_SELECT then Put("Keyboard"); end if; New_Line; Put("Data read::"); -- Display printable characters for i in Integer range 1..256 loop exit when irl_string(i) = Ascii.NUL; if irl_string(i) in ' '..'~' then Put(irl_string(i)); else Put('?'); end if; end loop; Put("::"); New_Line; Put_Line("The symbology read:"); SYMBOL_IO.Put(symbol); New_Line; else im_message(status); New_Line; end if; end loop; -- Reset display mode and Reader Wedge mode im_set_input_mode(IM_WEDGE); display_status := im_set_display_mode(IM_SIZE_MODE_80X25, IM_STD_VIDEO_MODE_3, IM_LCD_SCROLL_AT_16, IM_STANDARD_CHAR_HEIGHT); end ex_irl_v;
3-63
Page 104
im_irl_y im_irl_y Purpose:
This procedure receives input from the designated communications port the same as IRL ASCII input command Y. This procedure receives a single block, not an entire file, and always clears input from the host and edits reader commands from input. Unlike the other IRL instructions, the data is not automatically displayed. For more information on IRL and command Y, refer to the IRL Programming Reference Manual.
Syntax:
With Intrmecd_IO, Intrmecp_IO; Use Intrmecd_IO, Intrmecp_IO; procedure im_irl_y ( timeout : In System.Word; port : In IM_COM_PORT; term_char : In Character; prot_mode : In IM_PROTOCOL_CMD; irl_string : Out String; cmd_count : Out System.Word; status_code : Out System.Word);
IN Parameters:
The timeout parameter is the receive timeout period. You can exit the function before data is received or before the timeout occurs by performing an application break sequence (see your JANUS user’s manual). The return status indicates whether the function was successful, a timeout occurred, or the application break was received. The numeric range for timeout is from 1 to 65,534 ms. You can also use one of the following constants: IM_ZERO_TIMEOUT IM_INFINITE_TIMEOUT
No wait Wait forever
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 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 other character.
3-64
Page 105
im_irl_y
3
The prot_mode parameter is one of the following 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 break_status 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:
You must allocate at least 256 bytes to the irl_string parameter. The cmd_count returned is 0 unless an abort command is passed in the string. The status_code parameter is a standard status codes listed in Appendix A, “Status Codes.”
Return Value:
None.
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.
3-65
Page 106
im_irl_y
Data does not display correctly on the screen if the display is in the 80X25 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. To use this function, set the reader to Programmer mode using im_set_input_mode. 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” in Chapter 2, “Working With Ada.” See Also:
im_irl_a, im_irl_k, im_irl_n, im_irl_v, im_set_display_mode, im_set_input_mode
Example With System, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Text_IO, Intrmecd_IO, Intrmecp_IO; procedure ex_irl_y is comm_buff : Im_Buffer; buff_size : System.Word := 300; buff_ptr : System.Address := comm_buff(comm_buff'First)'Address; cmd_count : System.Word; display_status : System.Word; irl_string : String(1..256); link_status : System.Word; status : System.Word; begin -- Set display mode to something other than 80X25 display_status := im_set_display_mode(IM_SIZE_MODE_20X16, IM_STD_VIDEO_MODE_0, IM_LCD_SCROLL_AT_16, IM_STANDARD_CHAR_HEIGHT); Put_Line(" Example im_irl_y"); New_Line; Put_Line("Waiting for input"); Put_Line(" from COM1"); Put_Line("q to quit"); -- Link to protocol handler. A protocol handler MUST be installed. link_status := im_link_comm(IM_COM1, buff_ptr, buff_size); if im_isgood(link_status) then -- Set Reader Wedge mode to program interface im_set_input_mode(IM_PROGRAMMER);
3-66
Page 107
im_irl_y
3 loop -- Clear input string irl_string := (others => Ascii.NUL); -- Read COM1 with protocol ON im_irl_y (IM_INFINITE_TIMEOUT, IM_COM1, Ascii.CR, IM_PROTOCOL_ON, irl_string, cmd_count, status); exit when irl_string(1) = 'q'; if im_isgood(status) then Put_Line("Protocol ON"); -- Display printable characters for i in Integer range 1..256 loop exit when irl_string(i) = Ascii.NUL; if irl_string(i) in ' '..'~' then Put(irl_string(i)); else Put('?'); end if; end loop; New_Line; else im_message(status); New_Line; end if; -- Clear input string irl_string := (others => Ascii.NUL); -- Read COM1 with protocol OFF im_irl_y (IM_INFINITE_TIMEOUT, IM_COM1, Ascii.CR, IM_PROTOCOL_OFF, irl_string, cmd_count, status); exit when irl_string(1) = 'q'; if im_isgood(status) then Put_Line("Protocol OFF"); -- Display printable characters for i in Integer range 1..256 loop exit when irl_string(i) = Ascii.NUL; if irl_string(i) in ' '..'~' then Put(irl_string(i)); else Put('?'); end if; end loop; New_Line; else im_message(status); New_Line; end if; -- Clear input string irl_string := (others => Ascii.NUL); -- Read COM1 with no change in protocol im_irl_y (IM_INFINITE_TIMEOUT, IM_COM1, Ascii.CR, IM_NO_CHANGE, irl_string, cmd_count, status); exit when irl_string(1) = 'q';
3-67
Page 108
im_irl_y if im_isgood(status) then Put_Line("Protocol No change"); -- Display printable characters for i in Integer range 1..256 loop exit when irl_string(i) = Ascii.NUL; if irl_string(i) in ' '..'~' then Put(irl_string(i)); else Put('?'); end if; end loop; New_Line; else im_message(status); New_Line; end if; end loop; end if; -- Unlink to protocol handler. link_status := im_unlink_comm(IM_COM1); -- Set Reader Wedge mode back to Virtual Wedge mode im_set_input_mode(IM_WEDGE); -- Set display mode back to 80X25 display_status := im_set_display_mode(IM_SIZE_MODE_80X25, IM_STD_VIDEO_MODE_3, IM_LCD_SCROLL_AT_16, IM_STANDARD_CHAR_HEIGHT); end ex_irl_y;
3-68
Page 109
im_iserror
3 im_iserror Purpose:
This macro determines if the return status code from another PSK function is an error (either fatal or nonfatal).
Syntax:
With System, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Text_IO, Intrmecd_IO, Intrmecp_IO; function im_iserror( status :System.Word ) return Boolean;
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” in Chapter 2, “Working With Ada,” im_isgood, im_issuccess, im_iswarn
Indicates success or warning Indicates an error (either fatal or nonfatal)
Example With System, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Text_IO, Intrmecd_IO, Intrmecp_IO; procedure ex_iserror is status : System.Word; begin status := im_sound(IM_LOW_PITCH, IM_BEEP_DURATION, IM_NORMAL_VOLUME); if im_iserror(status) then Put_Line('Beep Error!'); else Put_Line('Beep success or warning'); end if; New_Line; end ex_iserror;
3-69
Page 110
im_isgood im_isgood Purpose:
This macro determines if the return status code from another PSK function is a success.
Syntax:
With System, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Text_IO, Intrmecd_IO, Intrmecp_IO; function im_isgood( status :System.Word ) return Boolean;
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” in Chapter 2, “Working With Ada,” im_iserror, im_issuccess, im_iswarn
Indicates a warning or an error (either fatal or nonfatal) Indicates success
Example With System, Text_IO, Intrmecd_IO, Intrmecp_IO; Use System, Text_IO, Intrmecd_IO, Intrmecp_IO; procedure ex_isgood is status : System.Word; begin status := im_sound(IM_LOW_PITCH, IM_BEEP_DURATION, IM_NORMAL_VOLUME); if im_isgood(status) then Put_Line('Beep successful!'); else Put_Line('Beep error or warning'); end if; New_Line; end ex_isgood;
3-70