24 #ifndef LELY_COAPP_LSS_MASTER_HPP_
25 #define LELY_COAPP_LSS_MASTER_HPP_
62 LssAddress(uint32_t vendor_id_ = 0, uint32_t product_code_ = 0,
63 uint32_t revision_ = 0, uint32_t serial_nr_ = 0)
115 ::std::error_code
ec{};
118 virtual void operator()() noexcept = 0;
120 virtual
void OnRequest(
void* data) noexcept = 0;
125 using LssRequestBase::LssRequestBase;
131 void OnRequest(
void* data) noexcept
final;
136 using LssRequestBase::LssRequestBase;
145 void OnRequest(
void* data) noexcept
final;
150 using LssRequestBase::LssRequestBase;
156 void OnRequest(
void* data) noexcept
final;
161 using LssRequestBase::LssRequestBase;
167 void OnRequest(
void* data) noexcept
final;
172 using LssRequestBase::LssRequestBase;
181 void OnRequest(
void* data) noexcept
final;
186 using LssRequestBase::LssRequestBase;
189 void OnRequest(
void* data) noexcept
final;
194 using LssRequestBase::LssRequestBase;
202 using LssGetNumberRequestBase::LssGetNumberRequestBase;
205 void OnRequest(
void* data) noexcept
final;
210 using LssGetNumberRequestBase::LssGetNumberRequestBase;
213 void OnRequest(
void* data) noexcept
final;
218 using LssGetNumberRequestBase::LssGetNumberRequestBase;
221 void OnRequest(
void* data) noexcept
final;
226 using LssGetNumberRequestBase::LssGetNumberRequestBase;
229 void OnRequest(
void* data) noexcept
final;
234 using LssRequestBase::LssRequestBase;
240 void OnRequest(
void* data) noexcept
final;
245 using LssRequestBase::LssRequestBase;
248 void OnRequest(
void* data) noexcept
final;
253 using LssRequestBase::LssRequestBase;
264 using LssScanRequestBase::LssScanRequestBase;
275 void OnRequest(
void* data) noexcept
final;
280 using LssScanRequestBase::LssScanRequestBase;
290 void OnRequest(
void* data) noexcept
final;
315 : detail::LssSwitchRequestBase(exec), con_(::std::forward<F>(con)) {}
324 operator()() noexcept final {
328 ::std::function<Signature> con_;
351 : detail::LssSwitchSelectiveRequestBase(exec),
352 con_(::std::forward<F>(con)) {}
361 operator()() noexcept final {
365 ::std::function<Signature> con_;
388 : detail::LssSetIdRequestBase(exec), con_(::std::forward<F>(con)) {}
397 operator()() noexcept final {
401 ::std::function<Signature> con_;
424 : detail::LssSetBitrateRequestBase(exec), con_(::std::forward<F>(con)) {}
433 operator()() noexcept final {
437 ::std::function<Signature> con_;
460 : detail::LssSwitchBitrateRequestBase(exec),
461 con_(::std::forward<F>(con)) {}
470 operator()() noexcept final {
474 ::std::function<Signature> con_;
496 : detail::LssStoreRequestBase(exec), con_(::std::forward<F>(con)) {}
505 operator()() noexcept final {
509 ::std::function<Signature> con_;
525 using Signature = void(::std::error_code ec, uint32_t number);
533 : detail::LssGetVendorIdRequestBase(exec), con_(::std::forward<F>(con)) {}
542 operator()() noexcept final {
543 if (con_) con_(ec, number);
546 ::std::function<Signature> con_;
562 using Signature = void(::std::error_code ec, uint32_t number);
570 : detail::LssGetProductCodeRequestBase(exec),
571 con_(::std::forward<F>(con)) {}
580 operator()() noexcept final {
581 if (con_) con_(ec, number);
584 ::std::function<Signature> con_;
600 using Signature = void(::std::error_code ec, uint32_t number);
608 : detail::LssGetRevisionRequestBase(exec), con_(::std::forward<F>(con)) {}
617 operator()() noexcept final {
618 if (con_) con_(ec, number);
621 ::std::function<Signature> con_;
637 using Signature = void(::std::error_code ec, uint32_t number);
645 : detail::LssGetSerialNrRequestBase(exec), con_(::std::forward<F>(con)) {}
654 operator()() noexcept final {
655 if (con_) con_(ec, number);
658 ::std::function<Signature> con_;
673 using Signature = void(::std::error_code ec, uint8_t
id);
681 : detail::LssGetIdRequestBase(exec), con_(::std::forward<F>(con)) {}
690 operator()() noexcept final {
691 if (con_) con_(ec,
id);
694 ::std::function<Signature> con_;
710 using Signature = void(::std::error_code ec,
bool found);
718 : detail::LssStoreRequestBase(exec), con_(::std::forward<F>(con)) {}
727 operator()() noexcept final {
730 if (ec == ::std::errc::timed_out) ec.clear();
731 if (con_) con_(ec, found);
734 ::std::function<Signature> con_;
758 : detail::LssSlowscanRequestBase(exec), con_(::std::forward<F>(con)) {}
767 operator()() noexcept final {
768 if (con_) con_(ec, address);
771 ::std::function<Signature> con_;
796 : detail::LssFastscanRequestBase(exec), con_(::std::forward<F>(con)) {}
805 operator()() noexcept final {
806 if (con_) con_(ec, address);
809 ::std::function<Signature> con_;
824 operator()() noexcept
final {
825 compat::invoke(::std::move(con_), ec);
829 typename ::std::decay<F>::type con_;
838 this->address = address;
843 operator()() noexcept
final {
844 compat::invoke(::std::move(con_), ec);
848 typename ::std::decay<F>::type con_;
861 operator()() noexcept
final {
862 compat::invoke(::std::move(con_), ec);
866 typename ::std::decay<F>::type con_;
874 this->bitrate = bitrate;
879 operator()() noexcept
final {
880 compat::invoke(::std::move(con_), ec);
884 typename ::std::decay<F>::type con_;
897 operator()() noexcept
final {
898 compat::invoke(::std::move(con_), ec);
902 typename ::std::decay<F>::type con_;
913 operator()() noexcept
final {
914 compat::invoke(::std::move(con_), ec);
918 typename ::std::decay<F>::type con_;
929 operator()() noexcept
final {
930 compat::invoke(::std::move(con_), ec, number);
934 typename ::std::decay<F>::type con_;
945 operator()() noexcept
final {
946 compat::invoke(::std::move(con_), ec, number);
950 typename ::std::decay<F>::type con_;
961 operator()() noexcept
final {
962 compat::invoke(::std::move(con_), ec, number);
966 typename ::std::decay<F>::type con_;
977 operator()() noexcept
final {
978 compat::invoke(::std::move(con_), ec, number);
982 typename ::std::decay<F>::type con_;
993 operator()() noexcept
final {
994 compat::invoke(::std::move(con_), ec,
id);
998 typename ::std::decay<F>::type con_;
1009 operator()() noexcept
final {
1012 if (ec == ::std::errc::timed_out) ec.clear();
1013 compat::invoke(::std::move(con_), ec, found);
1017 typename ::std::decay<F>::type con_;
1032 operator()() noexcept
final {
1033 compat::invoke(::std::move(con_), ec, address);
1037 typename ::std::decay<F>::type con_;
1046 this->address = address;
1052 operator()() noexcept
final {
1053 compat::invoke(::std::move(con_), ec, address);
1057 typename ::std::decay<F>::type con_;
1074 inline typename ::std::enable_if<
1080 ::std::forward<F>(con));
1095 inline typename ::std::enable_if<
1097 detail::LssSwitchSelectiveRequestWrapper<F>*>::type
1101 exec, address, ::std::forward<F>(con));
1116 inline typename ::std::enable_if<
1118 detail::LssSetIdRequestWrapper<F>*>::type
1122 ::std::forward<F>(con));
1138 inline typename ::std::enable_if<
1140 detail::LssSetBitrateRequestWrapper<F>*>::type
1144 ::std::forward<F>(con));
1160 inline typename ::std::enable_if<
1162 detail::LssSwitchBitrateRequestWrapper<F>*>::type
1166 ::std::forward<F>(con));
1180 inline typename ::std::enable_if<
1182 detail::LssStoreRequestWrapper<F>*>::type
1198 inline typename ::std::enable_if<
1200 detail::LssGetVendorIdRequestWrapper<F>*>::type
1203 ::std::forward<F>(con));
1216 inline typename ::std::enable_if<
1218 detail::LssGetProductCodeRequestWrapper<F>*>::type
1221 ::std::forward<F>(con));
1234 inline typename ::std::enable_if<
1236 detail::LssGetRevisionRequestWrapper<F>*>::type
1239 ::std::forward<F>(con));
1252 inline typename ::std::enable_if<
1254 detail::LssGetSerialNrRequestWrapper<F>*>::type
1257 ::std::forward<F>(con));
1270 inline typename ::std::enable_if<
1272 detail::LssGetIdRequestWrapper<F>*>::type
1288 inline typename ::std::enable_if<
1290 detail::LssIdNonConfigRequestWrapper<F>*>::type
1294 ::std::forward<F>(con));
1310 inline typename ::std::enable_if<
1312 detail::LssSlowscanRequestWrapper<F>*>::type
1316 ::std::forward<F>(con));
1335 inline typename ::std::enable_if<
1337 detail::LssFastscanRequestWrapper<F>*>::type
1341 ::std::forward<F>(con));
1395 Node& GetNode() const noexcept;
1401 io::CanControllerBase* GetController() const noexcept;
1404 ::std::chrono::microseconds GetInhibit() const;
1407 void SetInhibit(const ::std::chrono::microseconds& inhibit);
1414 ::std::chrono::milliseconds GetTimeout() const;
1421 void SetTimeout(const ::std::chrono::milliseconds& timeout);
1431 SubmitSwitch(detail::LssSwitchRequestBase& req,
1456 SubmitSwitch(
nullptr, state, ::std::forward<F>(con));
1491 return AsyncSwitch(
nullptr, state, preq);
1524 ::std::forward<F>(con)));
1531 SubmitSwitchSelective(
nullptr, address, ::std::forward<F>(con));
1567 return AsyncSwitchSelective(
nullptr, address, preq);
1606 SubmitSetId(
nullptr,
id, ::std::forward<F>(con));
1641 return AsyncSetId(
nullptr,
id, preq);
1683 SubmitSetBitrate(
nullptr, bitrate, ::std::forward<F>(con));
1721 return AsyncSetBitrate(
nullptr, bitrate, preq);
1763 SubmitSwitchBitrate(
nullptr, delay, ::std::forward<F>(con));
1801 return AsyncSwitchBitrate(
nullptr, delay, preq);
1835 SubmitStore(
nullptr, ::std::forward<F>(con));
1869 return AsyncStore(
nullptr, preq);
1903 SubmitGetVendorId(
nullptr, ::std::forward<F>(con));
1937 return AsyncGetVendorId(
nullptr, preq);
1971 SubmitGetProductCode(
nullptr, ::std::forward<F>(con));
2005 return AsyncGetProductCode(
nullptr, preq);
2039 SubmitGetRevision(
nullptr, ::std::forward<F>(con));
2073 return AsyncGetRevision(
nullptr, preq);
2107 SubmitGetSerialNr(
nullptr, ::std::forward<F>(con));
2141 return AsyncGetSerialNr(
nullptr, preq);
2174 SubmitGetId(
nullptr, ::std::forward<F>(con));
2208 return AsyncGetId(
nullptr, preq);
2240 SubmitIdNonConfig(
nullptr, ::std::forward<F>(con));
2277 return AsyncIdNonConfig(
nullptr, preq);
2322 SubmitSlowscan(
nullptr, ::std::forward<F>(con));
2360 return AsyncSlowscan(
nullptr, lo, hi, preq);
2404 ::std::forward<F>(con)));
2411 SubmitFastscan(
nullptr, ::std::forward<F>(con));
2446 const LssAddress& mask = {0, 0, 0, 0},
2447 detail::LssFastscanRequestBase** preq =
nullptr);
2450 LssFuture<LssAddress>
2453 detail::LssFastscanRequestBase** preq =
nullptr) {
2454 return AsyncFastscan(
nullptr, address, mask, preq);
2458 void Submit(detail::LssRequestBase& req);
2467 bool Cancel(detail::LssRequestBase& req);
2476 ::std::size_t CancelAll();
2485 bool Abort(detail::LssRequestBase& req);
2493 ::std::size_t AbortAll();
2507 OnStart(::std::function<
void(::std::error_code ec)> res) noexcept {
2508 res(::std::error_code{});
2529 virtual void OnSwitchBitrate(
2530 int bitrate, ::std::chrono::milliseconds delay,
2531 ::std::function<
void(::std::error_code ec)> res) noexcept;
2535 void unlock() final;
2545 ::std::unique_ptr<Impl_> impl_;
An 'LSS Fastscan' request.
void(::std::error_code ec, LssAddress address) Signature
The signature of the callback function invoked on completion of an 'LSS Fastscan' request.
LssFastscanRequest(ev_exec_t *exec, F &&con)
Constructs an empty 'LSS Fastscan' request with a completion task.
LssFastscanRequest(F &&con)
Equivalent to LssSlowscanRequest(nullptr, con).
An LSS 'inquire node-ID' request.
LssGetIdRequest(F &&con)
Equivalent to LssGetIdRequest(nullptr, con).
void(::std::error_code ec, uint8_t id) Signature
The signature of the callback function invoked on completion of an LSS 'inquire node-ID' request.
LssGetIdRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'store configuration' request with a completion task.
An LSS 'inquire identity product-code' request.
void(::std::error_code ec, uint32_t number) Signature
The signature of the callback function invoked on completion of an LSS 'inquire identity product-code...
LssGetProductCodeRequest(F &&con)
Equivalent to LssGetProductCodeRequest(nullptr, con).
LssGetProductCodeRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'store configuration' request with a completion task.
An LSS 'inquire identity revision-number' request.
void(::std::error_code ec, uint32_t number) Signature
The signature of the callback function invoked on completion of an LSS 'inquire identity revision-num...
LssGetRevisionRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'store configuration' request with a completion task.
LssGetRevisionRequest(F &&con)
Equivalent to LssGetRevisionRequest(nullptr, con).
An LSS 'inquire identity serial-number' request.
LssGetSerialNrRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'store configuration' request with a completion task.
void(::std::error_code ec, uint32_t number) Signature
The signature of the callback function invoked on completion of an LSS 'inquire identity serial-numbe...
LssGetSerialNrRequest(F &&con)
Equivalent to LssGetSerialNrRequest(nullptr, con).
An LSS 'inquire identity vendor-ID' request.
LssGetVendorIdRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'store configuration' request with a completion task.
LssGetVendorIdRequest(F &&con)
Equivalent to LssGetVendorIdRequest(nullptr, con).
void(::std::error_code ec, uint32_t number) Signature
The signature of the callback function invoked on completion of an LSS 'inquire identity vendor-ID' r...
An LSS 'identify non-configured remote slave' request.
LssIdNonConfigRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'identify non-configured remote slave' request with a completion task.
LssIdNonConfigRequest(F &&con)
Equivalent to LssIdNonConfigRequest(nullptr, con).
void(::std::error_code ec, bool found) Signature
The signature of the callback function invoked on completion of an LSS 'identify non-configured remot...
The base class for CANopen LSS masters.
void SubmitIdNonConfig(F &&con)
Equivalent to SubmitIdNonConfig(nullptr, con).
LssFuture< uint32_t > AsyncGetVendorId(detail::LssGetVendorIdRequestBase **preq=nullptr)
Equivalent to AsyncGetVendorId(nullptr, preq).
void SubmitSlowscan(ev_exec_t *exec, const LssAddress &lo, const LssAddress &hi, F &&con)
Creates and queues an 'LSS Slowscan' request.
LssFuture< bool > AsyncIdNonConfig(detail::LssIdNonConfigRequestBase **preq=nullptr)
Equivalent to AsyncIdNonConfig(nullptr, preq).
void SubmitGetProductCode(detail::LssGetProductCodeRequestBase &req)
Queues an LSS 'inquire identity product-code' request.
void SubmitSetBitrate(int bitrate, F &&con)
Equivalent to SubmitSetBitrate(nullptr, id, con).
void SubmitSwitch(ev_exec_t *exec, LssState state, F &&con)
Creates and queues an LSS 'switch state global' request.
void SubmitStore(F &&con)
Equivalent to SubmitStore(nullptr, con).
bool AbortSwitchBitrate(detail::LssSwitchBitrateRequestBase &req)
Aborts an LSS 'activate bit timing parameters' request.
LssFuture< LssAddress > AsyncSlowscan(const LssAddress &lo, const LssAddress &hi, detail::LssSlowscanRequestBase **preq=nullptr)
Equivalent to AsyncSlowscan(nullptr, lo, hi, preq).
LssFuture< void > AsyncSetBitrate(int bitrate, detail::LssSetBitrateRequestBase **preq=nullptr)
Equivalent to AsyncSetBitrate(nullptr, id, preq).
void SubmitFastscan(detail::LssFastscanRequestBase &req, const LssAddress &address, const LssAddress &mask)
Queues an 'LSS Fastscan' request.
void SubmitStore(detail::LssStoreRequestBase &req)
Queues an LSS 'store configuration' request.
bool AbortStore(detail::LssStoreRequestBase &req)
Aborts an LSS 'store configuration' request.
void SubmitSlowscan(F &&con)
Equivalent to SubmitSlowscan(nullptr, con).
bool AbortSetId(detail::LssSetIdRequestBase &req)
Aborts an LSS 'configure node-ID' request.
void SubmitGetId(detail::LssGetIdRequestBase &req)
Queues an LSS 'inquire node-ID' request.
bool CancelGetProductCode(detail::LssGetProductCodeRequestBase &req)
Cancels an LSS 'inquire identity product-code' request.
LssFuture< uint32_t > AsyncGetProductCode(detail::LssGetProductCodeRequestBase **preq=nullptr)
Equivalent to AsyncGetProductCode(nullptr, preq).
bool CancelGetSerialNr(detail::LssGetSerialNrRequestBase &req)
Cancels an LSS 'inquire identity serial-number' request.
bool CancelSetId(detail::LssSetIdRequestBase &req)
Cancels an LSS 'configure node-ID' request.
void SubmitSwitchSelective(detail::LssSwitchSelectiveRequestBase &req, const LssAddress &address)
Queues an LSS 'switch state selective' request.
bool CancelIdNonConfig(detail::LssIdNonConfigRequestBase &req)
Cancels an LSS 'identify non-configured remote slave' request.
bool CancelFastscan(detail::LssFastscanRequestBase &req)
Cancels an 'LSS Fastscan' request.
LssFuture< uint32_t > AsyncGetSerialNr(detail::LssGetSerialNrRequestBase **preq=nullptr)
Equivalent to AsyncGetSerialNr(nullptr, preq).
LssFuture< void > AsyncSetId(uint8_t id, detail::LssSetIdRequestBase **preq=nullptr)
Equivalent to AsyncSetId(nullptr, id, preq).
void SubmitIdNonConfig(detail::LssIdNonConfigRequestBase &req)
Queues an LSS 'identify non-configured remote slave' request.
LssFuture< void > AsyncSwitchBitrate(int delay, detail::LssSwitchBitrateRequestBase **preq=nullptr)
Equivalent to AsyncSwitchBitrate(nullptr, id, preq).
void SubmitGetRevision(detail::LssGetRevisionRequestBase &req)
Queues an LSS 'inquire identity revision-number' request.
void SubmitIdNonConfig(ev_exec_t *exec, F &&con)
Creates and queues an LSS 'identify non-configured remote slave' request.
LssFuture< void > AsyncSwitch(LssState state=LssState::WAITING, detail::LssSwitchRequestBase **preq=nullptr)
Equivalent to AsyncSwitch(nullptr, state, preq).
bool AbortGetSerialNr(detail::LssGetSerialNrRequestBase &req)
Aborts an LSS 'inquire identity serial-number' request.
void SubmitSwitch(LssState state, F &&con)
Equivalent to SubmitSwitch(nullptr, state, con).
void SubmitSwitchSelective(const LssAddress &address, F &&con)
Equivalent to SubmitSwitchSelective(nullptr, state, con).
LssFuture< void > AsyncSwitchSelective(const LssAddress &address, detail::LssSwitchSelectiveRequestBase **preq=nullptr)
Equivalent to AsyncSwitchSelective(nullptr, address, preq).
bool CancelSetBitrate(detail::LssSetBitrateRequestBase &req)
Cancels an LSS 'configure bit timing parameters' request.
bool CancelSwitch(detail::LssSwitchRequestBase &req)
Cancels an LSS 'switch state global' request.
void SubmitGetId(ev_exec_t *exec, F &&con)
Creates and queues an LSS 'inquire node-ID' request.
void SubmitGetId(F &&con)
Equivalent to SubmitGetId(nullptr, con).
LssFuture< void > AsyncSwitchBitrate(ev_exec_t *exec, int delay, detail::LssSwitchBitrateRequestBase **preq=nullptr)
Queues an asynchronous LSS 'activate bit timing parameters' request and creates a future which become...
bool AbortSetBitrate(detail::LssSetBitrateRequestBase &req)
Aborts an LSS 'configure bit timing parameters' request.
void SubmitSetId(uint8_t id, F &&con)
Equivalent to SubmitSetId(nullptr, id, con).
bool AbortGetRevision(detail::LssGetRevisionRequestBase &req)
Aborts an LSS 'inquire identity revision-number' request.
void SubmitGetVendorId(detail::LssGetVendorIdRequestBase &req)
Queues an LSS 'inquire identity vendor-ID' request.
void SubmitGetSerialNr(ev_exec_t *exec, F &&con)
Creates and queues an LSS 'inquire identity serial-number' request.
void SubmitSwitchBitrate(detail::LssSwitchBitrateRequestBase &req, int delay)
Queues an LSS 'activate bit timing parameters' request.
void SubmitGetVendorId(ev_exec_t *exec, F &&con)
Creates and queues an LSS 'inquire identity vendor-ID' request.
void SubmitFastscan(ev_exec_t *exec, const LssAddress &address, const LssAddress &mask, F &&con)
Creates and queues an 'LSS Fastscan' request.
bool CancelSwitchSelective(detail::LssSwitchSelectiveRequestBase &req)
Cancels an LSS 'switch state selective' request.
bool CancelGetId(detail::LssGetIdRequestBase &req)
Cancels an LSS 'inquire node-ID' request.
void SubmitGetVendorId(F &&con)
Equivalent to SubmitGetVendorId(nullptr, con).
void SubmitSetBitrate(ev_exec_t *exec, int bitrate, F &&con)
Creates and queues an LSS 'configure bit timing parameters' request.
bool AbortGetVendorId(detail::LssGetVendorIdRequestBase &req)
Aborts an LSS 'inquire identity vendor-ID' request.
void SubmitSetId(detail::LssSetIdRequestBase &req, uint8_t id)
Queues an LSS 'configure node-ID' request.
bool AbortSwitchSelective(detail::LssSwitchSelectiveRequestBase &req)
Aborts an LSS 'switch state selective' request.
LssFuture< uint32_t > AsyncGetRevision(detail::LssGetRevisionRequestBase **preq=nullptr)
Equivalent to AsyncGetRevision(nullptr, preq).
void SubmitStore(ev_exec_t *exec, F &&con)
Creates and queues an LSS 'store configuration' request.
void SubmitGetSerialNr(F &&con)
Equivalent to SubmitGetSerialNr(nullptr, con).
bool CancelGetRevision(detail::LssGetRevisionRequestBase &req)
Cancels an LSS 'inquire identity revision-number' request.
void SubmitSetId(ev_exec_t *exec, uint8_t id, F &&con)
Creates and queues an LSS 'configure node-ID' request.
void SubmitGetRevision(F &&con)
Equivalent to SubmitGetRevision(nullptr, con).
void SubmitSwitchBitrate(int delay, F &&con)
Equivalent to SubmitSwitchBitrate(nullptr, id, con).
void SubmitSwitchBitrate(ev_exec_t *exec, int delay, F &&con)
Creates and queues an LSS 'activate bit timing parameters' request.
bool CancelStore(detail::LssStoreRequestBase &req)
Cancels an LSS 'store configuration' request.
LssFuture< uint8_t > AsyncGetId(detail::LssGetIdRequestBase **preq=nullptr)
Equivalent to AsyncGetId(nullptr, preq).
LssFuture< LssAddress > AsyncFastscan(const LssAddress &address={0, 0, 0, 0}, const LssAddress &mask={0, 0, 0, 0}, detail::LssFastscanRequestBase **preq=nullptr)
Equivalent to AsyncFastscan(nullptr, address, mask, preq).
bool AbortSlowscan(detail::LssSlowscanRequestBase &req)
Aborts an 'LSS Slowscan' request.
LssFuture< void > AsyncStore(detail::LssStoreRequestBase **preq=nullptr)
Equivalent to AsyncStore(nullptr, preq).
virtual void OnStart(::std::function< void(::std::error_code ec)> res) noexcept
The function invoked when the LSS master services are executed during the NMT startup process.
void SubmitFastscan(F &&con)
Equivalent to SubmitFastscan(nullptr, con).
void SubmitGetProductCode(ev_exec_t *exec, F &&con)
Creates and queues an LSS 'inquire identity product-code' request.
bool CancelSlowscan(detail::LssSlowscanRequestBase &req)
Cancels an 'LSS Slowscan' request.
bool AbortGetProductCode(detail::LssGetProductCodeRequestBase &req)
Aborts an LSS 'inquire identity product-code' request.
bool CancelGetVendorId(detail::LssGetVendorIdRequestBase &req)
Cancels an LSS 'inquire identity vendor-ID' request.
void SubmitGetRevision(ev_exec_t *exec, F &&con)
Creates and queues an LSS 'inquire identity revision-number' request.
bool CancelSwitchBitrate(detail::LssSwitchBitrateRequestBase &req)
Cancels an LSS 'activate bit timing parameters' request.
bool AbortFastscan(detail::LssFastscanRequestBase &req)
Aborts an 'LSS Fastscan' request.
void SubmitGetSerialNr(detail::LssGetSerialNrRequestBase &req)
Queues an LSS 'inquire identity serial-number' request.
bool AbortIdNonConfig(detail::LssIdNonConfigRequestBase &req)
Aborts an LSS 'identify non-configured remote slave' request.
void SubmitSlowscan(detail::LssSlowscanRequestBase &req, const LssAddress &lo, const LssAddress &hi)
Queues an 'LSS Slowscan' request.
void SubmitSetBitrate(detail::LssSetBitrateRequestBase &req, int bitrate)
Queues an LSS 'configure bit timing parameters' request.
void SubmitGetProductCode(F &&con)
Equivalent to SubmitGetProductCode(nullptr, con).
bool AbortSwitch(detail::LssSwitchRequestBase &req)
Aborts an LSS 'switch state global' request.
bool AbortGetId(detail::LssGetIdRequestBase &req)
Aborts an LSS 'inquire node-ID' request.
void SubmitSwitchSelective(ev_exec_t *exec, const LssAddress &address, F &&con)
Creates and queues an LSS 'switch state selective' request.
LssMaster(Node &node, io::CanControllerBase *ctrl=nullptr)
Creates a new CANopen LSS master.
An LSS 'configure bit timing parameters' request.
void(::std::error_code ec) Signature
The signature of the callback function invoked on completion of an LSS 'configure bit timing paramete...
LssSetBitrateRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'configure bit timing parameters' request with a completion task.
LssSetBitrateRequest(F &&con)
Equivalent to LssSetBitrateRequest(nullptr, con).
An LSS 'configure node-ID' request.
void(::std::error_code ec) Signature
The signature of the callback function invoked on completion of an LSS 'configure node-ID' request.
LssSetIdRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'configure node-ID' request with a completion task.
LssSetIdRequest(F &&con)
Equivalent to LssSetIdRequest(nullptr, con).
An 'LSS Slowscan' request.
LssSlowscanRequest(F &&con)
Equivalent to LssSlowscanRequest(nullptr, con).
void(::std::error_code ec, LssAddress address) Signature
The signature of the callback function invoked on completion of an 'LSS Slowscan' request.
LssSlowscanRequest(ev_exec_t *exec, F &&con)
Constructs an empty 'LSS Slowscan' request with a completion task.
An LSS 'store configuration' request.
void(::std::error_code ec) Signature
The signature of the callback function invoked on completion of an LSS 'store configuration' request.
LssStoreRequest(F &&con)
Equivalent to LssStoreRequest(nullptr, con).
LssStoreRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'store configuration' request with a completion task.
An LSS 'activate bit timing parameters' request.
LssSwitchBitrateRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'activate bit timing parameters' request with a completion task.
LssSwitchBitrateRequest(F &&con)
Equivalent to LssSwitchBitrateRequest(nullptr, con).
void(::std::error_code ec) Signature
The signature of the callback function invoked on completion of an LSS 'activate bit timing parameter...
An LSS 'switch state global' request.
LssSwitchRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'switch state global' request with a completion task.
void(::std::error_code ec) Signature
The signature of the callback function invoked on completion of an LSS 'switch state global' request.
LssSwitchRequest(F &&con)
Equivalent to LssSwitchRequest(nullptr, con).
An LSS 'switch state selective' request.
LssSwitchSelectiveRequest(F &&con)
Equivalent to LssSwitchSelectiveRequest(nullptr, con).
LssSwitchSelectiveRequest(ev_exec_t *exec, F &&con)
Constructs an empty LSS 'switch state selective' request with a completion task.
void(::std::error_code ec) Signature
The signature of the callback function invoked on completion of an LSS 'switch state selective' reque...
The base class for CANopen nodes.
LssAddress mask
A mask specifying which bits in the LSS address of the slave device are already known and can be skip...
::std::error_code ec
The error code (0 on success).
ev::Executor GetExecutor() const noexcept
Returns the executor to which the completion task is (to be) submitted.
LssAddress address
On success, the LSS address of the detected slave device.
int bitrate
The requested pending bit rate (in bit/s) of the LSS slave device.
uint8_t id
The requested pending node-ID of the LSS slave device.
LssAddress hi
The upper bound of the LSS address of the slave device.
LssAddress lo
The lower bound of the LSS address of the slave device.
int delay
The delay (in milliseconds) before and after the switch, during which CAN frames MUST NOT be sent.
LssAddress address
The address of the LSS slave device to be switched into the configuration state.
An abstract task executor. This class is a wrapper around #ev_exec_t*.
A reference to an abstract CAN controller.
An abstract interface conforming to the BasicLockable concept.
This header file is part of the compatibility library; it includes <functional> and defines any missi...
const struct ev_exec_vtbl *const ev_exec_t
An abstract task executor.
This header file is part of the compatibility library; it includes <type_traits> and defines any miss...
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code >::value, detail::LssSwitchSelectiveRequestWrapper< F > * >::type make_lss_switch_selective_request(ev_exec_t *exec, const LssAddress &address, F &&con)
Creates an LSS 'switch state selective' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code, uint32_t >::value, detail::LssGetRevisionRequestWrapper< F > * >::type make_lss_get_revision_request(ev_exec_t *exec, F &&con)
Creates an LSS 'inquire identity revision-number' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code >::value, detail::LssSetBitrateRequestWrapper< F > * >::type make_lss_set_bitrate_request(ev_exec_t *exec, int bitrate, F &&con)
Creates an LSS 'configure bit timing parameters' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code, bool >::value, detail::LssIdNonConfigRequestWrapper< F > * >::type make_lss_id_non_config_request(ev_exec_t *exec, F &&con)
Creates an LSS 'identify non-configured remote slave' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code, uint32_t >::value, detail::LssGetSerialNrRequestWrapper< F > * >::type make_lss_get_serial_nr_request(ev_exec_t *exec, F &&con)
Creates an LSS 'inquire identity serial-number' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code >::value, detail::LssSwitchBitrateRequestWrapper< F > * >::type make_lss_switch_bitrate_request(ev_exec_t *exec, int delay, F &&con)
Creates an LSS 'activate bit timing parameters' request with a completion task.
LssState
The states of the LSS finite state automaton (FSA) of a slave device.
@ WAITING
The state in which a slave may be identified.
@ CONFIG
The state in which the node-ID and bit timing parameters of a slave may be configured.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code >::value, detail::LssStoreRequestWrapper< F > * >::type make_lss_store_request(ev_exec_t *exec, F &&con)
Creates an LSS 'store configuration' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code, uint32_t >::value, detail::LssGetVendorIdRequestWrapper< F > * >::type make_lss_get_vendor_id_request(ev_exec_t *exec, F &&con)
Creates an LSS 'inquire identity vendor-ID' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code, uint8_t >::value, detail::LssGetIdRequestWrapper< F > * >::type make_lss_get_id_request(ev_exec_t *exec, F &&con)
Creates an LSS 'inquire node-ID' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code >::value, detail::LssSetIdRequestWrapper< F > * >::type make_lss_set_id_request(ev_exec_t *exec, uint8_t id, F &&con)
Creates an LSS 'configure node-ID' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code >::value, detail::LssSwitchRequestWrapper< F > * >::type make_lss_switch_request(ev_exec_t *exec, LssState state, F &&con)
Creates an LSS 'switch state global' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code, LssAddress >::value, detail::LssSlowscanRequestWrapper< F > * >::type make_lss_slowscan_request(ev_exec_t *exec, const LssAddress &lo, const LssAddress &hi, F &&con)
Creates an 'LSS Slowscan' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code, LssAddress >::value, detail::LssFastscanRequestWrapper< F > * >::type make_lss_fastscan_request(ev_exec_t *exec, const LssAddress &address, const LssAddress &mask, F &&con)
Creates an 'LSS Fastscan' request with a completion task.
typename ::std::enable_if< compat::is_invocable< F, ::std::error_code, uint32_t >::value, detail::LssGetProductCodeRequestWrapper< F > * >::type make_lss_get_product_code_request(ev_exec_t *exec, F &&con)
Creates an LSS 'inquire identity product-code' request with a completion task.
This header file is part of the C++ CANopen application library; it contains the CANopen node declara...
ev_exec_t * exec
A pointer to the executor to which the task is (to be) submitted.
The 128-bit number uniquely identifying each CANopen node.
uint32_t revision
The revision number.
uint32_t product_code
THe product code.
uint32_t serial_nr
THe serial number.
uint32_t vendor_id
The vendor-ID.
Determines whether F can be invoked with the arguments Args....
#define EV_TASK_INIT(exec, func)
The static initializer for ev_task.