Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
6956a729
Commit
6956a729
authored
Sep 30, 2009
by
Pavel Vaynerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add control (on/off) for new ComPort
parent
b7843544
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
26 additions
and
14 deletions
+26
-14
libuniset.spec
conf/libuniset.spec
+7
-1
MBSlave.cc
extensions/ModbusSlave/MBSlave.cc
+4
-1
RTUExchange.cc
extensions/RTUExchange/RTUExchange.cc
+3
-1
RTUExchange.h
extensions/RTUExchange/RTUExchange.h
+1
-0
ModbusRTUMaster.h
include/modbus/ModbusRTUMaster.h
+1
-1
ModbusRTUSlave.h
include/modbus/ModbusRTUSlave.h
+1
-1
ModbusRTUSlaveSlot.h
include/modbus/ModbusRTUSlaveSlot.h
+1
-1
ModbusRTUMaster.cc
src/Communications/Modbus/ModbusRTUMaster.cc
+3
-3
ModbusRTUSlave.cc
src/Communications/Modbus/ModbusRTUSlave.cc
+3
-3
ModbusRTUSlaveSlot.cc
src/Communications/Modbus/ModbusRTUSlaveSlot.cc
+2
-2
No files found.
conf/libuniset.spec
View file @
6956a729
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Name: libuniset
Name: libuniset
Version: 0.97
Version: 0.97
Release: eter2
2
Release: eter2
4
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
License: GPL
License: GPL
Group: Development/C++
Group: Development/C++
...
@@ -178,6 +178,12 @@ rm -f %buildroot%_libdir/*.la
...
@@ -178,6 +178,12 @@ rm -f %buildroot%_libdir/*.la
%exclude %_pkgconfigdir/libUniSet.pc
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
%changelog
* Wed Sep 30 2009 Pavel Vainerman <pv@etersoft.ru> 0.97-eter23
- control (on/off) new ComPort
* Wed Sep 30 2009 Pavel Vainerman <pv@etersoft.ru> 0.97-eter22
- new build
* Tue Sep 29 2009 Vitaly Lipatov <lav@altlinux.ru> 0.97-eter21
* Tue Sep 29 2009 Vitaly Lipatov <lav@altlinux.ru> 0.97-eter21
- new build
- new build
...
...
extensions/ModbusSlave/MBSlave.cc
View file @
6956a729
...
@@ -76,7 +76,10 @@ prefix(prefix)
...
@@ -76,7 +76,10 @@ prefix(prefix)
if
(
speed
.
empty
()
)
if
(
speed
.
empty
()
)
speed
=
"38400"
;
speed
=
"38400"
;
ModbusRTUSlaveSlot
*
rs
=
new
ModbusRTUSlaveSlot
(
dev
);
bool
use485F
=
conf
->
getArgInt
(
"--rs-use485F"
,
it
.
getProp
(
"use485F"
));
bool
transmitCtl
=
conf
->
getArgInt
(
"--rs-transmit-ctl"
,
it
.
getProp
(
"transmitCtl"
));
ModbusRTUSlaveSlot
*
rs
=
new
ModbusRTUSlaveSlot
(
dev
,
use485F
,
transmitCtl
);
rs
->
setSpeed
(
speed
);
rs
->
setSpeed
(
speed
);
rs
->
setRecvTimeout
(
2000
);
rs
->
setRecvTimeout
(
2000
);
// rs->setAfterSendPause(afterSend);
// rs->setAfterSendPause(afterSend);
...
...
extensions/RTUExchange/RTUExchange.cc
View file @
6956a729
...
@@ -14,6 +14,7 @@ UniSetObject_LT(objId),
...
@@ -14,6 +14,7 @@ UniSetObject_LT(objId),
mb
(
0
),
mb
(
0
),
defSpeed
(
ComPort
::
ComSpeed0
),
defSpeed
(
ComPort
::
ComSpeed0
),
use485F
(
false
),
use485F
(
false
),
transmitCtl
(
false
),
shm
(
0
),
shm
(
0
),
initPause
(
0
),
initPause
(
0
),
force
(
false
),
force
(
false
),
...
@@ -55,6 +56,7 @@ allNotRespond(false)
...
@@ -55,6 +56,7 @@ allNotRespond(false)
speed
=
"38400"
;
speed
=
"38400"
;
use485F
=
conf
->
getArgInt
(
"--rs-use485F"
,
it
.
getProp
(
"use485F"
));
use485F
=
conf
->
getArgInt
(
"--rs-use485F"
,
it
.
getProp
(
"use485F"
));
transmitCtl
=
conf
->
getArgInt
(
"--rs-transmit-ctl"
,
it
.
getProp
(
"transmitCtl"
));
defSpeed
=
ComPort
::
getSpeed
(
speed
);
defSpeed
=
ComPort
::
getSpeed
(
speed
);
recv_timeout
=
conf
->
getArgPInt
(
"--rs-recv-timeout"
,
it
.
getProp
(
"recv_timeout"
),
50
);
recv_timeout
=
conf
->
getArgPInt
(
"--rs-recv-timeout"
,
it
.
getProp
(
"recv_timeout"
),
50
);
...
@@ -173,7 +175,7 @@ void RTUExchange::initMB( bool reopen )
...
@@ -173,7 +175,7 @@ void RTUExchange::initMB( bool reopen )
try
try
{
{
mb
=
new
ModbusRTUMaster
(
devname
,
use485F
);
mb
=
new
ModbusRTUMaster
(
devname
,
use485F
,
transmitCtl
);
if
(
defSpeed
!=
ComPort
::
ComSpeed0
)
if
(
defSpeed
!=
ComPort
::
ComSpeed0
)
mb
->
setSpeed
(
defSpeed
);
mb
->
setSpeed
(
defSpeed
);
...
...
extensions/RTUExchange/RTUExchange.h
View file @
6956a729
...
@@ -174,6 +174,7 @@ class RTUExchange:
...
@@ -174,6 +174,7 @@ class RTUExchange:
ComPort
::
Speed
defSpeed
;
ComPort
::
Speed
defSpeed
;
int
recv_timeout
;
int
recv_timeout
;
bool
use485F
;
bool
use485F
;
bool
transmitCtl
;
xmlNode
*
cnode
;
xmlNode
*
cnode
;
std
::
string
s_field
;
std
::
string
s_field
;
...
...
include/modbus/ModbusRTUMaster.h
View file @
6956a729
...
@@ -21,7 +21,7 @@ class ModbusRTUMaster:
...
@@ -21,7 +21,7 @@ class ModbusRTUMaster:
public
:
public
:
ModbusRTUMaster
(
ComPort
*
com
);
ModbusRTUMaster
(
ComPort
*
com
);
ModbusRTUMaster
(
const
std
::
string
dev
,
bool
use485
=
false
);
ModbusRTUMaster
(
const
std
::
string
dev
,
bool
use485
=
false
,
bool
tr_ctl
=
false
);
virtual
~
ModbusRTUMaster
();
virtual
~
ModbusRTUMaster
();
inline
void
cleanupChannel
(){
if
(
port
)
port
->
cleanupChannel
();
}
inline
void
cleanupChannel
(){
if
(
port
)
port
->
cleanupChannel
();
}
...
...
include/modbus/ModbusRTUSlave.h
View file @
6956a729
...
@@ -24,7 +24,7 @@ class ModbusRTUSlave:
...
@@ -24,7 +24,7 @@ class ModbusRTUSlave:
public
ModbusServer
public
ModbusServer
{
{
public
:
public
:
ModbusRTUSlave
(
const
std
::
string
dev
,
bool
use485
=
false
);
ModbusRTUSlave
(
const
std
::
string
dev
,
bool
use485
=
false
,
bool
tr_ctl
=
false
);
ModbusRTUSlave
(
ComPort
*
com
);
ModbusRTUSlave
(
ComPort
*
com
);
virtual
~
ModbusRTUSlave
();
virtual
~
ModbusRTUSlave
();
...
...
include/modbus/ModbusRTUSlaveSlot.h
View file @
6956a729
...
@@ -19,7 +19,7 @@ class ModbusRTUSlaveSlot:
...
@@ -19,7 +19,7 @@ class ModbusRTUSlaveSlot:
{
{
public
:
public
:
ModbusRTUSlaveSlot
(
ComPort
*
com
);
ModbusRTUSlaveSlot
(
ComPort
*
com
);
ModbusRTUSlaveSlot
(
const
std
::
string
dev
,
bool
use485
=
false
);
ModbusRTUSlaveSlot
(
const
std
::
string
dev
,
bool
use485
=
false
,
bool
tr_ctl
=
false
);
virtual
~
ModbusRTUSlaveSlot
();
virtual
~
ModbusRTUSlaveSlot
();
protected
:
protected
:
...
...
src/Communications/Modbus/ModbusRTUMaster.cc
View file @
6956a729
...
@@ -13,7 +13,7 @@ using namespace ModbusRTU;
...
@@ -13,7 +13,7 @@ using namespace ModbusRTU;
using
namespace
UniSetTypes
;
using
namespace
UniSetTypes
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
ModbusRTUMaster
::
ModbusRTUMaster
(
const
string
dev
,
bool
use485
)
:
ModbusRTUMaster
::
ModbusRTUMaster
(
const
string
dev
,
bool
use485
,
bool
tr_ctl
)
:
port
(
NULL
),
port
(
NULL
),
myport
(
true
)
myport
(
true
)
{
{
...
@@ -21,9 +21,9 @@ ModbusRTUMaster::ModbusRTUMaster( const string dev, bool use485 ):
...
@@ -21,9 +21,9 @@ ModbusRTUMaster::ModbusRTUMaster( const string dev, bool use485 ):
{
{
ComPort485F
*
cp
;
ComPort485F
*
cp
;
if
(
dev
==
"/dev/ttyS2"
)
if
(
dev
==
"/dev/ttyS2"
)
cp
=
new
ComPort485F
(
dev
,
5
);
cp
=
new
ComPort485F
(
dev
,
5
,
tr_ctl
);
else
if
(
dev
==
"/dev/ttyS3"
)
else
if
(
dev
==
"/dev/ttyS3"
)
cp
=
new
ComPort485F
(
dev
,
6
);
cp
=
new
ComPort485F
(
dev
,
6
,
tr_ctl
);
else
else
throw
Exception
(
"Open ComPort FAILED! dev must be /dev/ttyS2 or /dev/tytS3"
);
throw
Exception
(
"Open ComPort FAILED! dev must be /dev/ttyS2 or /dev/tytS3"
);
...
...
src/Communications/Modbus/ModbusRTUSlave.cc
View file @
6956a729
...
@@ -13,7 +13,7 @@ using namespace std;
...
@@ -13,7 +13,7 @@ using namespace std;
using
namespace
ModbusRTU
;
using
namespace
ModbusRTU
;
using
namespace
UniSetTypes
;
using
namespace
UniSetTypes
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
ModbusRTUSlave
::
ModbusRTUSlave
(
const
string
dev
,
bool
use485
)
:
ModbusRTUSlave
::
ModbusRTUSlave
(
const
string
dev
,
bool
use485
,
bool
tr_ctl
)
:
port
(
NULL
),
port
(
NULL
),
myport
(
true
)
myport
(
true
)
{
{
...
@@ -21,9 +21,9 @@ ModbusRTUSlave::ModbusRTUSlave( const string dev, bool use485 ):
...
@@ -21,9 +21,9 @@ ModbusRTUSlave::ModbusRTUSlave( const string dev, bool use485 ):
{
{
ComPort485F
*
cp
;
ComPort485F
*
cp
;
if
(
dev
==
"/dev/ttyS2"
)
if
(
dev
==
"/dev/ttyS2"
)
cp
=
new
ComPort485F
(
dev
,
5
);
cp
=
new
ComPort485F
(
dev
,
5
,
tr_ctl
);
else
if
(
dev
==
"/dev/ttyS3"
)
else
if
(
dev
==
"/dev/ttyS3"
)
cp
=
new
ComPort485F
(
dev
,
6
);
cp
=
new
ComPort485F
(
dev
,
6
,
tr_ctl
);
else
else
throw
Exception
(
"Open ComPort FAILED! dev must be /dev/ttyS2 or /dev/tytS3"
);
throw
Exception
(
"Open ComPort FAILED! dev must be /dev/ttyS2 or /dev/tytS3"
);
...
...
src/Communications/Modbus/ModbusRTUSlaveSlot.cc
View file @
6956a729
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
using
namespace
ModbusRTU
;
using
namespace
ModbusRTU
;
using
namespace
std
;
using
namespace
std
;
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
ModbusRTUSlaveSlot
::
ModbusRTUSlaveSlot
(
const
std
::
string
dev
,
bool
use485
)
:
ModbusRTUSlaveSlot
::
ModbusRTUSlaveSlot
(
const
std
::
string
dev
,
bool
use485
,
bool
tr_ctl
)
:
ModbusRTUSlave
(
dev
,
use485
)
ModbusRTUSlave
(
dev
,
use485
,
tr_ctl
)
{
{
}
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment