D028868 CR1500 CR1100 CR2700 JavaScript Programming Guide User Manual Page 24 of 41
The Code Corporation
12393 South Gateway Park Place, Suite 600, Draper, UT 84020
+1 (801) 495-2200
FAX +1 (801) 495-0280
storage.getHeader
The storage.getHeader method returns the first multi-line comment block from a
JavaScript file. This includes encrypted files, if the proper developer key is installed.
Example:
var headerInfo = storage.getHeader(“timeCard57”);
storage.listFiles
The storage.listFiles method returns a text string containing the names of the files
on the file system if it is given no input. If the method is given a text string as an input, it will
list all of the files that have a substring which matches the given string.
Example:
var allFilesonFS = storage.listFiles();
var filesThatContainFile = storage.listFiles(“File”);
Data in Code Reader Local Storage
The application development environment provides program access to Code reader local storage
through the storage object. Data is maintained in storage as named objects called files. CortexTools2
can transfer host data into a Code reader file. The Code reader application can also store data in files.
The name of a Code reader file may contain any printable ASCII characters.
Use the erase and write methods of the storage object to manage files. Use the findFirst and findNext
methods to locate files. Use the read method to access a file or the upload method to send it to the
host.
Note: storage.findFirst and storage.findNext are implemented by Code in the library
file .jselib.js. The scanner supplies the storage.findFirstInternal and
storage.findNextInternal functions.
13.3 Comm Object
The Code reader application development environment defines a host communication comm object to
support communications with a host resident application. For example, the CortexTools2 (section 6) is a
host resident utility that communicates with the Code reader for downloading files to the Code reader.
From the host computer’s view, the Code reader is a serial device accessible through a serial or USB port.
Code reader configuration settings define the active host communications port. The JavaScript program
transfers data to the host by writing to the Code reader host communications port, using methods defined
by the Code Rreader comm object. The Code reader host communications implementation supports two
basic styles of communication: raw text and packets. The Code reader host communications
implementation also supports a set of native protocols.