Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cla_prosim_driver
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
fmg005
cla_prosim_driver
Commits
01327d56
Commit
01327d56
authored
Apr 29, 2018
by
fmg005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added example code
parent
ec58d407
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
14 deletions
+43
-14
example.cpp
example.cpp
+43
-14
No files found.
example.cpp
View file @
01327d56
...
...
@@ -10,32 +10,61 @@
using
namespace
std
;
int
main
()
{
/*serial instance arguments*/
std
::
string
port
=
"/dev/ttyUSB0"
;
// arbitrary port
std
::
string
port
=
"/dev/ttyACM0"
;
uint32_t
baudrate
=
115200
;
serial
::
Timeout
timeout
=
serial
::
Timeout
();
serial
::
bytesize_t
bytesize
=
serial
::
eightbits
;
serial
::
parity_t
parity
=
serial
::
parity_none
;
serial
::
stopbits_t
stopbits
=
serial
::
stopbits_one
;
serial
::
flowcontrol_t
flowcontrol
=
serial
::
flowcontrol_hardware
;
/*end serial instance arguments*/
CLA
::
LOGGER
logger
(
"mylog.log"
);
// or CLA::LOGGER logger; /* for timestamped logs */
serial
::
Serial
myserial
(
port
,
baudrate
,
timeout
,
bytesize
,
parity
,
stopbits
,
flowcontrol
);
CLA
::
LOGGER
logger
;
serial
::
Serial
myserial
(
port
,
baudrate
,
timeout
,
bytesize
,
parity
,
stopbits
,
flowcontrol
);
HardwareSimulator
simulator
(
&
myserial
,
&
logger
);
/*
Do stuff with simulator object
*/
while
(
true
)
{
string
s_input
;
int
input
;
size_t
*
int_sz
;
cout
<<
"Select number to switch states"
<<
endl
;
cout
<<
"1.Remote Mode
\n
2.Local Mode
\n
3.Set IBP
\n
4.Get Mode
\n
5.Quit
\n\n
"
;
getline
(
cin
,
s_input
);
input
=
stoi
(
s_input
,
int_sz
);
if
(
input
==
1
)
{
simulator
.
SetRemoteMode
();
cout
<<
"
\n
"
;
}
else
if
(
input
==
2
)
{
simulator
.
SetLocalMode
();
cout
<<
"
\n
"
;
}
else
if
(
input
==
3
)
{
double
sys
;
double
diast
;
string
sys_string
;
string
diast_string
;
size_t
*
sz
;
cout
<<
"Enter the systolic pressure: "
;
getline
(
cin
,
sys_string
);
sys
=
stod
(
sys_string
,
sz
);
cout
<<
"Enter the diastolic pressure: "
;
getline
(
cin
,
diast_string
);
diast
=
stod
(
diast_string
,
sz
);
simulator
.
SetIBP
(
1
,
sys
,
diast
);
cout
<<
"
\n
"
;
}
else
if
(
input
==
4
)
{
cout
<<
"Device is currently in "
<<
simulator
.
GetCurrentMode
()
<<
" mode
\n\n
"
;
}
else
if
(
input
==
5
)
{
break
;
}
}
return
0
;
}
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