canitpClose (Function)

Top  Previous  Next

Architecture:

NX32 / NX32L

Device support:

MX2 turbo/encore/warp, NX-200, NX-400, LX2, LX5

Firmware version:

5.13 / 1.80.00


Close an ISO-TP connection previously opened by the canitpOpen function

 

 

Input:

None.

 

Returns: INT

1

- Successful.

0

- Not available.

-1

- ISO-TP is not open.

 

Declaration:

FUNCTION canitpClose : INT;
 

 

Example:

INCLUDE rtcu.inc

 

VAR

  buf   : ARRAY [1..4096] OF SINT;

END_VAR;

 

FUNCTION CALLBACK canitpRecv

VAR_INPUT

  size  : INT;

END_VAR;

  DebugMsg(message := strFromMemory(src := ADDR(buf), len := size));

END_FUNCTION;

 

PROGRAM example;

VAR

  rc    : INT;

END_VAR;

 

  // Open can

  canOpen(baud := 250, monitor := FALSE);

 

  // Open ISO-TP

  rc := canitpOpen(port     := 1,

                  src      := 16#12345678,

                  dst      := 16#12345679,

                  received := @canitpRecv,

                  cb_data  := ADDR(buf),

                  cb_size  := SIZEOF(buf));

  IF rc < 1 THEN

    DebugFmt(message := "canitpOpen=\1", v1 := rc);

    RETURN;

  END_IF;

 

  // ...

 

  // Close ISO-TP

  rc := canitpClose();

  IF rc < 1 THEN

    DebugFmt(message := "canitpClose=\1", v1 := rc);

    RETURN;

  END_IF;

 

BEGIN

END;

END_PROGRAM;