The text of a manual · part 21 of 36
Trakker Antares Application Development Tools System Manual: Part I - Trakker Antares PSK Reference Manual, pages 195 to 204
Pages 195 to 204 of 340, from Trakker Antares Application Development Tools System Manual
The original document is the PDF (1.6 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.
Filed in the catalog under the Intermec 2420, Intermec 2425, Intermec 2435 and Intermec 2481
Page 195
Chapter 5, PSK Function Descriptions fDisable
OUT Parameters Return Value index
Specifies whether callback is enabled or disabled if the application does not control the screen. The application does not control the screen when another application or the terminal software controls the screen. For example, if the user has displayed the Trakker Antares menu system, you might not want a callback function to overwrite the screen. Choose one of these constants: IM_TRUE Disable callback if the application does not control the screen at the call time. The current callback is skipped. IM_FALSE Enable callback whether or not the application controls the screen. Index number for the application in the timer callback database.
The function returns one of these codes: IM_SUCCESS IM_INVALID_TMCALLBK_PERIOD IM_INVALID_TMCALLBK_REPETITION
Notes
Success The period value is out of range The repeat_count value is out of range
When you create functions that will be called back, keep these points in mind: The functions (and any functions they call) must not be built with stack checking because the operating system stack is used during the callback. The functions should minimize the amount of dynamic variable space used. You must specify the index value when you use im_tm_callback_cancel to remove the function from the timer callback database.
See Also im_tm_callback_cancel
Example /************************ im_tm_callback_register *************************/ #include <time.h> #include <stdio.h> #include "imt24lib.h" void printHello(void) { im_sound(1000,50,IM_NORMAL_VOLUME); im_puts("... ",IM_NORMAL); }
Trakker Antares PSK Reference Manual
175
Page 196
Chapter 5, PSK Function Descriptions im_tm_callback_register (continued) void main(void) { IM_UCHAR input[300]; IM_ORIGIN source; IM_STATUS iStatus = 11; PTIMERCALLBACK pFunction; IM_USHORT iIndex = 0; time_t timeToStart; IM_BOOL fDisplay; IM_USHORT iRepeatCount; IM_ULONG iPeriod; //initialize // callback forever iRepeatCount = IM_CALLBK_CONTINUOUS; // 10-second period iPeriod = IM_CALLBK_SECOND*10; //print hello pFunction = printHello; //enable callback fDisplay = IM_FALSE; //time to first callback time(&timeToStart); //get current time timeToStart += 16; //future after 16seconds or //timeToStart -= 20; // or pass current 20 seconds //timeToStart = IM_CALLBK_NOW; //register the application iStatus = im_tm_callback_register(pFunction, timeToStart, iRepeatCount, iPeriod, fDisplay, &iIndex); for(;;) { im_receive_input(IM_LABEL_SELECT|IM_KEYBOARD_SELECT, IM_INFINITE_TIMEOUT, &source, input); //type 'Q' to cancel the application if(input[0]=='Q') im_tm_callback_cancel(iIndex); } }
176
Trakker Antares PSK Reference Manual
Page 197
Chapter 5, PSK Function Descriptions im_transmit_buffer Purpose
Syntax
OUT Parameters
This function automatically opens a socket and transmits the contents of a data buffer through a designated communications port. This function continues operating until the buffer transmission is complete or until an error status is detected. If the terminal is communicating in a TCP/IP network, you can also use the BSD sockets interface for network communications. #include "imt24lib.h" IM_STATUS im_transmit_buffer (IM_COM_PORT port_id, IM_USHORT length, IM_UCHAR far *data_buffer, IM_LTIME timeout);
port_id length data_buffer timeout
Trakker Antares PSK Reference Manual
Communications port: IM_COM1 COM1 input: 241X, 242X, 243X, and 2455 - Port on bottom end of terminal, 2475 and 248X - Physical port labeled COM1 IM_COM2 COM2 input: 248X - Physical port labeled COM2 on enhanced I/O board IM_COM3 COM3 input: 2420 - Modem IM_NET Network input (UDP Plus or TCP/IP): 2415, 2425, 2435, 2455, and 2475 - RF port, 248X - RF port or Ethernet port on enhanced I/O board IM_SCAN_ RS-232 port input: 242X - Serial interface PORT module, 2455 - Adapter cable, 248X Physical port labeled COM4 on enhanced I/O board Length of the data string that you want to transmit. Far pointer to the data array that you want to transmit. Transmit timeout period and is one of these values: 1 to 4,294,966 ms Numeric range. For IM_COM1, a numeric timeout larger than 4,294,966 is converted to 65534. The hardware cannot support long timeout values. IM_ZERO_TIMEOUT No wait.
177
Page 198
Chapter 5, PSK Function Descriptions im_transmit_buffer (continued) IM_INFINITE_NET_ TIMEOUT
OUT Parameters Return Value
None This function returns one of these codes: IM_SUCCESS IM_NET_BAD_CTRL_BLOCK IM_NET_BAD_DATA IM_NET_CONFIG_ERROR IM_NET_DATA_LENGTH IM_NET_FULL
IM_NET_NOT_READY IM_TCP_RECONNECT
Notes
Wait forever. The function will not return until the end of message character has been received. If you select COM1 or the Network port, IM_INFINITE_TIMEOUT and 0xFFFF are treated as IM_INFINITE_NET_ TIMEOUT.
Transmit completed. Net control block pointer is null. Data pointer is null or invalid data length. Incorrect RF configuration. Data length exceeds 1024 characters. Send buffer contains a previous application message. The data is not lost, but it has not left the host. Network not active or not properly configured. Terminal reestablished the TCP/IP connection with the host, but no data was sent from the terminal to the host.
If the transmit buffer is in use, the program waits until the buffer is available. Once the transmission begins, program control remains inside this function until the transmission is completed. There is no way to check the transmission status while transmitting. To detect end of data for TCP/IP transfers, call im_set_eom. IM_TCP_RECONNECT is only returned when im_tcp_reconnect_notify is called with the IM_TRUE parameter using TCP/IP.
178
Trakker Antares PSK Reference Manual
Page 199
Chapter 5, PSK Function Descriptions im_tcp_reconnect_notify does not affect this function if you are using UDP Plus. The return status from im_transmit_buffer and its variations indicates if the data to be sent was successfully accepted by the communications medium. The actual data transmission occurs at a later time. In an RF environment, this delay can be significant due to retries or roaming. The status of the transaction can be obtained through a status check at a later time by the client. Before the next data buffer is sent, the terminal’s TCP attempts to re-establish any lost connections. TCP cannot interrupt the client to report an error. As a result, TCP tries to recover from an old communications error when new data is to be sent. It is a good practice for the client to monitor the communication and to implement its own network “heart-beat”. See Also im_receive_buffer
Example /********************* im_transmit_buffer ****************************/ #include <string.h> #include <conio.h> #include "imstdio.h" #include "imt24lib.h" void main ( void ) { char szTxBuffer[1024]; IM_STATUS iStatus; im_clear_screen(); strcpy ( szTxBuffer, "MSG_HEADER,Testing Message 1, 2, 3, ..." ); iStatus = im_transmit_buffer ( IM_NET, strlen(szTxBuffer), szTxBuffer, 5000 ); if(iStatus == IM_SUCCESS) { printf("\nData sent: %s\n", szTxBuffer); } else { printf("\nTransmit Buffer Error: "); im_message(iStatus); } getch(); }
Trakker Antares PSK Reference Manual
179
Page 200
Chapter 5, PSK Function Descriptions im_transmit_buffer_no_wait Purpose
Syntax
IN Parameters
This function transmits the contents of a user-defined data buffer through a designated communications port without a timeout or wait. When this function is called, the user can input data to the terminal while the transmission is in progress. #include "imt24lib.h" IM_STATUS im_transmit_buffer_no_wait (IM_COM_PORT port_id, IM_COM_DATA_BUFFER far *psDataStruct);
port_id psDataStruct
OUT Parameters
180
Communications port: IM_COM1 COM1 input: 241X, 242X, 243X, and 2455 - Port on bottom end of terminal, 2475 and 248X Physical port labeled COM1 IM_COM2 COM2 input: 248X - Physical port labeled COM2 on enhanced I/O board IM_COM3 COM3 input: 2420 - Modem IM_NET Network input (UDP Plus or TCP/IP): 2415, 2425, 2435, 2455, and 2475 - RF port, 248X - RF port or Ethernet port on enhanced I/O board IM_SCAN_PORT_ RS-232 port input: 242X - Serial SELECT interface module, 2455 - Adapter cable, 248X - Physical port labeled COM4 on enhanced I/O board You must build and maintain a structure of the type IM_COM_DATA_BUFFER as described in IMT24LIB.H.
None
Trakker Antares PSK Reference Manual
Page 201
Chapter 5, PSK Function Descriptions
Return Value
This function returns one of these codes: IM_SUCCESS IM_NET_BAD_CTRL_BLOCK IM_NET_BAD_DATA
Transmit completed. Net control block pointer is null. Data pointer is null or invalid data length. IM_NET_CONFIG_ERROR Incorrect RF configuration. IM_NET_DATA_LENGTH Data length exceeds 1024 characters. IM_NET_FULL Send buffer contains a previous application message. The data is not lost, but it has not left the host. IM_NET_NOT_READY Network not active or not properly configured. The status block returns one of these values: IM_COMM_INUSE IM_NS_COMPLETE IM_NS_CANCELLED IM_NS_ERROR Notes
COM in use Transmission completed Transmission cancelled Transmission error
This function provides compatibility with the JANUS PSK. If your application does not need this compatibility, use im_transmit_buffer_no_wait_t or im_transmit_buffer instead. If your application needs a wait period, use im_event_wait rather than continually checking the return status bits. You cannot use the im_get_tx_status function to check on the transmit progress. Instead, use im_event_wait or im_event_status to check the transmission status. Check for the event IM_TX_NET_SELECT, which indicates that the network is ready to send another message.
See Also im_event_wait, im_event_status, im_transmit_buffer, im_transmit_buffer_no_wait_t
Example No example. This function provides compatibility with the JANUS PSK.
Trakker Antares PSK Reference Manual
181
Page 202
Chapter 5, PSK Function Descriptions im_transmit_buffer_no_wait_t Purpose
Syntax
IN Parameters
This function transmits the contents of a data buffer through a designated communications port without a timeout or wait. When this function is called, the user can input data to the terminal while the transmission is in progress. #include "imt24lib.h" IM_STATUS im_transmit_buffer_no_wait_t (IM_COM_PORT port_id, IM_USHORT userlength, IM_UCHAR far *pszdata_buffer);
port_id userlength pszdata_buffer
182
Communications port: IM_COM1 COM1 input: 241X, 242X, 243X, and 2455 - Port on bottom end of terminal, 2475 and 248X Physical port labeled COM1 IM_COM2 COM2 input: 248X - Physical port labeled COM2 on enhanced I/O board IM_COM3 COM3 input: 2420 - Modem IM_NET Network input (UDP Plus or TCP/IP): 2415, 2425, 2435, 2455, and 2475 - RF port, 248X - RF port or Ethernet port on enhanced I/O board IM_SCAN_PORT_ RS-232 port input: 242X - Serial SELECT interface module, 2455 - Adapter cable, 248X - Physical port labeled COM4 on enhanced I/O board Length of the data string that you want to transmit. Far pointer to the data array that you want to transmit.
Trakker Antares PSK Reference Manual
Page 203
Chapter 5, PSK Function Descriptions
OUT Parameters Return Value
None This function returns one of these codes: IM_SUCCESS IM_NET_BAD_CTRL_BLOCK IM_NET_BAD_DATA
Transmit completed. Net control block pointer is null. Data pointer is null or invalid data length. IM_NET_CONFIG_ERROR Incorrect RF configuration. IM_NET_DATA_LENGTH Data length exceeds 1024 characters. IM_NET_FULL Send buffer contains a previous application message. The data is not lost, but it has not left the host. IM_NET_NOT_READY Network not active or not properly configured. The status block returns one of these values: IM_COMM_INUSE IM_NS_COMPLETE IM_NS_CANCELLED IM_NS_ERROR Notes
COM in use Transmission completed Transmission cancelled Transmission error
Use im_get_tx_status or im_event_wait to determine if the transmission has completed.
See Also im_event_wait, im_get_tx_status, im_transmit_buffer, im_transmit_buffer_no_wait
Trakker Antares PSK Reference Manual
183
Page 204
Chapter 5, PSK Function Descriptions im_transmit_buffer_no_wait_t (continued)
Example /**************** im_transmit_buffer_no_wait_t *************************/ /* accepts user input, transmits it, then displays any received data. */ /* Task switch occurs at least once per sec (to update time display). */ /* The battery runs down faster than if time was not being displayed. */ /***********************************************************************/ #include <string.h> #include <imstdio.h> #include <time.h> //#include <conio.h> #include "imt24lib.h" IM_UCHAR gszString[1024]; /* Routine to display the time and other header info */ void doHeader ( void ) { IM_USHORT iX, iY; char szTime[9], szData[9]; im_get_cursor_xy( &iY, &iX ); /* Save cursor so can restore after paint heading */ im_set_cursor_xy(0,0); /* Display the time */ szTime[0] = ‘\0’; strdate(szDate); strTime(szTime); printf(“ %s %s \n" , szDate, szTime); /* if cursor on top move down, then restore cursor */ if ( iY < 2 ) { iY = 2; iX = 0 } im_set_cursor_xy (iY, iX ); } void TryTransmit ( IM_UCHAR * szString ) { IM_STATUS iStatus; IM_ORIGIN iSource; /* make sure last transmit completed */ iSource = IM_TX_NET_SELECT; iStatus = im_event_wait (60000L, &iSource ); if (iStatus == IM_SUCCESS) iStatus = im_transmit_buffer_no_wait_t ( IM_NETUDP, strlen( szString ), szString ); if ( iStatus == IM_TIMEOUT ) puts ( "Timed out on Transmit"); else if ( iStatus != IM+SUCCESS ) printf (“Error on Transmit\nError Code=%x\n", iStatus); } void main (void) { IM_USHORT ii;
184
Trakker Antares PSK Reference Manual