:html
<<
128.132
KBus-Object|KBus
--
The KBus-implementation is still temporary and will be changed in the future!
>>

<<
128.132.1
Functions of the KBus-Object|Functions
--
>>
<<
128.132.1.1
KBus.Error|Error
--
<!DEF>
function <!TW>KBus.Error (nNr : real) : real;
<!TXT>
Returns the result of the last action on the KBus <!PW>nNr. (0=ok)

The error codes come directly from the DLL. Please consult the DLL documentation for explanation of the error codes.
>>
<<
128.132.1.2
KBus.Received|Received
--
<!DEF>
function <!TW>KBus.Received (nNr : real) : real;
<!TXT>
Returns the frame received with the last frame send. The first value in the vector is the receive SId, followed by the data bytes. If nothing has been received, the vector is empty.
>>
<<
128.132.1.3
KBus.IsActive|IsActive
--
<!DEF>
function <!TW>KBus.IsActive : real;
<!TXT>
Returns <!RW>TRUE, if the KBus is activated globally

<!DEF>
function <!TW>KBus.IsActive (nNr : real) : real;
<!TXT>
Returns <!RW>TRUE, if KBus is activated globally and the KBus <!PW>nNr is also active.
>>
<<
128.132.1.5
KBus.IsOpen|IsOpen
--
<!DEF>
function <!TW>KBus.IsOpen (nNr : real) : real;
<!TXT>
Returns <!RW>TRUE, if the port is opened by the KBus <!PW>nNr.
>>
<<
128.132.1.6
KBus.Check|Check
--
<!DEF>
function <!TW>KBus.Check (lFrame, lTest : vector [; nMode : real]) : real;
<!TXT>
Compares the frame in the vector <!PW>lFrame vector with the frame in the vector <!PW>lTest.

 <!PW>lFrame may contain only values 0..255 (the bytes of the frame)

 <!PW>lTest may have values within the range -1..255, -1=Don't care

 <!PW>nMode determines the behaviour in case of different lengths:
<!STBL>
<!+>lMode<!+>Meaning<!>
<!c>0<!>length must be identical (default)<!>
<!c>1<!><!PW>lFrame may be shorter than <!PW>lTest<!>
<!c>2<!><!PW>lFrame may be longer then <!PW>lTest,<br>no test of the 'protruding' bytes<!>
<!c>3<!><!PW>lFrame may be longer or shorter<!>
<!ETBL>

Return: 
0 = everything okay, otherwise the index of the position in <!PW>lFrame which is different.
>>

<<
128.132.2
Procedures of the KBus-Object|Procedures
--
>>

<<
128.132.2.1
KBus.Open|Open
--
<!DEF>
procedure <!TW>KBus.Open (nNr : real);
<!TXT>
Transfers the value set with the <!RW>SetFlags to the DLL and opens the KBus <!PW>nNr. 

If the bus was already open, then nothing happens.
>>

<<
128.132.2.2
KBus.Close|Close
--
<!DEF>
procedure <!TW>KBus.Close (nNr : real);
<!TXT>
Closes the KBus <!PW>nNr.
>>

<<
128.132.2.3
KBus.SetFlags|SetFlags
--
<!DEF>
procedure <!TW>KBus.SetFlags (nByte : real);
<!TXT>
Sets the DLL-KWP_Flags to <!PW>nByte (0..255).

The value is activated only with the opening of the port.
>>
<<
128.132.2.4
KBus.Send|Send
--
<!DEF>
procedure <!TW>KBus.Send (nNr : real; lFrame : vector [; nPSId, nNSId : real]);
<!TXT>
Sends the frame from the vector <!PW>lFrame to the KBus <!PW>nNr. 

 <!PW>nPSId and <!PW>nNSId can be specified optionally as expected SIDs for positive and negative responses. 

If not specified, the sent SId or $40 is used as PSId and $7F as NSId . 

 <!PW>lFrame must contain the SId as first value and afterwards the data as requested by the special frame. All values 0..255.
>>
<<
128.132.2.5
KBus.Start|Start
--
<!DEF>
procedure <!TW>KBus.Start (nNr, nDiagnosticMode : real);
<!TXT>
Calls the DLL-Routine <!SW>StartDiagnosticSession with the <!PW>nDiagnosticMode mode (0..255) for the KBus <!PW>nNr.
>>

