Radiocraft Wireless M-Bus extension module  1.00.00
Modcall C functions

These functions can be called from VPL using the MODCALL keyword. More...

Functions

static int32 MODDECL mbusCallOpen (HANDLE *pCPU, void *pBase)
 Open communication interface to the module. More...
 
static int32 MODDECL mbusCallClose (HANDLE *pCPU, void *pBase)
 Close communication interface to the module. More...
 
static int32 MODDECL mbusCallReceive (HANDLE *pCPU, void *pBase)
 Check if any MBUS packets has been received. More...
 
static int32 MODDECL mbusCallSend (HANDLE *pCPU, void *pBase)
 Send a MBUS message. More...
 
static int32 MODDECL mbusCallInfo (HANDLE *pCPU, void *pBase)
 Perform a series of tests to validate communication. More...
 
static int32 MODDECL mbusCallSetFilter (HANDLE *pCPU, void *pBase)
 Set mode. More...
 
static int32 MODDECL mbusCallRegisterSlave (HANDLE *pCPU, void *pBase)
 Register a slave device. More...
 

Detailed Description

These functions can be called from VPL using the MODCALL keyword.

Function Documentation

◆ mbusCallClose()

static int32 MODDECL mbusCallClose ( HANDLE *  pCPU,
void *  pBase 
)
static

Close communication interface to the module.

Parameters
[in]pCPUThe handle to the system.
[in]pBasePointer to structure with function parameters.

Definition at line 1396 of file mod_mbus.c.

References lock, mbusClose(), and mbusDebug().

Referenced by moduleInit().

◆ mbusCallInfo()

static int32 MODDECL mbusCallInfo ( HANDLE *  pCPU,
void *  pBase 
)
static

Perform a series of tests to validate communication.

Perform a series of test by reading out configuration values to validate communication to module, result is send to device output.

Prints:

  • Signal strength
  • Signal quality
  • Temperature monitoring
  • Battery Monitoring
  • MBUS_MODE
  • DATA_INTERFACE
  • PART_NUMBER
  • HW_REV_NO
  • FW_REV_NO
  • SERIAL_NUMBER
  • INSTALL_MODE
  • RSSI_MODE

Result

mbus_test:Signal quality = 0
mbus_test:RSSI           = 205 (-102 dBm)
mbus_test:Temperature    = 32 C
mbus_test:VCC            = 3450mV
mbus_test:MBUS_MODE      = 0x01
mbus_test:DATA_INTERFACE = 0x00
mbus_test:PART_NUMBER    = RC1180-MBUS3
mbus_test:HW_REV_NO      = 2.00
mbus_test:FW_REV_NO      = 3.15
mbus_info:SERIAL_NUMBER  = 01 23 45 67 89 AB CD EF
mbus_info:INSTALL_MODE   = 0x02
mbus_info:RSSI_MODE      = 0x01
Parameters
[in]pCPUThe handle to the system.
[in]pBasepointer to VPL functions data structure
Returns
0 Message send
-1 Failed to send message

Definition at line 1535 of file mod_mbus.c.

References lock, mbus_info(), mbusClose(), mbusDebug(), and mbusOpen().

Referenced by moduleInit().

◆ mbusCallOpen()

static int32 MODDECL mbusCallOpen ( HANDLE *  pCPU,
void *  pBase 
)
static

Open communication interface to the module.

Parameters
[in]pCPUThe handle to the system.
[in]pBasePointer to structure with function parameters.

Definition at line 1374 of file mod_mbus.c.

References lock, mbusDebug(), mbusOpen(), mbus_open::mode, and mbus_open::rssi.

Referenced by moduleInit().

◆ mbusCallReceive()

static int32 MODDECL mbusCallReceive ( HANDLE *  pCPU,
void *  pBase 
)
static

◆ mbusCallRegisterSlave()

static int32 MODDECL mbusCallRegisterSlave ( HANDLE *  pCPU,
void *  pBase 
)
static

Register a slave device.

It is stored persistently.

Parameters
[in]pCPUThe handle to the system.
[in]pBasePointer to structure with function parameters.

Definition at line 1584 of file mod_mbus.c.

References mbus_reg_slave::id, mbus_reg_slave::idx, mbus_reg_slave::key, lock, mbus_reg_slave::manufacturer, mbus_register_slave(), mbusDebug(), mbus_reg_slave::type, and mbus_reg_slave::version.

Referenced by moduleInit().

◆ mbusCallSend()

static int32 MODDECL mbusCallSend ( HANDLE *  pCPU,
void *  pBase 
)
static

Send a MBUS message.

Parameters
[in]pCPUThe handle to the system.
[in]pBasepointer to VPL functions data structure
Returns
0 Message sent
-1 Invalid parameter.
-2 Failed to send message

Definition at line 1457 of file mod_mbus.c.

References mbus_send::control, mbus_send::data, mbus_send::length, lock, MBUS_DATA_LENGTH, mbusDebug(), and mbusSend().

Referenced by moduleInit().

◆ mbusCallSetFilter()

static int32 MODDECL mbusCallSetFilter ( HANDLE *  pCPU,
void *  pBase 
)
static

Set mode.

Parameters
[in]pCPUThe handle to the system.
[in]pBasePointer to structure with function parameters.

Definition at line 1562 of file mod_mbus.c.

References lock, mbus_config(), mbusDebug(), and mbus_set_filter::only_installed.

Referenced by moduleInit().