mbusScanStop (Function)

Top  Previous  Next

Architecture:

NX32L

Device support:

LX4

Firmware version:

1.94.00


This function is used to stop an M-Bus scan started with mbusScan.

 

 

Input:

handle : SYSHANDLE

A handle to the connection to stop scanning on.

 

Returns: INT

1

- Success

0

- Not supported

-1

- Invalid handle

-9

- Communication error

 

Declaration:

FUNCTION mbusScanStop : INT;
VAR_INPUT
  handle   : SYSHANDLE;
END_VAR;

 

 

Example:

INCLUDE rtcu.inc
 
FUNCTION CALLBACK OnScan;
VAR_INPUT
  handle      : SYSHANDLE;
  secondary   : STRING;
  primary     : INT;
END_VAR;
  DebugFmt(message:="device found: \1: "+secondary, v1:=primary);
END_FUNCTION;
 
FUNCTION CALLBACK OnProgress;
VAR_INPUT
  handle      : SYSHANDLE;
  secondary   : STRING;
  primary     : INT;
END_VAR;
  DebugFmt(message:="scanning: \1: "+secondary, v1:=primary);
END_FUNCTION;
 
PROGRAM test;
VAR
  mb : SYSHANDLE;
  rc : INT;
END_VAR;
 
  ...
  // Open wired M-Bus interface
  rc := mbusOpen(handle := mb);
  ...
  // Start scan for any secondary address
  rc := mbusScan(handle:=mb, cb_found:=@OnScan, cb_progress:=@OnProgress, smode:=2, mask:="FFFFFFFFFFFFFFFF");
  DebugFmt(message:="mbusScan(): \1", v1:=rc);
BEGIN
 
  ...
END;
END_PROGRAM;