The text of a manual · part 12 of 23
DuraTrax/LaserLite, LaserLite Pro/LaserLite Mx Developer's Reference, pages 111 to 120
Pages 111 to 120 of 229
The original document is the PDF (797 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 Videx DuraTrax, Videx LaserLite, Videx LaserLite Mx and Videx LaserLite Pro
Page 111
Chapter 5 LaserLite Mx Memory Card Data Management This chapter contains information on: •= The capabilities of the memory card. •= LaserLite Mx memory card command set. •= Transferring files between the memory card and the computer. •= Booting from the memory card. •= Sending cross-reference files to the memory card. •= Transferring data from the memory card. •= Creating and using cross-reference files. •= Opening a memory card file. •= Changing records in a memory card file. •= Handling errors.
Chapter 5 LaserLite Mx Memory Card Data Management
103
Page 112
Memory Card Capabilities You can perform the following operations with a LaserLite Mx and a memory card: •= Create, open, close, and delete files. Four different types of files are supported: identification (D), boot (B), sequential (S), and indexed (I/H). (See the table on page 136 for descriptions of the different file types.) •= Add, delete, and change records. •= Search records based on the key field. •= Move pointer within a file. •= Seek information based on a given string. •= Reorganize space. •= List memory card file information and status report. •= Boot main CPU You can use either the Vxcom (Windows 95/98/NT) or Download (DOS) communications program’s commands file to transfer files to and from the memory card.
104
Chapter 5 LaserLite Mx Memory Card Data Management
Page 113
LaserLite Mx Memory Card Command Set Operating System P Command–Pass to Memory Card The P command is the Pass to Memory Card command for the LaserLite Mx operating system software command line. The P command allows the communications program to directly control interaction with the memory card file system. Syntax: P <command string> The P command sends the accompanying command string to the memory card and returns the response as received from the memory card. The operating system can generate a special error, -2, to indicate that a memory card was not found. Otherwise, it returns the response exactly as received from the memory card for each command sent. Both the commands file R command (described on pages 106 and 133) and S command (described on pages 106 and 134) use a series of P commands to communicate with the memory card. On the following page are descriptions that show how the P command interprets the R and S commands.
Chapter 5 LaserLite Mx Memory Card Data Management
105
Page 114
R Command (Commands File) Actions: 1. The communications program sends a file to the memory card by issuing a series of P commands: •= It begins with the open (O) command: P o <modulus> <file type> <filename>
•= It then writes records using the append (A) command: P a <data strings>
2. The communications program processes and reports any errors generated by the memory card processor or the operating system. S Command (Commands File) Actions: 1. The communications program retrieves a file from the memory card by issuing the following series of P commands: •= It opens the file with the open (O) command: P o <modulus> <file type> <filename>
•= Then the communications program moves the pointer to the top of the file with the move pointer (M) command and retrieves the first record: P m &FFFF R
•= It then continues to issue M commands: P m 1 F or
P m 1024 F until it reaches the end of the file. 2. The communications program processes and reports any errors generated by the memory card processor or the operating system.
106
Chapter 5 LaserLite Mx Memory Card Data Management
Page 115
The P command uses the same command strings that are used by the Videx BASIC CARDCMD statement’s command_str$ parameter. The following table gives a brief description of these commands along with the page number where you can find complete information about the command. Parameters within { } are required; parameters within [ ] are optional. Command String
Description
A [hash value] {record}
Add a new record to the memory card’s open file. See page 109 for more information.
C {F/S/I} [status bytes]
List or send the card’s file management report or status information. See pages 110–113 for more information.
Delete a file from the memory card. D {file type} {filename} Delete an existing file. D {file handle} D {file handle} [file type] [filename] Rename an existing file. See page 114 for more information. F [hash value] [key field]
F H [hash value] [key field] H
Search for a record in the memory card’s open file with the given key field and send it to the host. Search for next record with same hash value or key field. See page 115 for more information. Delete a record from the memory card’s open file with the given key field. Delete next record with same hash value and key field. See page 116 for more information.
K &1092
Remove all deleted files from the memory card. See page 117 for more information.
M {# of records/bytes} {F/R} M M H {file handle}
Move the pointer within the open file. Show the current record. Delete the record at the move pointer. See pages 118–120 for more information.
Chapter 5 LaserLite Mx Memory Card Data Management
107
Page 116
command_str$
Brief Description
N [param1]
Format new memory card or determine the memory card ID. See page 121 for more information.
O [modulus] {file type} {filename}
Open a new or existing file on the memory card. Open an existing file. See pages 122– 123 for more information.
O {file handle} Q {file type} {filename}
Calculate the CRC of a file and send it back to the host. See page 124 for more information.
S {field #/bytes} {F/R} {string}
Perform search within the card’s open file. See page 125 for more information.
V
Read the memory card’s program version. See page 126 for more information.
Y
Repeat the last status byte or data. See page 127 for more information.
Z
Puts the data collector to sleep. See page 127 for more information.
108
Chapter 5 LaserLite Mx Memory Card Data Management
Page 117
The commands are described in detail in the following sections.
A [hash value] {record} Adds data to the memory card’s open file (see the O command on pages 122–123 to open a file). For an indexed (I) file, the card module first calculates the hash entry based on the key field of the record and then looks up the hash table for a pointer. If no pointer is found, it is the first record for the entry. The record is saved as the current end-of-file and the pointer at the hash table is set. If a pointer is found, a collision occurred for this entry. The DMS traverses the list and finds the last record with the same hash value. The new record is saved as the current end-of-file and the pointer is set at the last record. For type I files, the hash value is calculated internally. You can have more than one record with the same key field. The key field is delimited from other fields with a tab character (09 hex). For type H files, the hash value must also be passed with the command. For type S/D/B files, the A command appends {record} as data. Example: Add a record to the open indexed file test1: P a "This is a record" Returns: 00
Record added.
Successful return values: 00 Possible error codes that can be returned from this command: 01, 03, 04, 10, 32, 34, 39, 40, 41, 42, 53, 61, 63 (See pages 128– 129 for a description of the error codes.)
Chapter 5 LaserLite Mx Memory Card Data Management
109
Page 118
C {F/S/I} [status bytes] Lists the memory card’s file management or status information or sends a setup configuration to the memory card processor. F - List the file management report. S - List the status report. I - Send the report to the memory card processor to update. F - List the file management report The file management report is sent out first, if asked, followed by individual file information. The filenames are enclosed in quotation marks. The file type is sent out as a hexadecimal value, preceded by an ampersand. All hexadecimal values returned by the memory card begin with an ampersand (&) character. A space character is used to separate hexadecimal from ASCII, or different parts of the listing (for example, a space between file 1 and file 2). The following tables show the order of the data format. A sample of the file management report is shown on the following page.
File Management Report Format: bytes 1–2 bytes 3–4 bytes 5–6 bytes 7 bytes 8–b1 bytes b2–b3 bytes b4–b5 ...
Total space of the card (Kbytes). Bad space (Kbytes). Available space (Kbytes). Number of files (including deleted files). 1st valid file information. 2nd valid file information. 3rd valid file information.
Individual File Information: byte 1 byte 2 byte 3 bytes 4–5 bytes 6–7 bytes 8–16 110
File serial number in the memory card. File status. File type. File table size. The file size (Kbytes). The filename (variable length from 1–18 bytes).
Chapter 5 LaserLite Mx Memory Card Data Management
Page 119
Example: Request file management report: P c f Returns: &07980000076805 &01FF44FFFF0004 "card1" &02FF42FFFF0014 "CRD" &030049089B000C "data.txt" &03FF49089B000C "olddata.txt" &04FF49089B000C "data.txt" Note: The F command in a commands file issues the C F command to the memory card. It creates the following report on the information above: Memory Card File and Memory Status Report Total Space: Bad Space: Available Space: Retrievable Space:
1944 Kbytes 0 Kbytes 1896 Kbytes 12 Kbytes
Number of deleted files: Number of valid files:
1 4
File Number 1 2 3 3 4
Table Size n/a n/a 2203 2203 2203
Deleted No No Yes No No
Type D B I I I
Kbytes 4 20 12 12 12
Name "card1" "CRD" "data.txt" "olddata.txt" "data.txt"
Chapter 5 LaserLite Mx Memory Card Data Management
111
Page 120
S - List the status report At any given point in time, the LaserLite Mx can have an open file and a pointer to data or to a record within that file. When power is removed from the memory card module during sleep, the data management system loses track of this information. The status report contains the information needed to restore the memory card system to a previous state.
Status Report Format: byte 1 bytes 2–6 byte 7 bytes 8–b1
Last command before the C command. The move pointer: block # (2 bytes), page number (1 byte), column address (2 bytes). File type. Opened filename (variable length).
Example: Request status report: P c s Returns: &4F001503006A04
112
Chapter 5 LaserLite Mx Memory Card Data Management