Radiocraft Wireless M-Bus extension module
2.18
|
These functions are called directly from the Modcall C functions. More...
Functions | |
static int | mbusBufferReceive (tdef_mbus_frame *rframe, tdef_mbus_slave_address *address, int32 timeout) |
Get element from buffer with timeout. More... | |
static int | mbusClose (void) |
Closes the communication interface. More... | |
static int | mbusOpen (int8 mode, int8 rssi) |
Opens the connection to the M-Bus module. More... | |
static int | mbusSend (int16 c, int8 *data, int8 size) |
Send an M-BUS packet. More... | |
static int | mbus_register_slave (int idx, int16 manufacturer, int32 id, int8 version, int8 type, uint8 *key) |
Registers/installs a slave device on the M-Bus module. More... | |
static int | mbus_info (void) |
Print some information about the RF module to the device output. More... | |
static int | mbusStartReader (uint16 buf_size, int8 overwrite) |
Start the receive thread. More... | |
static int | mbusStopReader (void) |
Stop the receive thread and clean up. More... | |
static int | mbusGetBufferLevel (void) |
Get the actual level of how full the buffer is in promille. More... | |
These functions are called directly from the Modcall C functions.
|
static |
Print some information about the RF module to the device output.
Definition at line 1850 of file mod_mbus.c.
References mbus_read_regs(), mbusConfigCmd(), mbusConfigEnter(), mbusConfigExit(), mbusDebug(), mbusPrintInfo(), MUTEX_LOCK, MUTEX_UNLOCK, and rw_lock.
Referenced by mbusCallInfo().
|
static |
Registers/installs a slave device on the M-Bus module.
This is necessary when filtering or when using encryption.
[in] | idx | The index of the slave to register. 0-63. |
[in] | manufacturer | The ID of the manufacturer. Part of the device address. |
[in] | id | The device identification number/serial number. Part of the device address. |
[in] | version | The device version. Part of the device address. |
[in] | type | The device type. Part of the device address. |
[in] | key | The 16 byte (128 bit) encryption key. Can be set to NULL if encryption is not used. |
Definition at line 1775 of file mod_mbus.c.
References MAX_SLAVE_REGISTERS, mbus_slave_register, mbusConfigCmd(), mbusConfigEnter(), mbusConfigExit(), mbusConfigTransact(), mbusDebug(), MUTEX_LOCK, MUTEX_UNLOCK, and rw_lock.
Referenced by mbusCallRegisterSlave().
|
static |
Get element from buffer with timeout.
[in] | rframe | Pointer to frame structure to return data to. |
[in] | address | M-Bus slave address to lookup data for. |
[in] | timeout | Timeout in milliseconds. If timeout is -1, wait until data is received. |
Definition at line 1454 of file mod_mbus.c.
References mbus_frame::control, mbus_frame::data, flist_search_remove(), mbus_frame::id, mbus_frame::length, mbus_frame::linsec, lock, mbus_frame::manufacture, MUTEX_LOCK, MUTEX_UNLOCK, read_sem, mbus_frame::rssi, run_thread, TH_SEM_RESET, mbus_frame::type, and mbus_frame::version.
Referenced by mbusCallFilterReceive(), and mbusCallReceive().
|
static |
Closes the communication interface.
Definition at line 1512 of file mod_mbus.c.
References cfg_activated, cfg_active, fd, mbusDebug(), mbusPower(), MUTEX_LOCK, MUTEX_UNLOCK, and rw_lock.
Referenced by mbusCallClose(), mbusCallFilterEnable(), mbusCallInfo(), mbusCallRegisterSlave(), mbusCallSend(), and moduleNotify().
|
static |
Get the actual level of how full the buffer is in promille.
Definition at line 2043 of file mod_mbus.c.
References mbus_frame_list::counter, mbus_frame_list::frames_max, and mbus_flist.
Referenced by mbusCallGetBufferLevel().
|
static |
Opens the connection to the M-Bus module.
This must be called before the rest of the functions will work.
[in] | mode | The M-Bus mode to use.
|
[in] | rssi | Set to true to include the signal strength (RSSI) for each valid packet. It can be read from mbusReceive() and is available in the mbusFrame struct block (mbus_frame). |
Definition at line 1558 of file mod_mbus.c.
References fd, mbus_config(), mbusConfigEnter(), mbusConfigExit(), mbusDebug(), mbusPower(), MUTEX_LOCK, MUTEX_UNLOCK, and rw_lock.
Referenced by mbusCallFilterEnable(), mbusCallInfo(), mbusCallOpen(), mbusCallRegisterSlave(), and mbusCallSend().
|
static |
Send an M-BUS packet.
This will send a M-BUS message, if c is not -1 then the control field will be changed before sending. If no length is supplied then only the header frame will be send.
[in] | c | New value for the Control field if not -1. |
[in] | data | Data to send, may be null if only header is to be send. |
[in] | size | Size of data to send, if 0 the only header will be send |
Definition at line 1670 of file mod_mbus.c.
References fd, mbusConfigCmd(), mbusConfigEnter(), mbusConfigExit(), mbusDebug(), MUTEX_LOCK, MUTEX_UNLOCK, and rw_lock.
Referenced by mbusCallSend().
|
static |
Start the receive thread.
[in] | buf_size | Amount of elements the buffer will accept |
[in] | overwrite | If 1 (true), use overwrite policy, if 0 (false), discard newly received frame. |
Definition at line 1997 of file mod_mbus.c.
References mbus_frame_list::counter, mbus_frame_list::discarded, mbus_frame_list::flist_head, mbus_frame_list::flist_tail, mbus_frame_list::frames_max, mbus_flist, mbus_th_reader(), mbus_frame_list::overwrite, read_sem, reader, and run_thread.
Referenced by mbusCallOpen().
|
static |
Stop the receive thread and clean up.
Definition at line 2026 of file mod_mbus.c.
References flist_clear(), read_sem, and run_thread.
Referenced by mbusCallClose(), and moduleNotify().