Structure for input / output on the OD variable. More...
#include <CO_ODinterface.h>
Data Fields | |
OD_stream_t | stream |
Object Dictionary stream object, passed to read or write. | |
OD_size_t(* | read )(OD_stream_t *stream, uint8_t subIndex, void *buf, OD_size_t count, ODR_t *returnCode) |
Function pointer for reading value from specified variable from Object Dictionary. More... | |
OD_size_t(* | write )(OD_stream_t *stream, uint8_t subIndex, const void *buf, OD_size_t count, ODR_t *returnCode) |
Function pointer for writing value into specified variable inside Object Dictionary. More... | |
Structure for input / output on the OD variable.
It is initialized with OD_getSub() function. Access principle to OD variable is via read/write functions operating on stream, similar as standard read/write.
OD_size_t(* OD_IO_t::read) (OD_stream_t *stream, uint8_t subIndex, void *buf, OD_size_t count, ODR_t *returnCode) |
Function pointer for reading value from specified variable from Object Dictionary.
If OD variable is larger than buf, then this function must be called several times. After completed successful read function returns 'ODR_OK'. If read is partial, it returns 'ODR_PARTIAL'. In case of errors function returns code similar to SDO abort code.
Read can be restarted with OD_rwRestart() function.
At the moment, when Object Dictionary is initialized, every variable has assigned the same "read" function. This default function simply copies data from Object Dictionary variable. Application can bind its own "read" function for specific object. In that case application is able to calculate data for reading from own internal state at the moment of "read" function call. For this functionality OD object must have IO extension enabled. OD object must also be initialized with OD_extensionIO_init() function call.
"read" function must always copy all own data to buf, except if "buf" is not large enough. ("*returnCode" must not return 'ODR_PARTIAL', if there is still space in "buf".)
stream | Object Dictionary stream object. | |
subIndex | Object Dictionary subIndex of the accessed element. | |
buf | Pointer to external buffer, where to data will be copied. | |
count | Size of the external buffer in bytes. | |
[out] | returnCode | Return value from ODR_t. |
OD_size_t(* OD_IO_t::write) (OD_stream_t *stream, uint8_t subIndex, const void *buf, OD_size_t count, ODR_t *returnCode) |
Function pointer for writing value into specified variable inside Object Dictionary.
If OD variable is larger than buf, then this function must be called several times. After completed successful write function returns 'ODR_OK'. If write is partial, it returns 'ODR_PARTIAL'. In case of errors function returns code similar to SDO abort code.
Write can be restarted with OD_rwRestart() function.
At the moment, when Object Dictionary is initialised, every variable has assigned the same "write" function, which simply copies data to Object Dictionary variable. Application can bind its own "write" function, similar as it can bind "read" function.
"write" function must always copy all available data from buf. If OD variable expect more data, then "*returnCode" must return 'ODR_PARTIAL'.
stream | Object Dictionary stream object. | |
subIndex | Object Dictionary subIndex of the accessed element. | |
buf | Pointer to external buffer, from where data will be copied. | |
count | Size of the external buffer in bytes. | |
[out] | returnCode | Return value from ODR_t. |