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)
100 (*
static_cast<LssRequestBase*
>(task))();
103 LssRequestBase(
const LssRequestBase&) =
delete;
104 LssRequestBase& operator=(
const LssRequestBase&) =
delete;
106 virtual ~LssRequestBase() =
default;
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_;
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_;
533 :
detail::LssGetVendorIdRequestBase(
exec), con_(::
std::forward<F>(con)) {}
542 operator()() noexcept final {
543 if (con_) con_(ec, number);
546 ::std::function<Signature> con_;
571 con_(::
std::forward<F>(con)) {}
580 operator()() noexcept final {
581 if (con_) con_(ec, number);
584 ::std::function<Signature> con_;
608 :
detail::LssGetRevisionRequestBase(
exec), con_(::
std::forward<F>(con)) {}
617 operator()() noexcept final {
618 if (con_) con_(ec, number);
621 ::std::function<Signature> con_;
645 :
detail::LssGetSerialNrRequestBase(
exec), con_(::
std::forward<F>(con)) {}
654 operator()() noexcept final {
655 if (con_) con_(ec, number);
658 ::std::function<Signature> con_;
681 :
detail::LssGetIdRequestBase(
exec), con_(::
std::forward<F>(con)) {}
690 operator()() noexcept final {
691 if (con_) con_(ec,
id);
694 ::std::function<Signature> con_;
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 {
829 typename ::std::decay<F>::type con_;
843 operator()()
noexcept final {
848 typename ::std::decay<F>::type con_;
854 explicit LssSetIdRequestWrapper(
ev_exec_t*
exec, uint8_t
id, F&& con)
861 operator()()
noexcept final {
866 typename ::std::decay<F>::type con_;
879 operator()()
noexcept final {
884 typename ::std::decay<F>::type con_;
897 operator()()
noexcept final {
902 typename ::std::decay<F>::type con_;
913 operator()()
noexcept final {
918 typename ::std::decay<F>::type con_;
924 explicit LssGetVendorIdRequestWrapper(
ev_exec_t*
exec, F&& con)
929 operator()()
noexcept final {
934 typename ::std::decay<F>::type con_;
940 explicit LssGetProductCodeRequestWrapper(
ev_exec_t*
exec, F&& con)
945 operator()()
noexcept final {
950 typename ::std::decay<F>::type con_;
956 explicit LssGetRevisionRequestWrapper(
ev_exec_t*
exec, F&& con)
961 operator()()
noexcept final {
966 typename ::std::decay<F>::type con_;
972 explicit LssGetSerialNrRequestWrapper(
ev_exec_t*
exec, F&& con)
977 operator()()
noexcept final {
982 typename ::std::decay<F>::type con_;
993 operator()()
noexcept final {
998 typename ::std::decay<F>::type con_;
1004 explicit LssIdNonConfigRequestWrapper(
ev_exec_t*
exec, F&& con)
1009 operator()()
noexcept final {
1012 if (
ec == ::std::errc::timed_out)
ec.clear();
1017 typename ::std::decay<F>::type con_;
1032 operator()()
noexcept final {
1037 typename ::std::decay<F>::type con_;
1052 operator()()
noexcept final {
1057 typename ::std::decay<F>::type con_;
1074inline typename ::std::enable_if<
1080 ::std::forward<F>(con));
1095inline typename ::std::enable_if<
1097 detail::LssSwitchSelectiveRequestWrapper<F>*>::type
1101 exec, address, ::std::forward<F>(con));
1116inline typename ::std::enable_if<
1118 detail::LssSetIdRequestWrapper<F>*>::type
1122 ::std::forward<F>(con));
1138inline typename ::std::enable_if<
1140 detail::LssSetBitrateRequestWrapper<F>*>::type
1144 ::std::forward<F>(con));
1160inline typename ::std::enable_if<
1162 detail::LssSwitchBitrateRequestWrapper<F>*>::type
1166 ::std::forward<F>(con));
1180inline typename ::std::enable_if<
1182 detail::LssStoreRequestWrapper<F>*>::type
1198inline typename ::std::enable_if<
1200 detail::LssGetVendorIdRequestWrapper<F>*>::type
1203 ::std::forward<F>(con));
1216inline typename ::std::enable_if<
1218 detail::LssGetProductCodeRequestWrapper<F>*>::type
1221 ::std::forward<F>(con));
1234inline typename ::std::enable_if<
1236 detail::LssGetRevisionRequestWrapper<F>*>::type
1239 ::std::forward<F>(con));
1252inline typename ::std::enable_if<
1254 detail::LssGetSerialNrRequestWrapper<F>*>::type
1257 ::std::forward<F>(con));
1270inline typename ::std::enable_if<
1272 detail::LssGetIdRequestWrapper<F>*>::type
1288inline typename ::std::enable_if<
1290 detail::LssIdNonConfigRequestWrapper<F>*>::type
1294 ::std::forward<F>(con));
1310inline typename ::std::enable_if<
1312 detail::LssSlowscanRequestWrapper<F>*>::type
1316 ::std::forward<F>(con));
1335inline 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);
1524 ::std::forward<F>(con)));
2404 ::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_;
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).
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.
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.
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).
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).
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...
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).
bool Abort(detail::LssRequestBase &req)
Aborts a pending LSS request.
void SubmitSlowscan(ev_exec_t *exec, const LssAddress &lo, const LssAddress &hi, F &&con)
Creates and queues an 'LSS Slowscan' request.
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).
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 AbortSwitchBitrate(detail::LssSwitchBitrateRequestBase &req)
Aborts an LSS 'activate bit timing parameters' request.
LssFuture< uint8_t > AsyncGetId(detail::LssGetIdRequestBase **preq=nullptr)
Equivalent to AsyncGetId(nullptr, 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).
LssMaster(ev_exec_t *exec, Node &node, io::CanControllerBase *ctrl=nullptr)
Creates a new CANopen LSS master.
bool AbortSetId(detail::LssSetIdRequestBase &req)
Aborts an LSS 'configure node-ID' request.
LssFuture< uint8_t > AsyncGetId(ev_exec_t *exec, detail::LssGetIdRequestBase **preq=nullptr)
Queues an asynchronous LSS 'inquire node-ID' request and creates a future which becomes ready once th...
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.
bool CancelGetSerialNr(detail::LssGetSerialNrRequestBase &req)
Cancels an LSS 'inquire identity serial-number' request.
LssFuture< LssAddress > AsyncSlowscan(ev_exec_t *exec, const LssAddress &lo, const LssAddress &hi, detail::LssSlowscanRequestBase **preq=nullptr)
Queues an asynchronous 'LSS Slowscan' request and creates a future which becomes ready once the reque...
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.
LssFuture< LssAddress > AsyncSlowscan(const LssAddress &lo, const LssAddress &hi, detail::LssSlowscanRequestBase **preq=nullptr)
Equivalent to AsyncSlowscan(nullptr, lo, hi, preq).
LssFuture< void > AsyncSetBitrate(ev_exec_t *exec, int bitrate, detail::LssSetBitrateRequestBase **preq=nullptr)
Queues an asynchronous LSS 'configure bit timing parameters' request and creates a future which becom...
bool CancelIdNonConfig(detail::LssIdNonConfigRequestBase &req)
Cancels an LSS 'identify non-configured remote slave' request.
bool CancelFastscan(detail::LssFastscanRequestBase &req)
Cancels an 'LSS Fastscan' request.
void SubmitSwitch(detail::LssSwitchRequestBase &req, LssState state=LssState::WAITING)
Queues an LSS 'switch state global' request.
void SubmitIdNonConfig(detail::LssIdNonConfigRequestBase &req)
Queues an LSS 'identify non-configured remote slave' request.
LssFuture< uint32_t > AsyncGetProductCode(ev_exec_t *exec, detail::LssGetProductCodeRequestBase **preq=nullptr)
Queues an asynchronous LSS 'inquire identity product-code' request and creates a future which becomes...
LssFuture< uint32_t > AsyncGetVendorId(detail::LssGetVendorIdRequestBase **preq=nullptr)
Equivalent to AsyncGetVendorId(nullptr, 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.
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).
LssFuture< void > AsyncSetId(uint8_t id, detail::LssSetIdRequestBase **preq=nullptr)
Equivalent to AsyncSetId(nullptr, id, preq).
void SubmitSwitchSelective(const LssAddress &address, F &&con)
Equivalent to SubmitSwitchSelective(nullptr, state, con).
LssFuture< bool > AsyncIdNonConfig(detail::LssIdNonConfigRequestBase **preq=nullptr)
Equivalent to AsyncIdNonConfig(nullptr, preq).
LssFuture< void > AsyncStore(detail::LssStoreRequestBase **preq=nullptr)
Equivalent to AsyncStore(nullptr, 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.
LssFuture< void > AsyncSwitchSelective(ev_exec_t *exec, const LssAddress &address, detail::LssSwitchSelectiveRequestBase **preq=nullptr)
Queues an asynchronous LSS 'switch state selective' request and creates a future which becomes ready ...
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).
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.
LssFuture< uint32_t > AsyncGetRevision(detail::LssGetRevisionRequestBase **preq=nullptr)
Equivalent to AsyncGetRevision(nullptr, preq).
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.
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...
LssFuture< void > AsyncSwitch(ev_exec_t *exec, LssState state=LssState::WAITING, detail::LssSwitchRequestBase **preq=nullptr)
Queues an asynchronous LSS 'switch state global' request and creates a future which becomes ready onc...
LssFuture< uint32_t > AsyncGetVendorId(ev_exec_t *exec, detail::LssGetVendorIdRequestBase **preq=nullptr)
Queues an asynchronous LSS 'inquire identity vendor-ID' request and creates a future which becomes re...
void SubmitGetVendorId(ev_exec_t *exec, F &&con)
Creates and queues an LSS 'inquire identity vendor-ID' request.
bool Cancel(detail::LssRequestBase &req)
Cancels a pending LSS request.
void SubmitFastscan(ev_exec_t *exec, const LssAddress &address, const LssAddress &mask, F &&con)
Creates and queues an 'LSS Fastscan' request.
void Submit(detail::LssRequestBase &req)
Queues an LSS request.
bool CancelSwitchSelective(detail::LssSwitchSelectiveRequestBase &req)
Cancels an LSS 'switch state selective' request.
LssFuture< void > AsyncSwitch(LssState state=LssState::WAITING, detail::LssSwitchRequestBase **preq=nullptr)
Equivalent to AsyncSwitch(nullptr, state, preq).
bool CancelGetId(detail::LssGetIdRequestBase &req)
Cancels an LSS 'inquire node-ID' request.
void SubmitGetVendorId(F &&con)
Equivalent to SubmitGetVendorId(nullptr, con).
LssFuture< uint32_t > AsyncGetSerialNr(ev_exec_t *exec, detail::LssGetSerialNrRequestBase **preq=nullptr)
Queues an asynchronous LSS 'inquire identity serial-number' request and creates a future which become...
LssFuture< void > AsyncSwitchBitrate(int delay, detail::LssSwitchBitrateRequestBase **preq=nullptr)
Equivalent to AsyncSwitchBitrate(nullptr, id, preq).
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.
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).
LssFuture< void > AsyncSwitchSelective(const LssAddress &address, detail::LssSwitchSelectiveRequestBase **preq=nullptr)
Equivalent to AsyncSwitchSelective(nullptr, address, preq).
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.
bool AbortSlowscan(detail::LssSlowscanRequestBase &req)
Aborts an 'LSS Slowscan' request.
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.
LssFuture< uint32_t > AsyncGetRevision(ev_exec_t *exec, detail::LssGetRevisionRequestBase **preq=nullptr)
Queues an asynchronous LSS 'inquire identity revision-number' request and creates a future which beco...
LssFuture< bool > AsyncIdNonConfig(ev_exec_t *exec, detail::LssIdNonConfigRequestBase **preq=nullptr)
Queues an asynchronous LSS 'identify non-configured remote slave' request and creates a future which ...
bool CancelSwitchBitrate(detail::LssSwitchBitrateRequestBase &req)
Cancels an LSS 'activate bit timing parameters' request.
LssFuture< void > AsyncSetId(ev_exec_t *exec, uint8_t id, detail::LssSetIdRequestBase **preq=nullptr)
Queues an asynchronous LSS 'configure node-ID' request and creates a future which becomes ready once ...
bool AbortFastscan(detail::LssFastscanRequestBase &req)
Aborts an 'LSS Fastscan' request.
void SubmitGetSerialNr(detail::LssGetSerialNrRequestBase &req)
Queues an LSS 'inquire identity serial-number' request.
LssFuture< uint32_t > AsyncGetProductCode(detail::LssGetProductCodeRequestBase **preq=nullptr)
Equivalent to AsyncGetProductCode(nullptr, preq).
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.
LssFuture< uint32_t > AsyncGetSerialNr(detail::LssGetSerialNrRequestBase **preq=nullptr)
Equivalent to AsyncGetSerialNr(nullptr, preq).
LssFuture< void > AsyncSetBitrate(int bitrate, detail::LssSetBitrateRequestBase **preq=nullptr)
Equivalent to AsyncSetBitrate(nullptr, id, preq).
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.
LssFuture< void > AsyncStore(ev_exec_t *exec, detail::LssStoreRequestBase **preq=nullptr)
Queues an asynchronous LSS 'store configuration' request and creates a future which becomes ready onc...
LssMaster(Node &node, io::CanControllerBase *ctrl=nullptr)
Creates a new CANopen LSS master.
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).
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).
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.
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.
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...
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).
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...
uint32_t number
The LSS number reported by the slave device.
::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.
LssState state
The desired state of the LSS slave devices.
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...
invoke_result_t< F, Args... > invoke(F &&f, Args &&... args)
Invokes f with the arguments args... as if by INVOKE(forward<F>(f), forward<Args>(args)....
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...
The namespace for implementation details of the C++ CANopen application library.
The namespace for the C++ CANopen application library.
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, 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.
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 >::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, 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::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.
ev::Future< T, ::std::exception_ptr > LssFuture
A helper alias template for the type of future used to retrieve the result of an asynchronous LSS req...
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::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, 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 >::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.
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, 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::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::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.
ev::Promise< T, ::std::exception_ptr > LssPromise
A helper alias template for the type of promise used to store the result of an asynchronous LSS reque...
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.