Lely core libraries  1.9.2
obj.hpp
Go to the documentation of this file.
1 
22 #ifndef LELY_CO_OBJ_HPP_
23 #define LELY_CO_OBJ_HPP_
24 
25 #ifndef __cplusplus
26 #error "include <lely/co/obj.h> for the C interface"
27 #endif
28 
29 #include <lely/util/c_call.hpp>
30 #include <lely/util/c_type.hpp>
31 #include <lely/co/obj.h>
32 #include <lely/co/sdo.h>
33 #include <lely/co/val.hpp>
34 
35 #include <vector>
36 
37 namespace lely {
38 
39 template <co_unsigned16_t>
40 struct COSubDnInd;
41 template <co_unsigned16_t>
42 struct COSubUpInd;
43 
45 template <>
47  typedef __co_obj value_type;
48  typedef value_type& reference;
49  typedef const value_type& const_reference;
50  typedef value_type* pointer;
51  typedef const value_type* const_pointer;
52 
53  static void*
54  alloc() noexcept {
55  return __co_obj_alloc();
56  }
57  static void
58  free(void* ptr) noexcept {
59  __co_obj_free(ptr);
60  }
61 
62  static pointer
63  init(pointer p, co_unsigned16_t idx) noexcept {
64  return __co_obj_init(p, idx);
65  }
66 
67  static void
68  fini(pointer p) noexcept {
69  __co_obj_fini(p);
70  }
71 };
72 
74 class COObj : public incomplete_c_type<__co_obj> {
76 
77  public:
78  explicit COObj(co_unsigned16_t idx) : c_base(idx) {}
79 
80  CODev*
81  getDev() const noexcept {
82  return co_obj_get_dev(this);
83  }
84 
85  co_unsigned16_t
86  getIdx() const noexcept {
87  return co_obj_get_idx(this);
88  }
89 
90  co_unsigned8_t
91  getSubidx(co_unsigned8_t maxsubidx, co_unsigned8_t* subidx) const noexcept {
92  return co_obj_get_subidx(this, maxsubidx, subidx);
93  }
94 
95  ::std::vector<co_unsigned8_t>
96  getSubidx() const {
97  std::vector<co_unsigned8_t> subidx(getSubidx(0, 0));
98  getSubidx(subidx.size(), subidx.data());
99  return subidx;
100  }
101 
102  int
103  insert(COSub* sub) noexcept {
104  return co_obj_insert_sub(this, sub);
105  }
106  int
107  remove(COSub* sub) noexcept {
108  return co_obj_remove_sub(this, sub);
109  }
110 
111  COSub*
112  find(co_unsigned8_t subidx) const noexcept {
113  return co_obj_find_sub(this, subidx);
114  }
115 
116  const char*
117  getName() const noexcept {
118  return co_obj_get_name(this);
119  }
120 
121  int
122  setName(const char* name) noexcept {
123  return co_obj_set_name(this, name);
124  }
125 
126  co_unsigned8_t
127  getCode() const noexcept {
128  return co_obj_get_code(this);
129  }
130 
131  int
132  setCode(co_unsigned8_t code) noexcept {
133  return co_obj_set_code(this, code);
134  }
135 
136  template <co_unsigned16_t N>
137  const COVal<N>&
138  getVal(co_unsigned8_t subidx) const noexcept {
139  return *reinterpret_cast<const COVal<N>*>(co_obj_get_val(this, subidx));
140  }
141 
142  ::std::size_t
143  setVal(co_unsigned8_t subidx, const void* ptr, ::std::size_t n) noexcept {
144  return co_obj_set_val(this, subidx, ptr, n);
145  }
146 
147  template <co_unsigned16_t N>
148  ::std::size_t
149  setVal(co_unsigned8_t subidx, const COVal<N>& val) noexcept {
150  return setVal(subidx, val.address(), val.size());
151  }
152 
153  template <class T>
154  ::std::size_t
155  setVal(co_unsigned8_t subidx, const T& val) noexcept {
156  return setVal<co_type_traits_T<T>::index>(subidx, val);
157  }
158 
159  void
160  setDnInd(co_sub_dn_ind_t* ind, void* data) noexcept {
161  co_obj_set_dn_ind(this, ind, data);
162  }
163 
164  template <class F>
165  void
166  setDnInd(F* f) noexcept {
167  setDnInd(&c_obj_call<co_sub_dn_ind_t*, F>::function, static_cast<void*>(f));
168  }
169 
170  template <class C, typename c_mem_fn<co_sub_dn_ind_t*, C>::type M>
171  void
172  setDnInd(C* obj) noexcept {
174  static_cast<void*>(obj));
175  }
176 
177  void
178  setUpInd(co_sub_up_ind_t* ind, void* data) noexcept {
179  co_obj_set_up_ind(this, ind, data);
180  }
181 
182  template <class F>
183  void
184  setUpInd(F* f) noexcept {
185  setUpInd(&c_obj_call<co_sub_up_ind_t*, F>::function, static_cast<void*>(f));
186  }
187 
188  template <class C, typename c_mem_fn<co_sub_up_ind_t*, C>::type M>
189  void
190  setUpInd(C* obj) noexcept {
192  static_cast<void*>(obj));
193  }
194 
195  protected:
196  ~COObj() {}
197 };
198 
200 template <>
202  typedef __co_sub value_type;
203  typedef value_type& reference;
204  typedef const value_type& const_reference;
205  typedef value_type* pointer;
206  typedef const value_type* const_pointer;
207 
208  static void*
209  alloc() noexcept {
210  return __co_sub_alloc();
211  }
212  static void
213  free(void* ptr) noexcept {
214  __co_sub_free(ptr);
215  }
216 
217  static pointer
218  init(pointer p, co_unsigned8_t subidx, co_unsigned16_t type) noexcept {
219  return __co_sub_init(p, subidx, type);
220  }
221 
222  static void
223  fini(pointer p) noexcept {
224  __co_sub_fini(p);
225  }
226 };
227 
229 class COSub : public incomplete_c_type<__co_sub> {
231 
232  public:
233  COSub(co_unsigned8_t subidx, co_unsigned16_t type) : c_base(subidx, type) {}
234 
235  COObj*
236  getObj() const noexcept {
237  return co_sub_get_obj(this);
238  }
239 
240  co_unsigned8_t
241  getSubidx() const noexcept {
242  return co_sub_get_subidx(this);
243  }
244 
245  const char*
246  getName() const noexcept {
247  return co_sub_get_name(this);
248  }
249 
250  int
251  setName(const char* name) noexcept {
252  return co_sub_set_name(this, name);
253  }
254 
255  co_unsigned8_t
256  getType() const noexcept {
257  return co_sub_get_type(this);
258  }
259 
260  const void*
261  addressofMin() const noexcept {
262  return co_sub_addressof_min(this);
263  }
264 
265  ::std::size_t
266  sizeofMin() const noexcept {
267  return co_sub_sizeof_min(this);
268  }
269 
270  template <co_unsigned16_t N>
271  const COVal<N>&
272  getMin() const noexcept {
273  return *reinterpret_cast<const COVal<N>*>(co_sub_get_min(this));
274  }
275 
276  ::std::size_t
277  setMin(const void* ptr, ::std::size_t n) noexcept {
278  return co_sub_set_min(this, ptr, n);
279  }
280 
281  template <co_unsigned16_t N>
282  ::std::size_t
283  setMin(const COVal<N>& val) noexcept {
284  return setMin(val.address(), val.size());
285  }
286 
287  template <class T>
288  ::std::size_t
289  setMin(const T& val) noexcept {
290  return setMin<co_type_traits_T<T>::index>(val);
291  }
292 
293  const void*
294  addressofMax() const noexcept {
295  return co_sub_addressof_max(this);
296  }
297 
298  ::std::size_t
299  sizeofMax() const noexcept {
300  return co_sub_sizeof_max(this);
301  }
302 
303  template <co_unsigned16_t N>
304  const COVal<N>&
305  getMax() const noexcept {
306  return *reinterpret_cast<const COVal<N>*>(co_sub_get_max(this));
307  }
308 
309  ::std::size_t
310  setMax(const void* ptr, ::std::size_t n) noexcept {
311  return co_sub_set_max(this, ptr, n);
312  }
313 
314  template <co_unsigned16_t N>
315  ::std::size_t
316  setMax(const COVal<N>& val) noexcept {
317  return setMax(val.address(), val.size());
318  }
319 
320  template <class T>
321  ::std::size_t
322  setMax(const T& val) noexcept {
323  return setMax<co_type_traits_T<T>::index>(val);
324  }
325 
326  const void*
327  addressofDef() const noexcept {
328  return co_sub_addressof_def(this);
329  }
330 
331  ::std::size_t
332  sizeofDef() const noexcept {
333  return co_sub_sizeof_def(this);
334  }
335 
336  template <co_unsigned16_t N>
337  const COVal<N>&
338  getDef() const noexcept {
339  return *reinterpret_cast<const COVal<N>*>(co_sub_get_def(this));
340  }
341 
342  ::std::size_t
343  setDef(const void* ptr, ::std::size_t n) noexcept {
344  return co_sub_set_def(this, ptr, n);
345  }
346 
347  template <co_unsigned16_t N>
348  ::std::size_t
349  setDef(const COVal<N>& val) noexcept {
350  return setDef(val.address(), val.size());
351  }
352 
353  template <class T>
354  ::std::size_t
355  setDef(const T& val) noexcept {
356  return setDef<co_type_traits_T<T>::index>(val);
357  }
358 
359  const void*
360  addressofVal() const noexcept {
361  return co_sub_addressof_val(this);
362  }
363 
364  ::std::size_t
365  sizeofVal() const noexcept {
366  return co_sub_sizeof_val(this);
367  }
368 
369  template <co_unsigned16_t N>
370  const COVal<N>&
371  getVal() const noexcept {
372  return *reinterpret_cast<const COVal<N>*>(co_sub_get_val(this));
373  }
374 
375  ::std::size_t
376  setVal(const void* ptr, ::std::size_t n) noexcept {
377  return co_sub_set_val(this, ptr, n);
378  }
379 
380  template <co_unsigned16_t N>
381  ::std::size_t
382  setVal(const COVal<N>& val) noexcept {
383  return setVal(val.address(), val.size());
384  }
385 
386  template <class T>
387  ::std::size_t
388  setVal(const T& val) noexcept {
389  return setVal<co_type_traits_T<T>::index>(val);
390  }
391 
392  template <co_unsigned16_t N>
393  co_unsigned32_t
394  chkVal(const COVal<N>& val) const noexcept {
395  return co_sub_chk_val(this, N, &val);
396  }
397 
398  template <class T>
399  co_unsigned32_t
400  chkVal(const T& val) const noexcept {
401  return chkVal<co_type_traits_T<T>::index>(val);
402  }
403 
404  unsigned int
405  getAccess() const noexcept {
406  return co_sub_get_access(this);
407  }
408 
409  int
410  setAccess(unsigned int access) noexcept {
411  return co_sub_set_access(this, access);
412  }
413 
414  int
415  getPDOMapping() const noexcept {
416  return co_sub_get_pdo_mapping(this);
417  }
418 
419  void
420  setPDOMapping(unsigned int pdo_mapping) noexcept {
421  co_sub_set_pdo_mapping(this, pdo_mapping);
422  }
423 
424  unsigned int
425  getFlags() const noexcept {
426  return co_sub_get_flags(this);
427  }
428 
429  void
430  setFlags(unsigned int flags) noexcept {
431  co_sub_set_flags(this, flags);
432  }
433 
434  void
435  getDnInd(co_sub_dn_ind_t** pind, void** pdata) noexcept {
436  co_sub_get_dn_ind(this, pind, pdata);
437  }
438 
439  void
440  setDnInd(co_sub_dn_ind_t* ind, void* data) noexcept {
441  co_sub_set_dn_ind(this, ind, data);
442  }
443 
444  template <co_unsigned16_t N, typename COSubDnInd<N>::type M>
445  void
446  setDnInd(void* data) noexcept {
447  setDnInd(&COSubDnInd<N>::template function<M>, data);
448  }
449 
450  template <co_unsigned16_t N, class F>
451  void
452  setDnInd(F* f) noexcept {
453  setDnInd(&COSubDnInd<N>::template function<
454  &c_obj_call<typename COSubDnInd<N>::type, F>::function>,
455  static_cast<void*>(f));
456  }
457 
458  template <co_unsigned16_t N, class C,
459  typename c_mem_fn<typename COSubDnInd<N>::type, C>::type M>
460  void
461  setDnInd(C* obj) noexcept {
462  setDnInd(&COSubDnInd<N>::template function<
463  &c_mem_call<typename COSubDnInd<N>::type, C, M>::function>,
464  static_cast<void*>(obj));
465  }
466 
467  co_unsigned32_t
468  onDn(co_sdo_req& req) noexcept {
469  return co_sub_on_dn(this, &req);
470  }
471 
472  co_unsigned32_t
473  dnInd(co_sdo_req& req) noexcept {
474  return co_sub_dn_ind(this, &req);
475  }
476 
477  template <co_unsigned16_t N>
478  co_unsigned32_t
479  dnInd(const COVal<N>& val) noexcept {
480  return co_sub_dn_ind_val(this, N, &val);
481  }
482 
483  template <co_unsigned16_t N>
484  int
485  dn(COVal<N>& val) noexcept {
486  return co_sub_dn(this, &val);
487  }
488 
489  void
490  getUpInd(co_sub_up_ind_t** pind, void** pdata) noexcept {
491  co_sub_get_up_ind(this, pind, pdata);
492  }
493 
494  void
495  setUpInd(co_sub_up_ind_t* ind, void* data) noexcept {
496  co_sub_set_up_ind(this, ind, data);
497  }
498 
499  template <co_unsigned16_t N, typename COSubUpInd<N>::type M>
500  void
501  setUpInd(void* data) noexcept {
502  setUpInd(&COSubUpInd<N>::template function<M>, data);
503  }
504 
505  template <co_unsigned16_t N, class F>
506  void
507  setUpInd(F* f) noexcept {
508  setUpInd(&COSubUpInd<N>::template function<
509  &c_obj_call<typename COSubUpInd<N>::type, F>::function>,
510  static_cast<void*>(f));
511  }
512 
513  template <co_unsigned16_t N, class C,
514  typename c_mem_fn<typename COSubUpInd<N>::type, C>::type M>
515  void
516  setUpInd(C* obj) noexcept {
517  setUpInd(&COSubUpInd<N>::template function<
518  &c_mem_call<typename COSubUpInd<N>::type, C, M>::function>,
519  static_cast<void*>(obj));
520  }
521 
522  co_unsigned32_t
523  onUp(co_sdo_req& req) const noexcept {
524  return co_sub_on_up(this, &req);
525  }
526 
527  co_unsigned32_t
528  upInd(co_sdo_req& req) const noexcept {
529  return co_sub_up_ind(this, &req);
530  }
531 
532  protected:
533  ~COSub() {}
534 };
535 
541 template <co_unsigned16_t N>
542 struct COSubDnInd {
543  typedef co_unsigned32_t (*type)(COSub* sub, COVal<N>& val, void* data);
544 
545  template <type M>
546  static co_unsigned32_t
547  function(COSub* sub, co_sdo_req* req, void* data) noexcept {
548  uint32_t ac = 0;
549 
550  COVal<N> val;
551  if (co_sdo_req_dn_val(req, N, &val, &ac) == -1) return ac;
552 
553  if ((ac = sub->chkVal(val))) return ac;
554 
555  if ((ac = (*M)(sub, val, data))) return ac;
556 
557  sub->dn(val);
558  return ac;
559  }
560 };
561 
567 template <co_unsigned16_t N>
568 struct COSubUpInd {
569  typedef co_unsigned32_t (*type)(const COSub* sub, COVal<N>& val, void* data);
570 
571  template <type M>
572  static co_unsigned32_t
573  function(const COSub* sub, co_sdo_req* req, void* data) noexcept {
574  uint32_t ac = 0;
575 
576  COVal<N> val = sub->getVal<N>();
577 
578  if ((ac = (*M)(sub, val, data))) return ac;
579 
580  co_sdo_req_up_val(req, N, &val, &ac);
581  return ac;
582  }
583 };
584 
585 } // namespace lely
586 
587 #endif // !LELY_CO_OBJ_HPP_
A CANopen CANopen sub-object upload indication callback wrapper.
Definition: obj.hpp:42
size_t co_sub_set_def(co_sub_t *sub, const void *ptr, size_t n)
Sets the default value of a CANopen sub-object.
Definition: obj.c:592
A CANopen SDO upload/download request.
Definition: sdo.h:178
int co_obj_insert_sub(co_obj_t *obj, co_sub_t *sub)
Inserts a sub-object into a CANopen object.
Definition: obj.c:164
void co_obj_set_dn_ind(co_obj_t *obj, co_sub_dn_ind_t *ind, void *data)
Sets the download indication function for a CANopen object.
Definition: obj.c:336
size_t co_sub_sizeof_max(const co_sub_t *sub)
Returns size (in bytes) of the upper limit of the value of a CANopen sub-object.
Definition: obj.c:551
co_unsigned32_t co_sub_dn_ind_val(co_sub_t *sub, co_unsigned16_t type, const void *val)
Invokes the download indication function of a CANopen sub-object, registered with co_sub_set_dn_ind()...
Definition: obj.c:810
co_unsigned32_t co_sub_on_up(const co_sub_t *sub, struct co_sdo_req *req)
Implements the default behavior when an upload indication is received by a CANopen sub-object...
Definition: obj.c:866
A CANopen sub-object.
Definition: obj.h:54
size_t co_sub_set_max(co_sub_t *sub, const void *ptr, size_t n)
Sets the upper limit of a value of a CANopen sub-object.
Definition: obj.c:563
const void * co_sub_addressof_max(const co_sub_t *sub)
Returns the address of the upper limit of the value of a CANopen sub-object.
Definition: obj.c:545
int co_sub_set_name(co_sub_t *sub, const char *name)
Sets the name of a CANopen sub-object.
Definition: obj.c:484
size_t co_sub_sizeof_def(const co_sub_t *sub)
Returns size (in bytes) of the default value of a CANopen sub-object.
Definition: obj.c:580
int co_obj_set_code(co_obj_t *obj, co_unsigned8_t code)
Sets the code (type) of a CANopen object.
Definition: obj.c:258
void co_sub_set_flags(co_sub_t *sub, unsigned int flags)
Sets the object flags of a CANopen sub-object.
Definition: obj.c:730
const void * co_sub_get_min(const co_sub_t *sub)
Returns a pointer to the lower limit of the value of a CANopen sub-object.
Definition: obj.c:530
int co_sdo_req_up_val(struct co_sdo_req *req, co_unsigned16_t type, const void *val, co_unsigned32_t *pac)
Writes the specified value to a buffer and constructs a CANopen SDO upload request.
Definition: sdo.c:278
const void * co_sub_get_def(const co_sub_t *sub)
Returns a pointer to the default value of a CANopen sub-object.
Definition: obj.c:586
co_unsigned32_t co_sub_chk_val(const co_sub_t *sub, co_unsigned16_t type, const void *val)
Checks if the specifed value would be a valid value for a CANopen sub-object.
Definition: obj.c:656
The base class for a C++ interface to an incomplete C type.
Definition: c_type.hpp:245
An opaque CANopen device type.
Definition: dev.hpp:76
co_unsigned8_t co_obj_get_code(const co_obj_t *obj)
Returns the object code of a CANopen object.
Definition: obj.c:250
This header file is part of the CANopen library; it contains the Service Data Object (SDO) declaratio...
int co_sub_get_pdo_mapping(const co_sub_t *sub)
Returns 1 if it is possible to map the specified CANopen sub-object into a PDO, and 0 if not...
Definition: obj.c:706
This header file is part of the CANopen library; it contains the C++ interface of the CANopen value d...
const void * co_sub_addressof_min(const co_sub_t *sub)
Returns the address of the lower limit of the value of a CANopen sub-object.
Definition: obj.c:518
const void * co_sub_addressof_def(const co_sub_t *sub)
Returns the address of the default value of a CANopen sub-object.
Definition: obj.c:574
unsigned int co_sub_get_access(const co_sub_t *sub)
Returns the access type of a CANopen sub-object.
Definition: obj.c:682
int co_obj_remove_sub(co_obj_t *obj, co_sub_t *sub)
Removes a sub-object from a CANopen object.
Definition: obj.c:187
void co_sub_set_up_ind(co_sub_t *sub, co_sub_up_ind_t *ind, void *data)
Sets the upload indication function for a CANopen sub-object.
Definition: obj.c:857
An opaque CANopen object type.
Definition: obj.hpp:74
co_unsigned32_t co_sub_on_dn(co_sub_t *sub, struct co_sdo_req *req)
Implements the default behavior when a download indication is received by a CANopen sub-object...
Definition: obj.c:758
void co_obj_set_up_ind(co_obj_t *obj, co_sub_up_ind_t *ind, void *data)
Sets the upload indication function for a CANopen object.
Definition: obj.c:345
size_t co_sub_set_min(co_sub_t *sub, const void *ptr, size_t n)
Sets the lower limit of a value of a CANopen sub-object.
Definition: obj.c:536
This header file is part of the utilities library; it contains the C to C++ interface declarations...
size_t co_sub_sizeof_min(const co_sub_t *sub)
Returns size (in bytes) of the lower limit of the value of a CANopen sub-object.
Definition: obj.c:524
const void * co_sub_get_val(const co_sub_t *sub)
Returns a pointer to the current value of a CANopen sub-object.
Definition: obj.c:613
void co_sub_set_pdo_mapping(co_sub_t *sub, int pdo_mapping)
Enables or disables PDO mapping a CANopen sub-object.
Definition: obj.c:714
size_t co_obj_set_val(co_obj_t *obj, co_unsigned8_t subidx, const void *ptr, size_t n)
Sets the current value of a CANopen sub-object.
Definition: obj.c:294
An opaque CANopen sub-object type.
Definition: obj.hpp:229
co_unsigned32_t co_sub_up_ind(const co_sub_t *sub, struct co_sdo_req *req)
Invokes the upload indication function of a CANopen sub-object, registered with co_sub_set_up_ind().
Definition: obj.c:890
co_dev_t * co_obj_get_dev(const co_obj_t *obj)
Returns a pointer to the CANopen device containing the specified object.
Definition: obj.c:128
int co_sub_dn(co_sub_t *sub, void *val)
Downloads (moves) a value into a CANopen sub-object if the refuse-write-on-download flag (CO_OBJ_FLAG...
Definition: obj.c:832
void co_sub_get_dn_ind(const co_sub_t *sub, co_sub_dn_ind_t **pind, void **pdata)
Retrieves the download indication function for a CANopen sub-object.
Definition: obj.c:738
unsigned int co_sub_get_flags(const co_sub_t *sub)
Returns the object flags of a CANopen sub-object.
Definition: obj.c:722
co_unsigned8_t co_obj_get_subidx(const co_obj_t *obj, co_unsigned8_t maxsubidx, co_unsigned8_t *subidx)
Retrieves a list of sub-indices in a CANopen object.
Definition: obj.c:144
size_t co_sub_set_val(co_sub_t *sub, const void *ptr, size_t n)
Sets the current value of a CANopen sub-object.
Definition: obj.c:619
co_obj_t * co_sub_get_obj(const co_sub_t *sub)
Returns the a pointer to the CANopen object containing the specified sub-object.
Definition: obj.c:458
const void * co_sub_addressof_val(const co_sub_t *sub)
Returns the address of the current value of a CANopen sub-object.
Definition: obj.c:601
int co_sub_set_access(co_sub_t *sub, unsigned int access)
Sets the access type of a CANopen sub-object.
Definition: obj.c:690
int co_sdo_req_dn_val(struct co_sdo_req *req, co_unsigned16_t type, void *val, co_unsigned32_t *pac)
Copies the next segment of the specified CANopen SDO download request to the internal buffer and...
Definition: sdo.c:165
const void * co_sub_get_max(const co_sub_t *sub)
Returns a pointer to the upper limit of the value of a CANopen sub-object.
Definition: obj.c:557
int co_obj_set_name(co_obj_t *obj, const char *name)
Sets the name of a CANopen object.
Definition: obj.c:226
A CANopen CANopen sub-object download indication callback wrapper.
Definition: obj.hpp:40
co_unsigned8_t co_sub_get_subidx(const co_sub_t *sub)
Returns the sub-index of a CANopen sub-object.
Definition: obj.c:466
const void * co_obj_get_val(const co_obj_t *obj, co_unsigned8_t subidx)
Returns a pointer to the current value of a CANopen sub-object.
Definition: obj.c:287
const char * co_obj_get_name(const co_obj_t *obj)
Returns the name of a CANopen object.
Definition: obj.c:218
Global namespace for the Lely Industries N.V. libraries.
Definition: buf.hpp:32
size_t co_sub_sizeof_val(const co_sub_t *sub)
Returns size (in bytes) of the current value of a CANopen sub-object.
Definition: obj.c:607
co_unsigned16_t co_sub_get_type(const co_sub_t *sub)
Returns the data type of a CANopen sub-object.
Definition: obj.c:508
co_sub_t * co_obj_find_sub(const co_obj_t *obj, co_unsigned8_t subidx)
Finds a sub-object in a CANopen object.
Definition: obj.c:207
co_unsigned32_t co_sub_dn_ind(co_sub_t *sub, struct co_sdo_req *req)
Invokes the download indication function of a CANopen sub-object, registered with co_sub_set_dn_ind()...
Definition: obj.c:794
co_unsigned16_t co_obj_get_idx(const co_obj_t *obj)
Returns the index of a CANopen object.
Definition: obj.c:136
void co_sub_set_dn_ind(co_sub_t *sub, co_sub_dn_ind_t *ind, void *data)
Sets the download indication function for a CANopen sub-object.
Definition: obj.c:749
const char * co_sub_get_name(const co_sub_t *sub)
Returns the name of a CANopen sub-object.
Definition: obj.c:476
A CANopen object.
Definition: obj.h:32
This header file is part of the CANopen library; it contains the object dictionary declarations...
This header file is part of the utilities library; it contains the C callback wrapper declarations...
co_unsigned32_t co_sub_up_ind_t(const co_sub_t *sub, struct co_sdo_req *req, void *data)
The type of a CANopen sub-object upload indication function, invoked by an SDO upload request...
Definition: obj.h:150
A CANopen value.
Definition: val.hpp:42
void co_sub_get_up_ind(const co_sub_t *sub, co_sub_up_ind_t **pind, void **pdata)
Retrieves the upload indication function for a CANopen sub-object.
Definition: obj.c:846
A class template supplying a uniform interface to certain attributes of C types.
Definition: c_type.hpp:120
co_unsigned32_t co_sub_dn_ind_t(co_sub_t *sub, struct co_sdo_req *req, void *data)
The type of a CANopen sub-object download indication function, invoked by an SDO download request or ...
Definition: obj.h:135