26#if !LELY_NO_COAPP_MASTER
34BasicLogicalDriver<BasicDriver>::BasicLogicalDriver(
BasicDriver& driver_,
35 int num, uint32_t dev)
36 : master(driver_.master),
40 tpdo_event_mutex(driver_.tpdo_event_mutex),
46BasicLogicalDriver<BasicDriver>::~BasicLogicalDriver() { driver.Erase(*
this); }
49BasicLogicalDriver<BasicDriver>::AsyncConfig() {
54 auto read_67ff = [
this]() {
63 auto check_1000 = [
this, read_67ff](uint32_t value) ->
SdoFuture<void> {
64 if ((value) >> 16 == 0xffff)
return read_67ff();
71 auto value =
driver.master[0x1f84][
driver.id()].Read<uint32_t>(ec);
73 f = check_1000(value);
94 OnConfig([p](::std::error_code ec)
mutable {
95 p.
set(::std::make_exception_ptr(::std::system_error(ec,
"OnConfig")));
102BasicLogicalDriver<BasicDriver>::AsyncDeconfig() {
106 OnDeconfig([p](::std::error_code ec)
mutable {
107 p.
set(::std::make_exception_ptr(::std::system_error(ec,
"OnDeconfig")));
The base class for drivers for remote CANopen nodes.
void OnConfig(::std::function< void(::std::error_code ec)> res) noexcept override
The function invoked when the 'update configuration' step is reached during the NMT 'boot slave' proc...
SdoFuture< T > AsyncRead(uint16_t idx, uint8_t subidx)
Equivalent to AsyncRead(uint16_t idx, uint8_t subidx, const ::std::chrono::milliseconds& timeout),...
BasicDriver & driver
A reference to the driver with which this logical device driver is registered.
void OnDeconfig(::std::function< void(::std::error_code ec)> res) noexcept override
The function invoked by BasicMaster::AsyncDeconfig() to start the deconfiguration process.
ev::Executor GetExecutor() const noexcept final
Returns the executor used to execute event handlers for this driver, including SDO confirmation funct...
AsyncTask< F, Future >::future_type then(ev_exec_t *exec, F &&f)
Attaches a continuation function to a future and returns a new future which becomes ready once the co...
result_type & get()
Returns the result of a ready future.
Future< T, E > get_future() const noexcept
Returns a lely::ev::Future with (a reference to) the same shared state as *this.
bool set(U &&u)
Satisfies a promise, if it was not aready satisfied, and stores the specified value as the result in ...
value_type & value()
Returns a reference to the value if *this contains a value, and throws an exception if *this contains...
This is the internal header file of the C++ CANopen application library.
This header file is part of the C++ CANopen application library; it contains the logical device drive...
The namespace for the C++ CANopen application library.
SdoFuture< void > make_empty_sdo_future()
Returns an SDO future with a shared state that is immediately ready, containing a successful result o...
ev::Promise< T, ::std::exception_ptr > SdoPromise
A helper alias template for the type of promise used to store the result of an asynchronous SDO reque...
ev::Future< T, ::std::exception_ptr > SdoFuture
A helper alias template for the type of future used to retrieve the result of an asynchronous SDO req...