Lely core libraries
2.3.4
|
Go to the source code of this file.
Typedefs | |
typedef void | co_csdo_dn_con_t(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned32_t ac, void *data) |
The type of a CANopen Client-SDO download confirmation callback function, invoked when a download request completes (with success or failure). More... | |
typedef void | co_csdo_up_con_t(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned32_t ac, const void *ptr, size_t n, void *data) |
The type of a CANopen Client-SDO upload confirmation callback function, invoked when an upload request completes (with success or failure). More... | |
typedef void | co_csdo_ind_t(const co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, size_t size, size_t nbyte, void *data) |
The type of a CANopen Client-SDO request progress indication function, used to notify the user of the progress of the current upload/download request. More... | |
Functions | |
int | co_dev_dn_req (co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data) |
Submits a download request to a local device. More... | |
int | co_dev_dn_val_req (co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con, void *data) |
Submits a download request to a local device. More... | |
int | co_dev_dn_dcf_req (co_dev_t *dev, const uint_least8_t *begin, const uint_least8_t *end, co_csdo_dn_con_t *con, void *data) |
Submits a series of download requests to a local device. More... | |
int | co_dev_up_req (const co_dev_t *dev, co_unsigned16_t idx, co_unsigned8_t subidx, co_csdo_up_con_t *con, void *data) |
Submits an upload request to a local device. More... | |
co_csdo_t * | co_csdo_create (can_net_t *net, co_dev_t *dev, co_unsigned8_t num) |
Creates a new CANopen Client-SDO service. More... | |
void | co_csdo_destroy (co_csdo_t *sdo) |
Destroys a CANopen Client-SDO service. More... | |
int | co_csdo_start (co_csdo_t *sdo) |
Starts a Client-SDO service. More... | |
void | co_csdo_stop (co_csdo_t *sdo) |
Stops a Client-SDO service. More... | |
int | co_csdo_is_stopped (const co_csdo_t *sdo) |
Retuns 1 if the specified Client-SDO service is stopped, and 0 if not. More... | |
can_net_t * | co_csdo_get_net (const co_csdo_t *sdo) |
Returns a pointer to the CAN network of a Client-SDO. | |
co_dev_t * | co_csdo_get_dev (const co_csdo_t *sdo) |
Returns a pointer to the CANopen device of a Client-SDO. | |
co_unsigned8_t | co_csdo_get_num (const co_csdo_t *sdo) |
Returns the SDO number of a Client-SDO. | |
const struct co_sdo_par * | co_csdo_get_par (const co_csdo_t *sdo) |
Returns a pointer to the SDO parameter record of a Client-SDO. | |
int | co_csdo_get_timeout (const co_csdo_t *sdo) |
Returns the timeout (in milliseconds) of a Client-SDO. More... | |
void | co_csdo_set_timeout (co_csdo_t *sdo, int timeout) |
Sets the timeout of a Client-SDO. More... | |
void | co_csdo_get_dn_ind (const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata) |
Retrieves the indication function used to notify the user of the progress of the current SDO download request. More... | |
void | co_csdo_set_dn_ind (co_csdo_t *sdo, co_csdo_ind_t *ind, void *data) |
Sets the indication function used to notify the user of the progress of the current SDO download request. More... | |
void | co_csdo_get_up_ind (const co_csdo_t *sdo, co_csdo_ind_t **pind, void **pdata) |
Retrieves the indication function used to notify the user of the progress of the current SDO upload request. More... | |
void | co_csdo_set_up_ind (co_csdo_t *sdo, co_csdo_ind_t *ind, void *data) |
Sets the indication function used to notify the user of the progress of the current SDO upload request. More... | |
int | co_csdo_is_valid (const co_csdo_t *sdo) |
Returns 1 of the COB-IDs of the specified Client-SDO service are valid, and 0 if not. | |
int | co_csdo_is_idle (const co_csdo_t *sdo) |
Returns 1 if the specified Client-SDO service is idle, and 0 if a transfer is ongoing. | |
void | co_csdo_abort_req (co_csdo_t *sdo, co_unsigned32_t ac) |
Submits an abort transfer request to a remote Server-SDO. More... | |
int | co_csdo_dn_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data) |
Submits a download request to a remote Server-SDO. More... | |
int | co_csdo_dn_val_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con, void *data) |
Submits a download request to a remote Server-SDO. More... | |
int | co_csdo_dn_dcf_req (co_csdo_t *sdo, const uint_least8_t *begin, const uint_least8_t *end, co_csdo_dn_con_t *con, void *data) |
Submits a series of download requests to a remote Server-SDO. More... | |
int | co_csdo_up_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_csdo_up_con_t *con, void *data) |
Submits an upload request to a remote Server-SDO. More... | |
int | co_csdo_blk_dn_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, const void *ptr, size_t n, co_csdo_dn_con_t *con, void *data) |
Submits a block download request to a remote Server-SDO. More... | |
int | co_csdo_blk_dn_val_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned16_t type, const void *val, co_csdo_dn_con_t *con, void *data) |
Submits a block download request to a remote Server-SDO. More... | |
int | co_csdo_blk_up_req (co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned8_t pst, co_csdo_up_con_t *con, void *data) |
Submits a block upload request to a remote Server-SDO. More... | |
This header file is part of the CANopen library; it contains the Client-SDO declarations.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file csdo.h.
typedef void co_csdo_dn_con_t(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned32_t ac, void *data) |
The type of a CANopen Client-SDO download confirmation callback function, invoked when a download request completes (with success or failure).
sdo | a pointer to a Client-SDO service (NULL in case of a local device). |
idx | the object index. |
subidx | the object sub-index. |
ac | the abort code (0 on success). |
data | a pointer to user-specified data. |
typedef void co_csdo_up_con_t(co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, co_unsigned32_t ac, const void *ptr, size_t n, void *data) |
The type of a CANopen Client-SDO upload confirmation callback function, invoked when an upload request completes (with success or failure).
sdo | a pointer to a Client-SDO service (NULL in case of a local device). |
idx | the object index. |
subidx | the object sub-index. |
ac | the abort code (0 on success). |
ptr | a pointer to the uploaded bytes. |
n | the number of bytes at ptr. |
data | a pointer to user-specified data. |
typedef void co_csdo_ind_t(const co_csdo_t *sdo, co_unsigned16_t idx, co_unsigned8_t subidx, size_t size, size_t nbyte, void *data) |
The type of a CANopen Client-SDO request progress indication function, used to notify the user of the progress of the current upload/download request.
The indication function is invoked after the size of the value has been sent/received, and again after each block (of at most 127 segments) is sent/received. The last invocation occurs before the upload/download confirmation. No notification is generated for expedited transfers.
sdo | a pointer to a Client-SDO service. |
idx | the object index. |
subidx | the object sub-index. |
size | The total size (in bytes) of the value being uploaded/downloaded. |
nbyte | The number of bytes already uploaded/downloaded. |
data | a pointer to user-specified data. |
int co_dev_dn_req | ( | co_dev_t * | dev, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
const void * | ptr, | ||
size_t | n, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a download request to a local device.
This is equivalent to a write operation into an dictionary.
dev | a pointer to CANopen device. |
idx | the remote object index. |
subidx | the remote object sub-index. |
ptr | a pointer to the bytes to be downloaded. |
n | the number of bytes at ptr. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_dev_dn_val_req | ( | co_dev_t * | dev, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_unsigned16_t | type, | ||
const void * | val, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a download request to a local device.
This is equivalent to a write operation into an object dictionary.
dev | a pointer to CANopen device. |
idx | the remote object index. |
subidx | the remote object sub-index. |
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of string or domains, this MUST be the address of pointer. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_dev_dn_dcf_req | ( | co_dev_t * | dev, |
const uint_least8_t * | begin, | ||
const uint_least8_t * | end, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a series of download requests to a local device.
This function calls co_dev_dn_req() for each entry in the specified concise DCF.
dev | a pointer to CANopen device. |
begin | a pointer the the first byte in a concise DCF (see object 1F22 in CiA 302-3 version 4.1.0). |
end | a pointer to one past the last byte in the concise DCF. At most end - begin bytes are read. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_dev_up_req | ( | const co_dev_t * | dev, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_csdo_up_con_t * | con, | ||
void * | data | ||
) |
Submits an upload request to a local device.
This is equivalent to a read operation from an object dictionary.
dev | a pointer to CANopen device. |
idx | the remote object index. |
subidx | the remote object sub-index. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
Creates a new CANopen Client-SDO service.
The service is started as if by co_csdo_start().
net | a pointer to a CAN network. |
dev | a pointer to a CANopen device describing the client (can be NULL). |
num | the SDO number (in the range [1..128]). The SDO parameter record MUST exist in the object dictionary of dev. However, if dev is NULL, num is interpreted as a node-ID (in the range [1..127]) and the default SDO parameters are used. |
void co_csdo_destroy | ( | co_csdo_t * | sdo | ) |
Destroys a CANopen Client-SDO service.
int co_csdo_start | ( | co_csdo_t * | sdo | ) |
Starts a Client-SDO service.
void co_csdo_stop | ( | co_csdo_t * | sdo | ) |
Stops a Client-SDO service.
Any ongoing request is aborted.
int co_csdo_is_stopped | ( | const co_csdo_t * | sdo | ) |
Retuns 1 if the specified Client-SDO service is stopped, and 0 if not.
int co_csdo_get_timeout | ( | const co_csdo_t * | sdo | ) |
Returns the timeout (in milliseconds) of a Client-SDO.
A return value of 0 (the default) means no timeout is being used.
void co_csdo_set_timeout | ( | co_csdo_t * | sdo, |
int | timeout | ||
) |
Sets the timeout of a Client-SDO.
If the timeout expires before receiving a response from a server, the client aborts the transfer.
sdo | a pointer to a Client-SDO service. |
timeout | the timeout (in milliseconds). A value of 0 (the default) disables the timeout. |
void co_csdo_get_dn_ind | ( | const co_csdo_t * | sdo, |
co_csdo_ind_t ** | pind, | ||
void ** | pdata | ||
) |
Retrieves the indication function used to notify the user of the progress of the current SDO download request.
sdo | a pointer to a Client-SDO service. |
pind | the address at which to store a pointer to the indication function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void co_csdo_set_dn_ind | ( | co_csdo_t * | sdo, |
co_csdo_ind_t * | ind, | ||
void * | data | ||
) |
Sets the indication function used to notify the user of the progress of the current SDO download request.
sdo | a pointer to a Client-SDO service. |
ind | a pointer to the function to be invoked. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
void co_csdo_get_up_ind | ( | const co_csdo_t * | sdo, |
co_csdo_ind_t ** | pind, | ||
void ** | pdata | ||
) |
Retrieves the indication function used to notify the user of the progress of the current SDO upload request.
sdo | a pointer to a Client-SDO service. |
pind | the address at which to store a pointer to the indication function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void co_csdo_set_up_ind | ( | co_csdo_t * | sdo, |
co_csdo_ind_t * | ind, | ||
void * | data | ||
) |
Sets the indication function used to notify the user of the progress of the current SDO upload request.
sdo | a pointer to a Client-SDO service. |
ind | a pointer to the function to be invoked. |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to ind. |
void co_csdo_abort_req | ( | co_csdo_t * | sdo, |
co_unsigned32_t | ac | ||
) |
Submits an abort transfer request to a remote Server-SDO.
This function has no effect if the Client-SDO service is idle (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
ac | the abort code. |
int co_csdo_dn_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
const void * | ptr, | ||
size_t | n, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a download request to a remote Server-SDO.
This requests the server to download the value and is equivalent to a write operation into a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
ptr | a pointer to the bytes to be downloaded. It is the responsibility of the user to ensure that the buffer remains valid until the operation completes. |
n | the number of bytes at ptr. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_dn_val_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_unsigned16_t | type, | ||
const void * | val, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a download request to a remote Server-SDO.
This requests the server to download the value and is equivalent to a write operation into a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of string or domains, this MUST be the address of pointer. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_dn_dcf_req | ( | co_csdo_t * | sdo, |
const uint_least8_t * | begin, | ||
const uint_least8_t * | end, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a series of download requests to a remote Server-SDO.
This function calls co_csdo_dn_req() for each entry in the specified concise DCF.
sdo | a pointer to a Client-SDO service. |
begin | a pointer the the first byte in a concise DCF (see object 1F22 in CiA 302-3 version 4.1.0). |
end | a pointer to one past the last byte in the concise DCF. At most end - begin bytes are read. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_up_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_csdo_up_con_t * | con, | ||
void * | data | ||
) |
Submits an upload request to a remote Server-SDO.
This requests the server to upload the value and is equivalent to a read operation from a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_blk_dn_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
const void * | ptr, | ||
size_t | n, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a block download request to a remote Server-SDO.
This requests the server to download the value and is equivalent to a write operation into a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
ptr | a pointer to the bytes to be downloaded. |
n | the number of bytes at ptr. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_blk_dn_val_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_unsigned16_t | type, | ||
const void * | val, | ||
co_csdo_dn_con_t * | con, | ||
void * | data | ||
) |
Submits a block download request to a remote Server-SDO.
This requests the server to download the value and is equivalent to a write operation into a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
type | the data type (in the range [1..27]). This MUST be the object index of one of the static data types. |
val | the address of the value to be written. In case of string or domains, this MUST be the address of pointer. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |
int co_csdo_blk_up_req | ( | co_csdo_t * | sdo, |
co_unsigned16_t | idx, | ||
co_unsigned8_t | subidx, | ||
co_unsigned8_t | pst, | ||
co_csdo_up_con_t * | con, | ||
void * | data | ||
) |
Submits a block upload request to a remote Server-SDO.
This requests the server to upload the value and is equivalent to a read operation from a remote object dictionary. Note that the request will fail if another transfer is in progress (see co_csdo_is_idle()).
sdo | a pointer to a Client-SDO service. |
idx | the remote object index. |
subidx | the remote object sub-index. |
pst | the protocol switch threshold. If pst is non-zero, and the number of bytes to be uploaded is less than or equal to pst, the server may switch to the SDO upload protocol. |
con | a pointer to the confirmation function (can be NULL). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to con. |