DataObject

DataObject

A CANopen Data Object.

DataObjects should not be created directly, use Eds#addEntry or Eds#addSubEntry instead.

Constructor

new DataObject(key, data)

Source:
See:
  • CiA306 "Object descriptions" (ยง4.6.3)
Parameters:
Name Type Description
key string

object index key (e.g., 1018sub3)

data object

creation parameters.

Properties
Name Type Description
parameterName string

name of the data object.

objectType ObjectType

object type.

dataType DataType

data type.

accessType AccessType

access restrictions.

lowLimit number

minimum value.

highLimit number

maximum value.

pdoMapping boolean

enable PDO mapping.

compactSubObj boolean

use the compact sub-object format.

defaultValue number | string | Date

default value.

scaleFactor number

optional multiplier for numeric types.

Fires:

Members

dataTypeString :string

Description:
  • The data type as a string.

Source:

The data type as a string.

Type:
  • string

index :number

Description:
  • The Eds index.

Source:

The Eds index.

Type:
  • number

objectTypeString :string

Description:
  • The object type as a string.

Source:

The object type as a string.

Type:
  • string

raw :Buffer

Description:
  • The raw data Buffer.

Source:

The raw data Buffer.

Type:
  • Buffer

size :number

Description:
  • Size of the raw data in bytes including sub-entries.

Source:

Size of the raw data in bytes including sub-entries.

Type:
  • number

subIndex :number|null

Description:
  • The Eds subIndex.

Source:

The Eds subIndex.

Type:
  • number | null

value :number|bigint|string|Date

Description:
  • The cooked value.

Source:
See:
  • Eds.typeToRaw

The cooked value.

Type:
  • number | bigint | string | Date

Methods

(static) isDataObject(obj) → {boolean}

Description:
  • Returns true if the object is an instance of DataObject;

Source:
Since:
  • 6.0.0
Parameters:
Name Type Description
obj *

object to test.

Returns:

true if obj is DataObject.

Type
boolean

at(index) → {DataObject}

Description:
  • Get a sub-entry.

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

sub-entry index to get.

Returns:

new DataObject.

Type
DataObject

toString() → {string}

Description:
  • Primitive string conversion.

Source:
Since:
  • 6.0.0
Returns:

DataObject string representation.

Type
string

valueOf() → {number|bigint|string|Date}

Description:
  • Primitive value conversion.

Source:
Since:
  • 6.0.0
Returns:

DataObject value.

Type
number | bigint | string | Date

Events

update

Description:
  • The DataObject value was changed.

Source: