Lely core libraries
2.3.4
|
This header file is part of the CANopen library; it contains the ASCII gateway declarations (see CiA 309-3 version 2.1). More...
#include <lely/co/gw.h>
Go to the source code of this file.
Macros | |
#define | CO_GW_TXT_IMPL_HI 2 |
The high number of the version of CiA 309-3 implemented by this gateway. | |
#define | CO_GW_TXT_IMPL_LO 1 |
The low number of the version of CiA 309-3 implemented by this gateway. | |
Typedefs | |
typedef struct __co_gw_txt | co_gw_txt_t |
An opaque CANopen ASCII gateway type. | |
typedef int | co_gw_txt_recv_func_t(const char *txt, void *data) |
The type of a CANopen ASCII gateway receive callback function, invoked when when an indication of conformation is received from a gateway and needs to be sent to the user. More... | |
typedef int | co_gw_txt_send_func_t(const struct co_gw_req *req, void *data) |
The type of a CANopen ASCII gateway send callback function, invoked when a request has been issued by the user and needs to be sent to a gateway. More... | |
Functions | |
co_gw_txt_t * | co_gw_txt_create (void) |
Creates a new CANopen ASCII gateway. More... | |
void | co_gw_txt_destroy (co_gw_txt_t *gw) |
Destroys a CANopen ASCII gateway. More... | |
int | co_gw_txt_iec (co_gw_txt_t *gw) |
Returns (and clears) the last internal error code. | |
size_t | co_gw_txt_pending (const co_gw_txt_t *gw) |
Returns the number of pending (i.e., unconfirmed) requests. | |
int | co_gw_txt_recv (co_gw_txt_t *gw, const struct co_gw_srv *srv) |
Receives and forwards an indication or confirmation from a CANopen gateway. More... | |
void | co_gw_txt_get_recv_func (const co_gw_txt_t *gw, co_gw_txt_recv_func_t **pfunc, void **pdata) |
Retrieves the callback function used to forward indications and confirmations received by a CANopen gateway to the user. More... | |
void | co_gw_txt_set_recv_func (co_gw_txt_t *gw, co_gw_txt_recv_func_t *func, void *data) |
Sets the callback function used to forward indications and confirmations received by a CANopen gateway to the user. More... | |
size_t | co_gw_txt_send (co_gw_txt_t *gw, const char *begin, const char *end, struct floc *at) |
Sends a user request to a CANopen gateway. More... | |
void | co_gw_txt_get_send_func (const co_gw_txt_t *gw, co_gw_txt_send_func_t **pfunc, void **pdata) |
Retrieves the callback function used to send requests from the user to a CANopen gateway. More... | |
void | co_gw_txt_set_send_func (co_gw_txt_t *gw, co_gw_txt_send_func_t *func, void *data) |
Sets the callback function used to send requests from the user to a CANopen gateway. More... | |
This header file is part of the CANopen library; it contains the ASCII gateway declarations (see CiA 309-3 version 2.1).
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 gw_txt.h.
typedef int co_gw_txt_recv_func_t(const char *txt, void *data) |
The type of a CANopen ASCII gateway receive callback function, invoked when when an indication of conformation is received from a gateway and needs to be sent to the user.
txt | a pointer to a human-readable string containing the indication or confirmation. |
data | a pointer to user-specified data. |
set_errnum()
. typedef int co_gw_txt_send_func_t(const struct co_gw_req *req, void *data) |
The type of a CANopen ASCII gateway send callback function, invoked when a request has been issued by the user and needs to be sent to a gateway.
req | a pointer to the parameters of the request to be sent. |
data | a pointer to user-specified data. |
set_errnum()
. co_gw_txt_t* co_gw_txt_create | ( | void | ) |
Creates a new CANopen ASCII gateway.
void co_gw_txt_destroy | ( | co_gw_txt_t * | gw | ) |
Destroys a CANopen ASCII gateway.
int co_gw_txt_recv | ( | co_gw_txt_t * | gw, |
const struct co_gw_srv * | srv | ||
) |
Receives and forwards an indication or confirmation from a CANopen gateway.
gw | a pointer to a CANopen ASCII gateway. |
srv | a pointer to the service parameters. |
void co_gw_txt_get_recv_func | ( | const co_gw_txt_t * | gw, |
co_gw_txt_recv_func_t ** | pfunc, | ||
void ** | pdata | ||
) |
Retrieves the callback function used to forward indications and confirmations received by a CANopen gateway to the user.
gw | a pointer to a CANopen ASCII gateway. |
pfunc | the address at which to store a pointer to the callback function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void co_gw_txt_set_recv_func | ( | co_gw_txt_t * | gw, |
co_gw_txt_recv_func_t * | func, | ||
void * | data | ||
) |
Sets the callback function used to forward indications and confirmations received by a CANopen gateway to the user.
gw | a pointer to a CANopen ASCII gateway. |
func | a pointer to the function invoked by co_gw_txt_recv(). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |
size_t co_gw_txt_send | ( | co_gw_txt_t * | gw, |
const char * | begin, | ||
const char * | end, | ||
struct floc * | at | ||
) |
Sends a user request to a CANopen gateway.
gw | a pointer to a CANopen ASCII gateway. |
begin | a pointer to the start of the buffer containing the request. |
end | a pointer to one past the last character in the buffer (can be NULL if the buffer is null-terminated). |
at | an optional pointer to the file location of begin (used for diagnostic purposes). On success, if at != NULL , *at points to one past the last character parsed. On error, *at is left untouched. |
void co_gw_txt_get_send_func | ( | const co_gw_txt_t * | gw, |
co_gw_txt_send_func_t ** | pfunc, | ||
void ** | pdata | ||
) |
Retrieves the callback function used to send requests from the user to a CANopen gateway.
gw | a pointer to a CANopen ASCII gateway. |
pfunc | the address at which to store a pointer to the callback function (can be NULL). |
pdata | the address at which to store a pointer to user-specified data (can be NULL). |
void co_gw_txt_set_send_func | ( | co_gw_txt_t * | gw, |
co_gw_txt_send_func_t * | func, | ||
void * | data | ||
) |
Sets the callback function used to send requests from the user to a CANopen gateway.
gw | a pointer to a CANopen ASCII gateway. |
func | a pointer to the function invoked by co_gw_txt_send(). |
data | a pointer to user-specified data (can be NULL). data is passed as the last parameter to func. |