include
scip2
response
reboot.h
Go to the documentation of this file.
1
/*
2
* Copyright 2020 The urg_stamped Authors
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#ifndef SCIP2_RESPONSE_REBOOT_H
18
#define SCIP2_RESPONSE_REBOOT_H
19
20
#include <boost/asio.hpp>
21
22
#include <string>
23
24
#include <
scip2/response/abstract.h
>
25
26
namespace
scip2
27
{
28
class
ResponseRB
:
public
Response
29
{
30
public
:
31
using
Callback
= boost::function<void(
32
const
boost::posix_time::ptime&,
33
const
std::string&,
34
const
std::string&)>;
35
36
protected
:
37
Callback
cb_
;
38
39
public
:
40
std::string
getCommandCode
()
const
41
{
42
return
std::string(
"RB"
);
43
}
44
void
operator()
(
45
const
boost::posix_time::ptime& time_read,
46
const
std::string& echo_back,
47
const
std::string& status,
48
std::istream& stream)
49
{
50
if
(
cb_
)
51
{
52
cb_
(time_read, echo_back, status);
53
}
54
readUntilEnd
(stream);
55
}
56
void
registerCallback
(
Callback
cb)
57
{
58
cb_
= cb;
59
}
60
};
61
62
}
// namespace scip2
63
64
#endif // SCIP2_RESPONSE_REBOOT_H
scip2::ResponseRB::Callback
boost::function< void(const boost::posix_time::ptime &, const std::string &, const std::string &)> Callback
Definition:
reboot.h:34
scip2::ResponseRB::registerCallback
void registerCallback(Callback cb)
Definition:
reboot.h:56
scip2::Response
Definition:
abstract.h:27
scip2::ResponseRB
Definition:
reboot.h:28
scip2::readUntilEnd
void readUntilEnd(std::istream &stream)
Definition:
abstract.h:39
scip2
Definition:
connection.h:30
scip2::ResponseRB::getCommandCode
std::string getCommandCode() const
Definition:
reboot.h:40
scip2::ResponseRB::operator()
void operator()(const boost::posix_time::ptime &time_read, const std::string &echo_back, const std::string &status, std::istream &stream)
Definition:
reboot.h:44
abstract.h
scip2::ResponseRB::cb_
Callback cb_
Definition:
reboot.h:37
urg_stamped
Author(s): Atsushi Watanabe
autogenerated on Wed Dec 18 2024 03:10:57