CAPL7

39)  seqFileGetBlock

Syntax              long seqFileGetBlock(char buffer[], dword bufferSize, long fileHandle);
Function         The function reads at most bufferSize characters from the file specified byhandle file into the array buffer. Newline characters are read into the buffer.The file position indicator is advanced by the number of characters successfully read.
Parameters     buffer = a character array to put file data into
                        bufferSize = the size of the buffer in characters
                        fileHandle = the file handle long integer assigned by seqFileLoad()
Returns          The return value is the number of characters successfully read, which may be less than                               bufferSize if the end-of-file is encountered. The value is negative when an error occurs.
Example        
char buffer[10];
long fileHandle;
long charsRead;
fileHandle = seqFileLoad(“capl.dat”);
charsRead = seqFileGetBlock(buffer, 10,fileHandle);
if (charsRead >= 0)
{
write(“Characters read: %d”, charsRead);
}
else
{
write(“Error %d reading from file.”, charsRead);
}
See also seqFileLoad, seqFileRewind, seqFileGetBlock, seqFileGetLine, seqFileGetLineSZ, seqFileClose
Compatibility: This function can only be used in P-Blocks in CANalyzer’s transmission branch and CANoe’s simulation setup window.

40) seqFileGetLine

Syntax               long seqFileGetLine(char buffer[], dword bufferSize, long fileHandle);
Function         The function reads at most bufferSize-1 characters from the file with the handle file into the array buffer. No more characters are read after a new line character or after end-of- file. The function retains the new line character, but the line is not null-terminated. A null must be placed into the character array after the data if the buffer is to be used as a string.
Parameters     buffer = a character array to put file data into
                        bufferSize = the size of the buffer in characters
                        fileHandle = the file handle long integer
                        assigned by seqFileLoad()
Returns          The number of characters successfully read, or a negative error code if the operation fails.
Example
char buffer[100];
long fileHandle;
long charsRead;
fileHandle = seqFileLoad(“capl.dat”);
charsRead = seqFileGetLine(buffer, 100,fileHandle);
if (charsRead >= 0)
{
write(“Characters read: %d”, charsRead);
// Add a null to end before printing
buffer[charsRead] = 0;
write(“The string read: %s”, buffer);
}
else
{
write(“Error %d reading from file.”, charsRead);
}
See also seqFileLoad, seqFileRewind, seqFileGetBlock, seqFileGetLineSZ, seqFileClose
Compatibility: This function can only be used in P-Blocks in CANalyzer’s transmission branch and CANoe’s simulation setup window.

41) seqFileGetLineSZ

Syntax        long seqFileGetLineSZ(char buffer[], dword bufferSize, long fileHandle,                                                               unsigned long nullTerm);
Function         The function reads at most bufferSize-1 characters from the file with the handle file into the array buffer. No more characters are read after a new line character or after end-of- file. The function retains the new line character, and the line is terminated by a null character.
Parameters     buffer = a character array to put file data into
                        bufferSize = the size of the buffer in characters
                        fileHandle = the file handle long integer assigned by seqFileLoad()
                        nullTerm = A boolean value. Setting this value to 1 means to terminate the line with a                                null. 0 means do not terminate the line with a null.
Returns          The number of characters successfully read, or a negative error code if the operation fails.
Example
char buffer[100];
long fileHandle;
long charsRead;
fileHandle = seqFileLoad(“capl.dat”);
charsRead = seqFileGetLineSZ(buffer, 100,fileHandle, 1);
if (charsRead >= 0)
{
write(“Characters read: %d”, charsRead);
write(“The line read: %s”, buffer);
}
else
{
write(“Error %d reading from file.”, charsRead);
}
See also seqFileLoad, seqFileRewind, seqFileGetBlock, seqFileGetLine, seqFileClose
Compatibility: This function can only be used in P-Blocks in CANalyzer’s transmission branch and CANoe’s simulation setup window.

42)  seqFileLoad

Syntax               long seqFileLoad(char fileName);
Function         This function opens the file whose names the string pointed to by the name. The file will                           be opened as read-only.
Parameters     The names of the file, data type ‘char’
Returns          The file handle. The return value is <= 0 if an error occurs.
Note                The function searches the file in the path given by the SeqFilePath entry in the [CAPL] section of the CAN.INI initialization file. If the entry does not exist, the file is searched in the application directory (Exec/Exec32). Any drive and path information provided in the parameter is ignored.
Example ...
long fileHandle;
fileHandle = seqFileLoad(“setup.txt”);
if (fileHandle <= 0)
{
write(“Error number %d opening setup.txt.”, fileHandle);
}
else
{
write(“setup.txt opened with file handle %d”, fileHandle);
}
...
See also seqFileRewind, eqFileGetBlock, seqFileGetLine, seqFileGetLineSZ, seqFileClose
Compatibility: This function can only be used in P-Blocks in CANalyzer’s transmission branch and CANoe’s simulation setup window. The CAN.INI file must be properly set up before using this function.

43)  seqFileRewind

Syntax               long seqFileRewind(long fileHandle);
Function         This function sets the file position indicator to the beginning of the file specified by the                            handle file.
Parameters     The file handles of the file to rewind. The handle is assigned by seqFileLoad().
Returns          The function returns zero if successful. If the operation fails, it returns nonzero error                                  code.
Example        
long fileHandle;
long errCode;
fileHandle = seqFileLoad(“setup.txt”);
...
errCode = seqFileRewind(fileHandle);
if (errCode == 0)
{
write(“setup.txt rewind successful.”);
}
else
{
write(“Rewind failed.”);
}
See also seqFileLoad, seqFileRewind, seqFileGetBlock, seqFileGetLine, seqFileGetLineSZ, seqFileClose
Compatibility: This function can only be used in P-Blocks in CANalyzer’s transmission branch and CANoe’s simulation setup window.

44)  setBtr

Syntax              setBtr(long channel, byte btr0, byte btr1);
Function         Sets the baud rate. The values do not become active until the next call of the function                               resetCan().The function can also be used to automatically determine the baud rate. It                                 should be noted that these values depend on the CAN controller used.
Parameters     CAN-Channel: 0 = both controllers
                                               1 = Channel 1
                                                      2 = Channel 2
                        BTR0: Value of Bit Timing Register 0
                        BTR1: Value of Bit Timing Register 1
Returns none
Example
...
setBtr(0, 0x00, 0x3a); // 500 kBaud for 82C200
resetCan(); // activate
...
See also resetCan, setOcr
Compatibility :This function has restricted compatibility. Please see the function compatibility chart for more details.

45)  setLogFileName

Syntax             setLogFileName(string fileName);
Function         Set the name of the logfile.
Parameters     New name of the logfile. The name may be an absolute path or a single filename. If a                         path is supplied, the path must exist prior to the start of the simulation. If the path does not exist, the call to setLogFileName() will be gnored. The logfile will be placed in the directory of the current configuration, if a single filename is supplied. The directories of  the path must be separated by a double backslash (‘\\’). The filename must not contain a file extension. The extension will be set automatically based on the type of log file (.ASC  for ASCII or .LOG for binary).
Returns          none
Example
...
setLogFileName(“newlog”);
...
Set the name of the logging file to “newlog” in the directory of the current configuration.
...
setLogFileName(“c:\\canw\\demo\\automot\\newlog”);
...
Set the absolute path of the logging file. The path c:\canw\demo\automot
must be created before the simulation begins.
Compatibility : This function has restricted compatibility. Please see the function compatibility chart for more details.


No comments:

Post a Comment