Lely core libraries 2.3.4
sdev.h File Reference

This header file is part of the CANopen library; it contains the static device description declarations. More...

#include <lely/co/dev.h>
#include <lely/co/obj.h>
#include <lely/co/val.h>
Include dependency graph for sdev.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  co_sdev
 A static CANopen device. More...
 
struct  co_sobj
 A static CANopen object. More...
 
struct  co_ssub
 A static CANopen sub-object. More...
 

Functions

co_dev_tco_dev_create_from_sdev (const struct co_sdev *sdev)
 Creates a CANopen device from a static device description.
 
int snprintf_c99_sdev (char *s, size_t n, const co_dev_t *dev)
 Prints a C99 static initializer code fragment for a static device description (struct co_sdev) to a string buffer.
 
int asprintf_c99_sdev (char **ps, const co_dev_t *dev)
 Equivalent to snprintf_c99_sdev(), except that it allocates a string large enough to hold the output, including the terminating null byte.
 

Detailed Description

This header file is part of the CANopen library; it contains the static device description declarations.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

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 sdev.h.

Function Documentation

◆ co_dev_create_from_sdev()

co_dev_t * co_dev_create_from_sdev ( const struct co_sdev sdev)

Creates a CANopen device from a static device description.

Returns
a pointer to a new device, or NULL on error. In the latter case, the error number can be obtained with get_errc().

Definition at line 89 of file sdev.c.

◆ snprintf_c99_sdev()

int snprintf_c99_sdev ( char *  s,
size_t  n,
const co_dev_t dev 
)

Prints a C99 static initializer code fragment for a static device description (struct co_sdev) to a string buffer.

Parameters
sthe address of the output buffer. If s is not NULL, at most n - 1 characters are written, plus a terminating null byte.
nthe size (in bytes) of the buffer at s. If n is zero, nothing is written.
deva pointer to a CANopen device description to be printed.
Returns
the number of characters that would have been written had the buffer been sufficiently large, not counting the terminating null byte, or a negative number on error. In the latter case, the error number is stored in errno.

Definition at line 116 of file sdev.c.

◆ asprintf_c99_sdev()

int asprintf_c99_sdev ( char **  ps,
const co_dev_t dev 
)

Equivalent to snprintf_c99_sdev(), except that it allocates a string large enough to hold the output, including the terminating null byte.

Parameters
psthe address of a value which, on success, contains a pointer to the allocated string. This pointer SHOULD be passed to free() to release the allocated storage.
deva pointer to a CANopen device description to be printed.
Returns
the number of characters written, not counting the terminating null byte, or a negative number on error. In the latter case, the error number is stored in errno.

Definition at line 414 of file sdev.c.