Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Instrument Control
NomadSpecialModules
Commits
5de2e283
Commit
5de2e283
authored
Jul 13, 2016
by
yannick legoc
Browse files
Get the result array and wait for the log format.
parent
65d5beb5
Changes
6
Hide whitespace changes
Inline
Side-by-side
src/controllers/remotedielectrics/DielectricsRemoteMatlabReq.cpp
View file @
5de2e283
...
...
@@ -52,6 +52,8 @@ RemoteMatlabReq::RemoteMatlabReq(const std::string& name) :
initialized
.
init
(
this
,
NOSAVE
,
"initialized"
);
applicationState
.
init
(
this
,
NOSAVE
,
"matlab_state"
);
values
.
init
(
this
,
NOSAVE
,
"values"
);
requestTypeValues
.
init
(
this
,
NOSAVE
,
"request_type_values"
);
requestTypeValues
.
resize
(
4
);
...
...
@@ -211,7 +213,17 @@ void RemoteMatlabReq::start() {
proto
::
FrequencyResponse
response
;
response
.
ParseFromString
(
data
);
cout
<<
"received response "
<<
response
.
responseid
()
<<
endl
;
cout
<<
"received response "
<<
response
.
responseid
()
<<
" values "
<<
response
.
values_size
()
<<
endl
;
delete
[]
values
.
get
();
int32
*
newArray
=
new
int32
[
response
.
values_size
()];
for
(
int
i
=
0
;
i
<
response
.
values_size
();
++
i
)
{
newArray
[
i
]
=
response
.
values
(
i
);
}
values
.
set
(
newArray
);
values
.
setSize
(
response
.
values_size
());
sleep
(
1
);
...
...
src/controllers/remotedielectrics/DielectricsRemoteMatlabReq.h
View file @
5de2e283
...
...
@@ -62,6 +62,8 @@ public:
Property
<
bool
>
initialized
;
Property
<
int32
>
applicationState
;
ArrayProperty
<
int32
>
values
;
private:
bool
initApplication
();
void
stopApplication
();
...
...
src/controllers/remotedielectrics/FrequencyRequestMessages.pb.cc
View file @
5de2e283
...
...
@@ -497,6 +497,7 @@ void RunSpectrumsRequest::Swap(RunSpectrumsRequest* other) {
#ifndef _MSC_VER
const
int
FrequencyResponse
::
kResponseIdFieldNumber
;
const
int
FrequencyResponse
::
kValuesFieldNumber
;
#endif // !_MSC_VER
FrequencyResponse
::
FrequencyResponse
()
...
...
@@ -557,6 +558,7 @@ FrequencyResponse* FrequencyResponse::New() const {
void
FrequencyResponse
::
Clear
()
{
responseid_
=
0
;
values_
.
Clear
();
::
memset
(
_has_bits_
,
0
,
sizeof
(
_has_bits_
));
mutable_unknown_fields
()
->
clear
();
}
...
...
@@ -585,6 +587,24 @@ bool FrequencyResponse::MergePartialFromCodedStream(
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectTag
(
18
))
goto
parse_values
;
break
;
}
// repeated int32 values = 2 [packed = true];
case
2
:
{
if
(
tag
==
18
)
{
parse_values:
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadPackedPrimitive
<
::
google
::
protobuf
::
int32
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_INT32
>
(
input
,
this
->
mutable_values
())));
}
else
if
(
tag
==
16
)
{
DO_
((
::
google
::
protobuf
::
internal
::
WireFormatLite
::
ReadRepeatedPrimitiveNoInline
<
::
google
::
protobuf
::
int32
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
TYPE_INT32
>
(
1
,
18
,
input
,
this
->
mutable_values
())));
}
else
{
goto
handle_unusual
;
}
if
(
input
->
ExpectAtEnd
())
goto
success
;
break
;
}
...
...
@@ -619,6 +639,16 @@ void FrequencyResponse::SerializeWithCachedSizes(
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteInt32
(
1
,
this
->
responseid
(),
output
);
}
// repeated int32 values = 2 [packed = true];
if
(
this
->
values_size
()
>
0
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteTag
(
2
,
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WIRETYPE_LENGTH_DELIMITED
,
output
);
output
->
WriteVarint32
(
_values_cached_byte_size_
);
}
for
(
int
i
=
0
;
i
<
this
->
values_size
();
i
++
)
{
::
google
::
protobuf
::
internal
::
WireFormatLite
::
WriteInt32NoTag
(
this
->
values
(
i
),
output
);
}
output
->
WriteRaw
(
unknown_fields
().
data
(),
unknown_fields
().
size
());
// @@protoc_insertion_point(serialize_end:proto.FrequencyResponse)
...
...
@@ -636,6 +666,23 @@ int FrequencyResponse::ByteSize() const {
}
}
// repeated int32 values = 2 [packed = true];
{
int
data_size
=
0
;
for
(
int
i
=
0
;
i
<
this
->
values_size
();
i
++
)
{
data_size
+=
::
google
::
protobuf
::
internal
::
WireFormatLite
::
Int32Size
(
this
->
values
(
i
));
}
if
(
data_size
>
0
)
{
total_size
+=
1
+
::
google
::
protobuf
::
internal
::
WireFormatLite
::
Int32Size
(
data_size
);
}
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN
();
_values_cached_byte_size_
=
data_size
;
GOOGLE_SAFE_CONCURRENT_WRITES_END
();
total_size
+=
data_size
;
}
total_size
+=
unknown_fields
().
size
();
GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN
();
...
...
@@ -651,6 +698,7 @@ void FrequencyResponse::CheckTypeAndMergeFrom(
void
FrequencyResponse
::
MergeFrom
(
const
FrequencyResponse
&
from
)
{
GOOGLE_CHECK_NE
(
&
from
,
this
);
values_
.
MergeFrom
(
from
.
values_
);
if
(
from
.
_has_bits_
[
0
/
32
]
&
(
0xffu
<<
(
0
%
32
)))
{
if
(
from
.
has_responseid
())
{
set_responseid
(
from
.
responseid
());
...
...
@@ -674,6 +722,7 @@ bool FrequencyResponse::IsInitialized() const {
void
FrequencyResponse
::
Swap
(
FrequencyResponse
*
other
)
{
if
(
other
!=
this
)
{
std
::
swap
(
responseid_
,
other
->
responseid_
);
values_
.
Swap
(
&
other
->
values_
);
std
::
swap
(
_has_bits_
[
0
],
other
->
_has_bits_
[
0
]);
_unknown_fields_
.
swap
(
other
->
_unknown_fields_
);
std
::
swap
(
_cached_size_
,
other
->
_cached_size_
);
...
...
src/controllers/remotedielectrics/FrequencyRequestMessages.pb.h
View file @
5de2e283
...
...
@@ -291,6 +291,18 @@ class FrequencyResponse : public ::google::protobuf::MessageLite {
inline
::
google
::
protobuf
::
int32
responseid
()
const
;
inline
void
set_responseid
(
::
google
::
protobuf
::
int32
value
);
// repeated int32 values = 2 [packed = true];
inline
int
values_size
()
const
;
inline
void
clear_values
();
static
const
int
kValuesFieldNumber
=
2
;
inline
::
google
::
protobuf
::
int32
values
(
int
index
)
const
;
inline
void
set_values
(
int
index
,
::
google
::
protobuf
::
int32
value
);
inline
void
add_values
(
::
google
::
protobuf
::
int32
value
);
inline
const
::
google
::
protobuf
::
RepeatedField
<
::
google
::
protobuf
::
int32
>&
values
()
const
;
inline
::
google
::
protobuf
::
RepeatedField
<
::
google
::
protobuf
::
int32
>*
mutable_values
();
// @@protoc_insertion_point(class_scope:proto.FrequencyResponse)
private:
inline
void
set_has_responseid
();
...
...
@@ -300,6 +312,8 @@ class FrequencyResponse : public ::google::protobuf::MessageLite {
::
google
::
protobuf
::
uint32
_has_bits_
[
1
];
mutable
int
_cached_size_
;
::
google
::
protobuf
::
RepeatedField
<
::
google
::
protobuf
::
int32
>
values_
;
mutable
int
_values_cached_byte_size_
;
::
google
::
protobuf
::
int32
responseid_
;
#ifdef GOOGLE_PROTOBUF_NO_STATIC_INITIALIZER
friend
void
protobuf_AddDesc_FrequencyRequestMessages_2eproto_impl
();
...
...
@@ -568,6 +582,36 @@ inline void FrequencyResponse::set_responseid(::google::protobuf::int32 value) {
// @@protoc_insertion_point(field_set:proto.FrequencyResponse.responseId)
}
// repeated int32 values = 2 [packed = true];
inline
int
FrequencyResponse
::
values_size
()
const
{
return
values_
.
size
();
}
inline
void
FrequencyResponse
::
clear_values
()
{
values_
.
Clear
();
}
inline
::
google
::
protobuf
::
int32
FrequencyResponse
::
values
(
int
index
)
const
{
// @@protoc_insertion_point(field_get:proto.FrequencyResponse.values)
return
values_
.
Get
(
index
);
}
inline
void
FrequencyResponse
::
set_values
(
int
index
,
::
google
::
protobuf
::
int32
value
)
{
values_
.
Set
(
index
,
value
);
// @@protoc_insertion_point(field_set:proto.FrequencyResponse.values)
}
inline
void
FrequencyResponse
::
add_values
(
::
google
::
protobuf
::
int32
value
)
{
values_
.
Add
(
value
);
// @@protoc_insertion_point(field_add:proto.FrequencyResponse.values)
}
inline
const
::
google
::
protobuf
::
RepeatedField
<
::
google
::
protobuf
::
int32
>&
FrequencyResponse
::
values
()
const
{
// @@protoc_insertion_point(field_list:proto.FrequencyResponse.values)
return
values_
;
}
inline
::
google
::
protobuf
::
RepeatedField
<
::
google
::
protobuf
::
int32
>*
FrequencyResponse
::
mutable_values
()
{
// @@protoc_insertion_point(field_mutable_list:proto.FrequencyResponse.values)
return
&
values_
;
}
// @@protoc_insertion_point(namespace_scope)
...
...
src/controllers/remotedielectrics/FrequencyRequestMessages.proto
View file @
5de2e283
...
...
@@ -24,4 +24,5 @@ message RunSpectrumsRequest {
message
FrequencyResponse
{
required
int32
responseId
=
1
;
repeated
int32
values
=
2
[
packed
=
true
];
}
src/controllers/remotedielectrics/RunSpectrumsTest.cpp
View file @
5de2e283
...
...
@@ -49,6 +49,14 @@ void RunSpectrumsTest::start() {
matlabController
->
startCommand
();
log
(
Level
::
s_Info
)
<<
"Freq min "
<<
frMin
<<
" Freq Max "
<<
frMax
<<
" N Max "
<<
nMax
<<
" Comment "
<<
comment
<<
endlog
;
cout
<<
"values"
<<
endl
;
int32
size
=
matlabController
->
values
.
getSize
();
int32
*
values
=
matlabController
->
values
.
get
();
for
(
int32
i
=
0
;
i
<
size
;
++
i
)
{
cout
<<
values
[
i
]
<<
endl
;
}
}
}
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