The text of a manual · part 7 of 12
Spectrum One Serial Access Bridge (SAB) II Programmer's Reference Guide: Chapter 3 BAR Reference, pages 43 to 52
Pages 43 to 52 of 94, from Spectrum One Serial Access Bridge (SAB) II Programmer's Reference Guide
The original document is the PDF (1.8 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 Symbol SAB-Lite
Page 43
Chapter 3
BAR Reference The BAR reference gives detailed information of BAR commands and their structure within a packet. To use File Access and Administrative BARs, set the directives under [BARs] in SSP.INI to yes. Table 3-1. Command/Response Header Structure
Byte Field 0 Flag Field
1
2
Contents Bit 0 identifies command or response packet. 0 = command, 1 = response Bit 1 identifies communication mode: 0 = wait mode, 1 = no-wait mode Other flags are command specific. Command and Individual command or return packet. For administration Return Code BARs, command code identifies packet as admin BAR, bytes 4 and 5 identify the actual command. With a response, byte 1 contains an error or status code. 0x01 BAR_CREATEFILE create file 0x02 BAR_OPENFILE open file 0x03 BAR_CLOSEFILE close file 0x04 BAR_READDATA read data from file 0x05 BAR_WRITEDATA write data to file 0x06 BAR_SEEKFILE seek file 0x07 BAR_GETLINE read text line from file 0x08 BAR_PUTLINE write text line to file 0x09 BAR_BRIDGEMSG send message 0x0A BAR_GETTIME get host time and date 0x40 BAR_ADMIN administrative request Data Length LSB 16-bit unsigned integer value giving the data transferred size.
3-1
Page 44
SAB II - Programmer’s Reference Guide Table 3-1. Command/Response Header Structure
Byte Field 3 Data Length MSB 4-7 Command Specific
Contents If no data is sent with the packet, data length equals zero. Contains file handle for many file access commands. For administrative BARs, bytes 4 and 5 contain function and subfunction codes while bytes 6 and 7 contain the message length integer value.
File Access BARs File access BARs interface to and from the host for file services. BARs exist on both the host and the SAB. The host BARs provide location independent file resources and services to the SAB. The BARs on the SAB and the BARs on the host form a client/server relationship. The SAB interface is the client. The host-based BARs services the file access requests. File access BARs provide the following functions: • create, open and close files • read and write data from and to files • seek to a position in a file • read and write text lines to and from files • send messages to the host • obtain date and time from the host. The SAB processes all file access commands in the client mode. The SAB issues command packets to the host. The host issues response packets when command processing completes.
3-2
Page 45
BAR Reference
Create File Requests host create a named file in the host file system. The file pathname is not given in the data string. The host provides a default area for the files necessary for SAB operation. If the specified file exists when the Create File command is issued, the file is truncated to 0 length and all data in the existing file is lost. The Create File command differs from the Open File command. Non-existent files can be created. Existing file are initialized with a length of 0. No other host-based processes may access the specified file other than SAB requests. Table 3-2. Create File Command Packet
Byte Value 0 VAR
Description flags
1 2 3 4-7 command code data length data length unused
0x01 VAR VAR DC
Details bit 0= 1 command Packet bit 1 reserved bit 4 = 1 create text mode file = 0 create binary mode file BAR_CREATFILE LSB MSB
The data field contains the filename to open, represented as an ASCII null-terminated string.
3-3
Page 46
SAB II - Programmer’s Reference Guide Table 3-3. Create File Response Packet
Byte Value 0 VAR
Description flags
1 2 3 4-7 return code data length data length file handle
VAR 0x00 0x00 XXX
Details bit0 = 0 response packet bit 1 reserved bit 2 = 1 create text mode file = 0 create binary mode file Refer to Table 3-4.
On subsequent WRITE and CLOSE commands the SAB includes the file handle to indicate to the host which file the command pertains to. No data field returns with this reply. Table 3-4. Create File Return Codes
Value 0x00 0x01 0x02 0x05 0x06
3-4
Name BAR_RTN_OK BARERR_BADPAK BARERR_NOCREFIL BARERR_OPERATIO N BARERR_UNKNOWN
Description good return invalid packet could not create file host operation error occurred unimplemented BAR error
Page 47
BAR Reference
Open File Requests host open a named file in the host file system. The Open File command opens the file for read, with the file pointer at the beginning of the file. The file pathname is not given in the data string. The host provides a default area for the files necessary for SAB operation. Table 3-5. Open File Command Packet
Byte Value 0 VAR
Description flags
1 2 3 4-7 command code data length data length unused
0x02 VAR VAR XXX
Details bit 0 = 1 command packet bit 1 reserved bit 4 = 1 open text mode file = 0 open binary mode file BAR_OPENFILE LSB MSB
The data field contains the filename to open, represented as an ASCII NULL-terminated string. Table 3-6. Open File Response Packet
Byte Value 0 VAR
Description flags
1 2 3 4-7 return code data length data length file handle
VAR 0x00 0x00 XXX
Details bit 0 =0 response packet bit 1 reserved bit 4 = 1 open text mode file = 0 open binary mode file Refer to Table 3-7
On subsequent WRITE and CLOSE commands the SAB includes the file handle to indicate to the host which file the command pertains to.
3-5
Page 48
SAB II - Programmer’s Reference Guide
No data field returns with this reply. Table 3-7. Open File Return Codes
Value 0x00 0x01 0x03 0x05 0x06
3-6
Name Description BAR_RTN_OK good return BARERR_BADPAK invalid packet BARERR_FILNOTFND could not find file BARERR_OPERATIO host operation error occurred N BARERR_UNKNOWN unimplemented BAR error
Page 49
BAR Reference
Close File Requests host close a previously opened file in the host file system. The file handle returned from the OPEN FILE or CREATE FILE commands identifies the file. Table 3-8. Close File Command Packet
Byte Value 0 VAR
Description flags
1 2 3 4-7 command code data length data length file handle
0x03 0x00 0x00 XXX
Details bit 0 =1 command packet bit 1 reserved BAR_CLOSEFILE
No data field is attached for this command. Table 3-9. Close File Response Packet
Byte Value 0 VAR
Description flags
1 2 3 4-7 return code data length data length file handle
0x02 0x00 0x00 XXX
Details bit 0 = 0 response packet bit 1 reserved bit 4 = 1 create text mode file = 0 create binary mode file Refer to Table 3-10
3-7
Page 50
SAB II - Programmer’s Reference Guide Table 3-10. Close File Return Codes
Value 0x00 0x01 0x04 0x05 0x06
3-8
Name Description BAR_RTN_OK good return BARERR_BADPAK invalid packet BARERR_BADFILHAN invalid file handle given BARERR_OPERATIO host operation error occurred N BARERR_UNKNOWN unimplemented BAR error
Page 51
BAR Reference
Read Binary Data From File Requests host read a data block from a previously opened file in the host file system. The file handle returned from the OPEN FILE command identifies the file. The file must be opened in a binary mode with no conversions performed by the host. Table 3-11. Read Binary Data From File Command Packet
Byte Value 0 VAR
Description flags
1 2 3 4-7 command code data length data length file handle
0x04 VAR VAR XXX
Details bit 0= 1 command packet bit 1 reserved BAR_READDATA LSB MSB
The data field contains the maximum read length for the request. The integer data is represented as an ASCII numeric, NULL-terminated string. Maximum read length is 512 bytes. Table 3-12. Read Binary Data From File Response Packet
Byte Value 0 VAR
Description flags
1 2 3 4-7 return code data length data length file handle
VAR VAR VAR XXX
Details bit 0= 0 response packet bit 1 reserved Refer to Table 3-13 LSB MSB
The data length header field (bytes 2 and 3) gives the actual length of data read from the host file.
3-9
Page 52
SAB II - Programmer’s Reference Guide
The data field contains the file data read, up to the maximum requested. Table 3-13. Read Binary Data From File Return Codes
Value 0x00 0x01 0x04 0x05 0x05
3-10
Name Description BAR_RTN_OK good return BARERR_BADPAK invalid packet BARERR_BADFILHAN invalid file handle given BARERR_OPERATIO host operation error occurred N BARERR_UNKNOWN unimplemented BAR error