Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
Kestrel Collaboration
Kestrel Firmware
serial
Commits
0f75942f
Commit
0f75942f
authored
14 years ago
by
William Woodall
Browse files
Options
Download
Email Patches
Plain Diff
Cleaning up cout's
parent
f4430b48
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
6 deletions
+4
-6
serial/src/serial.cpp
serial/src/serial.cpp
+2
-4
serial/src/test_serial.cpp
serial/src/test_serial.cpp
+2
-2
No files found.
serial/src/serial.cpp
View file @
0f75942f
...
...
@@ -10,10 +10,10 @@ public:
template
<
typename
Error
>
bool
operator
()(
const
Error
&
err
,
std
::
size_t
bytes_transferred
)
{
std
::
cout
<<
"Here2"
<<
std
::
endl
;
if
(
err
)
{
// There is an Error
if
(
err
==
boost
::
asio
::
error
::
invalid_argument
)
std
::
cout
<<
"Invalid Argument Error"
<<
std
::
endl
;
if
(
err
==
boost
::
asio
::
error
::
operation_aborted
)
{
std
::
cout
<<
"Here1"
<<
std
::
endl
;
return
1
;
}
if
(
err
!=
boost
::
asio
::
error
::
invalid_argument
)
{
// The Error is not invalid argument
...
...
@@ -212,7 +212,6 @@ std::string Serial::read(int size) {
}
void
Serial
::
read_complete
(
const
boost
::
system
::
error_code
&
error
,
std
::
size_t
bytes_transferred
)
{
// std::cout << "Here2" << std::endl;
if
(
!
error
||
error
!=
boost
::
asio
::
error
::
operation_aborted
)
{
// If there was no error OR the error wasn't operation aborted (canceled), Cancel the timer
this
->
timeout_timer
->
cancel
();
// will cause timeout_callback to fire with an error
}
...
...
@@ -225,7 +224,6 @@ void Serial::read_complete(const boost::system::error_code& error, std::size_t b
void
Serial
::
timeout_callback
(
const
boost
::
system
::
error_code
&
error
)
{
if
(
!
error
)
{
// The timeout wasn't canceled, so cancel the async read
std
::
cout
<<
"Here3"
<<
std
::
endl
;
this
->
serial_port
->
cancel
();
}
}
...
...
This diff is collapsed.
Click to expand it.
serial/src/test_serial.cpp
View file @
0f75942f
...
...
@@ -30,7 +30,7 @@ int main(int argc, char **argv)
ros
::
NodeHandle
n
;
std
::
string
port
(
"/dev/tty
.usbserial-A900cfJA
"
);
std
::
string
port
(
"/dev/tty
USB0
"
);
// std::string port("/dev/tty.usbmodemfa141");
serial
=
new
Serial
(
port
,
9600
,
250
);
...
...
@@ -58,4 +58,4 @@ int main(int argc, char **argv)
}
return
0
;
}
\ No newline at end of file
}
This diff is collapsed.
Click to expand it.
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