26 #ifndef LELY_NO_CO_GW_TXT 119 format_printf__(2, 3);
129 co_unsigned16_t type, const
void *val);
136 co_unsigned16_t net, co_unsigned8_t node, const
char *begin,
137 const
char *end, struct
floc *at);
140 co_unsigned16_t net, co_unsigned8_t node, const
char *begin,
141 const
char *end, struct
floc *at);
144 void *data, co_unsigned16_t net, const
char *begin,
145 const
char *end, struct
floc *at);
149 co_unsigned16_t net, const
char *begin, const
char *end,
153 co_unsigned16_t net, const
char *begin, const
char *end,
157 co_unsigned16_t net, const
char *begin, const
char *end,
161 co_unsigned16_t net, const
char *begin, const
char *end,
166 co_unsigned16_t net, co_unsigned8_t node, const
char *begin,
167 const
char *end, struct
floc *at);
170 co_unsigned16_t net, co_unsigned8_t node, const
char *begin,
171 const
char *end, struct
floc *at);
175 co_unsigned16_t net, const
char *begin, const
char *end,
179 co_unsigned16_t net, const
char *begin, const
char *end,
183 co_unsigned16_t net, const
char *begin, const
char *end,
187 void *data, const
char *begin, const
char *end,
191 void *data, co_unsigned16_t net, const
char *begin,
192 const
char *end, struct
floc *at);
196 const
char *begin, const
char *end, struct
floc *at);
199 co_unsigned16_t net, const
char *begin, const
char *end,
203 const
char *begin, const
char *end, struct
floc *at);
207 co_unsigned16_t net, const
char *begin, const
char *end,
211 void *data, co_unsigned16_t net, const
char *begin,
212 const
char *end, struct
floc *at);
215 co_unsigned16_t net, const
char *begin, const
char *end,
219 co_unsigned16_t net, const
char *begin, const
char *end,
223 void *data, co_unsigned16_t net, const
char *begin,
224 const
char *end, struct
floc *at);
227 co_unsigned16_t net, const
char *begin, const
char *end,
231 co_unsigned16_t net, const
char *begin, const
char *end,
236 co_unsigned16_t net, const
char *begin, const
char *end,
240 co_unsigned16_t net, const
char *begin, const
char *end,
248 struct
floc *at, co_unsigned32_t *pseq, co_unsigned16_t *pnet,
249 co_unsigned8_t *
pnode);
253 const
char *begin, const
char *end, struct
floc *at,
int *psrv);
257 const
char *begin, const
char *end, struct
floc *at);
261 struct
floc *at, co_unsigned16_t *pidx, co_unsigned8_t *psubidx,
262 co_unsigned16_t *ptype);
266 struct
floc *at,
int ext, co_unsigned16_t *pnum,
271 struct
floc *at, co_unsigned16_t *ptype);
275 struct
floc *at, co_unsigned16_t type,
void *val);
282 struct
floc *at,
char *s,
size_t *pn);
286 struct
floc *at, co_unsigned8_t *ptrans);
297 __co_gw_txt_alloc(
void)
306 __co_gw_txt_free(
void *ptr)
353 __co_gw_txt_free(gw);
363 __co_gw_txt_fini(gw);
364 __co_gw_txt_free(gw);
439 co_unsigned32_t seq = (uintptr_t)con->
data;
501 assert(!end || end >= begin);
512 const char *cp = begin;
524 if ((end && cp >= end) || !*cp)
527 co_unsigned32_t seq = 0;
528 co_unsigned16_t net = 0;
529 co_unsigned8_t node = 0xff;
532 cp, end,
floc, &seq, &net, &node))))
536 void *data = (
void *)(uintptr_t)seq;
550 "node-ID specified before global command");
555 "network-ID specified before global command");
584 "node-ID specified before network-level command");
587 net = node == 0xff ? 0 : node;
598 gw, srv, data, net, node, cp, end,
floc);
602 gw, srv, data, net, node, cp, end,
floc);
606 gw, srv, data, net, cp, end,
floc);
610 gw, srv, data, net, cp, end,
floc);
614 gw, srv, data, net, cp, end,
floc);
618 gw, srv, data, net, cp, end,
floc);
622 gw, srv, data, net, cp, end,
floc);
741 if ((!end || cp < end) && *cp && !
isbreak((
unsigned char)*cp))
743 "expected line break after request");
750 while ((!end || cp + chars < end) && cp[chars] && cp[chars++] !=
'\n')
802 if (con->
iec || con->
ac)
878 const uint8_t *bp = (
const uint8_t *)con->
val;
889 char *buf = malloc(chars + 1);
922 + con->
n *
sizeof(*con->
val))) {
932 &buf,
"[%" PRIu32
"] %u pdo %u", seq, con->
net, con->
n);
939 for (co_unsigned8_t i = 0; i < con->
n; i++) {
941 result =
asprintf(&tmp,
"%s 0x%" PRIx64, buf, con->
val[i]);
966 "[%" PRIu32
"] %" PRIu32
" %" PRIu32
" %u.%u %" PRIu32
969 (uint_least16_t)((con->
revision >> 16) & 0xffff),
970 (uint_least16_t)(con->
revision & 0xffff),
983 gw,
"[%" PRIu32
"] 0x%08" PRIx32, seq, con->
id);
1003 "[%" PRIu32
"] 0x%08" PRIx32
" 0x%08" PRIx32
1004 " 0x%08" PRIx32
" 0x%08" PRIx32,
1020 "[%" PRIu32
"] ERROR: %08" PRIX32
" (%s)", seq,
1035 + ind->
n *
sizeof(*ind->
val))) {
1044 int result =
asprintf(&buf,
"%u pdo %u %u", ind->
net, ind->
num, ind->
n);
1051 for (co_unsigned8_t i = 0; i < ind->
n; i++) {
1053 result =
asprintf(&tmp,
"%s 0x%" PRIx64, buf, ind->
val[i]);
1078 gw,
"%u %u BOOT_UP", ind->
net, ind->
node);
1087 default: str =
"ERROR";
break;
1095 gw,
"%u %u %s", ind->
net, ind->
node, str);
1137 default: str =
"ERROR";
break;
1150 va_start(ap, format);
1161 int n = vsnprintf(NULL, 0, format, aq);
1166 vsprintf(buf, format, ap);
1190 char **pbegin,
char *end, co_unsigned16_t type,
const void *val)
1192 const union co_val *u = val;
1199 const char *vs = u->vs;
1202 vs +=
lex_utf8(vs, NULL, NULL, &c32);
1222 co_unsigned8_t node,
const char *begin,
const char *end,
1228 const char *cp = begin;
1231 co_unsigned16_t idx = 0;
1232 co_unsigned8_t subidx = 0;
1233 co_unsigned16_t type = 0;
1256 co_unsigned8_t
node,
const char *begin,
const char *end,
1262 const char *cp = begin;
1265 co_unsigned16_t
idx = 0;
1266 co_unsigned8_t
subidx = 0;
1267 co_unsigned16_t
type = 0;
1292 goto error_malloc_req;
1304 uint8_t *bp = (uint8_t *)req->
val;
1307 goto error_write_val;
1328 co_unsigned16_t net,
const char *begin,
const char *end,
1334 const char *cp = begin;
1356 co_unsigned16_t
net,
const char *begin,
const char *end,
1362 const char *cp = begin;
1365 co_unsigned16_t num = 0;
1370 cp, end, at, 0, &num, &comm, &
map))))
1376 +
map.n *
sizeof(*
map.map),
1382 .trans = comm.
trans,
1384 for (co_unsigned8_t i = 0; i <
map.n; i++)
1393 co_unsigned16_t
net,
const char *begin,
const char *end,
1399 const char *cp = begin;
1404 if ((chars =
lex_char(
'x', cp, end, at))) {
1410 co_unsigned16_t
num = 0;
1415 cp, end, at, ext, &num, &comm, &
map))))
1421 +
map.n *
sizeof(*
map.map),
1427 .trans = comm.
trans,
1429 .event = comm.
event,
1432 for (co_unsigned8_t i = 0; i <
map.n; i++)
1441 co_unsigned16_t
net,
const char *begin,
const char *end,
1447 const char *cp = begin;
1450 co_unsigned16_t
num = 0;
1458 "PDO number must be in the range [1..512]");
1474 co_unsigned16_t
net,
const char *begin,
const char *end,
1480 const char *cp = begin;
1483 co_unsigned16_t
num = 0;
1492 "PDO number must be in the range [1..512]");
1511 "number of values must be in the range [0..64]");
1515 for (co_unsigned8_t i = 0; i < req.
n; i++) {
1526 req.
size += req.
n *
sizeof(*req.
val);
1534 co_unsigned16_t
net, co_unsigned8_t node,
const char *begin,
1535 const char *end,
struct floc *at)
1540 const char *cp = begin;
1543 co_unsigned16_t gt = 0;
1551 co_unsigned8_t ltf = 0;
1572 co_unsigned16_t
net, co_unsigned8_t
node,
const char *begin,
1573 const char *end,
struct floc *at)
1578 const char *cp = begin;
1581 co_unsigned16_t ms = 0;
1601 const char *begin,
const char *end,
struct floc *at)
1606 const char *cp = begin;
1609 co_unsigned8_t bitidx = 0;
1618 "the bit timing must be in the range [0..9]");
1634 const char *begin,
const char *end,
struct floc *at)
1639 const char *cp = begin;
1642 co_unsigned16_t ms = 0;
1661 const char *begin,
const char *end,
struct floc *at)
1666 const char *cp = begin;
1669 co_unsigned8_t node = 0;
1678 "the node-ID must be in the range [1..%u, 255]",
1695 const char *begin,
const char *end,
struct floc *at)
1700 const char *cp = begin;
1721 co_unsigned16_t net,
const char *begin,
const char *end,
1727 const char *cp = begin;
1733 if (!strncasecmp(
"Disable", cp, chars)) {
1736 }
else if (!strncasecmp(
"Disable", cp, chars)) {
1741 "expected 'Disable' or 'Enable' after 'boot_up_indication'");
1757 const char *end,
struct floc *at)
1762 const char *cp = begin;
1765 co_unsigned16_t
net = 0;
1774 "the network-ID must be in the range [0, 1..%u]",
1789 co_unsigned16_t
net,
const char *begin,
const char *end,
1795 const char *cp = begin;
1798 co_unsigned8_t node = 0;
1807 "the node-ID must be in the range [0, 1..%u]",
1824 const char *begin,
const char *end,
struct floc *at)
1829 const char *cp = begin;
1832 co_unsigned32_t n = 0;
1849 co_unsigned16_t net,
const char *begin,
const char *end,
1855 const char *cp = begin;
1858 co_unsigned8_t mode = 0;
1877 co_unsigned16_t
net,
const char *begin,
const char *end,
1883 const char *cp = begin;
1903 co_unsigned16_t
net,
const char *begin,
const char *end,
1909 const char *cp = begin;
1912 co_unsigned8_t node = 0;
1921 "the node-ID must be in the range [1..%u, 255]",
1938 co_unsigned16_t
net,
const char *begin,
const char *end,
1944 const char *cp = begin;
1947 co_unsigned8_t bitsel = 0;
1955 co_unsigned8_t bitidx = 0;
1975 co_unsigned16_t
net,
const char *begin,
const char *end,
1981 const char *cp = begin;
1984 co_unsigned16_t delay = 0;
2003 co_unsigned16_t
net,
const char *begin,
const char *end,
2009 const char *cp = begin;
2012 co_unsigned8_t cs = 0;
2020 "code must be in the range [0x5A..0x5D]");
2036 co_unsigned16_t
net,
const char *begin,
const char *end,
2042 const char *cp = begin;
2064 co_unsigned16_t
net,
const char *begin,
const char *end,
2070 const char *cp = begin;
2092 co_unsigned16_t
net,
const char *begin,
const char *end,
2098 const char *cp = begin;
2184 "unable to send gateway request");
2191 co_unsigned32_t *pseq, co_unsigned16_t *pnet,
2192 co_unsigned8_t *
pnode)
2195 assert(!end || end >= begin);
2197 const char *cp = begin;
2202 "expected '[' before sequence number");
2206 co_unsigned32_t seq = 0;
2216 "expected ']' after sequence number");
2220 co_unsigned16_t
net = 0;
2221 co_unsigned8_t node = 0xff;
2229 if ((chars =
lex_c99_u8(cp, end, at, &node))) {
2235 "the network-ID must be in the range [1..%u]",
2242 "the node-ID must be in the range [0..%u]",
2249 "the node-ID must be in the range [0..%u]",
2272 const char *begin,
const char *end,
struct floc *at,
int *psrv)
2275 assert(!end || end >= begin);
2277 const char *cp = begin;
2290 if (!strncasecmp(
"_lss_fastscan", cp, chars)) {
2293 }
else if (!strncasecmp(
"_lss_slowscan", cp, chars)) {
2296 }
else if (!strncasecmp(
"boot_up_indication", cp, chars)) {
2299 }
else if (!strncasecmp(
"disable", cp, chars)) {
2304 if (!strncasecmp(
"guarding", cp, chars)) {
2307 }
else if (!strncasecmp(
"heartbeat", cp, chars)) {
2312 "expected 'guarding' or 'heartbeat'");
2315 }
else if (!strncasecmp(
"enable", cp, chars)) {
2320 if (!strncasecmp(
"guarding", cp, chars)) {
2323 }
else if (!strncasecmp(
"heartbeat", cp, chars)) {
2328 "expected 'guarding' or 'heartbeat'");
2331 }
else if (!strncasecmp(
"info", cp, chars)) {
2336 if (!strncasecmp(
"version", cp, chars)) {
2343 }
else if (!strncasecmp(
"init", cp, chars)) {
2346 }
else if (!strncasecmp(
"lss_activate_bitrate", cp, chars)) {
2349 }
else if (!strncasecmp(
"lss_conf_bitrate", cp, chars)) {
2352 }
else if (!strncasecmp(
"lss_get_node", cp, chars)) {
2355 }
else if (!strncasecmp(
"lss_identity", cp, chars)) {
2358 }
else if (!strncasecmp(
"lss_ident_nonconf", cp, chars)) {
2361 }
else if (!strncasecmp(
"lss_inquire_addr", cp, chars)) {
2364 }
else if (!strncasecmp(
"lss_set_node", cp, chars)) {
2367 }
else if (!strncasecmp(
"lss_store", cp, chars)) {
2370 }
else if (!strncasecmp(
"lss_switch_glob", cp, chars)) {
2373 }
else if (!strncasecmp(
"lss_switch_sel", cp, chars)) {
2376 }
else if (!strncasecmp(
"preop", cp, chars)
2377 || !strncasecmp(
"preoperational", cp, chars)) {
2380 }
else if (!strncasecmp(
"r", cp, chars)
2381 || !strncasecmp(
"read", cp, chars)) {
2386 if (!strncasecmp(
"p", cp, chars)
2387 || !strncasecmp(
"pdo", cp, chars)) {
2397 }
else if (!strncasecmp(
"reset", cp, chars)) {
2402 if (!strncasecmp(
"comm", cp, chars)
2403 || !strncasecmp(
"communication", cp, chars)) {
2406 }
else if (!strncasecmp(
"node", cp, chars)) {
2411 "expected 'node' or 'comm[unication]'");
2414 }
else if (!strncasecmp(
"set", cp, chars)) {
2419 if (!strncasecmp(
"command_size", cp, chars)) {
2422 }
else if (!strncasecmp(
"command_timeout", cp, chars)) {
2425 }
else if (!strncasecmp(
"heartbeat", cp, chars)) {
2428 }
else if (!strncasecmp(
"id", cp, chars)) {
2431 }
else if (!strncasecmp(
"network", cp, chars)) {
2434 }
else if (!strncasecmp(
"node", cp, chars)) {
2437 }
else if (!strncasecmp(
"rpdo", cp, chars)) {
2440 }
else if (!strncasecmp(
"sdo_timeout", cp, chars)) {
2443 }
else if (!strncasecmp(
"tpdo", cp, chars)) {
2446 }
else if (!strncasecmp(
"tpdox", cp, chars)) {
2454 "expected 'command_size', 'command_timeout', 'heartbeat', 'id', 'network', 'node', 'rpdo', 'sdo_timeout' or 'tpdo[x]'");
2457 }
else if (!strncasecmp(
"start", cp, chars)) {
2460 }
else if (!strncasecmp(
"stop", cp, chars)) {
2463 }
else if (!strncasecmp(
"w", cp, chars)
2464 || !strncasecmp(
"write", cp, chars)) {
2469 if (!strncasecmp(
"p", cp, chars)
2470 || !strncasecmp(
"pdo", cp, chars)) {
2482 "expected '_lss_fastscan', '_lss_slowscan', 'boot_up_indication', 'disable', 'enable', 'info', 'init', 'lss_activate_bitrate', 'lss_conf_bitrate', 'lss_get_node', 'lss_identity', 'lss_ident_nonconf', 'lss_inquire_addr', 'lss_set_node', 'lss_store', 'lss_switch_glob', 'lss_switch_sel', 'preop[erational]', 'r[ead]', 'reset', 'set', 'start', 'stop', or 'w[rite]'");
2496 assert(!end || end >= begin);
2498 const char *cp = begin;
2500 if ((end && cp >= end) || !(*cp ==
'_' || isalpha((
unsigned char)*cp)))
2504 while ((!end || cp < end)
2505 && (*cp ==
'_' || isalnum((
unsigned char)*cp)))
2513 co_unsigned16_t *pidx, co_unsigned8_t *psubidx,
2514 co_unsigned16_t *ptype)
2518 const char *cp = begin;
2549 const char *cp = begin;
2552 co_unsigned16_t num = 0;
2561 "PDO number must be in the range [1..512]");
2578 cp, end, at, &comm.
trans))))
2582 if (ext && comm.
trans >= 0xfe) {
2594 if (ext && comm.
trans >= 0xfd) {
2597 cp, end, at, &comm.
event)))) {
2604 }
else if (ext && comm.
trans <= 240) {
2607 cp, end, at, &comm.
sync)))) {
2625 "number of mapped values must be in the range [0..64]");
2629 for (co_unsigned8_t i = 0; i <
map.n; i++) {
2632 co_unsigned16_t idx = 0;
2633 co_unsigned8_t subidx = 0;
2642 "expected object sub-index");
2649 co_unsigned16_t type = 0;
2656 "only basic types can be mapped to PDOs");
2663 map.map[i] = ((co_unsigned32_t)(idx ? idx : type) << 16)
2664 | ((co_unsigned32_t)subidx << 8) | len;
2675 for (co_unsigned8_t i = 0; i <
map.n; i++)
2676 pmap->
map[i] =
map.map[i];
2684 co_unsigned16_t *ptype)
2688 const char *cp = begin;
2691 co_unsigned16_t type = 0;
2694 if (!strncasecmp(
"b", cp, chars)) {
2696 }
else if (!strncasecmp(
"d", cp, chars)) {
2698 }
else if (!strncasecmp(
"i16", cp, chars)) {
2700 }
else if (!strncasecmp(
"i24", cp, chars)) {
2702 }
else if (!strncasecmp(
"i32", cp, chars)) {
2704 }
else if (!strncasecmp(
"i40", cp, chars)) {
2706 }
else if (!strncasecmp(
"i48", cp, chars)) {
2708 }
else if (!strncasecmp(
"i56", cp, chars)) {
2710 }
else if (!strncasecmp(
"i64", cp, chars)) {
2712 }
else if (!strncasecmp(
"i8", cp, chars)) {
2714 }
else if (!strncasecmp(
"os", cp, chars)) {
2716 }
else if (!strncasecmp(
"r32", cp, chars)) {
2718 }
else if (!strncasecmp(
"r64", cp, chars)) {
2720 }
else if (!strncasecmp(
"t", cp, chars)) {
2722 }
else if (!strncasecmp(
"td", cp, chars)) {
2724 }
else if (!strncasecmp(
"u16", cp, chars)) {
2726 }
else if (!strncasecmp(
"u24", cp, chars)) {
2728 }
else if (!strncasecmp(
"u32", cp, chars)) {
2730 }
else if (!strncasecmp(
"u40", cp, chars)) {
2732 }
else if (!strncasecmp(
"u48", cp, chars)) {
2734 }
else if (!strncasecmp(
"u56", cp, chars)) {
2736 }
else if (!strncasecmp(
"u64", cp, chars)) {
2738 }
else if (!strncasecmp(
"u8", cp, chars)) {
2740 }
else if (!strncasecmp(
"us", cp, chars)) {
2742 }
else if (!strncasecmp(
"vs", cp, chars)) {
2758 co_unsigned16_t type,
void *val)
2761 assert(!end || end >= begin);
2766 const char *cp = begin;
2771 "expected '\"' before string");
2779 "unable to create value of type VISIBLE_STRING");
2783 char *vs = *(
void **)val;
2791 "expected '\"' after string");
2799 default:
return co_val_lex(type, val, begin, end, at);
2816 const char *cp = begin;
2819 char *ends = s + (s && pn ? *pn : 0);
2821 while ((!end || cp < end) && *cp && !
isbreak((
unsigned char)*cp)) {
2824 if ((end && cp + 1 >= end) || cp[1] !=
'\"')
2828 }
else if (*cp ==
'\\') {
2848 co_unsigned8_t *ptrans)
2852 const char *cp = begin;
2861 co_unsigned8_t trans = 0;
2863 if (!strncasecmp(
"event", cp, 5)) {
2868 }
else if (!strncasecmp(
"rtr", cp, chars)) {
2871 }
else if (!strncasecmp(
"sync", cp, 4)) {
2882 "SYNC period must be in the range [0..240]");
2887 "expected 'event', 'rtr' or 'sync<0..240>'");
2903 const char *cp = begin;
2947 const char *cp = begin;
2966 struct co_id hi = lo;
2970 "expected lower bound for revision number");
2978 "expected upper bound for revision number");
2986 "expected lower bound for serial number");
2994 "expected upper bound for serial number");
3008 #endif // !LELY_NO_CO_GW_TXT #define CO_GW_SRV_LSS_SET_RATE
CANopen gateway service: LSS configure bit-rate.
co_unsigned16_t net
The network-ID.
co_unsigned16_t net
The network-ID.
A PDO mapping parameter record.
#define CO_NMT_ST_RESET_NODE
The NMT sub-state 'reset application'.
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
static size_t co_gw_txt_send_lss_set_id(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS configure node-ID' request after parsing its parameters.
size_t size
The size of this struct (in bytes).
int vasprintf(char **strp, const char *fmt, va_list ap)
Equivalent to vsprintf(), except that it allocates a string large enough to hold the output...
co_unsigned8_t node
The node-ID.
The parameters of a CANopen gateway 'LSS inquire node-ID' confirmation.
co_unsigned8_t sync
SYNC start value.
size_t size
The size of this struct (in bytes).
#define CO_GW_NUM_NET
The maximum number of networks in a CANopen gateway.
co_unsigned16_t gt
The guard time (in milliseconds).
co_unsigned16_t num
The PDO number.
co_unsigned16_t net
The network-ID.
size_t co_type_sizeof(co_unsigned16_t type)
Returns the native size (in bytes) of a value of the specified data type, or 0 if it is not a static ...
co_unsigned8_t subidx
The object sub-index.
co_unsigned32_t cobid
The COB-ID.
#define CO_GW_IEC_BOOTUP
CANopen gateway internal error: Boot-up.
void * data
A pointer to user-specified data.
#define CO_DEFTYPE_UNSIGNED56
The data type (and object index) of a 56-bit unsigned integer.
The parameters of a CANopen gateway 'Set heartbeat producer' request.
co_unsigned16_t ms
The heartbeat time (in milliseconds).
static size_t co_gw_txt_send_init(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'Initialize gateway' request after parsing its parameters.
#define CO_GW_SRV_NMT_RESET_NODE
CANopen gateway service: Reset node.
#define CO_NMT_ST_START
The NMT state 'operational'.
co_unsigned8_t ltf
The lifetime factor.
This header file is part of the C11 and POSIX compatibility library; it includes <strings.h>, if it exists, and defines any missing functionality.
void * data
A pointer to user-specified data.
size_t size
The size of this struct (in bytes).
#define CO_DEFTYPE_TIME_DIFF
The data type (and object index) of a 48-bit structure representing a time difference.
int srv
The service number (CO_GW_SRV_SET_RPDO).
#define CO_GW_SRV_INIT
CANopen gateway service: Initialize gateway.
co_unsigned64_t val[0x40]
An array of object values.
#define CO_GW_SRV_SET_BOOTUP_IND
CANopen gateway service: Boot-up forwarding.
#define CO_DEFTYPE_VISIBLE_STRING
The data type (and object index) of an array of visible characters.
size_t size
The size of this struct (in bytes).
static int co_gw_txt_recv_pdo_read(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_pdo_read *con)
Processes a 'Read PDO data' confirmation.
int srv
The service number (CO_GW_SRV_SDO).
size_t size
The size of this struct (in bytes).
#define CO_GW_REQ_SET_RPDO_SIZE
The minimum size (in bytes) of a CANopen gateway 'Configure RPDO' request.
co_unsigned32_t map[0x40]
An array of objects to be mapped.
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...
static size_t co_gw_txt_lex_prefix(const char *begin, const char *end, struct floc *at, co_unsigned32_t *pseq, co_unsigned16_t *pnet, co_unsigned8_t *pnode)
Lexes the prefix (sequence number and optional network and node-ID) of a request. ...
The parameters of a CANopen gateway 'Initialize gateway' request.
void * data
A pointer to user-specified data.
co_unsigned32_t n
The command size (in bytes).
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...
co_unsigned16_t num
The PDO number.
int srv
The service number (CO_GW_SRV_LSS_GET_LSSID).
#define CO_DEFTYPE_DOMAIN
The data type (and object index) of an arbitrary large block of data.
void * data
A pointer to user-specified data.
A location in a text file.
static size_t co_gw_txt_send_sdo_dn(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, co_unsigned8_t node, const char *begin, const char *end, struct floc *at)
Sends an 'SDO download' request after parsing its parameters.
static size_t co_gw_txt_lex_vs(const char *begin, const char *end, struct floc *at, char *s, size_t *pn)
Lexes an array of visible characters (CO_DEFTYPE_VISIBLE_STRING), excluding the delimiting quotes...
int asprintf(char **strp, const char *fmt,...)
Equivalent to sprintf(), except that it allocates a string large enough to hold the output...
co_unsigned8_t node
The node-ID.
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.
void * data
A pointer to user-specified data.
#define CO_GW_SRV__LSS_FASTSCAN
Lely-specific gateway service: LSS Fastscan.
#define CO_GW_SRV_LSS_STORE
CANopen gateway service: LSS store configuration.
co_unsigned8_t mode
0 for waiting state, 1 for configuration state.
size_t print_c99_flt(char **pbegin, char *end, float f)
Prints a C99 float to a memory buffer.
The parameters of a CANopen gateway 'Inquire LSS address' request.
#define CO_GW_SRV_SET_ID
CANopen gateway service: Set node-ID.
The parameters of a CANopen gateway 'SDO download' request.
co_unsigned8_t node
The node-ID.
int srv
The service number (CO_GW_SRV_NMT_HB_ENABLE).
#define CO_GW_SRV_NMT_NG_DISABLE
CANopen gateway service: Disable node guarding.
static int co_gw_txt_recv_sdo_up(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_sdo_up *con)
Processes an 'SDO upload' confirmation.
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.
#define CO_GW_IND_RPDO_SIZE
The minimum size (in bytes) of a CANopen gateway 'RPDO received' indication.
static size_t co_gw_txt_send_lss_switch_sel(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS switch state selective' request after parsing its parameters.
int srv
The service number (CO_GW_SRV_NMT_NG_ENABLE).
#define CO_GW_SRV_SET_TPDO
CANopen gateway service: Configure TPDO.
The parameters of a CANopen gateway 'SDO upload' confirmation.
#define CO_DEFTYPE_INTEGER24
The data type (and object index) of a 24-bit signed integer.
void set_errnum(errnum_t errnum)
Sets the current (thread-specific) platform-independent error number to errnum.
unsigned int up
The transfer direction: download (0) or upload (1).
static size_t co_gw_txt_send_set_hb(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Set heartbeat producer' request after parsing its parameters.
const char * co_nmt_es2str(char es)
Returns a pointer to a string describing an NMT boot error status.
void diag(enum diag_severity severity, int errc, const char *format,...)
Emits a diagnostic message.
co_unsigned8_t n
Number of mapped objects in PDO.
size_t size
The size of this struct (in bytes).
co_gw_txt_recv_func_t * recv_func
A pointer to the callback function invoked by co_gw_txt_recv().
void * data
A pointer to user-specified data.
size_t print_char(char **pbegin, char *end, int c)
Prints a single character to a memory buffer.
#define CO_GW_SRV_SDO_DN
CANopen gateway service: SDO download.
A union of the CANopen static data types.
static size_t co_gw_txt_send__lss_fastscan(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS Fastscan' request after parsing its parameters.
#define CO_DEFTYPE_INTEGER48
The data type (and object index) of a 48-bit signed integer.
int srv
The service number (CO_GW_SRV_LSS_SET_RATE).
The parameters of a CANopen gateway 'LSS switch state global' request.
size_t size
The size of this struct (in bytes).
#define CO_GW_IEC_INTERN
CANopen gateway internal error: Request not processed due to internal state.
A PDO communication parameter record.
static size_t co_gw_txt_lex_sdo(const char *begin, const char *end, struct floc *at, co_unsigned16_t *pidx, co_unsigned8_t *psubidx, co_unsigned16_t *ptype)
Lexes the multiplexer and data type of an SDO upload/download request.
void * data
A pointer to user-specified data.
co_unsigned8_t node
The node-ID.
#define CO_GW_SRV_PDO_WRITE
CANopen gateway service: Write PDO data.
co_unsigned16_t net
The network-ID.
int srv
The service number (CO_GW_SRV_LSS_SWITCH).
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.
#define CO_GW_REQ_SET_TPDO_SIZE
The minimum size (in bytes) of a CANopen gateway 'Configure TPDO' request.
size_t size
The size of this struct (in bytes).
int srv
The service number.
#define CO_DEFTYPE_UNSIGNED48
The data type (and object index) of a 48-bit unsigned integer.
The parameters of a CANopen gateway 'Configure SDO time-out' request.
#define CO_GW_SRV_GET_VERSION
CANopen gateway service: Get version.
co_unsigned8_t bitidx
The bit timing index (in the range [0..9]).
co_unsigned32_t cobid
COB-ID.
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
static size_t co_gw_txt_lex_pdo(const char *begin, const char *end, struct floc *at, int ext, co_unsigned16_t *pnum, struct co_pdo_comm_par *pcomm, struct co_pdo_map_par *pmap)
Lexes the communication and mapping parameters of a configure PDO request.
co_unsigned16_t num
The PDO number.
co_unsigned8_t bitidx
The bit timing index.
int srv
The service number (CO_GW_SRV_SET_TPDO).
#define CO_GW_TXT_IMPL_LO
The low number of the version of CiA 309-3 implemented by this gateway.
static size_t co_gw_txt_send_lss_set_rate(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS configure bit-rate' request after parsing its parameters.
static size_t co_gw_txt_lex_srv(const char *begin, const char *end, struct floc *at, int *psrv)
Lexes the service number of a request.
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' confirmation.
The parameters of a CANopen gateway 'Read PDO' confirmation.
This header file is part of the CANopen library; it contains the Service Data Object (SDO) declaratio...
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Read PDO' request.
co_unsigned8_t gw_class
The gateway class.
The parameters of a CANopen gateway 'Error control event received' indication.
The parameters of a CANopen gateway 'Emergency event received' indication.
#define CO_PDO_MAP_PAR_INIT
The static initializer from struct co_pdo_map_par.
co_unsigned16_t ms
The heartbeat time (in milliseconds).
The parameters of a CANopen gateway 'Get version' confirmation.
size_t size
The size of this struct (in bytes).
size_t lex_c99_u64(const char *begin, const char *end, struct floc *at, uint_least64_t *pu64)
Lexes a C99 uint_least64_t from a memory buffer.
struct co_id lo
The lower bound of the LSS address.
co_unsigned16_t type
The data type.
co_unsigned16_t net
The network-ID.
This header file is part of the CANopen library; it contains the CANopen value declarations.
static size_t co_gw_txt_send_set_bootup_ind(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Boot-up forwarding' request after parsing its parameters.
int srv
The service number (CO_GW_SRV_SET_SDO_TIMEOUT).
void set_errc(int errc)
Sets the current (thread-specific) native error code to errc.
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
#define CO_GW_SRV_NMT_ENTER_PREOP
CANopen gateway service: Set node to pre-operational.
size_t size
The size of this struct (in bytes).
int iec
The internal error code (0 on success).
#define CO_GW_SRV_NMT_STOP
CANopen gateway service: Start node.
static size_t co_gw_txt_print_val(char **pbegin, char *end, co_unsigned16_t type, const void *val)
Prints a CANopen value.
size_t lex_c99_dbl(const char *begin, const char *end, struct floc *at, double *pd)
Lexes a C99 double from a memory buffer.
void * data
A pointer to user-specified data.
size_t co_val_print(co_unsigned16_t type, const void *val, char **pbegin, char *end)
Prints a value of the specified data type to a memory buffer.
static int co_gw_txt_recv_rpdo(co_gw_txt_t *gw, const struct co_gw_ind_rpdo *ind)
Processes an 'RPDO received' indication.
size_t print_utf8(char **pbegin, char *end, char32_t c32)
Prints a UTF-8 encoded Unicode character to a memory buffer.
size_t lex_ctype(int(*ctype)(int), const char *begin, const char *end, struct floc *at)
Greedily lexes a sequence of characters of the specified class from a memory buffer.
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
static size_t co_gw_txt_send_set_cmd_timeout(co_gw_txt_t *gw, int srv, void *data, const char *begin, const char *end, struct floc *at)
Sends a 'Set command time-out' request after parsin gits parameters.
co_unsigned8_t bitsel
The bit timing selector.
co_unsigned16_t net
The network-ID.
#define CO_DEFTYPE_UNSIGNED32
The data type (and object index) of a 32-bit unsigned integer.
#define CO_GW_SRV_LSS_SWITCH_SEL
CANopen gateway service: LSS switch state selective.
int co_val_init_vs_n(char **val, const char *vs, size_t n)
Initializes an array of visible characters (CO_DEFTYPE_VISIBLE_STRING).
#define CO_GW_SRV_SDO_UP
CANopen gateway service: SDO upload.
static size_t co_gw_txt_send_set_net(co_gw_txt_t *gw, int srv, void *data, const char *begin, const char *end, struct floc *at)
Sends a 'Set default network' request after parsing its parameters.
#define CO_DEFTYPE_UNSIGNED24
The data type (and object index) of a 24-bit unsigned integer.
co_unsigned32_t product_code
Product code.
size_t lex_char(int c, const char *begin, const char *end, struct floc *at)
Lexes the specified character from a memory buffer.
#define CO_DEFTYPE_INTEGER64
The data type (and object index) of a 64-bit signed integer.
#define CO_GW_REQ_SDO_DN_SIZE
The minimum size (in bytes) of a CANopen gateway 'SDO download' request.
The parameters of a CANopen gateway 'Set command time-out' request.
int srv
The service number (CO_GW_SRV__BOOT).
#define CO_GW_SRV_LSS_GET_ID
CANopen gateway service: LSS inquire node-ID.
co_unsigned8_t node
The node-ID.
static void co_gw_txt_send_req(co_gw_txt_t *gw, const struct co_gw_req *req)
Invokes the callback function to send a request.
size_t pending
The number of pending requests.
size_t size
The size of this struct (in bytes).
size_t lex_utf8(const char *begin, const char *end, struct floc *at, char32_t *pc32)
Lexes a UTF-8 encoded Unicode character from a memory buffer.
co_unsigned32_t vendor_id
Vendor-ID.
co_unsigned16_t event
Event timer.
static size_t co_gw_txt_send_nmt_set_ng(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, co_unsigned8_t node, const char *begin, const char *end, struct floc *at)
Sends an 'Enable node guarding' request after parsing its parameters.
The parameters of a CANopen gateway 'CiA 301 progress indication download' indication.
#define __likely(x)
Indicates to the compiler that the expression is most-likely true.
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...
#define CO_DEFTYPE_REAL32
The data type (and object index) of a 32-bit IEEE-754 floating-point number.
co_unsigned8_t st
The state of the node, or 0 in case of a boot-up event.
#define CO_GW_SRV_SET_SDO_TIMEOUT
CANopen gateway service: Configure SDO time-out.
static size_t co_gw_txt_lex_id(const char *begin, const char *end, struct floc *at, struct co_id *pid)
Lexes an LSS address.
static size_t co_gw_txt_send_lss_switch(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS switch state global' request after parsing its parameters.
co_unsigned64_t val[0x40]
An array of object values.
#define CO_GW_SRV_NMT_RESET_COMM
CANopen gateway service: Reset communication.
int srv
The service number (CO_GW_SRV_LSS_SWITCH_SEL).
size_t print_c99_dbl(char **pbegin, char *end, double d)
Prints a C99 double to a memory buffer.
struct co_id id_1
In case of an LSS Slowscan request, the lower bound of the LSS address; in case of an LSS Fastscan re...
int srv
The service number (CO_GW_SRV_SET_CMD_TIMEOUT).
The common parameters of a CANopen gateway confirmation.
uint32_t nbyte
The transferred bytes.
size_t co_gw_txt_pending(const co_gw_txt_t *gw)
Returns the number of pending (i.e., unconfirmed) requests.
The common parameters of a CANopen gateway node-level request.
#define CO_DEFTYPE_INTEGER8
The data type (and object index) of an 8-bit signed integer.
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
co_gw_txt_t * co_gw_txt_create(void)
Creates a new CANopen ASCII gateway.
char val[1]
The (first byte in the) value.
co_unsigned16_t net
The network-ID.
#define CO_GW_SRV_LSS_GET_LSSID
CANopen gateway service: Inquire LSS address.
#define CO_DEFTYPE_UNSIGNED16
The data type (and object index) of a 16-bit unsigned integer.
size_t size
The size of this struct (in bytes).
void co_gw_txt_destroy(co_gw_txt_t *gw)
Destroys a CANopen ASCII gateway.
co_unsigned8_t cs
The command specifier (one of 0x5a, 0x5b, 0x5c or 0x5d).
#define CO_GW_SRV_EMCY
CANopen gateway service: Emergency event received.
static int co_gw_txt_recv_lss_get_lssid(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_lss_get_lssid *con)
Processes an 'Inquire LSS address' confirmation.
static size_t co_gw_txt_send_set_rpdo(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Configure RPDO' request after parsing its parameters.
size_t size
The size of this struct (in bytes).
size_t size
The size of this struct (in bytes).
int co_type_is_basic(co_unsigned16_t type)
Returns 1 if the specified (static) data type is a basic type, and 0 if not.
This is the internal header file of the CANopen library.
size_t size
The size of this struct (in bytes).
#define CO_GW_SRV_NMT_START
CANopen gateway service: Start node.
static size_t co_gw_txt_send_set_sdo_timeout(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Configure SDO time-out' request after parsing its parameters.
static int co_gw_txt_recv__lss_scan(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con__lss_scan *con)
Processes an 'LSS Slowscan/Fastscan' confirmation.
co_unsigned8_t er
The error register.
static size_t co_gw_txt_send_pdo_write(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Write PDO data' request after parsing its parameters.
static int co_gw_txt_recv_con(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con *con)
Processes a confirmation.
#define CO_GW_SRV_SET_CMD_TIMEOUT
CANopen gateway service: Set command time-out.
void diag_if(enum diag_severity severity, int errc, const struct floc *at, const char *format,...)
Emits a diagnostic message occurring at a location in a text file.
size_t size
The size of this struct (in bytes).
#define CO_DEFTYPE_UNICODE_STRING
The data type (and object index) of an array of (16-bit) Unicode characters.
#define CO_ID_INIT
The static initializer for struct co_id.
#define CO_NMT_ST_STOP
The NMT state 'stopped'.
co_unsigned8_t prot_lo
The protocol version (low number).
int column
The column number (starting from 1).
co_unsigned8_t subidx
The object sub-index.
co_unsigned16_t num
The PDO number.
#define CO_NMT_ST_PREOP
The NMT state 'pre-operational'.
size_t lex_c99_flt(const char *begin, const char *end, struct floc *at, float *pf)
Lexes a C99 float from a memory buffer.
This header file is part of the utilities library; it contains the lexer function declarations...
static int co_gw_txt_recv_ec(co_gw_txt_t *gw, const struct co_gw_ind_ec *ind)
Processes an 'Error control event received' indication.
co_unsigned32_t len
The length of the value (in bytes).
co_unsigned16_t net
The network-ID.
#define CO_GW_SRV_SET_NODE
CANopen gateway service: Set default node-ID.
size_t size
The size of this struct (in bytes).
static int co_gw_txt_recv_get_version(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_get_version *con)
Processes a 'Get version' confirmation.
#define CO_DEFTYPE_TIME_OF_DAY
The data type (and object index) of a 48-bit structure representing the absolute time.
int srv
The service number.
int get_errc(void)
Returns the last (thread-specific) native error code set by a system call or library function...
co_unsigned16_t net
The network-ID.
co_unsigned16_t net
The network-ID.
The parameters of a CANopen gateway 'Inquire LSS address' confirmation.
int srv
The service number (CO_GW_SRV_PDO_READ).
static size_t co_gw_txt_lex_val(const char *begin, const char *end, struct floc *at, co_unsigned16_t type, void *val)
Lexes a value for an SDO download request.
#define MAX(a, b)
Returns the maximum of a and b.
int srv
The service number (CO_GW_SRV_SDO_DN).
const char * co_gw_iec2str(int iec)
Returns a string describing an internal error code.
The parameters of a CANopen gateway 'Set command size' request.
co_unsigned16_t net
The network-ID.
The common parameters of a CANopen gateway network-level request.
size_t floc_lex(struct floc *at, const char *begin, const char *end)
Increments a file location by reading characters from a memory buffer.
int srv
The service number (CO_GW_SRV_PDO_READ).
static int co_gw_txt_recv_txt(co_gw_txt_t *gw, const char *txt)
Invokes the callback function to process a received indication or confirmation.
#define CO_DEFTYPE_UNSIGNED8
The data type (and object index) of an 8-bit unsigned integer.
static size_t co_gw_txt_lex_type(const char *begin, const char *end, struct floc *at, co_unsigned16_t *ptype)
Lexes a data type.
size_t size
The size of this struct (in bytes).
#define CO_DEFTYPE_UNSIGNED40
The data type (and object index) of a 40-bit unsigned integer.
The parameters of a CANopen gateway 'Start heartbeat consumer' request.
size_t size
The size of this struct (in bytes).
#define CO_NUM_NODES
The maximum number of nodes in a CANopen network.
void * send_data
A pointer to the user-specified data for send_func.
size_t size
The size of this struct (in bytes).
The parameters of a CANopen gateway 'Enable node guarding' request.
co_unsigned8_t n
Number of mapped objects in PDO.
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.
#define CO_NMT_ST_RESET_COMM
The NMT sub-state 'reset communication'.
co_unsigned16_t net
The network-ID.
size_t size
The size of this struct (in bytes).
static size_t co_gw_txt_send_lss_get_lssid(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'Inquire LSS address' request after parsing its parameters.
co_unsigned16_t type
The data type.
static int co_gw_txt_recv_sdo(co_gw_txt_t *gw, const struct co_gw_ind_sdo *ind)
Processes an 'CiA 301 progress indication download' indication.
#define CO_GW_SRV_LSS_SWITCH
CANopen gateway service: LSS switch state global.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_SET_HB).
#define CO_PDO_COMM_PAR_INIT
The static initializer from struct co_pdo_comm_par.
co_unsigned32_t vendor_id
The vendor-ID.
size_t lex_c99_u8(const char *begin, const char *end, struct floc *at, uint_least8_t *pu8)
Lexes a C99 uint_least8_t from a memory buffer.
#define CO_GW_SRV_EC
CANopen gateway service: Error control event received.
co_unsigned32_t map[0x40]
An array of objects to be mapped.
#define CO_DEFTYPE_INTEGER16
The data type (and object index) of a 16-bit signed integer.
size_t lex_c99_long(const char *begin, const char *end, struct floc *at, long *pl)
Lexes a C99 long from a memory buffer.
co_unsigned16_t net
The network-ID.
struct co_id hi
The upper bound of the LSS address.
int errno2c(int errnum)
Transforms a standard C error number to a native error code.
This header file is part of the utilities library; it contains the diagnostic declarations.
int srv
The service number (CO_GW_SRV_SDO_UP).
#define __unlikely(x)
Indicates to the compiler that the expression is most-likely false.
size_t size
The size of this struct (in bytes).
co_unsigned8_t node
The node-ID.
#define CO_DEFTYPE_INTEGER56
The data type (and object index) of a 56-bit signed integer.
static size_t co_gw_txt_send_pdo_read(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Read PDO data' request after parsing its parameters.
#define CO_GW_SRV_NMT_NG_ENABLE
CANopen gateway service: Enable node guarding.
static int co_gw_txt_recv_err(co_gw_txt_t *gw, co_unsigned32_t seq, int iec, co_unsigned32_t ac)
Processes a confirmation with a non-zero internal error code or SDO abort code.
#define CO_GW_CON_PDO_READ_SIZE
The minimum size (in bytes) of a CANopen gateway 'Read PDO' confirmation.
#define CO_GW_SRV_SET_NET
CANopen gateway service: Set default network.
The parameters of a CANopen gateway 'LSS switch state selective' request.
int isbreak(int c)
Returns 1 if c is a line break character, and 0 otherwise.
The parameters of a CANopen gateway 'Configure TPDO' request.
static size_t co_gw_txt_send_lss_id_slave(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS identify remote slave' request after parsing its parameters.
static size_t co_gw_txt_lex_trans(const char *begin, const char *end, struct floc *at, co_unsigned8_t *ptrans)
Lexes the transmission type of a configure PDO request.
co_unsigned32_t product_code
The product code.
static size_t co_gw_txt_send_nmt_set_hb(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, co_unsigned8_t node, const char *begin, const char *end, struct floc *at)
Sends a 'Start heartbeat consumer' request after parsing its parameters.
int srv
The service number (CO_GW_SRV_LSS_GET_LSSID).
co_unsigned32_t revision
Revision number.
size_t size
The size of this struct (in bytes).
#define CO_GW_SRV_LSS_SWITCH_RATE
CANopen gateway service: LSS activate new bit-rate.
co_unsigned16_t net
The network-ID.
#define CO_GW_SRV_RPDO
CANopen gateway service: RPDO received.
size_t size
The size of this struct (in bytes).
#define CO_DEFTYPE_OCTET_STRING
The data type (and object index) of an array of octets.
The parameters of a Lely-specific gateway 'LSS Slowscan/Fastscan' request.
void * data
A pointer to user-specified data.
const char * co_sdo_ac2str(co_unsigned32_t ac)
Returns a string describing an SDO abort code.
This header file is part of the CANopen library; it contains the ASCII gateway declarations (see CiA ...
static int co_gw_txt_recv__boot(co_gw_txt_t *gw, const struct co_gw_ind__boot *ind)
Processes a 'Boot slave process completed' indication.
int srv
The service number (CO_GW_SRV_EMCY).
uint8_t msef[5]
The manufacturer-specific error code.
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...
#define CO_GW_REQ_PDO_WRITE_SIZE
The minimum size (in bytes) of a CANopen gateway 'Write PDO' request.
The parameters of a CANopen gateway 'Configure RPDO' request.
static size_t co_gw_txt_lex_id_sel(const char *begin, const char *end, struct floc *at, struct co_id *plo, struct co_id *phi)
Lexes an LSS address range.
co_unsigned32_t serial_nr
The serial number.
size_t co_val_lex(co_unsigned16_t type, void *val, const char *begin, const char *end, struct floc *at)
Lexes a value of the specified data type from a memory buffer.
The parameters of a CANopen gateway 'LSS identify remote slave' request.
static size_t co_gw_txt_send_set_cmd_size(co_gw_txt_t *gw, int srv, void *data, const char *begin, const char *end, struct floc *at)
Sends a 'Set command size' request after parsing its parameters.
int timeout
The SDO timeout (in milliseconds).
The parameters of a Lely-specific gateway 'Boot slave process completed' indication.
This header file is part of the C11 and POSIX compatibility library; it includes <stdio.h> and defines any missing functionality.
co_unsigned16_t idx
The object index.
#define CO_DEFTYPE_UNSIGNED64
The data type (and object index) of a 64-bit unsigned integer.
char es
The error status (in the range ['A'..'O'], or 0 on success).
co_unsigned8_t n
Number of mapped objects in PDO.
co_unsigned32_t serial_nr
Serial number.
struct co_id id_2
In case of an LSS Slowscan request, the upper bound of the LSS address; in case of an LSS Fastscan re...
#define CO_GW_SRV_SDO
CANopen gateway service: CiA 301 progress indication download.
co_unsigned32_t id
The LSS number.
This header file is part of the utilities library; it contains the printing function declarations...
This header file is part of the CANopen library; it contains the device description declarations...
int srv
The service number (CO_GW_SRV_SET_BOOTUP_IND).
static int co_gw_txt_recv_fmt(co_gw_txt_t *gw, const char *format,...)
Formats a received indication or confirmation and invokes the callback function to process it...
int co_val_init(co_unsigned16_t type, void *val)
Initializes a value of the specified data type to zero.
co_unsigned16_t net
The network-ID.
static size_t co_gw_txt_send__lss_slowscan(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS Slowscan' request after parsing its parameters.
int iec
The last internal error code.
co_unsigned8_t prot_hi
The protocol version (high number).
size_t size
The size of this struct (in bytes).
#define CO_GW_SRV_NMT_HB_DISABLE
CANopen gateway service: Disable heartbeat consumer.
void co_val_fini(co_unsigned16_t type, void *val)
Finalizes a value of the specified data type.
size_t lex_c99_esc(const char *begin, const char *end, struct floc *at, char32_t *pc32)
Lexes a C99 character escape sequence from a memory buffer if the buffer begins with '\'...
co_unsigned16_t delay
The delay (in milliseconds).
size_t size
The size of this struct (in bytes).
#define CO_GW_SRV_LSS_SET_ID
CANopen gateway service: LSS configure node-ID.
#define CO_GW_SRV_LSS_ID_SLAVE
CANopen gateway service: LSS identify remote slave.
The parameters of a CANopen gateway 'SDO upload' request.
#define CO_GW_SRV_PDO_READ
CANopen gateway service: Read PDO data.
#define CO_GW_IEC_SYNTAX
CANopen gateway internal error: Syntax error.
static int co_gw_txt_recv_emcy(co_gw_txt_t *gw, const struct co_gw_ind_emcy *ind)
Processes an 'Emergency event received' indication.
#define CO_GW_SRV_SET_CMD_SIZE
CANopen gateway service: Set command size.
co_unsigned32_t ac
The SDO abort code (0 on success).
#define CO_GW_SRV_SET_HB
CANopen gateway service: Set heartbeat producer.
co_unsigned16_t net
The network-ID.
int co_gw_txt_iec(co_gw_txt_t *gw)
Returns (and clears) the last internal error code.
#define CO_DEFTYPE_REAL64
The data type (and object index) of a 64-bit IEEE-754 floating-point number.
int srv
The service number (CO_GW_SRV_INIT).
void * data
A pointer to user-specified data.
#define CO_GW_SRV__LSS_SLOWSCAN
Lely-specific gateway service: LSS Slowscan.
co_gw_txt_send_func_t * send_func
A pointer to the callback function invoked by co_gw_txt_send().
int srv
The service number (CO_GW_SRV_LSS_GET_ID).
size_t size
The size of this struct (in bytes).
static size_t co_gw_txt_lex_cmd(const char *begin, const char *end, struct floc *at)
Lexes a single command.
co_unsigned32_t revision
The revision number.
int srv
The service number (CO_GW_SRV__LSS_SLOWSCAN or CO_GW_SRV__LSS_FASTSCAN).
co_unsigned16_t num
The PDO number.
The parameters of a CANopen gateway 'LSS activate new bit-rate' request.
void * data
A pointer to user-specified data.
co_unsigned16_t net
The network-ID.
co_unsigned16_t net
The network-ID.
co_unsigned8_t node
The node-ID.
co_unsigned16_t net
The network-ID.
co_unsigned16_t idx
The object index.
void * recv_data
A pointer to the user-specified data for recv_func.
size_t lex_line_comment(const char *delim, const char *begin, const char *end, struct floc *at)
Lexes a single line-comment (excluding the line break) starting with the specified delimiter from a m...
static size_t co_gw_txt_send_set_id(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Set node-ID' request after parsing its parameters.
co_unsigned64_t val[0x40]
An array of object values.
int srv
The service number (CO_GW_SRV_PDO_WRITE).
This header file is part of the CANopen library; it contains the network management (NMT) declaration...
size_t lex_c99_u32(const char *begin, const char *end, struct floc *at, uint_least32_t *pu32)
Lexes a C99 uint_least32_t from a memory buffer.
co_unsigned32_t map[0x40]
An array of objects to be mapped.
#define CO_GW_SRV_SET_RPDO
CANopen gateway service: Configure RPDO.
unsigned cs
A flag indicating whether "boot-up event received" commands should be forwarded (1) or not (0)...
int srv
The service number (CO_GW_SRV_SET_CMD_TIMEOUT).
The parameters of a CANopen gateway 'Write PDO' request.
This header file is part of the C11 and POSIX compatibility library; it includes <stdlib.h> and defines any missing functionality.
co_unsigned16_t ec
The emergency error code.
#define CO_DEFTYPE_INTEGER32
The data type (and object index) of a 32-bit signed integer.
co_unsigned16_t net
The network-ID.
co_unsigned16_t net
The network-ID.
size_t lex_c99_u16(const char *begin, const char *end, struct floc *at, uint_least16_t *pu16)
Lexes a C99 uint_least16_t from a memory buffer.
#define CO_GW_SRV_LSS_ID_NON_CFG_SLAVE
CANopen gateway service: LSS identify non-configured remote slaves.
co_unsigned8_t n
Number of mapped objects in PDO.
#define CO_DEFTYPE_INTEGER40
The data type (and object index) of a 40-bit signed integer.
The common parameters of a CANopen gateway service.
The parameters of a CANopen gateway 'LSS configure bit-rate' request.
static size_t co_gw_txt_send_sdo_up(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, co_unsigned8_t node, const char *begin, const char *end, struct floc *at)
Sends an 'SDO upload' request after parsing its parameters.
int srv
The service number (CO_GW_SRV_LSS_SWITCH_RATE).
#define CO_GW_TXT_IMPL_HI
The high number of the version of CiA 309-3 implemented by this gateway.
void * data
A pointer to user-specified data.
void * data
A pointer to user-specified data.
int srv
The service number (CO_GW_SRV_SDO_UP).
size_t size
The size of this struct (in bytes).
co_unsigned16_t net
The network-ID.
size_t co_val_write(co_unsigned16_t type, const void *val, uint8_t *begin, uint8_t *end)
Writes a value of the specified data type to a memory buffer.
void * data
A pointer to user-specified data.
size_t print_c99_esc(char **pbegin, char *end, char32_t c32)
Prints a UTF-8 encoded Unicode character to a memory buffer.
co_unsigned16_t net
The network-ID.
void * data
A pointer to user-specified data.
co_unsigned8_t st
The the state of the node (including the toggle bit).
co_unsigned16_t inhibit
Inhibit time.
co_unsigned32_t cobid
The COB-ID.
void * data
A pointer to user-specified data.
static size_t co_gw_txt_send_lss_switch_rate(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends an 'LSS activate new bit-rate' request after parsing its parameters.
#define CO_GW_SRV__BOOT
Lely-specific gateway service: Boot slave process completed.
#define CO_SDO_AC_TYPE_LEN
SDO abort code: Data type does not match, length of service parameter does not match.
int timeout
The command timeout (in milliseconds).
#define CO_GW_SRV__SYNC
Lely-specific gateway service: Synchronization event received.
int srv
The service number (CO_GW_SRV_GET_VERSION).
void * data
A pointer to user-specified data.
static size_t co_gw_txt_send_set_node(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Set default node-ID' request after parsing its parameters.
The parameters of a CANopen gateway 'Boot-up forwarding' request.
co_unsigned8_t trans
Transmission type.
int srv
The service number (CO_GW_SRV_RPDO).
static size_t co_gw_txt_send_set_tpdo(co_gw_txt_t *gw, int srv, void *data, co_unsigned16_t net, const char *begin, const char *end, struct floc *at)
Sends a 'Configure TPDO' request after parsing its parameters.
#define CO_GW_SRV_NMT_HB_ENABLE
CANopen gateway service: Start heartbeat consumer.
The common parameters of a CANopen gateway request.
size_t size
The size of this struct (in bytes).
int srv
The service number (CO_GW_SRV_EC).
int srv
The service number.
int srv
The service number.
The parameters of a CANopen gateway 'RPDO received' indication.
static int co_gw_txt_recv_lss_get_id(co_gw_txt_t *gw, co_unsigned32_t seq, const struct co_gw_con_lss_get_id *con)
Processes an 'LSS inquire node-ID' confirmation.
struct co_id id
The LSS address.
co_unsigned8_t node
The node-ID.
co_unsigned8_t id
The node-ID.
char val[1]
The (first byte in the) value.
#define CO_DEFTYPE_BOOLEAN
The data type (and object index) of a boolean truth value.
size_t co_val_read(co_unsigned16_t type, void *val, const uint8_t *begin, const uint8_t *end)
Reads a value of the specified data type from a memory buffer.
int iec
The internal error code (0 on success).
void * data
A pointer to user-specified data.
#define CO_GW_CON_SDO_UP_SIZE
The minimum size (in bytes) of a CANopen gateway 'SDO upload' confirmation.
A node in a pairing heap.
This header file is part of the CANopen library; it contains the Process Data Object (PDO) declaratio...
int srv
The service number (CO_GW_SRV_LSS_ID_SLAVE).
co_unsigned8_t node
The node-ID.
#define CO_GW_SRV__TIME
Lely-specific gateway service: Time stamp event received.