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
560875d8
Commit
560875d8
authored
Feb 05, 2019
by
Pavel Vainerman
Browse files
Options
Browse Files
Download
Plain Diff
backported to p8 as 2.8-alt1.M80P.2 (with rpmbph script)
parents
7a38b471
be2f0dbe
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
73 additions
and
30 deletions
+73
-30
UniSetObject_i.idl
IDL/UniSetTypes/UniSetObject_i.idl
+1
-0
admin.cc
Utilities/Admin/admin.cc
+24
-6
libuniset2.spec
conf/libuniset2.spec
+5
-2
DBServer_MySQL.cc
extensions/DBServer-MySQL/DBServer_MySQL.cc
+2
-1
DBServer_PostgreSQL.cc
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
+2
-1
DBServer_SQLite.cc
extensions/DBServer-SQLite/DBServer_SQLite.cc
+2
-1
TestObject.cc
extensions/SharedMemory/tests/TestObject.cc
+6
-0
TestObject.h
extensions/SharedMemory/tests/TestObject.h
+2
-0
test_sm.cc
extensions/SharedMemory/tests/test_sm.cc
+2
-1
MessageType.h
include/MessageType.h
+2
-0
UInterface.h
include/UInterface.h
+1
-1
UniSetObject.h
include/UniSetObject.h
+1
-0
MessageType.cc
src/Core/MessageType.cc
+6
-3
UInterface.cc
src/Core/UInterface.cc
+3
-3
UniSetObject.cc
src/Core/UniSetObject.cc
+3
-2
test_messagetype.cc
tests/test_messagetype.cc
+9
-7
test_ui.cc
tests/test_ui.cc
+2
-2
No files found.
IDL/UniSetTypes/UniSetObject_i.idl
View file @
560875d8
...
@@ -55,6 +55,7 @@
...
@@ -55,6 +55,7 @@
/*
!
Функция
посылки
текстового
сообщения
объекту
*/
/*
!
Функция
посылки
текстового
сообщения
объекту
*/
void
pushMessage
(
in
string
msg
void
pushMessage
(
in
string
msg
,
in
long
mtype
,
in
uniset
::
Timespec
tm
,
in
uniset
::
Timespec
tm
,
in
uniset
::
ProducerInfo
pi
,
in
uniset
::
ProducerInfo
pi
,
in
long
priority
,
in
long
priority
...
...
Utilities/Admin/admin.cc
View file @
560875d8
...
@@ -78,7 +78,7 @@ int getState( const string& args, UInterface& ui );
...
@@ -78,7 +78,7 @@ int getState( const string& args, UInterface& ui );
int
getCalibrate
(
const
string
&
args
,
UInterface
&
ui
);
int
getCalibrate
(
const
string
&
args
,
UInterface
&
ui
);
int
oinfo
(
const
string
&
args
,
UInterface
&
ui
,
const
string
&
userparam
);
int
oinfo
(
const
string
&
args
,
UInterface
&
ui
,
const
string
&
userparam
);
int
apiRequest
(
const
string
&
args
,
UInterface
&
ui
,
const
string
&
query
);
int
apiRequest
(
const
string
&
args
,
UInterface
&
ui
,
const
string
&
query
);
void
sendText
(
const
string
&
args
,
UInterface
&
ui
,
const
string
&
txt
);
void
sendText
(
const
string
&
args
,
UInterface
&
ui
,
const
string
&
txt
,
int
mtype
);
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
static
void
print_help
(
int
width
,
const
string
&
cmd
,
const
string
&
help
,
const
string
&
tab
=
" "
)
static
void
print_help
(
int
width
,
const
string
&
cmd
,
const
string
&
help
,
const
string
&
tab
=
" "
)
{
{
...
@@ -125,7 +125,7 @@ static void usage()
...
@@ -125,7 +125,7 @@ static void usage()
print_help
(
36
,
"-v|--verbose"
,
"Подробный вывод логов.
\n
"
);
print_help
(
36
,
"-v|--verbose"
,
"Подробный вывод логов.
\n
"
);
print_help
(
36
,
"-q|--quiet"
,
"Выводит только результат.
\n
"
);
print_help
(
36
,
"-q|--quiet"
,
"Выводит только результат.
\n
"
);
print_help
(
36
,
"-z|--csv"
,
"Вывести результат (getValue) в виде val1,val2,val3...
\n
"
);
print_help
(
36
,
"-z|--csv"
,
"Вывести результат (getValue) в виде val1,val2,val3...
\n
"
);
print_help
(
36
,
"-m|--sendText id1@node1,id2@node2,id3,..
text"
,
"Послать объектам текстовое сообщение text
\n
"
);
print_help
(
36
,
"-m|--sendText id1@node1,id2@node2,id3,..
mtype text"
,
"Послать объектам текстовое сообщение text типа mtype
\n
"
);
cout
<<
endl
;
cout
<<
endl
;
}
}
...
@@ -377,17 +377,35 @@ int main(int argc, char** argv)
...
@@ -377,17 +377,35 @@ int main(int argc, char** argv)
if
(
checkArg
(
optind
,
argc
,
argv
)
==
0
)
if
(
checkArg
(
optind
,
argc
,
argv
)
==
0
)
{
{
if
(
!
quiet
)
if
(
!
quiet
)
cerr
<<
"admin(sendText): Unknown '
text'. Use: id,name,name2@nodeX
text"
<<
endl
;
cerr
<<
"admin(sendText): Unknown '
mtype'. Use: id,name,name2@nodeX mtype
text"
<<
endl
;
return
1
;
return
1
;
}
}
ostringstream
txt
;
if
(
checkArg
(
optind
+
1
,
argc
,
argv
)
==
0
)
{
if
(
!
quiet
)
cerr
<<
"admin(sendText): Unknown 'text'. Use: id,name,name2@nodeX mtype text"
<<
endl
;
return
1
;
}
for
(
int
i
=
optind
+
1
;
i
<
argc
;
i
++
)
{
if
(
checkArg
(
i
,
argc
,
argv
)
==
0
)
break
;
txt
<<
" "
<<
argv
[
optind
+
1
];
}
auto
conf
=
uniset_init
(
argc
,
argv
,
conffile
);
auto
conf
=
uniset_init
(
argc
,
argv
,
conffile
);
UInterface
ui
(
conf
);
UInterface
ui
(
conf
);
ui
.
initBackId
(
uniset
::
AdminID
);
ui
.
initBackId
(
uniset
::
AdminID
);
std
::
string
txt
=
string
(
argv
[
optind
]);
int
mtype
=
uni_atoi
(
argv
[
optind
]);
sendText
(
optarg
,
ui
,
txt
);
sendText
(
optarg
,
ui
,
txt
.
str
(),
mtype
);
return
0
;
return
0
;
}
}
break
;
break
;
...
@@ -1111,7 +1129,7 @@ int apiRequest( const string& args, UInterface& ui, const string& query )
...
@@ -1111,7 +1129,7 @@ int apiRequest( const string& args, UInterface& ui, const string& query )
}
}
// --------------------------------------------------------------------------------------
// --------------------------------------------------------------------------------------
void
sendText
(
const
string
&
args
,
UInterface
&
ui
,
const
string
&
txt
)
void
sendText
(
const
string
&
args
,
UInterface
&
ui
,
const
string
&
txt
,
int
mtype
)
{
{
auto
conf
=
uniset_conf
();
auto
conf
=
uniset_conf
();
auto
sl
=
uniset
::
getObjectsList
(
args
,
conf
);
auto
sl
=
uniset
::
getObjectsList
(
args
,
conf
);
...
...
conf/libuniset2.spec
View file @
560875d8
...
@@ -26,7 +26,7 @@
...
@@ -26,7 +26,7 @@
Name: libuniset2
Name: libuniset2
Version: 2.8
Version: 2.8
Release: alt
0.M80P.1
Release: alt
1.M80P.2
Summary: UniSet - library for building distributed industrial control systems
Summary: UniSet - library for building distributed industrial control systems
License: LGPL
License: LGPL
...
@@ -546,9 +546,12 @@ rm -f %buildroot%_docdir/%oname/html/*.md5
...
@@ -546,9 +546,12 @@ rm -f %buildroot%_docdir/%oname/html/*.md5
# history of current unpublished changes
# history of current unpublished changes
%changelog
%changelog
*
Mon Feb 04 2019 Pavel Vainerman <pv@altlinux.ru> 2.8-alt0.M80P.1
*
Tue Feb 05 2019 Pavel Vainerman <pv@altlinux.ru> 2.8-alt1.M80P.2
- backport to ALTLinux p8 (by rpmbph script)
- backport to ALTLinux p8 (by rpmbph script)
* Mon Feb 04 2019 Pavel Vainerman <pv@altlinux.ru> 2.8-alt2
- added 'mtype' for TextMessage
* Sun Feb 03 2019 Pavel Vainerman <pv@altlinux.ru> 2.8-alt1
* Sun Feb 03 2019 Pavel Vainerman <pv@altlinux.ru> 2.8-alt1
- added new public function 'pushMessage(string)'
- added new public function 'pushMessage(string)'
...
...
extensions/DBServer-MySQL/DBServer_MySQL.cc
View file @
560875d8
...
@@ -138,11 +138,12 @@ void DBServer_MySQL::onTextMessage( const TextMessage* msg )
...
@@ -138,11 +138,12 @@ void DBServer_MySQL::onTextMessage( const TextMessage* msg )
ostringstream
data
;
ostringstream
data
;
data
<<
"INSERT INTO "
<<
tblName
(
msg
->
type
)
data
<<
"INSERT INTO "
<<
tblName
(
msg
->
type
)
<<
"(date, time, time_usec, text, node) VALUES( '"
<<
"(date, time, time_usec, text,
mtype,
node) VALUES( '"
<<
dateToString
(
msg
->
tm
.
tv_sec
,
"-"
)
<<
"','"
// date
<<
dateToString
(
msg
->
tm
.
tv_sec
,
"-"
)
<<
"','"
// date
<<
timeToString
(
msg
->
tm
.
tv_sec
,
":"
)
<<
"','"
// time
<<
timeToString
(
msg
->
tm
.
tv_sec
,
":"
)
<<
"','"
// time
<<
msg
->
tm
.
tv_nsec
<<
"','"
// time_usec
<<
msg
->
tm
.
tv_nsec
<<
"','"
// time_usec
<<
msg
->
txt
<<
"','"
// text
<<
msg
->
txt
<<
"','"
// text
<<
msg
->
mtype
<<
"','"
// mtype
<<
msg
->
node
<<
"')"
;
// node
<<
msg
->
node
<<
"')"
;
// node
dbinfo
<<
myname
<<
"(insert_main_messages): "
<<
data
.
str
()
<<
endl
;
dbinfo
<<
myname
<<
"(insert_main_messages): "
<<
data
.
str
()
<<
endl
;
...
...
extensions/DBServer-PostgreSQL/DBServer_PostgreSQL.cc
View file @
560875d8
...
@@ -128,11 +128,12 @@ void DBServer_PostgreSQL::onTextMessage( const TextMessage* msg )
...
@@ -128,11 +128,12 @@ void DBServer_PostgreSQL::onTextMessage( const TextMessage* msg )
{
{
ostringstream
data
;
ostringstream
data
;
data
<<
"INSERT INTO "
<<
tblName
(
msg
->
type
)
data
<<
"INSERT INTO "
<<
tblName
(
msg
->
type
)
<<
"(date, time, time_usec, text, node) VALUES( '"
<<
"(date, time, time_usec, text,
mtype,
node) VALUES( '"
<<
dateToString
(
msg
->
tm
.
tv_sec
,
"-"
)
<<
"','"
// date
<<
dateToString
(
msg
->
tm
.
tv_sec
,
"-"
)
<<
"','"
// date
<<
timeToString
(
msg
->
tm
.
tv_sec
,
":"
)
<<
"','"
// time
<<
timeToString
(
msg
->
tm
.
tv_sec
,
":"
)
<<
"','"
// time
<<
msg
->
tm
.
tv_nsec
<<
"','"
// time_usec
<<
msg
->
tm
.
tv_nsec
<<
"','"
// time_usec
<<
msg
->
txt
<<
"','"
// text
<<
msg
->
txt
<<
"','"
// text
<<
msg
->
mtype
<<
"','"
// mtype
<<
msg
->
node
<<
"')"
;
// node
<<
msg
->
node
<<
"')"
;
// node
dbinfo
<<
myname
<<
"(insert_main_messages): "
<<
data
.
str
()
<<
endl
;
dbinfo
<<
myname
<<
"(insert_main_messages): "
<<
data
.
str
()
<<
endl
;
...
...
extensions/DBServer-SQLite/DBServer_SQLite.cc
View file @
560875d8
...
@@ -125,11 +125,12 @@ void DBServer_SQLite::onTextMessage( const TextMessage* msg )
...
@@ -125,11 +125,12 @@ void DBServer_SQLite::onTextMessage( const TextMessage* msg )
{
{
ostringstream
data
;
ostringstream
data
;
data
<<
"INSERT INTO "
<<
tblName
(
msg
->
type
)
data
<<
"INSERT INTO "
<<
tblName
(
msg
->
type
)
<<
"(date, time, time_usec, text, node) VALUES( '"
<<
"(date, time, time_usec, text,
mtype,
node) VALUES( '"
<<
dateToString
(
msg
->
tm
.
tv_sec
,
"-"
)
<<
"','"
// date
<<
dateToString
(
msg
->
tm
.
tv_sec
,
"-"
)
<<
"','"
// date
<<
timeToString
(
msg
->
tm
.
tv_sec
,
":"
)
<<
"','"
// time
<<
timeToString
(
msg
->
tm
.
tv_sec
,
":"
)
<<
"','"
// time
<<
msg
->
tm
.
tv_nsec
<<
"','"
// time_usec
<<
msg
->
tm
.
tv_nsec
<<
"','"
// time_usec
<<
msg
->
txt
<<
"','"
// text
<<
msg
->
txt
<<
"','"
// text
<<
msg
->
mtype
<<
"','"
// mtype
<<
msg
->
node
<<
"')"
;
// node
<<
msg
->
node
<<
"')"
;
// node
dbinfo
<<
myname
<<
"(insert_main_messages): "
<<
data
.
str
()
<<
endl
;
dbinfo
<<
myname
<<
"(insert_main_messages): "
<<
data
.
str
()
<<
endl
;
...
...
extensions/SharedMemory/tests/TestObject.cc
View file @
560875d8
...
@@ -59,6 +59,7 @@ void TestObject::sensorInfo( const SensorMessage* sm )
...
@@ -59,6 +59,7 @@ void TestObject::sensorInfo( const SensorMessage* sm )
void
TestObject
::
onTextMessage
(
const
TextMessage
*
msg
)
void
TestObject
::
onTextMessage
(
const
TextMessage
*
msg
)
{
{
lastText
=
msg
->
txt
;
lastText
=
msg
->
txt
;
lastTextType
=
msg
->
mtype
;
}
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
void
TestObject
::
stopHeartbeat
()
void
TestObject
::
stopHeartbeat
()
...
@@ -112,4 +113,9 @@ string TestObject::getLastTextMessage() const
...
@@ -112,4 +113,9 @@ string TestObject::getLastTextMessage() const
{
{
return
lastText
;
return
lastText
;
}
}
int
TestObject
::
getLastTextMessageType
()
const
{
return
lastTextType
;
}
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
extensions/SharedMemory/tests/TestObject.h
View file @
560875d8
...
@@ -37,6 +37,7 @@ class TestObject:
...
@@ -37,6 +37,7 @@ class TestObject:
bool
isFullQueue
();
bool
isFullQueue
();
std
::
string
getLastTextMessage
()
const
;
std
::
string
getLastTextMessage
()
const
;
int
getLastTextMessageType
()
const
;
protected
:
protected
:
TestObject
();
TestObject
();
...
@@ -52,6 +53,7 @@ class TestObject:
...
@@ -52,6 +53,7 @@ class TestObject:
long
lostMessages
=
{
false
};
long
lostMessages
=
{
false
};
long
lastValue
=
{
0
};
long
lastValue
=
{
0
};
std
::
string
lastText
=
{
""
};
std
::
string
lastText
=
{
""
};
int
lastTextType
=
{
0
};
};
};
// -----------------------------------------------------------------------------
// -----------------------------------------------------------------------------
#endif // _TestObject_H_
#endif // _TestObject_H_
...
...
extensions/SharedMemory/tests/test_sm.cc
View file @
560875d8
...
@@ -317,8 +317,9 @@ TEST_CASE("[SM]: sendText", "[sm][sendText]")
...
@@ -317,8 +317,9 @@ TEST_CASE("[SM]: sendText", "[sm][sendText]")
std
::
string
txt
=
"Hello world"
;
std
::
string
txt
=
"Hello world"
;
ui
->
sendText
(
obj
->
getId
(),
txt
);
ui
->
sendText
(
obj
->
getId
(),
txt
,
3
);
msleep
(
300
);
msleep
(
300
);
REQUIRE
(
obj
->
getLastTextMessage
()
==
txt
);
REQUIRE
(
obj
->
getLastTextMessage
()
==
txt
);
REQUIRE
(
obj
->
getLastTextMessageType
()
==
3
);
}
}
include/MessageType.h
View file @
560875d8
...
@@ -287,6 +287,7 @@ namespace uniset
...
@@ -287,6 +287,7 @@ namespace uniset
TextMessage
()
noexcept
;
TextMessage
()
noexcept
;
TextMessage
(
const
VoidMessage
*
msg
)
noexcept
;
TextMessage
(
const
VoidMessage
*
msg
)
noexcept
;
TextMessage
(
const
char
*
msg
,
TextMessage
(
const
char
*
msg
,
int
mtype
,
const
::
uniset
::
Timespec
&
tm
,
const
::
uniset
::
Timespec
&
tm
,
const
::
uniset
::
ProducerInfo
&
pi
,
const
::
uniset
::
ProducerInfo
&
pi
,
Priority
prior
=
Message
::
Medium
,
Priority
prior
=
Message
::
Medium
,
...
@@ -295,6 +296,7 @@ namespace uniset
...
@@ -295,6 +296,7 @@ namespace uniset
std
::
shared_ptr
<
VoidMessage
>
toLocalVoidMessage
()
const
;
std
::
shared_ptr
<
VoidMessage
>
toLocalVoidMessage
()
const
;
std
::
string
txt
;
std
::
string
txt
;
int
mtype
;
};
};
}
}
...
...
include/UInterface.h
View file @
560875d8
...
@@ -233,7 +233,7 @@ namespace uniset
...
@@ -233,7 +233,7 @@ namespace uniset
/*! посылка сообщения msg объекту name на узел node */
/*! посылка сообщения msg объекту name на узел node */
void
send
(
const
uniset
::
ObjectId
name
,
const
uniset
::
TransportMessage
&
msg
,
uniset
::
ObjectId
node
);
void
send
(
const
uniset
::
ObjectId
name
,
const
uniset
::
TransportMessage
&
msg
,
uniset
::
ObjectId
node
);
void
send
(
const
uniset
::
ObjectId
name
,
const
uniset
::
TransportMessage
&
msg
);
void
send
(
const
uniset
::
ObjectId
name
,
const
uniset
::
TransportMessage
&
msg
);
void
sendText
(
const
uniset
::
ObjectId
name
,
const
std
::
string
&
text
,
const
uniset
::
ObjectId
node
=
uniset
::
DefaultObjectId
);
void
sendText
(
const
uniset
::
ObjectId
name
,
const
std
::
string
&
text
,
int
mtype
,
const
uniset
::
ObjectId
node
=
uniset
::
DefaultObjectId
);
void
sendText
(
const
uniset
::
ObjectId
name
,
const
uniset
::
TextMessage
&
msg
,
const
uniset
::
ObjectId
node
=
uniset
::
DefaultObjectId
);
void
sendText
(
const
uniset
::
ObjectId
name
,
const
uniset
::
TextMessage
&
msg
,
const
uniset
::
ObjectId
node
=
uniset
::
DefaultObjectId
);
// ---------------------------------------------------------------
// ---------------------------------------------------------------
...
...
include/UniSetObject.h
View file @
560875d8
...
@@ -109,6 +109,7 @@ namespace uniset
...
@@ -109,6 +109,7 @@ namespace uniset
//! поместить текстовое сообщение в очередь
//! поместить текстовое сообщение в очередь
virtual
void
pushMessage
(
const
char
*
msg
,
virtual
void
pushMessage
(
const
char
*
msg
,
::
CORBA
::
Long
mtype
,
const
::
uniset
::
Timespec
&
tm
,
const
::
uniset
::
Timespec
&
tm
,
const
::
uniset
::
ProducerInfo
&
pi
,
const
::
uniset
::
ProducerInfo
&
pi
,
::
CORBA
::
Long
priority
,
::
CORBA
::
Long
priority
,
...
...
src/Core/MessageType.cc
View file @
560875d8
...
@@ -241,6 +241,7 @@ namespace uniset
...
@@ -241,6 +241,7 @@ namespace uniset
tm
=
m
->
tm
;
tm
=
m
->
tm
;
consumer
=
m
->
consumer
;
consumer
=
m
->
consumer
;
supplier
=
m
->
supplier
;
supplier
=
m
->
supplier
;
mtype
=
m
->
mtype
;
txt
=
m
->
txt
;
txt
=
m
->
txt
;
}
}
}
}
...
@@ -250,7 +251,8 @@ namespace uniset
...
@@ -250,7 +251,8 @@ namespace uniset
type
=
Message
::
TextMessage
;
type
=
Message
::
TextMessage
;
}
}
TextMessage
::
TextMessage
(
const
char
*
msg
,
TextMessage
::
TextMessage
(
const
char
*
msg
,
int
_mtype
,
const
uniset
::
Timespec
&
tm
,
const
uniset
::
Timespec
&
tm
,
const
::
uniset
::
ProducerInfo
&
pi
,
const
::
uniset
::
ProducerInfo
&
pi
,
Priority
prior
,
Priority
prior
,
...
@@ -263,7 +265,8 @@ namespace uniset
...
@@ -263,7 +265,8 @@ namespace uniset
this
->
consumer
=
cons
;
this
->
consumer
=
cons
;
this
->
tm
.
tv_sec
=
tm
.
sec
;
this
->
tm
.
tv_sec
=
tm
.
sec
;
this
->
tm
.
tv_nsec
=
tm
.
nsec
;
this
->
tm
.
tv_nsec
=
tm
.
nsec
;
txt
=
std
::
string
(
msg
);
this
->
txt
=
std
::
string
(
msg
);
this
->
mtype
=
_mtype
;
}
}
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
std
::
shared_ptr
<
VoidMessage
>
TextMessage
::
toLocalVoidMessage
()
const
std
::
shared_ptr
<
VoidMessage
>
TextMessage
::
toLocalVoidMessage
()
const
...
@@ -276,7 +279,7 @@ namespace uniset
...
@@ -276,7 +279,7 @@ namespace uniset
ts
.
sec
=
tm
.
tv_sec
;
ts
.
sec
=
tm
.
tv_sec
;
ts
.
nsec
=
tm
.
tv_nsec
;
ts
.
nsec
=
tm
.
tv_nsec
;
auto
tmsg
=
std
::
make_shared
<
TextMessage
>
(
txt
.
c_str
(),
ts
,
pi
,
priority
,
consumer
);
auto
tmsg
=
std
::
make_shared
<
TextMessage
>
(
txt
.
c_str
(),
mtype
,
ts
,
pi
,
priority
,
consumer
);
return
std
::
static_pointer_cast
<
VoidMessage
>
(
tmsg
);
return
std
::
static_pointer_cast
<
VoidMessage
>
(
tmsg
);
}
}
//--------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------
...
...
src/Core/UInterface.cc
View file @
560875d8
...
@@ -1020,7 +1020,7 @@ namespace uniset
...
@@ -1020,7 +1020,7 @@ namespace uniset
send
(
name
,
msg
,
uconf
->
getLocalNode
());
send
(
name
,
msg
,
uconf
->
getLocalNode
());
}
}
// ------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------
void
UInterface
::
sendText
(
const
ObjectId
name
,
const
std
::
string
&
txt
,
const
ObjectId
node
)
void
UInterface
::
sendText
(
const
ObjectId
name
,
const
std
::
string
&
txt
,
int
mtype
,
const
ObjectId
node
)
{
{
if
(
name
==
uniset
::
DefaultObjectId
)
if
(
name
==
uniset
::
DefaultObjectId
)
throw
uniset
::
ORepFailed
(
"UI(sendText): ERROR: id=uniset::DefaultObjectId"
);
throw
uniset
::
ORepFailed
(
"UI(sendText): ERROR: id=uniset::DefaultObjectId"
);
...
@@ -1051,7 +1051,7 @@ namespace uniset
...
@@ -1051,7 +1051,7 @@ namespace uniset
oref
=
resolve
(
name
,
onode
);
oref
=
resolve
(
name
,
onode
);
UniSetObject_i_var
obj
=
UniSetObject_i
::
_narrow
(
oref
);
UniSetObject_i_var
obj
=
UniSetObject_i
::
_narrow
(
oref
);
obj
->
pushMessage
(
txt
.
c_str
(),
ts
,
pi
,
Message
::
Medium
,
uniset
::
DefaultObjectId
);
obj
->
pushMessage
(
txt
.
c_str
(),
mtype
,
ts
,
pi
,
Message
::
Medium
,
uniset
::
DefaultObjectId
);
return
;
return
;
}
}
catch
(
const
CORBA
::
TRANSIENT
&
)
{}
catch
(
const
CORBA
::
TRANSIENT
&
)
{}
...
@@ -1125,7 +1125,7 @@ namespace uniset
...
@@ -1125,7 +1125,7 @@ namespace uniset
oref
=
resolve
(
name
,
onode
);
oref
=
resolve
(
name
,
onode
);
UniSetObject_i_var
obj
=
UniSetObject_i
::
_narrow
(
oref
);
UniSetObject_i_var
obj
=
UniSetObject_i
::
_narrow
(
oref
);
obj
->
pushMessage
(
msg
.
txt
.
c_str
(),
ts
,
pi
,
msg
.
priority
,
msg
.
consumer
);
obj
->
pushMessage
(
msg
.
txt
.
c_str
(),
msg
.
mtype
,
ts
,
pi
,
msg
.
priority
,
msg
.
consumer
);
return
;
return
;
}
}
catch
(
const
CORBA
::
TRANSIENT
&
)
{}
catch
(
const
CORBA
::
TRANSIENT
&
)
{}
...
...
src/Core/UniSetObject.cc
View file @
560875d8
...
@@ -400,13 +400,14 @@ namespace uniset
...
@@ -400,13 +400,14 @@ namespace uniset
termWaiting
();
termWaiting
();
}
}
// ------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------
void
UniSetObject
::
pushMessage
(
const
char
*
msg
,
void
UniSetObject
::
pushMessage
(
const
char
*
msg
,
::
CORBA
::
Long
mtype
,
const
::
uniset
::
Timespec
&
tm
,
const
::
uniset
::
Timespec
&
tm
,
const
::
uniset
::
ProducerInfo
&
pi
,
const
::
uniset
::
ProducerInfo
&
pi
,
::
CORBA
::
Long
priority
,
::
CORBA
::
Long
priority
,
::
CORBA
::
Long
consumer
)
::
CORBA
::
Long
consumer
)
{
{
uniset
::
TextMessage
tmsg
(
msg
,
tm
,
pi
,
(
uniset
::
Message
::
Priority
)
priority
,
consumer
);
uniset
::
TextMessage
tmsg
(
msg
,
mtype
,
tm
,
pi
,
(
uniset
::
Message
::
Priority
)
priority
,
consumer
);
auto
vm
=
tmsg
.
toLocalVoidMessage
();
auto
vm
=
tmsg
.
toLocalVoidMessage
();
if
(
vm
->
priority
==
Message
::
Medium
)
if
(
vm
->
priority
==
Message
::
Medium
)
...
...
tests/test_messagetype.cc
View file @
560875d8
...
@@ -260,25 +260,27 @@ TEST_CASE("TextMessage", "[basic][message types][TextMessage]" )
...
@@ -260,25 +260,27 @@ TEST_CASE("TextMessage", "[basic][message types][TextMessage]" )
ObjectId
consumer
=
40
;
ObjectId
consumer
=
40
;
TextMessage
tm
(
txt
.
c_str
(),
tspec
,
pi
,
uniset
::
Message
::
High
,
consumer
);
TextMessage
tm
(
txt
.
c_str
(),
3
,
tspec
,
pi
,
uniset
::
Message
::
High
,
consumer
);
REQUIRE
(
tm
.
consumer
==
consumer
);
REQUIRE
(
tm
.
consumer
==
consumer
);
REQUIRE
(
tm
.
node
==
pi
.
node
);
REQUIRE
(
tm
.
node
==
pi
.
node
);
REQUIRE
(
tm
.
supplier
==
pi
.
id
);
REQUIRE
(
tm
.
supplier
==
pi
.
id
);
REQUIRE
(
tm
.
txt
==
txt
);
REQUIRE
(
tm
.
txt
==
txt
);
REQUIRE
(
tm
.
tm
.
tv_sec
==
tspec
.
sec
);
REQUIRE
(
tm
.
tm
.
tv_sec
==
tspec
.
sec
);
REQUIRE
(
tm
.
tm
.
tv_nsec
==
tspec
.
nsec
);
REQUIRE
(
tm
.
tm
.
tv_nsec
==
tspec
.
nsec
);
REQUIRE
(
tm
.
mtype
==
3
);
auto
vm
=
tm
.
toLocalVoidMessage
();
auto
vm
=
tm
.
toLocalVoidMessage
();
REQUIRE
(
vm
->
type
==
Message
::
TextMessage
);
REQUIRE
(
vm
->
type
==
Message
::
TextMessage
);
TextMessage
tm2
(
vm
.
get
());
TextMessage
tm2
(
vm
.
get
());
REQUIRE
(
tm
.
consumer
==
consumer
);
REQUIRE
(
tm2
.
consumer
==
consumer
);
REQUIRE
(
tm
.
node
==
pi
.
node
);
REQUIRE
(
tm2
.
node
==
pi
.
node
);
REQUIRE
(
tm
.
supplier
==
pi
.
id
);
REQUIRE
(
tm2
.
supplier
==
pi
.
id
);
REQUIRE
(
tm
.
txt
==
txt
);
REQUIRE
(
tm2
.
txt
==
txt
);
REQUIRE
(
tm
.
tm
.
tv_sec
==
tspec
.
sec
);
REQUIRE
(
tm2
.
tm
.
tv_sec
==
tspec
.
sec
);
REQUIRE
(
tm
.
tm
.
tv_nsec
==
tspec
.
nsec
);
REQUIRE
(
tm2
.
tm
.
tv_nsec
==
tspec
.
nsec
);
REQUIRE
(
tm2
.
mtype
==
3
);
}
}
}
}
// ---------------------------------------------------------------
// ---------------------------------------------------------------
tests/test_ui.cc
View file @
560875d8
...
@@ -44,8 +44,8 @@ TEST_CASE("UInterface", "[UInterface]")
...
@@ -44,8 +44,8 @@ TEST_CASE("UInterface", "[UInterface]")
REQUIRE_THROWS_AS
(
ui
.
getTimeChange
(
sid
,
-
20
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
.
getTimeChange
(
sid
,
-
20
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
.
getTimeChange
(
sid
,
DefaultObjectId
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
.
getTimeChange
(
sid
,
DefaultObjectId
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
.
getTimeChange
(
sid
,
conf
->
getLocalNode
()),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
.
getTimeChange
(
sid
,
conf
->
getLocalNode
()),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
.
sendText
(
testOID
,
"hello"
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
.
sendText
(
testOID
,
"hello"
,
1
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
.
sendText
(
testOID
,
"hello"
,
-
20
),
uniset
::
Exception
);
REQUIRE_THROWS_AS
(
ui
.
sendText
(
testOID
,
"hello"
,
1
,
-
20
),
uniset
::
Exception
);
CHECK_FALSE
(
ui
.
isExist
(
sid
)
);
CHECK_FALSE
(
ui
.
isExist
(
sid
)
);
CHECK_FALSE
(
ui
.
isExist
(
sid
,
DefaultObjectId
)
);
CHECK_FALSE
(
ui
.
isExist
(
sid
,
DefaultObjectId
)
);
...
...
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