10
10
#include " libcyphal/application/node.hpp"
11
11
#include " libcyphal/presentation/presentation.hpp"
12
12
#include " libcyphal/presentation/server.hpp"
13
+ #include " libcyphal/time_provider.hpp"
14
+ #include " libcyphal/transport/types.hpp"
13
15
#include " libcyphal/types.hpp"
14
16
15
17
#include < cetl/pf17/cetlpf.hpp>
@@ -52,9 +54,12 @@ class ExecCmdProvider // NOSONAR cpp:S4963
52
54
// /
53
55
// / @param node The application layer node instance. In use to access heartbeat producer.
54
56
// / @param presentation The presentation layer instance. In use to create 'ExecuteCommand' service server.
57
+ // / @param time_provider The time provider - in use to calculate RPC call deadlines.
55
58
// / @return The ExecuteCommand provider instance or a failure.
56
59
// /
57
- static auto make (libcyphal::application::Node& node, libcyphal::presentation::Presentation& presentation)
60
+ static auto make (libcyphal::application::Node& node,
61
+ libcyphal::presentation::Presentation& presentation,
62
+ libcyphal::ITimeProvider& time_provider)
58
63
-> libcyphal::Expected<Derived, libcyphal::presentation::Presentation::MakeFailure>
59
64
{
60
65
auto maybe_srv = presentation.makeServer <Service>();
@@ -63,7 +68,7 @@ class ExecCmdProvider // NOSONAR cpp:S4963
63
68
return std::move (*failure);
64
69
}
65
70
66
- return Derived{node, presentation, cetl::get<Server>(std::move (maybe_srv))};
71
+ return Derived{node, presentation, time_provider, cetl::get<Server>(std::move (maybe_srv))};
67
72
}
68
73
69
74
ExecCmdProvider (ExecCmdProvider&& other) noexcept
@@ -96,16 +101,19 @@ class ExecCmdProvider // NOSONAR cpp:S4963
96
101
// / The user should override the method to handle custom commands.
97
102
// / If the method returns `false`, the server will respond with a `STATUS_BAD_COMMAND` status.
98
103
// /
99
- // / @param command The command to be executed.
100
- // / @param parameter The command parameter.
101
- // / @param response The response to be sent back to the requester.
104
+ // / @param command The command to be executed.
105
+ // / @param parameter The command parameter.
106
+ // / @param metadata The transport RX metadata.
107
+ // / @param response The response to be sent back to the requester.
102
108
// /
103
- virtual bool onCommand (const Request::_traits_::TypeOf::command command,
104
- const cetl::string_view parameter,
105
- Response& response) noexcept
109
+ virtual bool onCommand (const Request::_traits_::TypeOf::command command,
110
+ const cetl::string_view parameter,
111
+ const libcyphal::transport::ServiceRxMetadata& metadata,
112
+ Response& response) noexcept
106
113
{
107
114
(void ) command;
108
115
(void ) parameter;
116
+ (void ) metadata;
109
117
(void ) response;
110
118
111
119
return false ;
@@ -126,7 +134,7 @@ class ExecCmdProvider // NOSONAR cpp:S4963
126
134
server_.setOnRequestCallback ([this ](const auto & arg, auto continuation) {
127
135
//
128
136
Response response{alloc_};
129
- if (!onCommand (arg.request .command , makeStringView (arg.request .parameter ), response))
137
+ if (!onCommand (arg.request .command , makeStringView (arg.request .parameter ), arg. metadata , response))
130
138
{
131
139
response.status = Response::STATUS_BAD_COMMAND;
132
140
}
0 commit comments