Lely core libraries  2.3.4
gw_txt.h
Go to the documentation of this file.
1 
22 #ifndef LELY_CO_GW_TXT_H_
23 #define LELY_CO_GW_TXT_H_
24 
25 #include <lely/co/gw.h>
26 
28 #define CO_GW_TXT_IMPL_HI 2
29 
31 #define CO_GW_TXT_IMPL_LO 1
32 
33 struct __co_gw_txt;
34 #if !defined(__cplusplus) || LELY_NO_CXX
35 typedef struct __co_gw_txt co_gw_txt_t;
37 #endif
38 
39 // The file location struct from <lely/util/diag.h>.
40 struct floc;
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
58 typedef int co_gw_txt_recv_func_t(const char *txt, void *data);
59 
70 typedef int co_gw_txt_send_func_t(const struct co_gw_req *req, void *data);
71 
72 void *__co_gw_txt_alloc(void);
73 void __co_gw_txt_free(void *ptr);
74 struct __co_gw_txt *__co_gw_txt_init(struct __co_gw_txt *gw);
75 void __co_gw_txt_fini(struct __co_gw_txt *gw);
76 
79 
82 
84 int co_gw_txt_iec(co_gw_txt_t *gw);
85 
87 size_t co_gw_txt_pending(const co_gw_txt_t *gw);
88 
98 int co_gw_txt_recv(co_gw_txt_t *gw, const struct co_gw_srv *srv);
99 
112 void co_gw_txt_get_recv_func(const co_gw_txt_t *gw,
113  co_gw_txt_recv_func_t **pfunc, void **pdata);
114 
127  co_gw_txt_t *gw, co_gw_txt_recv_func_t *func, void *data);
128 
143 size_t co_gw_txt_send(co_gw_txt_t *gw, const char *begin, const char *end,
144  struct floc *at);
145 
158 void co_gw_txt_get_send_func(const co_gw_txt_t *gw,
159  co_gw_txt_send_func_t **pfunc, void **pdata);
160 
173  co_gw_txt_t *gw, co_gw_txt_send_func_t *func, void *data);
174 
175 #ifdef __cplusplus
176 }
177 #endif
178 
179 #endif // !LELY_CO_GW_TXT_H_
co_gw_txt_create
co_gw_txt_t * co_gw_txt_create(void)
Creates a new CANopen ASCII gateway.
Definition: gw_txt.c:337
co_gw_req
The common parameters of a CANopen gateway request.
Definition: gw.h:271
co_gw_txt_send_func_t
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...
Definition: gw_txt.h:70
floc
A location in a text file.
Definition: diag.h:39
co_gw_txt_recv_func_t
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 con...
Definition: gw_txt.h:58
co_gw_txt_destroy
void co_gw_txt_destroy(co_gw_txt_t *gw)
Destroys a CANopen ASCII gateway.
Definition: gw_txt.c:362
co_gw_txt_recv
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.
Definition: gw_txt.c:389
co_gw_txt_get_send_func
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.
Definition: gw_txt.c:770
co_gw_txt_get_recv_func
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 g...
Definition: gw_txt.c:486
__co_gw_txt
A CANopen ASCII gateway.
Definition: gw_txt.c:45
co_gw_txt_set_recv_func
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 gatewa...
Definition: gw_txt.c:760
co_gw_txt_send
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.
Definition: gw_txt.c:498
gw.h
co_gw_srv
The common parameters of a CANopen gateway service.
Definition: gw.h:263
co_gw_txt_iec
int co_gw_txt_iec(co_gw_txt_t *gw)
Returns (and clears) the last internal error code.
Definition: gw_txt.c:371
co_gw_txt_pending
size_t co_gw_txt_pending(const co_gw_txt_t *gw)
Returns the number of pending (i.e., unconfirmed) requests.
Definition: gw_txt.c:381
co_gw_txt_set_send_func
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.
Definition: gw_txt.c:782