out_modbus.h
Go to the documentation of this file.
#pragma once
#include "options.h"
#ifndef MBUS_DISABLE
#include <abstractout.h>
#include <item.h>
#include "itemCmd.h"
#include <utils.h>
class mbPersistent : public chPersistent {
public:
// int addr
int8_t driverStatus;
int baud;
serialParamType serialParam;
uint16_t pollingInterval;
uint32_t timestamp;
aJsonObject * pollingRegisters;
aJsonObject * pollingIrs;
aJsonObject * parameters;
};
class out_Modbus : public abstractOut {
public:
out_Modbus(Item * _item):abstractOut(_item){store = (mbPersistent *) item->getPersistent();};
int Setup() override;
int Poll(short cause) override;
int Stop() override;
int Status() override;
int getChanType() override;
int Ctrl(itemCmd cmd, char* subItem=NULL, bool toExecute=true) override;
int getDefaultStorageType(){return ST_INT32;};
//int Ctrl(short cmd, short n=0, int * Parameters=NULL, int suffixCode=0, char* subItem=NULL) override;
protected:
mbPersistent * store;
bool getConfig();
int findRegister(int registerNum, int posInBuffer, int regType);
void pollModbus(aJsonObject * reg, int regType);
};
#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