UniSet
2.8.0
extensions
ModbusMaster
RTUExchange.h
1
/*
2
* Copyright (c) 2015 Pavel Vainerman.
3
*
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License as
6
* published by the Free Software Foundation, version 2.1.
7
*
8
* This program is distributed in the hope that it will be useful, but
9
* WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11
* Lesser General Lesser Public License for more details.
12
*
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*/
16
// -----------------------------------------------------------------------------
17
#ifndef _RTUEXCHANGE_H_
18
#define _RTUEXCHANGE_H_
19
// -----------------------------------------------------------------------------
20
#include <ostream>
21
#include <string>
22
#include <map>
23
#include <vector>
24
#include "MBExchange.h"
25
#include "modbus/ModbusRTUMaster.h"
26
#include "RTUStorage.h"
27
// --------------------------------------------------------------------------
28
namespace
uniset
29
{
30
// -----------------------------------------------------------------------------
31
class
RTUExchange
:
32
public
MBExchange
33
{
34
public
:
35
RTUExchange
(
uniset::ObjectId
objId,
uniset::ObjectId
shmID,
36
const
std::shared_ptr<SharedMemory>& ic =
nullptr
,
const
std::string& prefix =
"rs"
);
37
virtual
~
RTUExchange
();
38
40
static
std::shared_ptr<RTUExchange>
init_rtuexchange
(
int
argc,
const
char
*
const
* argv,
41
uniset::ObjectId
shmID,
const
std::shared_ptr<SharedMemory>& ic =
nullptr
,
42
const
std::string& prefix =
"rs"
);
43
44
static
void
help_print(
int
argc,
const
char
*
const
* argv );
45
46
protected
:
47
std::shared_ptr<ModbusRTUMaster> mbrtu;
48
std::mutex mbMutex;
49
std::string devname;
50
ComPort::Speed defSpeed;
51
bool
use485F;
52
bool
transmitCtl;
53
54
virtual
void
step()
override
;
55
virtual
bool
poll()
override
;
56
57
virtual
std::shared_ptr<ModbusClient> initMB(
bool
reopen =
false
)
override
;
58
virtual
bool
initDeviceInfo( RTUDeviceMap& m, ModbusRTU::ModbusAddr a,
UniXML::iterator
& it )
override
;
59
60
private
:
61
RTUExchange
();
62
63
bool
rs_pre_clean;
64
};
65
// --------------------------------------------------------------------------
66
}
// end of namespace uniset
67
// -----------------------------------------------------------------------------
68
#endif // _RS_EXCHANGE_H_
69
// -----------------------------------------------------------------------------
uniset::MBExchange
Definition:
MBExchange.h:55
uniset::RTUExchange
Definition:
RTUExchange.h:31
uniset
Definition:
CommonEventLoop.h:14
uniset::ObjectId
long ObjectId
Definition:
UniSetTypes_i.idl:30
uniset::RTUExchange::init_rtuexchange
static std::shared_ptr< RTUExchange > init_rtuexchange(int argc, const char *const *argv, uniset::ObjectId shmID, const std::shared_ptr< SharedMemory > &ic=nullptr, const std::string &prefix="rs")
Definition:
rtuexchange.cc:355
uniset::UniXML_iterator
Definition:
UniXML.h:43
Документация по UniSet. Последние изменения: Вс 25 Окт 2020 00:02:12. Создано системой
1.8.17