Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
E
Electrometers
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Software Control System
Tango devices
MeasureInstruments
lib
Electrometers
Commits
19f493cd
Commit
19f493cd
authored
14 years ago
by
ELATTAOUI
Browse files
Options
Downloads
Patches
Plain Diff
Novelec part : mcce2_off cmd fixed.
parent
5be6c9bc
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
include/NovelecProtocol.h
+4
-0
4 additions, 0 deletions
include/NovelecProtocol.h
pom.xml
+1
-1
1 addition, 1 deletion
pom.xml
src/NovelecProtocol.cpp
+52
-10
52 additions, 10 deletions
src/NovelecProtocol.cpp
with
57 additions
and
11 deletions
include/NovelecProtocol.h
+
4
−
0
View file @
19f493cd
...
@@ -116,6 +116,10 @@ protected :
...
@@ -116,6 +116,10 @@ protected :
std
::
string
check_and_extract_data
(
std
::
string
resp_to_check
,
short
command_sent
);
std
::
string
check_and_extract_data
(
std
::
string
resp_to_check
,
short
command_sent
);
private
:
private
:
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
void
is_allowed
();
//- if true, parameters cannot be changed !
//- if true, parameters cannot be changed !
bool
_is_measure_mode_on
;
bool
_is_measure_mode_on
;
//- if true, explicite response mode is enabled
//- if true, explicite response mode is enabled
...
...
This diff is collapsed.
Click to expand it.
pom.xml
+
1
−
1
View file @
19f493cd
...
@@ -8,7 +8,7 @@
...
@@ -8,7 +8,7 @@
</parent>
</parent>
<groupId>
fr.soleil.lib
</groupId>
<groupId>
fr.soleil.lib
</groupId>
<artifactId>
Electrometers-${aol}-${library}-${mode}
</artifactId>
<artifactId>
Electrometers-${aol}-${library}-${mode}
</artifactId>
<version>
2.5.
0
</version>
<version>
2.5.
1
</version>
<packaging>
nar
</packaging>
<packaging>
nar
</packaging>
<name>
Electrometers library
</name>
<name>
Electrometers library
</name>
<description>
Electrometers library
</description>
<description>
Electrometers library
</description>
...
...
This diff is collapsed.
Click to expand it.
src/NovelecProtocol.cpp
+
52
−
10
View file @
19f493cd
...
@@ -123,7 +123,8 @@ std::string tmp("no data");
...
@@ -123,7 +123,8 @@ std::string tmp("no data");
//- send cmd to have a explicite response :
//- send cmd to have a explicite response :
cmd_to_send
<<
_devAdd
<<
" MEASURE 1 "
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" MEASURE 1 "
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
//- check only the command response
//- check only the command response
check_command
(
tmp
);
check_command
(
tmp
);
_is_measure_mode_on
=
true
;
_is_measure_mode_on
=
true
;
...
@@ -142,10 +143,10 @@ std::string tmp("no data");
...
@@ -142,10 +143,10 @@ std::string tmp("no data");
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
//- check only the command response
//- check only the command response
check_command
(
tmp
);
check_command
(
tmp
);
_is_measure_mode_on
=
false
;
_is_measure_mode_on
=
false
;
}
}
// ============================================================================
// ============================================================================
...
@@ -157,6 +158,9 @@ std::stringstream cmd_to_send;
...
@@ -157,6 +158,9 @@ std::stringstream cmd_to_send;
std
::
string
argout
(
"no data"
);
std
::
string
argout
(
"no data"
);
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send command to Novelec device
//- send command to Novelec device
cmd_to_send
<<
_devAdd
<<
" READ "
<<
MODE_CMD_NUM
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" READ "
<<
MODE_CMD_NUM
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -215,7 +219,10 @@ std::stringstream cmd_to_send;
...
@@ -215,7 +219,10 @@ std::stringstream cmd_to_send;
std
::
string
cmdNumber
(
" 1"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
cmdNumber
(
" 1"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- send cmd to have a explicite response :
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send cmd to have a explicite response :
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
//- check only the command response
//- check only the command response
...
@@ -231,6 +238,9 @@ std::stringstream cmd_to_send;
...
@@ -231,6 +238,9 @@ std::stringstream cmd_to_send;
std
::
string
cmdNumber
(
" 2"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
cmdNumber
(
" 2"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send cmd to have a explicite response :
//- send cmd to have a explicite response :
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -247,6 +257,9 @@ std::stringstream cmd_to_send;
...
@@ -247,6 +257,9 @@ std::stringstream cmd_to_send;
std
::
string
cmdNumber
(
" 3"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
cmdNumber
(
" 3"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send cmd to have a explicite response :
//- send cmd to have a explicite response :
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -263,6 +276,9 @@ std::stringstream cmd_to_send;
...
@@ -263,6 +276,9 @@ std::stringstream cmd_to_send;
std
::
string
cmdNumber
(
" 4"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
cmdNumber
(
" 4"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send cmd to have a explicite response :
//- send cmd to have a explicite response :
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -279,6 +295,9 @@ std::stringstream cmd_to_send;
...
@@ -279,6 +295,9 @@ std::stringstream cmd_to_send;
std
::
string
cmdNumber
(
" 5"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
cmdNumber
(
" 5"
);
//- PROG 1 -> = PROG FUNCTION
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send cmd to have a explicite response :
//- send cmd to have a explicite response :
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" PROG 1 "
<<
cmdNumber
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -320,6 +339,9 @@ void NovelecProtocol::set_range (std::string value)
...
@@ -320,6 +339,9 @@ void NovelecProtocol::set_range (std::string value)
std
::
stringstream
cmd_to_send
;
std
::
stringstream
cmd_to_send
;
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send command to Novelec device
//- send command to Novelec device
cmd_to_send
<<
_devAdd
<<
" PROG "
<<
_rangeParameterNum
<<
" "
<<
value
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" PROG "
<<
_rangeParameterNum
<<
" "
<<
value
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -364,6 +386,9 @@ void NovelecProtocol::set_polarity (std::string newPolarity)
...
@@ -364,6 +386,9 @@ void NovelecProtocol::set_polarity (std::string newPolarity)
std
::
stringstream
cmd_to_send
;
std
::
stringstream
cmd_to_send
;
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send command to Novelec device
//- send command to Novelec device
cmd_to_send
<<
_devAdd
<<
" PROG 2"
<<
" "
<<
newPolarity
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" PROG 2"
<<
" "
<<
newPolarity
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -405,6 +430,9 @@ void NovelecProtocol::set_frequency (std::string newFrequency)
...
@@ -405,6 +430,9 @@ void NovelecProtocol::set_frequency (std::string newFrequency)
std
::
stringstream
cmd_to_send
;
std
::
stringstream
cmd_to_send
;
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send command to Novelec device
//- send command to Novelec device
cmd_to_send
<<
_devAdd
<<
" PROG 9"
<<
" "
<<
newFrequency
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" PROG 9"
<<
" "
<<
newFrequency
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -448,6 +476,9 @@ void NovelecProtocol::set_gain (std::string newGain)
...
@@ -448,6 +476,9 @@ void NovelecProtocol::set_gain (std::string newGain)
std
::
stringstream
cmd_to_send
;
std
::
stringstream
cmd_to_send
;
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send command to Novelec device
//- send command to Novelec device
cmd_to_send
<<
_devAdd
<<
" PROG 8"
<<
" "
<<
newGain
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" PROG 8"
<<
" "
<<
newGain
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -517,6 +548,9 @@ void NovelecProtocol::local (void)
...
@@ -517,6 +548,9 @@ void NovelecProtocol::local (void)
std
::
stringstream
cmd_to_send
;
std
::
stringstream
cmd_to_send
;
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send command
//- send command
cmd_to_send
<<
_devAdd
<<
" LOCAL"
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" LOCAL"
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -533,6 +567,9 @@ void NovelecProtocol::remote (void)
...
@@ -533,6 +567,9 @@ void NovelecProtocol::remote (void)
std
::
stringstream
cmd_to_send
;
std
::
stringstream
cmd_to_send
;
std
::
string
tmp
(
"no data"
);
std
::
string
tmp
(
"no data"
);
//- check if the MCCE2 is not in MEASURE mode to get/change any settings
this
->
is_allowed
();
//- send command
//- send command
cmd_to_send
<<
_devAdd
<<
" REMOTE"
<<
END_OF_LINE
<<
std
::
endl
;
cmd_to_send
<<
_devAdd
<<
" REMOTE"
<<
END_OF_LINE
<<
std
::
endl
;
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
tmp
=
_communication_link
->
write_read
(
cmd_to_send
.
str
());
...
@@ -575,6 +612,17 @@ std::string tmp("no data");
...
@@ -575,6 +612,17 @@ std::string tmp("no data");
check_command
(
tmp
);
check_command
(
tmp
);
}
}
// ============================================================================
// NovelecProtocol::is_allowed
// ============================================================================
void
NovelecProtocol
::
is_allowed
(
void
)
{
if
(
this
->
_is_measure_mode_on
)
throw
electrometer
::
ElectrometerException
(
"COMMAND_NOT_ALLOWED"
,
"Cannot change parameter(s) when MEASURE mode enabled : call MCCE2_OFF command."
,
"NovelecProtocol::check_command( )."
);
}
// ============================================================================
// ============================================================================
// NovelecProtocol::check_command
// NovelecProtocol::check_command
// This method read the device response and check and throw an
// This method read the device response and check and throw an
...
@@ -588,12 +636,6 @@ std::string data;
...
@@ -588,12 +636,6 @@ std::string data;
//- A correct response is :
//- A correct response is :
// -> "address ACK " : if command well understood
// -> "address ACK " : if command well understood
//- An invalid response is: "address NAK ..."
//- An invalid response is: "address NAK ..."
if
(
_is_measure_mode_on
)
throw
electrometer
::
ElectrometerException
(
"COMMAND_NOT_ALLOWED"
,
"Cannot change parameter(s) when MEASURE mode enabled."
,
"NovelecProtocol::check_command( )."
);
if
(
response
.
find
(
"NAK"
)
!=
std
::
string
::
npos
)
if
(
response
.
find
(
"NAK"
)
!=
std
::
string
::
npos
)
{
{
throw
electrometer
::
ElectrometerException
(
"COMMAND_NOT_UNDERSTOOD"
,
throw
electrometer
::
ElectrometerException
(
"COMMAND_NOT_UNDERSTOOD"
,
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment