SdoClient

SdoClient

CANopen SDO protocol handler (Client).

The service data object (SDO) protocol uses a client-server structure where a client can initiate the transfer of data from the server's object dictionary. An SDO is transfered as a sequence of segments with basic error checking.

Constructor

new SdoClient(eds)

Source:
Implements:
See:
  • CiA301 'Service data object (SDO)' (ยง7.2.4)
Parameters:
Name Type Description
eds Eds

Eds object.

Members

blockSize :number

Description:
  • Number of segments per block when serving block transfers.

Source:

Number of segments per block when serving block transfers.

Type:
  • number

Methods

addServer(serverId, cobIdTx, cobIdRx)

Description:
  • Add an SDO client parameter entry.

Source:
Deprecated:
Parameters:
Name Type Description
serverId number

server COB-ID to add.

cobIdTx number

Sdo COB-ID for outgoing messages (to server).

cobIdRx number

Sdo COB-ID for incoming messages (from server).

(async) download(args)

Description:
  • Service: SDO download.

    Write data to an SDO server.

Source:
Parameters:
Name Type Description
args object

arguments to destructure.

Properties
Name Type Attributes Description
deviceId number

SDO server.

data object

data to download.

index number

index or name to download to.

subIndex number

data subIndex to download to.

dataType DataType <optional>

type of data to download.

timeout number <optional>

time before transfer is aborted.

blockTransfer boolean <optional>

use block transfer protocol.

Fires:

getServer(serverId) → {DataObject|null}

Description:
  • Get an SDO client parameter entry.

Source:
Deprecated:
  • Use Eds.getSdoClientParameters instead.
Parameters:
Name Type Description
serverId number

server COB-ID of the entry to get.

Returns:

the matching entry.

Type
DataObject | null

init()

Description:
  • Initialize the device and audit the object dictionary.

Source:
Deprecated:
  • Use SdoClient#start() instead.

receive(message)

Description:
  • Call when a new CAN message is received.

Source:
Implements:
Parameters:
Name Type Description
message object

CAN frame.

Properties
Name Type Description
id number

CAN message identifier.

data Buffer

CAN message data;

removeServer(serverId)

Description:
  • Remove an SDO client parameter entry.

Source:
Deprecated:
Parameters:
Name Type Description
serverId number

server COB-ID of the entry to remove.

setBlockSize(value)

Description:
  • Set the number of segments per block when serving block transfers.

Source:
Since:
  • 6.0.0
Parameters:
Name Type Description
value number

block size [1-127].

start()

Description:
  • Start the module.

Source:
Implements:
Fires:

stop()

Description:
  • Stop the module.

Source:
Implements:
Fires:

(async) upload(args) → {Promise.<(Buffer|number|bigint|string|Date)>}

Description:
  • Service: SDO upload

    Read data from an SDO server.

Source:
Parameters:
Name Type Description
args object

arguments to destructure.

Properties
Name Type Attributes Description
deviceId number

SDO server.

index number

data index to upload.

subIndex number

data subIndex to upload.

dataType DataType <optional>

expected data type.

timeout number <optional>

time before transfer is aborted.

blockTransfer boolean <optional>

use block transfer protocol.

Fires:
Returns:

resolves when the upload is complete.

Type
Promise.<(Buffer|number|bigint|string|Date)>