Lely core libraries 2.3.4
ssdo.h File Reference

This header file is part of the CANopen library; it contains the Server-SDO declarations. More...

#include <lely/can/net.h>
#include <lely/co/sdo.h>
Include dependency graph for ssdo.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

co_ssdo_tco_ssdo_create (can_net_t *net, co_dev_t *dev, co_unsigned8_t num)
 Creates a new CANopen Server-SDO service.
 
void co_ssdo_destroy (co_ssdo_t *sdo)
 Destroys a CANopen Server-SDO service.
 
int co_ssdo_start (co_ssdo_t *sdo)
 Starts a Server-SDO service.
 
void co_ssdo_stop (co_ssdo_t *sdo)
 Stops a Server-SDO service.
 
int co_ssdo_is_stopped (const co_ssdo_t *sdo)
 Retuns 1 if the specified Server-SDO service is stopped, and 0 if not.
 
can_net_tco_ssdo_get_net (const co_ssdo_t *sdo)
 Returns a pointer to the CAN network of a Server-SDO.
 
co_dev_tco_ssdo_get_dev (const co_ssdo_t *sdo)
 Returns a pointer to the CANopen device of a Server-SDO.
 
co_unsigned8_t co_ssdo_get_num (const co_ssdo_t *sdo)
 Returns the SDO number of a Server-SDO.
 
const struct co_sdo_parco_ssdo_get_par (const co_ssdo_t *sdo)
 Returns a pointer to the SDO parameter record of a Server-SDO.
 
int co_ssdo_get_timeout (const co_ssdo_t *sdo)
 Returns the timeout (in milliseconds) of a Server-SDO.
 
void co_ssdo_set_timeout (co_ssdo_t *sdo, int timeout)
 Sets the timeout of a Server-SDO.
 

Detailed Description

This header file is part of the CANopen library; it contains the Server-SDO 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 ssdo.h.

Function Documentation

◆ co_ssdo_create()

co_ssdo_t * co_ssdo_create ( can_net_t net,
co_dev_t dev,
co_unsigned8_t  num 
)

Creates a new CANopen Server-SDO service.

The service is started as if by co_ssdo_start().

Parameters
neta pointer to a CAN network.
deva pointer to a CANopen device describing the server.
numthe SDO number (in the range [1..128]). Except when num is 1, the SDO parameter record MUST exist in the object dictionary of dev.
Returns
a pointer to a new Server-SDO service, or NULL on error. In the latter case, the error number can be obtained with get_errc().
See also
co_ssdo_destroy()

Definition at line 650 of file ssdo.c.

◆ co_ssdo_destroy()

void co_ssdo_destroy ( co_ssdo_t sdo)

Destroys a CANopen Server-SDO service.

See also
co_ssdo_create()

Definition at line 677 of file ssdo.c.

◆ co_ssdo_start()

int co_ssdo_start ( co_ssdo_t sdo)

Starts a Server-SDO service.

Postcondition
on success, co_ssdo_is_stopped() returns 0.
Returns
0 on success, or -1 on error. In the latter case, the error number can be obtained with get_errc().
See also
co_ssdo_stop()

Definition at line 687 of file ssdo.c.

◆ co_ssdo_stop()

void co_ssdo_stop ( co_ssdo_t sdo)

Stops a Server-SDO service.

Any ongoing request is aborted.

Postcondition
co_ssdo_is_stopped() returns 1.
See also
co_ssdo_start()

Definition at line 721 of file ssdo.c.

◆ co_ssdo_is_stopped()

int co_ssdo_is_stopped ( const co_ssdo_t sdo)

Retuns 1 if the specified Server-SDO service is stopped, and 0 if not.

See also
co_ssdo_start, co_ssdo_stop()

Definition at line 744 of file ssdo.c.

◆ co_ssdo_get_timeout()

int co_ssdo_get_timeout ( const co_ssdo_t sdo)

Returns the timeout (in milliseconds) of a Server-SDO.

A return value of 0 (the default) means no timeout is being used.

See also
co_ssdo_set_timeout()

Definition at line 784 of file ssdo.c.

◆ co_ssdo_set_timeout()

void co_ssdo_set_timeout ( co_ssdo_t sdo,
int  timeout 
)

Sets the timeout of a Server-SDO.

If the timeout expires before receiving a request from a client, the server aborts the transfer.

Parameters
sdoa pointer to a Server-SDO service.
timeoutthe timeout (in milliseconds). A value of 0 (the default) disables the timeout.
See also
co_ssdo_get_timeout()

Definition at line 792 of file ssdo.c.