The text of a manual · part 25 of 36
Trakker Antares Application Development Tools System Manual: Part I - Trakker Antares PSK Reference Manual, pages 235 to 244
Pages 235 to 244 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 235
Chapter 5, PSK Function Descriptions
{ // char Rxfilename[] = "e:\\works\\h3test\\xtest\\getvp2.bin"; char Rxfilename[] = "c:getvp2.bin"; char Txfilename[] = "c:getvp.bin"; IM_STATUS istatus; im_clear_screen(); printf("Enter any character for beginning\n"); printf("of receive file.\n"); getch(); // Test im_xm_receive_file function istatus = im_ym_receive_file(Rxfilename,IM_COM1); printf("\nistatus for receive is %x \n", istatus); im_message(istatus); if(istatus == IM_OK) { printf("\nReceive file success\n"); im_message(istatus); } else { printf("\nReceive File Error: "); im_message(istatus); } getch(); im_clear_screen(); printf("Enter any character for beginning\n"); printf("of transmit file.\n"); getch(); //
Test im_ym_transmit_file function istatus = im_ym_transmit_file(Txfilename,IM_COM1); printf("\nistatus for transmit is %x \n",istatus);
if(istatus == IM_OK) { printf("\nTransmit file success\n"); } else { printf("\nTransmit File Error: "); im_message(istatus); } getch(); return; }
Trakker Antares PSK Reference Manual
215
Page 236
Chapter 5, PSK Function Descriptions im_ym_transmit_file Purpose Syntax
IN Parameters
This function sets the terminal to transmit a file to the host using YMODEM protocol. #include "imt24lib.h" IM_STATUS im_ym_transmit_file (IM_CHAR far *filename, IM_COM_PORT port_id)
filename port_id
OUT Parameters Return Value
Far pointer to IM_CHAR and is the filename in the terminal. The terminal filename has the format drive:filename. 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_SCAN_PORT_ RS-232 port input: 242X - Serial SELECT interface module, 2455 - Adapter cable, 248X - Physical port labeled COM4 on enhanced I/O board
None This function returns one of these codes: IM_SUCCESS IM_NET_PORT_HANDLE
Notes
Success Port handle is unknown
The host must be set up to receive a file (using YMODEM protocol) from the terminal for this function to execute successfully.
See Also im_ym_receive_file
Example See example for im_ym_receive_file on page 214.
216
Trakker Antares PSK Reference Manual
Page 237
Chapter 5, PSK Function Descriptions recv Purpose Syntax IN Parameters
This BSD socket specific function receives a message. You can use the recv function call to receive a message from a socket on an open connection. int recv(int s, char *buf, int len, int flags);
s buf len flags
OUT Parameters buf Return Value n >= 0 n<0 Notes
Socket identifier. Pointer to buffer that will receive the message. Size of the buffer. 0. This parameter is not used by the Trakker Antares socket interface. Buffer that will receive the message. Success, where n is the number of bytes sent. Error
BSD socket functions do not support low power pending functions, such as the functional equivalent functions im_receive_input, im_receive_field, im_receive_buffer, and im_event_wait. Therefore, if you choose to use BSD socket functions for input, you may adversely affect battery life.
Example /******************************** recv **********************************/ int rc; /* return code */ int s1; /* socket identifier */ unsigned char buff[BUFFLEN); /* read buffer */ •••• rc = connect(sl, (struct sockaddr *)&socka, sizeof(socka)); if(rc < 0) printf("Connection error.\n"); •••• rc = recv(s1, buff, 2, 0); if(rc < 0) printf("Error: receiving data\n"); else if(rc == 2) printf ("Success: read 2 bytes\n"); else printf("Error: read did not retrieve 2 bytes\n");
Trakker Antares PSK Reference Manual
217
Page 238
Chapter 5, PSK Function Descriptions send Purpose Syntax
This BSD socket-specific function sends a message. You can use the send function call to send a message to a socket on an open connection. int send(int s, char *buf, int len, int flags);
IN Parameters s buf len flags
OUT Parameters
None
Return Value
This function returns one of these values: n -1 c
Notes
Socket identifier. Buffer that will receive the message. Size of the buffer. 0. This parameter is not used by the Trakker Antares socket interface.
Success, where n is the number of bytes sent Error Error condition where c is one of the following values: NE_PARM An error occurred with a parameter to recv NE_TIMEOUT Timed out before data became available
BSD socket functions do not support low power pending functions, such as the functional equivalent functions im_receive_input, im_receive_field, im_receive_buffer, and im_event_wait. Therefore, if you choose to use BSD socket functions for input, you may adversely affect battery life.
Example /******************************** send **********************************/ int s2; /* socket identifier */ int rc; /* return code */ unsigned char buff[BUFFLEN]; /* send buffer */ •••• rc = send(s2, buffer, sizeof(buffer), 0); if (rc < 0) printf("Error: sending data\n");
218
Trakker Antares PSK Reference Manual
Page 239
Chapter 5, PSK Function Descriptions socket Purpose
Syntax
This BSD socket-specific function creates a socket. You must create a socket before you can use any of the other socket function calls. This call returns an integer value that identifies the socket you create. Both the client and the server must perform the socket call as an initialization routine. int socket(int domain, int type, int protocol);
IN Parameters
None
OUT Parameters domain type protocol Return Value
This function returns one of these values: 0 -1
Notes
PF_INET (TCP/IP and related). Socket type: SOCK_STREAM stream socket (TCP/IP) SOCK_DGRAM datagram socket (UDP/IP) SOCK_RAW raw protocol interface (link layer) 0. This parameter is not used by the Trakker Antares socket interface.
Success Error
In the following example, the type parameter is SOCK_DGRAM.; therefore, the socket function creates a UDP socket.
Example /******************************* socket *********************************/ int s; /* a socket */ s = socket(PF_INET, SOCK_DGRAM, 0); if (s < 0) printf("Error opening socket\n");
Trakker Antares PSK Reference Manual
219
Page 240
Chapter 5, PSK Function Descriptions
220
Trakker Antares PSK Reference Manual
Page 241
A
Status Codes and ASCII Character Set
This appendix lists the status code hex values and their meanings and contains a table of the ASCII character set and ASCII control characters. This chapter covers these topics: • Using the status code return values • Trakker Antares status code return values • ASCII character set
Trakker Antares PSK Reference Manual
221
Page 242
Appendix A, Status Codes and ASCII Character Set
Using the Status Code Return Values Most of the Trakker Antares® PSK functions return status codes. You can use the codes to test for error conditions that your application will act upon. How you test for the status codes depends on the complexity of the function returning the status and your application needs. In most cases, you can use the status code macros discussed in Chapter 2, “Programming Guidelines,” to determine success or failure. In other cases, you can check for the exact status code value. The next table lists the status code return values and the error message text provided by im_message. The status codes are in hexadecimal format. Note: The status codes are IM_USHORT (unsigned short) values.
Trakker Antares Status Code Return Values Status Code 0x000
Message Text Successful operation (IM_SUCCESS or IM_OK)
0x051
Response larger than buffer
0x052
Invalid command
0x053
Set attribute with bad value
0x054
Write to read-only attribute Attempted to write a value to a read-only attribute
0x055
General error not covered
0x056
Incorrect parameter or string length
0x057
Queue or pool empty
0x058
Action not permitted from this origin
0x059
Indicates that a DLE character has been found must be removed from the input string
0x05A
During config. parsing, a digit was expected While parsing a configuration command, expected a digit but encountered another value.
0x060
Queue is full
0x061
UDP+: Buffer too large to send
0x062
UDP+: NULL buffer was passed
0x063
UDP+: Msg received bigger than buffer
0x064
UDP+: Msg already transmitted
0x065
UDP+: Invalid param block
0x066
Network is inactive or improperly configured
0x067
Network control block pointer is null
0x068
Data pointer is null or data length is invalid
0x069
Data length exceeds 1024
0x06A
Send buffer contains a previous application message
222
Trakker Antares PSK Reference Manual
Page 243
Appendix A, Status Codes and ASCII Character Set
Trakker Antares Status Code Return Values (continued) Status Code 0x06B
Message Text Incorrect RF configuration
0x070
The Ninit usnet call failed
0x071
The Nportinit usnet call failed
0x072
The Nterm usnet call failed
0x073
The Portterm usnet call failed
0x074
The Nopen usnet call failed
0x075
The Nclose usnet call failed
0x076
The Nread usnet call failed
0x077
The Nwrite usnet call failed
0x078
Invalid group event
0x079
Network PM failed
0x07A
Invalid send buffer
0x07B
The send buff is not empty
0x07C
A failure occurred in udp timer
0x07D
Maximum number of bad sequence numbers has occurred. Possible duplicate IP address in network.
0x07E
Could not connect to controller
0x080
File open failed
0x081
Read or Write request failed
0x082
The getbuf usnet call failed
0x083
Data or ACK receive failed
0x084
File write failed
0x085
File close failed
0x0A1
Invalid sub-function request
0x0A2
Table is full
0x0A3
Index out of range
0x0A4
Time value at that index is zero
0x0A5
Pointers do not match
0x0A6
Requested row value not supported
0x0A7
Requested column value not supported
0x0A8
Invalid Command
0x0A9
Invalid Configuration Combination
0x0AA
Invalid viewport request
0x0AD
Invalid Logical Key requested
0x0AE
Invalid Modifier requested
0x0B0
Invalid device
0x110
No TCB slot available
0x111
No RAM available for stack
0x112
Invalid time
Trakker Antares PSK Reference Manual
223
Page 244
Appendix A, Status Codes and ASCII Character Set
Trakker Antares Status Code Return Values (continued) Status Code 0x113
Message Text Invalid slot
0x114
Invalid delay type
0x115
Invalid event
0x116
Invalid group event
0x117
Invalid resource
0x118
Invalid mailbox
0x119
Invalid memory release
0x11A
Function timeout expired
0x11B
Periodic event table full
0x11C
Invalid profile_type code
0x11D
Invalid MMU180 page number
0x11E
Device not open
0x11F
Device not open or not device owner
0x120
Invalid pool id
0x121
Invalid block size for pool
0x122
Invalid pool type
0x123
No table space available for message
0x134
Invalid file descriptor pointer
0x135
Task not suspended
0x136
Not owner of stream
0x137
Stream access error
0x138
Color requested > NUMCOLORS
0x139
Missed system time required
0x13A mtenv table full
0x13B
Acquire/release table full
0x13C
Too small of memory release to MTmeminit
0x13D chkmem detects memory chain corrupt
0x13E
MBXLIMIT messages in mailbox
0x13F
Too small of memory passed to MTmeminit
0x1F0
Add Decode - The Decode symbology is already present in the auto-discrimination table.
0x1F1
Drop Decode - The Decode symbology was not found in the auto-discrimination table.
0x1F2
Intermediate row which was already read
0x1F3
Intermediate row successfully decoded
0x1F4
Command symbology (code39)
0x1F5
Code39 half-ASCII
0x1F6
Good decode
0x1F7
Label has already been read this trigger pull
0x1F8
Votes aren't all in for the label
0x200
Decodes auto-discrimination tbl full
0x201
Decode Data command error: Not enough resources to attempt to decode the counts.
224
Trakker Antares PSK Reference Manual