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
b0c264a1
Commit
b0c264a1
authored
Mar 19, 2016
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make style..
parent
d52d7d65
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
49 additions
and
36 deletions
+49
-36
smonitor.cc
Utilities/SMonit/smonitor.cc
+2
-2
log.cc
Utilities/ULog/log.cc
+1
-1
MQTTPublisher.cc
extensions/MQTTPublisher/MQTTPublisher.cc
+1
-0
MBTCPPersistentSlave.cc
extensions/ModbusSlave/MBTCPPersistentSlave.cc
+1
-1
tests.cc
extensions/SharedMemory/tests/tests.cc
+12
-12
UNetReceiver.cc
extensions/UNetUDP/UNetReceiver.cc
+10
-4
UNetReceiver.h
extensions/UNetUDP/UNetReceiver.h
+1
-1
UNetSender.cc
extensions/UNetUDP/UNetSender.cc
+2
-0
UNetSender.h
extensions/UNetUDP/UNetSender.h
+1
-1
LogReader.h
include/LogReader.h
+4
-1
UniSetTypes.cc
src/ObjectRepository/UniSetTypes.cc
+10
-9
test_utypes.cc
tests/test_utypes.cc
+4
-4
No files found.
Utilities/SMonit/smonitor.cc
View file @
b0c264a1
...
...
@@ -16,10 +16,10 @@ int main( int argc, const char** argv )
if
(
argc
>
1
&&
(
!
strcmp
(
argv
[
1
],
"--help"
)
||
!
strcmp
(
argv
[
1
],
"-h"
)
)
)
{
cout
<<
"Usage: uniset-smonit [ args ] --sid id1@node1,Sensor2@node2,id2,sensorname3,... "
<<
endl
<<
"Args: "
<<
endl
<<
"Args: "
<<
endl
<<
" --confile confilename - Default: configure.xml"
<<
endl
<<
" --name XXX - name for smonit. Default: TestProc"
<<
endl
;
// << " --script scriptname \n"
// << " --script scriptname \n"
return
0
;
}
...
...
Utilities/ULog/log.cc
View file @
b0c264a1
...
...
@@ -257,7 +257,7 @@ int main( int argc, char** argv )
lr
.
setReconnectDelay
(
rdelay
);
if
(
!
logfile
.
empty
()
)
lr
.
log
()
->
logFile
(
logfile
,
logtruncate
);
lr
.
log
()
->
logFile
(
logfile
,
logtruncate
);
if
(
!
vcmd
.
empty
()
)
lr
.
sendCommand
(
addr
,
port
,
vcmd
,
cmdonly
,
verb
);
...
...
extensions/MQTTPublisher/MQTTPublisher.cc
View file @
b0c264a1
...
...
@@ -41,6 +41,7 @@ MQTTPublisher::MQTTPublisher(UniSetTypes::ObjectId objId, xmlNode* cnode, UniSet
{
ostringstream
s
;
if
(
t
.
empty
()
)
s
<<
conf
->
getRootSection
()
<<
"/sensors"
;
else
...
...
extensions/ModbusSlave/MBTCPPersistentSlave.cc
View file @
b0c264a1
...
...
@@ -194,7 +194,7 @@ void MBTCPPersistentSlave::execute_tcp()
#warning MBTCPPersistentSlave: Из этой функции нет возврата..
sslot
->
mainLoop
(
vaddr
);
// ========== В текущей реализации КОД НИЖЕ не будет вызван... по крайней мере пока не завершится процесс ====
// ========== В текущей реализации КОД НИЖЕ не будет вызван... по крайней мере пока не завершится процесс ====
// если слишком быстро обработали запрос
// то ничего не делаем..
...
...
extensions/SharedMemory/tests/tests.cc
View file @
b0c264a1
...
...
@@ -47,18 +47,18 @@ int main(int argc, const char* argv[] )
act
->
add
(
shm
);
/*
ObjectId ns_id = conf->getControllerID("ReservSharedMemory");
if( ns_id == DefaultObjectId )
{
cerr << "Not found ID for 'ReservSharedMemory'" << endl;
return 1;
}
auto nullsm = make_shared<NullSM>(ns_id, "reserv-sm-configure.xml");
act->add(nullsm);
*/
/*
ObjectId ns_id = conf->getControllerID("ReservSharedMemory");
if( ns_id == DefaultObjectId )
{
cerr << "Not found ID for 'ReservSharedMemory'" << endl;
return 1;
}
auto nullsm = make_shared<NullSM>(ns_id, "reserv-sm-configure.xml");
act->add(nullsm);
*/
ObjectId
o_id
=
conf
->
getObjectID
(
"TestObject"
);
if
(
o_id
==
DefaultObjectId
)
...
...
extensions/UNetUDP/UNetReceiver.cc
View file @
b0c264a1
...
...
@@ -100,7 +100,7 @@ void UNetReceiver::setCheckConnectionPause( timeout_t msec )
checkConnectionTime
=
(
double
)
msec
/
1000.0
;
if
(
evCheckConnection
.
is_active
()
)
evCheckConnection
.
start
(
0
,
checkConnectionTime
);
evCheckConnection
.
start
(
0
,
checkConnectionTime
);
}
// -----------------------------------------------------------------------------
void
UNetReceiver
::
setLostTimeout
(
timeout_t
msec
)
...
...
@@ -120,7 +120,7 @@ void UNetReceiver::setUpdatePause( timeout_t msec )
updateTime
=
(
double
)
updatepause
/
1000.0
;
if
(
evUpdate
.
is_active
()
)
evUpdate
.
start
(
0
,
updateTime
);
evUpdate
.
start
(
0
,
updateTime
);
}
// -----------------------------------------------------------------------------
void
UNetReceiver
::
setMaxProcessingCount
(
int
set
)
...
...
@@ -181,6 +181,7 @@ bool UNetReceiver::createConnection( bool throwEx )
ptRecvTimeout
.
setTiming
(
recvTimeout
);
ptPrepare
.
setTiming
(
prepareTime
);
if
(
activated
)
evprepare
(
loop
.
evloop
());
}
...
...
@@ -189,6 +190,7 @@ bool UNetReceiver::createConnection( bool throwEx )
ostringstream
s
;
s
<<
myname
<<
"(createConnection): "
<<
e
.
what
();
unetcrit
<<
s
.
str
()
<<
std
::
endl
;
if
(
throwEx
)
throw
SystemError
(
s
.
str
());
...
...
@@ -199,12 +201,14 @@ bool UNetReceiver::createConnection( bool throwEx )
ostringstream
s
;
s
<<
myname
<<
"(createConnection): catch..."
;
unetcrit
<<
s
.
str
()
<<
std
::
endl
;
if
(
throwEx
)
throw
SystemError
(
s
.
str
());
udp
=
nullptr
;
}
return
(
udp
!=
nullptr
);
return
(
udp
!=
nullptr
);
}
// -----------------------------------------------------------------------------
void
UNetReceiver
::
start
()
...
...
@@ -225,7 +229,7 @@ void UNetReceiver::evprepare( const ev::loop_ref& eloop )
if
(
!
udp
)
{
evCheckConnection
.
set
(
eloop
);
evCheckConnection
.
start
(
0
,
checkConnectionTime
);
evCheckConnection
.
start
(
0
,
checkConnectionTime
);
}
else
{
...
...
@@ -243,6 +247,7 @@ void UNetReceiver::evfinish( const ev::loop_ref& eloop )
{
uniset_mutex_lock
l
(
checkConnMutex
);
if
(
evCheckConnection
.
is_active
()
)
evCheckConnection
.
stop
();
}
...
...
@@ -550,6 +555,7 @@ void UNetReceiver::checkConnectionEvent( ev::periodic& tm, int revents )
unetinfo
<<
myname
<<
"(checkConnectionEvent): check connection event.."
<<
endl
;
uniset_mutex_lock
l
(
checkConnMutex
);
if
(
!
createConnection
(
false
)
)
tm
.
again
();
}
...
...
extensions/UNetUDP/UNetReceiver.h
View file @
b0c264a1
...
...
@@ -92,7 +92,7 @@ class UNetReceiver:
public
std
::
enable_shared_from_this
<
UNetReceiver
>
{
public
:
UNetReceiver
(
const
std
::
string
&
host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>&
smi
,
bool
nocheckConnection
=
false
);
UNetReceiver
(
const
std
::
string
&
host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>&
smi
,
bool
nocheckConnection
=
false
);
virtual
~
UNetReceiver
();
void
start
();
...
...
extensions/UNetUDP/UNetSender.cc
View file @
b0c264a1
...
...
@@ -119,6 +119,7 @@ bool UNetSender::createConnection( bool throwEx )
ostringstream
s
;
s
<<
myname
<<
"(createConnection): "
<<
e
.
what
();
unetcrit
<<
s
.
str
()
<<
std
::
endl
;
if
(
throwEx
)
throw
SystemError
(
s
.
str
());
...
...
@@ -129,6 +130,7 @@ bool UNetSender::createConnection( bool throwEx )
ostringstream
s
;
s
<<
myname
<<
"(createConnection): catch..."
;
unetcrit
<<
s
.
str
()
<<
std
::
endl
;
if
(
throwEx
)
throw
SystemError
(
s
.
str
());
...
...
extensions/UNetUDP/UNetSender.h
View file @
b0c264a1
...
...
@@ -64,7 +64,7 @@
class
UNetSender
{
public
:
UNetSender
(
const
std
::
string
&
host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>&
smi
,
bool
nocheckConnection
=
false
,
UNetSender
(
const
std
::
string
&
host
,
const
ost
::
tpport_t
port
,
const
std
::
shared_ptr
<
SMInterface
>&
smi
,
bool
nocheckConnection
=
false
,
const
std
::
string
&
s_field
=
""
,
const
std
::
string
&
s_fvalue
=
""
,
const
std
::
string
&
prefix
=
"unet"
,
size_t
maxDCount
=
UniSetUDP
::
MaxDCount
,
size_t
maxACount
=
UniSetUDP
::
MaxACount
);
...
...
include/LogReader.h
View file @
b0c264a1
...
...
@@ -77,7 +77,10 @@ class LogReader
void
setLogLevel
(
Debug
::
type
t
);
inline
std
::
shared_ptr
<
DebugStream
>
log
(){
return
outlog
;
}
inline
std
::
shared_ptr
<
DebugStream
>
log
()
{
return
outlog
;
}
protected
:
...
...
src/ObjectRepository/UniSetTypes.cc
View file @
b0c264a1
...
...
@@ -572,18 +572,19 @@ std::ostream& UniSetTypes::operator<<( std::ostream& os, const IONotifyControlle
std
::
string
UniSetTypes
::
replace_all
(
const
std
::
string
&
src
,
const
std
::
string
&
from
,
const
std
::
string
&
to
)
{
string
res
(
src
);
if
(
from
.
empty
()
)
return
std
::
move
(
res
);
return
std
::
move
(
res
);
size_t
pos
=
res
.
find
(
from
,
pos
);
size_t
pos
=
res
.
find
(
from
,
pos
);
while
(
pos
!=
std
::
string
::
npos
)
{
res
.
replace
(
pos
,
from
.
length
(),
to
);
pos
+=
to
.
length
();
pos
=
res
.
find
(
from
,
pos
);
}
while
(
pos
!=
std
::
string
::
npos
)
{
res
.
replace
(
pos
,
from
.
length
(),
to
);
pos
+=
to
.
length
();
pos
=
res
.
find
(
from
,
pos
);
}
return
std
::
move
(
res
);
return
std
::
move
(
res
);
}
// -------------------------------------------------------------------------
tests/test_utypes.cc
View file @
b0c264a1
...
...
@@ -160,17 +160,17 @@ TEST_CASE("UniSetTypes: replace_all", "[utypes][replace_all]" )
{
const
std
::
string
str1
(
"Text %p test text %p"
);
std
::
string
res
=
UniSetTypes
::
replace_all
(
str1
,
"%p"
,
"my"
);
std
::
string
res
=
UniSetTypes
::
replace_all
(
str1
,
"%p"
,
"my"
);
REQUIRE
(
res
==
"Text my test text my"
);
const
std
::
string
str2
(
"Text %rlong test text %rlong"
);
res
=
UniSetTypes
::
replace_all
(
str2
,
"%rlong"
,
"2"
);
res
=
UniSetTypes
::
replace_all
(
str2
,
"%rlong"
,
"2"
);
REQUIRE
(
res
==
"Text 2 test text 2"
);
res
=
UniSetTypes
::
replace_all
(
str2
,
""
,
"my"
);
res
=
UniSetTypes
::
replace_all
(
str2
,
""
,
"my"
);
REQUIRE
(
res
==
str2
);
res
=
UniSetTypes
::
replace_all
(
str2
,
"not found"
,
"my"
);
res
=
UniSetTypes
::
replace_all
(
str2
,
"not found"
,
"my"
);
REQUIRE
(
res
==
str2
);
}
// -----------------------------------------------------------------------------
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