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
f3a75105
Commit
f3a75105
authored
Mar 07, 2014
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(ComPort): исправил ошибку в функции getTimeout(), а также перевёл
класс на использование msec, в соответсвии с общей "политикой" библиотеки
parent
72c4c8b9
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
19 additions
and
16 deletions
+19
-16
libuniset.spec
conf/libuniset.spec
+4
-1
ComPort.h
include/ComPort.h
+3
-3
ComPort.cc
src/Communications/ComPort.cc
+2
-2
ComPort485F.cc
src/Communications/ComPort485F.cc
+3
-3
ModbusRTUMaster.cc
src/Communications/Modbus/ModbusRTUMaster.cc
+3
-3
ModbusRTUSlave.cc
src/Communications/Modbus/ModbusRTUSlave.cc
+4
-4
No files found.
conf/libuniset.spec
View file @
f3a75105
...
...
@@ -8,7 +8,7 @@
Name: libuniset
Version: 1.7
Release: alt
7
Release: alt
8
Summary: UniSet - library for building distributed industrial control systems
...
...
@@ -335,6 +335,9 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet.pc
%changelog
* Fri Mar 07 2014 Pavel Vainerman <pv@altlinux.ru> 1.7-alt8
- fixed bug in ComPort class (getTimeout. eterbug #9890)
* Wed Feb 12 2014 Pavel Vainerman <pv@altlinux.ru> 1.7-alt7
- revert last changes ("ModbusMaster: add thread for check connection")
...
...
include/ComPort.h
View file @
f3a75105
...
...
@@ -82,9 +82,9 @@ public:
void
setCharacterSize
(
CharacterSize
);
void
setStopBits
(
StopBits
sBit
);
virtual
void
setTimeout
(
int
timeout
);
void
setWaiting
(
bool
waiting
);
inline
int
getTimeout
(){
return
uTimeout
*
1000
;
}
// msec
virtual
void
setTimeout
(
int
msec
);
inline
int
getTimeout
(){
return
uTimeout
/
1000
;
}
// msec
void
setWaiting
(
bool
waiting
);
virtual
unsigned
char
receiveByte
();
virtual
void
sendByte
(
unsigned
char
x
);
...
...
src/Communications/ComPort.cc
View file @
f3a75105
...
...
@@ -257,9 +257,9 @@ void ComPort::sendByte(unsigned char x)
}
// --------------------------------------------------------------------------------
// Lav: убрать, переделать в receiveBlock
void
ComPort
::
setTimeout
(
int
timeout
)
void
ComPort
::
setTimeout
(
int
msec
)
{
uTimeout
=
timeout
;
uTimeout
=
msec
*
1000
;
}
// --------------------------------------------------------------------------------
// Lav: ситуация, когда отправлено меньше запрошенного, не типична и должна
...
...
src/Communications/ComPort485F.cc
View file @
f3a75105
...
...
@@ -73,10 +73,10 @@ ComPort485F::ComPort485F( string dev, int gpio_num, bool tmit_ctrl ):
}
}
// --------------------------------------------------------------------------------
void
ComPort485F
::
setTimeout
(
int
timeout
)
void
ComPort485F
::
setTimeout
(
int
msec
)
{
tout_msec
=
timeout
/
1000
;
ComPort
::
setTimeout
(
timeout
);
tout_msec
=
msec
;
ComPort
::
setTimeout
(
msec
);
}
// --------------------------------------------------------------------------------
unsigned
char
ComPort485F
::
m_receiveByte
(
bool
wait
)
...
...
src/Communications/Modbus/ModbusRTUMaster.cc
View file @
f3a75105
...
...
@@ -35,7 +35,7 @@ ModbusRTUMaster::ModbusRTUMaster( const string dev, bool use485, bool tr_ctl ):
port
->
setCharacterSize
(
ComPort
::
CSize8
);
port
->
setStopBits
(
ComPort
::
OneBit
);
port
->
setWaiting
(
true
);
port
->
setTimeout
(
replyTimeOut_ms
*
1000
);
port
->
setTimeout
(
replyTimeOut_ms
);
// port->setBlocking(false);
}
// -------------------------------------------------------------------------
...
...
@@ -51,7 +51,7 @@ ModbusRTUMaster::ModbusRTUMaster( ComPort* com ):
port
->
setCharacterSize
(
ComPort
::
CSize8
);
port
->
setStopBits
(
ComPort
::
OneBit
);
port
->
setWaiting
(
true
);
port
->
setTimeout
(
replyTimeOut_ms
*
1000
);
port
->
setTimeout
(
replyTimeOut_ms
);
// port->setBlocking(false);
}
// -------------------------------------------------------------------------
...
...
@@ -116,7 +116,7 @@ int ModbusRTUMaster::getNextData( unsigned char* buf, int len )
void
ModbusRTUMaster
::
setChannelTimeout
(
timeout_t
msec
)
{
if
(
port
)
port
->
setTimeout
(
msec
*
1000
);
port
->
setTimeout
(
msec
);
}
// --------------------------------------------------------------------------------
mbErrCode
ModbusRTUMaster
::
sendData
(
unsigned
char
*
buf
,
int
len
)
...
...
src/Communications/Modbus/ModbusRTUSlave.cc
View file @
f3a75105
...
...
@@ -35,7 +35,7 @@ ModbusRTUSlave::ModbusRTUSlave( const string dev, bool use485, bool tr_ctl ):
port
->
setCharacterSize
(
ComPort
::
CSize8
);
port
->
setStopBits
(
ComPort
::
OneBit
);
port
->
setWaiting
(
true
);
port
->
setTimeout
(
recvTimeOut_ms
*
1000
);
port
->
setTimeout
(
recvTimeOut_ms
);
// port->setBlocking(false);
}
...
...
@@ -49,7 +49,7 @@ ModbusRTUSlave::ModbusRTUSlave( ComPort* com ):
port
->
setCharacterSize
(
ComPort
::
CSize8
);
port
->
setStopBits
(
ComPort
::
OneBit
);
port
->
setWaiting
(
true
);
port
->
setTimeout
(
recvTimeOut_ms
*
1000
);
port
->
setTimeout
(
recvTimeOut_ms
);
// port->setBlocking(false);
}
...
...
@@ -129,9 +129,9 @@ int ModbusRTUSlave::getNextData( unsigned char* buf, int len )
void
ModbusRTUSlave
::
setChannelTimeout
(
timeout_t
msec
)
{
if
(
msec
==
UniSetTimer
::
WaitUpTime
)
port
->
setTimeout
(
15
*
60
*
1000
*
1000
);
// используем просто большое время (15 минут). Переведя его в наносекунды
.
port
->
setTimeout
(
15
*
60
*
1000
);
// используем просто большое время (15 минут)
.
else
port
->
setTimeout
(
msec
*
1000
);
port
->
setTimeout
(
msec
);
}
// --------------------------------------------------------------------------------
mbErrCode
ModbusRTUSlave
::
sendData
(
unsigned
char
*
buf
,
int
len
)
...
...
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