The text of a manual · part 14 of 28
6400 PSK Reference Manual, pages 131 to 140
Pages 131 to 140 of 272
The original document is the PDF (1.1 MB). 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 6400
Page 131
im_receive_byte
5 im_receive_byte (continued) /* Byte oriented defines */ #define COM1 0 #define SETTINGS (_COM_9600 | _COM_CHR7 | _COM_STOP1 | _COM_EVENPARITY ) static IM_COM_PORT com_port = IM_COM1;
/* Uses COM1*/ void main (void) { IM_UCHAR inchar; IM_STATUS status; im_cputs("\nChoose a protocol:\n", IM_NORMAL); printf("1) PC Standard\n"); printf("2) No protocol\n"); if (getche() == '2') /* Call bios to initialize com port */ { /* Communications port init */ _bios_serialcom(_COM_INIT, COM1, SETTINGS); } printf ("\nChars received\n"); printf ("<ESC> to quit\n"); printf ("PC function\n"); im_cputs ("Ctrl Z to finish at\n", IM_NORMAL); printf ("host\n"); /* Phimec protocol handler must NOT be installed ...*/ while (1) { /* Call Intermec function */ status = im_receive_byte(com_port, &inchar); if ( IM_ISERROR(status)) { printf("st: %xH\n", status); im_message(status); } else im_putchar (inchar, IM_NORMAL); /* If User press <ESC> key, then stop program */ if ( kbhit() && getch() == '\x1B') break; } }
5-75
Page 132
im_receive_field im_receive_field Purpose:
This function manages an input field area on the screen. You can specify display attributes for the field and control the length of the input data.
Syntax:
#include "im64psk.h" IM_STATUS im_receive_field (IM_ORIGIN iAllowedSource, IM_UINT iTimeout, IM_ATTRIBUTES iAttribute IM_ULONG iFlags IM_SHORT iAllowedLength IM_ORIGIN far *lpReturnedSource, IM_UCHAR far *lpReturnedString);
IN Parameters:
iAllowedSource constants:
Defines the available input source. Choose one or more of these
IM_LABEL_SELECT
Label selected
IM_KEYBOARD_SELECT
Keypad selected
IM_COM1_SELECT
COM1 selected
IM_NET_SELECT
Network selected
IM_ALL_SELECT
All sources selected iTimeout Specifies the receive timeout period. Either enter a number from 1 to 65,534 to indicate the length of the timeout in milliseconds, or choose one of these constants: IM_ZERO_TIMEOUT
No wait
IM_INFINITE_TIMEOUT Wait forever - the function does not return until the end of message character is received, a return is entered, or one of the conditions set with the iFlags parameter is met. If COM1 is selected, IM_INFINITE_TIMEOUT acts like IM_INFINITE_NET_TIMEOUT. iAttribute
Specifies the display attributes. Choose one of these constants:
IM_NORMAL Plain text IM_INVERSE
Inverse color text
IM_UNDERLINE Underlined text iFlags
Controls the field action. Choose one or more of these constants:
IM_ERASE_FIELD Clear field data and display any field attributes on screen, filling the field area. If this flag is not set, the old data is displayed and the field is padded with blanks. Attributes are applied to the current row. IM_RETURN_ON_FULL and then exit the field.
5-76
If the input data fills the field, display the truncated data,
Page 133
im_receive_field
5 im_receive_field (continued) IM_RETURN_ON_FUNCTION If a function key is pressed, then display all of the data entered into the field and return the data in lpReturnedString IM_DISPLAY_ONLY IM_AT_END
Display the field and its attributes without waiting for input
Move the cursor to the end of the data already in the field
IM_STAY_IN_FIELD
Cursor stays in the input field upon field exit
IM_NO_DISPLAY Receive input but do not echo the input to the display IM_START_IN_INSERT
Line editing mode is set to insert (default value)
IM_UPCASE Changes input to upper case IM_LOCASE Changes input to lower case iAllowedLength Defines the display field size. The buffer needs to be at least one byte. OUT Parameters:
lpReturnedSource
Specifies the actual input source and is one of these constants:
IM_NO_SELECT
No selection made
IM_LABEL_SELECT
Label selected
IM_KEYBOARD_SELECT IM_COM1_SELECT
COM1 selected
IM_NET_SELECT
Network selected lpReturnedString Return Value:
Keypad selected
String received.
This function returns one of these codes: IM_SUCCESS
Successfully received input
IM_TIMEOUT
Timeout occurred
IM_INPUT_FULL Maximum number of characters was received and input was stopped. All characters entered are returned. IM_RETURN_F# Note:
F1 through F10 was received
If both IM_UPCASE and IM_LOCASE are set, then IM_UPCASE is used. If neither flag is set, keys are interpreted as pressed. 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, and COM1. When iAllowedSource is set to IM_COM1_SELECT and iTimeout is set to IM_INFINITE_TIMEOUT, this function performs as if timeout were set to IM_INFINITE_NET_TIMEOUT.
5-77
Page 134
im_receive_field im_receive_field (continued) To receive data from the radio network, im_receive_field requires that you provide radio parameters such as the terminal number, host identification, or LAN identification at one time per application. The inquiry impacts all functions that provide radio communication (im_receive_buffer, im_receive_input, im_transmit_buffer). See Also:
im_receive_buffer
Example /********************* im_receive_field*******************************/ /*Example of doing a data input screen using im_receive_field */ /* Also validates input for length and draws box. */ #include "im64psk.h" #include "string.h" /* Fields and prompts */ char sBadge[10] ={0}, sPart[26]={0}, sOrderNo[10]={0}; char Label0[] ="Job Setup", Label1[]="Enter Badge:", Label2[] ="Scan Part Number:", Label3[] = "Enter Order Number:"; #define FIELD_FLAGS IM_RETURN_ON_TAB | IM_RETURN_ON_FULL | IM_AT_END /* Table of information to drive display and data input */ struct screen{ IM_UCHAR * pszText; IM_USHORT iRow, iCol, iLength, iMinLength; IM_ATTRIBUTES iAttribute; IM_USHORT iFlags; } aScreen[] = { { Label0 , 1, 5, sizeof(Label0)-1, 0, IM_NORMAL, IM_DISPLAY_ONLY }, { Label1 , 3, 1, sizeof(Label1)-1, 0, IM_NORMAL, IM_DISPLAY_ONLY }, { Label2 , 5, 1, sizeof(Label2)-1, 0, IM_NORMAL, IM_DISPLAY_ONLY }, { sBadge , 4, 1, 9, 3, IM_INVERSE, FIELD_FLAGS }, { sPart , 6, 1, 25, 0, IM_INVERSE, FIELD_FLAGS }, {(void *)0,0,0,0,0,0} /*Termination line*/ }; /*note that sizeof includes the null terminator and we pass in the displayable size*/ /* Simple example validation routine. */ IM_BOOL DoValidation ( IM_UCHAR * szField, IM_USHORT iMinLength ) { if ( (IM_USHORT)strlen( szField ) >= iMinLength ) return IM_TRUE; else { im_status_line("Input to short", IM_TRUE, 50); return IM_FALSE; } } void main (void) { IM_ULONG iSetup = IM_DISPLAY_ONLY, iPassFlags, ii=0; IM_STATUS iStatus;
5-78
Page 135
im_receive_field
5 im_receive_field (continued) IM_ORIGIN iSource; /* set up display */ im_clear_screen(); /******************************************************************************** *******/ /* loops through once to display prompts and fields then comes back through to gather */ /* input. If validation fails stays in field until validation passes. */ /******************************************************************************** *******/ do { im_set_cursor_xy( aScreen[ii].iRow, aScreen[ii].iCol ); iPassFlags = aScreen[ii].iFlags | iSetup ; iStatus = im_receive_field( IM_KEYBOARD_SELECT | IM_LABEL_SELECT, IM_INFINITE_TIMEOUT, aScreen[ii].iAttribute, iPassFlags,aScreen[ii].iLength, &iSource, aScreen[ii].pszText); /* Validate if not display pass */ if (iSetup & IM_DISPLAY_ONLY) { ii++; } else if (DoValidation(aScreen[ii].pszText, aScreen[ii].iMinLength ) ) { ii++; iSetup = iSetup & !IM_AT_END; } else /* Must have been error, go to end of same field */ iSetup = iSetup | IM_AT_END; /*See if display pass done and if is, turn into data input pass. */ if ((iSetup & IM_DISPLAY_ONLY) && ( aScreen[ii].pszText == (void *)0 ) ) { iSetup = iSetup & !IM_DISPLAY_ONLY ; /*reset the display only bit */ ii = 0; /* and start again at the top */ } } while ( aScreen[ii].pszText != (void *)0 ) ; }
5-79
Page 136
im_receive_file im_receive_file Purpose:
This function receives a file from the DCS 300 or from a TFTP server via TCP/IP direct connect and writes the file to disk on the terminal.
Syntax:
#include “im64psk.h” IM_STATUS im_receive_file (IM_UCHAR far *con_file, IM_UCHAR far *trakker_file);
IN Parameters:
con_file Path and filename for the file on the DCS 300 or the TFTP server you want to download. This parameter can be a string in quotes or a far pointer to a variable containing the filename. Note: If you are using UDP Plus, the file you want to download must reside on a path relative to D:\USERDATA on the DCS 300. If you are using TCP/IP, you can use an absolute or true path to download the file you want from the TFTP server. trakker_file Is the drive letter and filename for saving the file on the Trakker Antares terminal. This parameter can be a string in quotes or a far pointer to a variable containing the filename. The Trakker Antares terminals do not use directories. All file names use this format: drive:abcdefgh.ext
OUT Parameters: Return Value:
None This function returns one of these codes: IM_SUCCESS Successfullly transferred file to the terminal. IM_NET_BAD_CTRL_BLOCK
Net control block pointer is null.
IM_NET_BAD_DATA Data pointer is null or invalid data length. IM_GENERR
Error occurred. View the error log from the terminal system menu.
IM_NET_NOT_READY Network not active or not properly configured. Notes:
You can use a literal string for either filename. Use a statement in this format: im_receive_file( (IM_UCHAR *) "c:\\apps\\vtxxx.bin", (IM_UCHAR *) "c:vtxxx.bin")
See Also:
im_cancel_rx_buffer, im_receive_buffer, im_receive_field, im_receive_input
Example See example for im_transmit_file.
5-80
Page 137
im_receive_input
5 im_receive_input Purpose:
This function gets input from the source and places it into the received buffer. You can use the im_get_length function after this function to get the input length.
Syntax:
#include "im64psk.h" IM_STATUS im_receive_input (IM_ORIGIN iAllowedSource, IM_UINT iTimeout, IM_ORIGIN far *lpReturnedSource, IM_UCHAR far *lpReturnedString);
IN Parameters:
iAllowedSource constants:
Defines the available input source. Choose one or more of these
IM_LABEL_SELECT
Label selected
IM_KEYBOARD_SELECT IM_COM1_SELECT
Keypad selected
COM1 selected
IM_NET_SELECT
Network input
IM_ALL_SELECT
All sources selected
Use these variables to modify the input by performing a logical OR with the above input sources. IM_KEYCODE_ENABLE Applies when the keyboard or a label is a source. Returns each key pressed and its keycode, or returns one character of a label per call. Does not echo to the screen. This is the functional equivalent of setting the input mode to IM_DESKTOP. Keyboard characters are returned as 4 bytes. The first byte is the ASCII code. The second byte is the scan code, and the last 2 bytes are flags for modifier keys (Shift, Control, and Alt). iTimeout Specifies the receive timeout period. Either enter a number from 1 to 65,534 to indicate the length of the timeout in milliseconds, or choose one of these constants: IM_ZERO_TIMEOUT
No wait
IM_INFINITE_TIMEOUT Wait forever - the function will not return until the end of message character has been received OUT Parameters:
lpReturnedSource
Specifies the actual input source and is one of these constants:
IM_NO_SELECT
No selection made
IM_LABEL_SELECT
Label selected
IM_KEYBOARD_SELECT IM_COM1_SELECT
Keypad selected
COM1 selected
5-81
Page 138
im_receive_input im_receive_input (continued) IM_NET_SELECT lpReturnedString Return Value:
Network selected Pointer to the variable where the data is placed.
This function returns one of these codes: IM_SUCCESS Success IM_TIMEDOUT Timeout occurred
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, and COM1. When allowed is set to IM_COM1_SELECT and timeout is set to IM_INFINITE_TIMEOUT, this function performs as if timeout were set to IM_INFINITE_NET_TIMEOUT. To receive data from the radio network, im_receive_input requires that you provide radio parameters such as the terminal number, host identification, or LAN identification at one time per application. The inquiry impacts all functions that provide radio communications (im_receive_field, im_receive_buffer, im_transmit_buffer).
See Also:
im_receive_buffer, im_receive_field
Example /********************* im_receive_input ******************************/ #include <stdio.h> #include "im64psk.h" IM_UCHAR input[1024]; void main (void) { IM_USHORT length; IM_ORIGIN source; IM_STATUS status; im_clear_screen(); /* Clear the screen */ printf("Demo \nim_receive_input\n'Q' to quit\n\'C' to clear screen\n"); /* Input loop */ do { /* Set up input source */ source = IM_LABEL_SELECT | IM_KEYBOARD_SELECT; /* Request input from label, keypad */ status = im_receive_input(source, IM_INFINITE_TIMEOUT, &source, input); length = im_get_length(source); if (IM_ISGOOD(status)) { /* Show the input source */ if (source == IM_LABEL_SELECT) printf("\nLabel input:\n"); else if (source == IM_KEYBOARD_SELECT) printf("\nKeybd input:\n"); /* Display input data */
5-82
Page 139
im_receive_input
5 im_receive_input (continued) printf("%s\nInput length: %d\n", input, length); } else /* input error */ printf("input error\n"); /* Upper case first char of input for simplifying to test input */ input[0] = toupper(input[0]); /*If the first char in string is 'C', then clear screen.*/ if (input[0] == 'C') im_clear_screen(); } while (input[0] != 'Q'); /* First number in string is 'Q', then stop */ }
5-83
Page 140
im_rx_check_status im_rx_check_status Purpose:
This function directs the active protocol handler to check the communication 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:
#include “im64psk.h” IM_STATUS im_rx_check_status (IM_COM_PORT port_id);
IN Parameters:
OUT Parameters: Return Value:
Notes: See Also:
The port_id parameter identifies the communications port as follows: IM_COM1
COM1
IM_COM2
COM2, scanner port (2010 and 2050)
IM_COM4
COM4 (RF only)
None. This function returns one of the standar status codes defined in Appendix A, "Status Codes." You must install a protocol handler to use this function. im_receive_buffer_no_wait
Example See example for im_receive_buffer_no_wait.
5-84