23#ifndef LELY_CO_LSS_HPP_
24#define LELY_CO_LSS_HPP_
26#if !defined(__cplusplus) || LELY_NO_CXX
27#error "include <lely/co/lss.h> for the C interface"
46 return __co_lss_alloc();
50 free(
void* ptr)
noexcept {
56 return __co_lss_init(p, nmt);
83 getNMT()
const noexcept {
99 setRateInd(F* f)
noexcept {
101 static_cast<void*
>(f));
104 template <class C, typename c_mem_fn<co_lss_rate_ind_t*, C>::type M>
106 setRateInd(C* obj)
noexcept {
108 static_cast<void*
>(obj));
123 setStoreInd(F* f)
noexcept {
125 static_cast<void*
>(f));
128 template <class C, typename c_mem_fn<co_lss_store_ind_t*, C>::type M>
130 setStoreInd(C* obj)
noexcept {
132 static_cast<void*
>(obj));
136 getInhibit()
const noexcept {
141 setInhibit(co_unsigned16_t inhibit)
noexcept {
146 getTimeout()
const noexcept {
151 setTimeout(
int timeout)
noexcept {
156 isMaster()
const noexcept {
161 isIdle()
const noexcept {
166 abortReq()
noexcept {
171 switchReq(co_unsigned8_t mode)
noexcept {
182 switchSelReq(
const co_id&
id, F* f)
noexcept {
184 static_cast<void*
>(f));
187 template <class C, typename c_mem_fn<co_lss_cs_ind_t*, C>::type M>
189 switchSelReq(
const co_id&
id, C* obj)
noexcept {
191 static_cast<void*
>(obj));
201 setIdReq(co_unsigned8_t
id, F* f)
noexcept {
203 static_cast<void*
>(f));
206 template <class C, typename c_mem_fn<co_lss_err_ind_t*, C>::type M>
208 setIdReq(co_unsigned8_t
id, C* obj)
noexcept {
210 static_cast<void*
>(obj));
214 setRateReq(co_unsigned16_t rate,
co_lss_err_ind_t* ind,
void* data)
noexcept {
220 setRateReq(co_unsigned16_t rate, F* f)
noexcept {
222 static_cast<void*
>(f));
225 template <class C, typename c_mem_fn<co_lss_err_ind_t*, C>::type M>
227 setRateReq(co_unsigned16_t rate, C* obj)
noexcept {
229 static_cast<void*
>(obj));
233 switchRateReq(
int delay)
noexcept {
244 storeReq(F* f)
noexcept {
246 static_cast<void*
>(f));
249 template <class C, typename c_mem_fn<co_lss_err_ind_t*, C>::type M>
251 storeReq(C* obj)
noexcept {
253 static_cast<void*
>(obj));
263 getVendorIdReq(F* f)
noexcept {
265 static_cast<void*
>(f));
268 template <class C, typename c_mem_fn<co_lss_lssid_ind_t*, C>::type M>
270 getVendorIdReq(C* obj)
noexcept {
272 static_cast<void*
>(obj));
282 getProductCodeReq(F* f)
noexcept {
284 static_cast<void*
>(f));
287 template <class C, typename c_mem_fn<co_lss_lssid_ind_t*, C>::type M>
289 getProductCodeReq(C* obj)
noexcept {
291 static_cast<void*
>(obj));
301 getRevisionReq(F* f)
noexcept {
303 static_cast<void*
>(f));
306 template <class C, typename c_mem_fn<co_lss_lssid_ind_t*, C>::type M>
308 getRevisionReq(C* obj)
noexcept {
310 static_cast<void*
>(obj));
320 getSerialNrReq(F* f)
noexcept {
322 static_cast<void*
>(f));
325 template <class C, typename c_mem_fn<co_lss_lssid_ind_t*, C>::type M>
327 getSerialNrReq(C* obj)
noexcept {
329 static_cast<void*
>(obj));
339 getIdReq(F* f)
noexcept {
341 static_cast<void*
>(f));
344 template <class C, typename c_mem_fn<co_lss_nid_ind_t*, C>::type M>
346 getIdReq(C* obj)
noexcept {
348 static_cast<void*
>(obj));
353 void* data)
noexcept {
359 idSlaveReq(
const co_id& lo,
const co_id& hi, F* f)
noexcept {
361 static_cast<void*
>(f));
364 template <class C, typename c_mem_fn<co_lss_cs_ind_t*, C>::type M>
366 idSlaveReq(
const co_id& lo,
const co_id& hi, C* obj)
noexcept {
368 static_cast<void*
>(obj));
378 idNonCfgSlaveReq(F* f)
noexcept {
380 static_cast<void*
>(f));
383 template <class C, typename c_mem_fn<co_lss_cs_ind_t*, C>::type M>
385 idNonCfgSlaveReq(C* obj)
noexcept {
387 static_cast<void*
>(obj));
392 void* data)
noexcept {
398 slowscanReq(
const co_id& lo,
const co_id& hi, F* f)
noexcept {
400 static_cast<void*
>(f));
403 template <class C, typename c_mem_fn<co_lss_scan_ind_t*, C>::type M>
405 slowscanReq(
const co_id& lo,
const co_id& hi, C* obj)
noexcept {
407 static_cast<void*
>(obj));
412 void* data)
noexcept {
418 fastscanReq(
const co_id*
id,
const co_id* mask, F* f)
noexcept {
420 static_cast<void*
>(f));
423 template <class C, typename c_mem_fn<co_lss_scan_ind_t*, C>::type M>
425 fastscanReq(
const co_id*
id,
const co_id* mask, C* obj)
noexcept {
426 return fastscanReq(
id, mask,
428 static_cast<void*
>(obj));
An opaque CANopen LSS master/slave service type.
An opaque CANopen NMT master/slave service type.
The base class for a C++ interface to an incomplete C type.
This header file is part of the CANopen library; it contains the Layer Setting Services (LSS) and pro...
void co_lss_lssid_ind_t(co_lss_t *lss, co_unsigned8_t cs, co_unsigned32_t id, void *data)
The type of a CANopen LSS inquire identity indication function, invoked when an 'inquire identity ven...
int co_lss_get_vendor_id_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the 'inquire identity vendor-ID' service.
int co_lss_store_ind_t(co_lss_t *lss, co_unsigned8_t id, co_unsigned16_t rate, void *data)
The type of a CANopen LSS 'store configuration' indication function, invoked when the pending node-ID...
void co_lss_err_ind_t(co_lss_t *lss, co_unsigned8_t cs, co_unsigned8_t err, co_unsigned8_t spec, void *data)
The type of a CANopen LSS error received indication function, invoked when a 'configure node-ID',...
int co_lss_is_master(const co_lss_t *lss)
Returns 1 if the specified CANopen LSS service is a master, and 0 if not.
void co_lss_nid_ind_t(co_lss_t *lss, co_unsigned8_t cs, co_unsigned8_t id, void *data)
The type of a CANopen LSS inquire node-ID indication function, invoked when an 'inquire node-ID' requ...
int co_lss_set_id_req(co_lss_t *lss, co_unsigned8_t id, co_lss_err_ind_t *ind, void *data)
Requests the 'configure node-ID' service.
void co_lss_set_timeout(co_lss_t *lss, int timeout)
Sets the timeout of an LSS master service.
co_unsigned16_t co_lss_get_inhibit(const co_lss_t *lss)
Returns the inhibit time (in multiples of 100 microseconds) of an LSS master service.
void co_lss_scan_ind_t(co_lss_t *lss, co_unsigned8_t cs, const struct co_id *id, void *data)
The type of a CANopen LSS identify remote slave indication function, invoked when a 'Slowscan' or 'Fa...
int co_lss_slowscan_req(co_lss_t *lss, const struct co_id *lo, const struct co_id *hi, co_lss_scan_ind_t *ind, void *data)
Requests the 'LSS Slowscan' service.
int co_lss_switch_rate_req(co_lss_t *lss, int delay)
Requests the 'activate bit timing parameters' service.
int co_lss_get_id_req(co_lss_t *lss, co_lss_nid_ind_t *ind, void *data)
Requests the 'inquire node-ID' service.
int co_lss_get_revision_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the 'inquire identity revision-number' service.
void co_lss_set_store_ind(co_lss_t *lss, co_lss_store_ind_t *ind, void *data)
Sets the indication function invoked when an LSS 'store configuration' request is received.
int co_lss_switch_sel_req(co_lss_t *lss, const struct co_id *id, co_lss_cs_ind_t *ind, void *data)
Requests the 'switch state selective' service.
void co_lss_get_rate_ind(const co_lss_t *lss, co_lss_rate_ind_t **pind, void **pdata)
Retrieves the indication function invoked when an LSS 'activate bit timing' request is received.
int co_lss_switch_req(co_lss_t *lss, co_unsigned8_t mode)
Requests the 'switch state global' service.
void co_lss_stop(co_lss_t *lss)
Stops an LSS service.
int co_lss_set_rate_req(co_lss_t *lss, co_unsigned16_t rate, co_lss_err_ind_t *ind, void *data)
Requests the 'configure bit timing parameters' service.
int co_lss_is_idle(const co_lss_t *lss)
Returns 1 if the specified LSS master is idle, and 0 if a request is ongoing.
void co_lss_set_rate_ind(co_lss_t *lss, co_lss_rate_ind_t *ind, void *data)
Sets the indication function invoked when an LSS 'activate bit timing' request is received.
int co_lss_get_timeout(const co_lss_t *lss)
Returns the timeout (in milliseconds) of an LSS master service.
co_nmt_t * co_lss_get_nmt(const co_lss_t *lss)
Returns a pointer to the NMT service of an LSS master/slave service.
int co_lss_get_product_code_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the 'inquire identity product-code' service.
int co_lss_id_slave_req(co_lss_t *lss, const struct co_id *lo, const struct co_id *hi, co_lss_cs_ind_t *ind, void *data)
Requests the 'LSS identify remote slave' service.
int co_lss_store_req(co_lss_t *lss, co_lss_err_ind_t *ind, void *data)
Requests the 'store configuration' service.
void co_lss_cs_ind_t(co_lss_t *lss, co_unsigned8_t cs, void *data)
The type of a CANopen LSS command received indication function, invoked when a 'switch state selectiv...
int co_lss_start(co_lss_t *lss)
Starts an LSS service.
void co_lss_rate_ind_t(co_lss_t *lss, co_unsigned16_t rate, int delay, void *data)
The type of a CANopen LSS 'activate bit timing' indication function, invoked when a baudrate switch i...
int co_lss_id_non_cfg_slave_req(co_lss_t *lss, co_lss_cs_ind_t *ind, void *data)
Requests the 'LSS identify non-configured remote slave' service.
int co_lss_fastscan_req(co_lss_t *lss, const struct co_id *id, const struct co_id *mask, co_lss_scan_ind_t *ind, void *data)
Requests the 'LSS Fastscan' service.
int co_lss_get_serial_nr_req(co_lss_t *lss, co_lss_lssid_ind_t *ind, void *data)
Requests the 'inquire identity serial-number' service.
void co_lss_abort_req(co_lss_t *lss)
Aborts the current LSS master request.
void co_lss_get_store_ind(const co_lss_t *lss, co_lss_store_ind_t **pind, void **pdata)
Retrieves the indication function invoked when an LSS 'store configuration' request is received.
void co_lss_set_inhibit(co_lss_t *lss, co_unsigned16_t inhibit)
Sets the inhibit time between successive LSS messages of an LSS master service.
This header file is part of the CAN library; it contains the C++ interface of the CAN network interfa...
A CANopen LSS master/slave service.
A class template supplying a uniform interface to certain attributes of C types.