| LightHub v4.0.0 Smarthome controller firmware

out_modbus.h
Go to the documentation of this file.
1 #pragma once
2 #include "options.h"
3 #ifndef MBUS_DISABLE
4 #include <abstractout.h>
5 #include <item.h>
6 #include "itemCmd.h"
7 #include <utils.h>
8
9
10
11 class mbPersistent : public chPersistent {
12
13 public:
14 // int addr
15 int8_t driverStatus;
16 int baud;
17 serialParamType serialParam;
18 uint16_t pollingInterval;
19 uint32_t timestamp;
20 aJsonObject * pollingRegisters;
21 aJsonObject * pollingIrs;
22 aJsonObject * parameters;
23 };
24
25
26
27 class out_Modbus : public abstractOut {
28 public:
29
30 out_Modbus(Item * _item):abstractOut(_item){store = (mbPersistent *) item->getPersistent();};
31 int Setup() override;
32 int Poll(short cause) override;
33 int Stop() override;
34 int Status() override;
35 int getChanType() override;
36 int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true) override;
37 int getDefaultStorageType(){return ST_INT32;};
38 //int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL) override;
39
40 protected:
41 mbPersistent * store;
42 bool getConfig();
43 int findRegister(int registerNum, int posInBuffer, int regType);
44 void pollModbus(aJsonObject * reg, int regType);
45 };
46 #endif
out_Modbus::getConfig
bool getConfig()
Definition: out_modbus.cpp:106
mbPersistent::pollingRegisters
aJsonObject * pollingRegisters
Definition: out_modbus.h:20
itemCmd.h
itemCmd
Definition: itemCmd.h:153
out_Modbus::out_Modbus
out_Modbus(Item *_item)
Definition: out_modbus.h:30
chPersistent
Definition: abstractout.h:7
mbPersistent::pollingIrs
aJsonObject * pollingIrs
Definition: out_modbus.h:21
out_Modbus::Setup
int Setup() override
Remove?? Now getChanType used instead.
Definition: out_modbus.cpp:163
ST_INT32
#define ST_INT32
Definition: itemCmd.h:96
serialParamType
#define serialParamType
Definition: utils.h:49
mbPersistent::serialParam
serialParamType serialParam
Definition: out_modbus.h:17
options.h
abstractOut
Definition: abstractout.h:8
out_Modbus::getDefaultStorageType
int getDefaultStorageType()
Definition: out_modbus.h:37
out_Modbus::getChanType
int getChanType() override
Definition: out_modbus.cpp:412
out_Modbus::Ctrl
int Ctrl(itemCmd cmd, char *subItem=NULL, bool toExecute=true) override
Control unified Modbus item
Definition: out_modbus.cpp:424
mbPersistent::driverStatus
int8_t driverStatus
Definition: out_modbus.h:15
out_Modbus::pollModbus
void pollModbus(aJsonObject *reg, int regType)
Definition: out_modbus.cpp:331
utils.h
out_Modbus::Stop
int Stop() override
Definition: out_modbus.cpp:188
Item::getPersistent
chPersistent * getPersistent()
Definition: item.cpp:464
out_Modbus::findRegister
int findRegister(int registerNum, int posInBuffer, int regType)
Definition: out_modbus.cpp:232
out_Modbus::Poll
int Poll(short cause) override
Definition: out_modbus.cpp:374
mbPersistent::parameters
aJsonObject * parameters
Definition: out_modbus.h:22
Item
Definition: item.h:104
mbPersistent
Definition: out_modbus.h:11
mbPersistent::baud
int baud
Definition: out_modbus.h:16
out_Modbus::store
mbPersistent * store
Definition: out_modbus.h:37
out_Modbus::Status
int Status() override
Definition: out_modbus.cpp:198
abstractout.h
mbPersistent::timestamp
uint32_t timestamp
Definition: out_modbus.h:19
out_Modbus
Definition: out_modbus.h:27
abstractOut::item
Item * item
Definition: abstractout.h:18
mbPersistent::pollingInterval
uint16_t pollingInterval
Definition: out_modbus.h:18
item.h