This commit is contained in:
Timur A. Fatkhullin 2024-11-06 00:15:20 +03:00
parent 4a20eecc02
commit 8d6e1bb59c
4 changed files with 8 additions and 4 deletions

View File

@ -237,7 +237,7 @@ public:
auto self(this->shared_from_this());
_netService.asyncReceive(
[self, this](std::error_code ec, message_t msg) {
[self, this](netservice_t::async_callback_err_t ec, message_t msg) {
if (ec) {
stop();
} else {
@ -249,7 +249,7 @@ public:
_netService.asyncSend(
*msg_sptr,
[self, msg_sptr, this](std::error_code ec) {
[self, msg_sptr, this](netservice_t::async_callback_err_t ec) {
if (ec) {
stop();
} else {

View File

@ -47,7 +47,7 @@ using adc_common_duration_t = adc_duration_common_type_t<std::chrono::nanosecond
std::chrono::months,
std::chrono::years>;
// concepts for asynchronous opereration callback callable first argument type (asynchronous operation error)
// concepts for asynchronous operation callback callable first argument type (asynchronous operation error)
// 1) the type must be convertible to boolean and
// a) true - asynchronous operation completed without errors
// b) false - an error occured
@ -106,6 +106,9 @@ concept adc_netservice_c = requires(SRVT srv, const SRVT srv_const) {
typename SRVT::endpoint_t; // a type representing endpoint of the network service
// underlying protocol
// asynchronous operation error
requires adc_async_callback_err_t<typename SRVT::async_callback_err_t>;
// callback callables for asynchronous operations
requires adc_async_callback_t<typename SRVT::async_connect_callback_t>;
requires adc_async_callback_t<typename SRVT::async_send_callback_t>;

View File

@ -9,7 +9,6 @@ ABSTRACT DEVICE COMPONENTS LIBRARY
#include <filesystem>
#include <functional>
#include <list>
#include <map>
#include <set>
#include <unordered_map>

View File

@ -134,6 +134,8 @@ public:
using endpoint_t = typename TRANSPORT_PROTOT::endpoint;
// typedefs for completion tokens (callbacks, required by 'adc_netservice_c' concept)
typedef std::error_code async_callback_err_t;
typedef std::function<void(std::error_code)> async_connect_callback_t;
typedef std::function<void(std::error_code)> async_send_callback_t;
typedef std::function<void(std::error_code, RMSGT)> async_receive_callback_t;