26 #if !LELY_NO_COAPP_MASTER 34 BasicLogicalDriver<BasicDriver>::BasicLogicalDriver(BasicDriver& driver_,
35 int num, uint32_t dev)
36 : master(driver_.master),
40 tpdo_event_mutex(driver_.tpdo_event_mutex),
46 BasicLogicalDriver<BasicDriver>::~BasicLogicalDriver() { driver.Erase(*
this); }
49 BasicLogicalDriver<BasicDriver>::AsyncConfig() {
54 auto read_67ff = [
this]() {
55 return AsyncRead<uint32_t>(0x67ff, 0).then(
57 [
this](SdoFuture<uint32_t> f) { dev_ = f.get().value(); });
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);
77 f = AsyncRead<uint32_t>(0x1000, 0).then(
78 GetExecutor(), [
this, check_1000](SdoFuture<uint32_t> f) {
79 return check_1000(f.get().value());
89 return f.then(
GetExecutor(), [
this](SdoFuture<void> f) {
94 OnConfig([p](::std::error_code ec)
mutable {
95 p.set(::std::make_exception_ptr(::std::system_error(ec,
"OnConfig")));
97 return p.get_future();
102 BasicLogicalDriver<BasicDriver>::AsyncDeconfig() {
106 OnDeconfig([p](::std::error_code ec)
mutable {
107 p.set(::std::make_exception_ptr(::std::system_error(ec,
"OnDeconfig")));
110 return p.get_future();
117 #endif // !LELY_NO_COAPP_MASTER ev::Executor GetExecutor() const noexcept final
Returns the executor used to execute event handlers for this driver, including SDO confirmation funct...
This is the internal header file of the C++ CANopen application library.
void post(ev_task &task) noexcept
void OnDeconfig(::std::function< void(::std::error_code ec)> res) noexcept override
The default implementation invokes AsyncDeconfig() to start the deconfiguration process for all regis...
This header file is part of the C++ CANopen application library; it contains the logical device drive...
SdoFuture< void > make_empty_sdo_future()
Returns an SDO future with a shared state that is immediately ready, containing a successful result o...
void OnConfig(::std::function< void(::std::error_code ec)> res) noexcept override
The default implementation invokes AsyncConfig() to start the configuration process for all registere...