Detailed instructions for use are in the User's Guide.
[. . . ] Crestron SIMPL+® Software Language Reference Guide
This document was prepared and written by the Technical Documentation department at:
Crestron Electronics, Inc. 15 Volvo Drive Rockleigh, NJ 07647 1-888-CRESTRON
All brand names, product names and trademarks are the property of their respective owners. ©2003 Crestron Electronics, Inc.
Crestron SIMPL+®
Software
Contents
SIMPL+ Language Reference Guide
Introduction . 5797G
Contents
i
Software
Crestron SIMPL+
#DEFAULT_VOLATILE . [. . . ] 5797G
Crestron SIMPL+® RemoveDirectory
Name:
RemoveDirectory
Software
Syntax:
SIGNED_INTEGER RemoveDirectory(STRING DirName)
Description:
Removes the directory with the specified name. The path name can be a relative link or absolute, refer to page page 14. Requires StartFileOperations(), refer to page page 183.
Parameters:
DIRNAME string containing the name of the desired directory.
Return Value:
Returns 0 if successful and 1 if an error occurred.
Example:
(Refer to "File Functions Overview"on page 116) IF( RemoveDirectory("NewDirect") < 0)
PRINT("Error occurred deleting directory\n");
Version:
SIMPL+ Version 3. 00. 02 or higher (Pro 2 only)
Control System:
2-Series Only
Language Reference Guide - DOC. 5797G
SIMPL+®
181
Software SetCurrentDirectory
Name:
SetCurrentDirectory
Crestron SIMPL+ ®
Syntax:
SIGNED_INTEGER SetCurrentDirectory(STRING DirName)
Description:
Changes the working directory to the specified name. Refer to "Relative Path Names" on page 14.
Parameters:
DIRNAME string containing the name of the desired directory.
Return Value:
Returns 0 if successful and 1 if an error occurred.
Example:
(Refer to "File Functions Overview"on page 116) IF( SetCurrentDirectory("NewDirect") < 0)
PRINT("Error occurred creating directory\n"); PRINT("Directory is now: %s\n", GetCurrentDirectory());
Version:
SIMPL+ Version 3. 00. 02 or higher (Pro 2 only)
Control System:
2-Series Only
182
SIMPL+®
Language Reference Guide - DOC. 5797G
Crestron SIMPL+® StartFileOperations
Name:
StartFileOperations
Software
Syntax:
SIGNED_INTEGER StartFileOperations()
Description:
Signifies to the operating system that the current thread is starting its file operations.
Parameters:
None.
Return Value:
Returns 0 if successful and 1 if an error occurred.
Example:
(Refer to "File Functions Overview"on page 116) IF ( StartFileOperations() < 0 )
PRINT ( "Error in starting file ops\n" ); // various file operations IF ( EndFileOperations() < 0 ) PRINT ( "Error Occurred in ending file ops\n" );
NOTE: StartFileOperations is required prior to any operation accessing a file. EndFileOperations is required after finishing all file operations and prior to terminating the thread of execution (e. g. , one of the PUSH commands).
Version:
SIMPL+ Version 3. 00. 02 or higher (Pro 2 only)
Control System:
2-Series Only
Language Reference Guide - DOC. 5797G
SIMPL+®
183
Software WaitForNewDisk
Name:
WaitForNewDisk
Crestron SIMPL+ ®
Syntax:
SIGNED_INTEGER WaitForNewDisk()
Description:
Waits for a compact flash card to be inserted into the control system. Refer to "CheckForDisk" on page 119.
Parameters:
None.
Return Value:
Returns 0 when a new compact flash card is installed into the control system, <0 if an error occurs.
Example:
(Refer to "File Functions Overview"on page 116) while(1)
{ if ( WaitForNewDisk() < 0 ) break; // perform operations on the new disk. }
Version:
SIMPL+ Version 3. 00. 02 or higher (Pro 2 only)
Control System:
2-Series Only
184
SIMPL+®
Language Reference Guide - DOC. 5797G
Crestron SIMPL+® WriteInteger
Name:
WriteInteger
Software
Syntax:
SIGNED_INTEGER WriteInteger ( INTEGER file_handle, INTEGER i )
Description:
Writes an integer from a file starting at the current file position. Refer to the section entitled "Reading and Writing Data to a File" on page 118 for a discussion of when to use this function and when to use the related functions: FileWrite, WriteInteger, WriteString, WriteStructure, WriteSignedInteger, WriteLongInteger, WriteLongSignedInteger, WriteIntegerArray, WriteSignedIntegerArray, WriteLongIntegerArray, WriteLongSignedIntegerArray, WriteStringArray. NOTE: Input and Output variables of any kind are not allowed in the file reading and writing functions, just internal variables. Use ReadInteger to read this.
Parameters:
FILE_HANDLE specifies the file handle of the previously opened file (from FileOpen). I is the integer whose value is written.
Return Value:
Number of bytes written to the file. If the return value is negative, it is an error code.
Language Reference Guide - DOC. 5797G
SIMPL+®
185
Software
Example:
(Refer to "File Functions Overview"on page 116) SIGNED_INTEGER
INTEGER i; StartFileOperations();
Crestron SIMPL+ ®
nFileHandle, iErrorCode;
nFileHandle = FileOpen ( "MyFile", _O_WRONLY ); IF (nFileHandle >= 0) { iErrorCode = WriteInteger(nFileHandle, i); if (iErrorCode > 0) PRINT ( "Written to file correctly. \n"); else PRINT ( "Error code %d\n", iErrorCode); } EndFileOperations();
Version:
SIMPL+ Version 3. 00. 07 or higher (Pro 2 only)
Control System:
2-Series Only
186
SIMPL+®
Language Reference Guide - DOC. 5797G
Crestron SIMPL+® WriteIntegerArray
Name:
WriteIntegerArray
Software
Syntax:
SIGNED_INTEGER WriteIntegerArray( INTEGER file_handle,
INTEGER iArray[m][n] )
Description:
Writes the array from a file starting at the current file position. Two bytes are written, most significant first containing the row dimension of the array, then two more bytes are written, containing the column dimension of the array. Then each integer is written as a two byte quantity, most significant byte first. Note that there is one more row and one more column than the dimensions that are written, because there is a row 0 and a column 0. Refer to the section entitled "Reading and Writing Data to a File" on page 118 for a discussion of when to use this function and when to use the related functions: FileWrite, WriteInteger, WriteString, WriteStructure, WriteSignedInteger, WriteLongInteger, WriteLongSignedInteger, WriteIntegerArray, WriteSignedIntegerArray, WriteLongIntegerArray, WriteLongSignedIntegerArray, WriteStringArray. [. . . ] No merchandise may be returned for credit, exchange, or service without prior authorization from CRESTRON. To obtain warranty service for CRESTRON products, contact the factory and request an RMA (Return Merchandise Authorization) number. Enclose a note specifying the nature of the problem, name and phone number of contact person, RMA number, and return address. Products may be returned for credit, exchange, or service with a CRESTRON Return Merchandise Authorization (RMA) number. [. . . ]