Skip to main content
Firmware Version 0.1.7

API Reference

Firmware Version:

C/C++ API Reference

Return Interface Enum

typedef enum
{
RETURN_FAILURE = 0,
RETURN_SUCCESS = 1
} ret_interface_t;
Description

Used to indicate the success or failure status of an interface operation.

EnumeratorValueDescription
RETURN_FAILURE0Operation failed
RETURN_SUCCESS1Operation succeeded

CAN Baud Rate Enum

typedef enum
{
UNKNOWN_OR_INVALID_BAUDRATE = -1,
BAUDRATE_10K,
BAUDRATE_20K,
BAUDRATE_50K,
BAUDRATE_100K,
BAUDRATE_125K,
BAUDRATE_250K,
BAUDRATE_500K,
BAUDRATE_750K,
BAUDRATE_1M
} CANBaudRate;
Description

Defines the supported CAN bus communication baud rates for the interface.

EnumeratorValueDescription
UNKNOWN_OR_INVALID_BAUDRATE-1Invalid or unknown baud rate
BAUDRATE_10K010 kbps
BAUDRATE_20K120 kbps
BAUDRATE_50K250 kbps
BAUDRATE_100K3100 kbps
BAUDRATE_125K4125 kbps
BAUDRATE_250K5250 kbps
BAUDRATE_500K6500 kbps
BAUDRATE_750K7750 kbps
BAUDRATE_1M81 Mbps

CANInterface.CANInterface()

CANInterface::CANInterface()
Description

Construct a new CANInterface object.

CANInterface.closeInterface()

uint8_t CANInterface::closeInterface()
Description

Closes CANInterface and running threads.

Returns
DatatypeDescription
uint8_tuint8_t Success(0) or Failure(1)

CANInterface.getConnectedDevices()

std::map<uint32_t, uint8_t> CANInterface::getConnectedDevices()
Description

Get list of connected devices.

Returns
DatatypeDescription
std::map<uint32_t,uint8_t>Map array of node id's and corresponding device types which are connected.

CANInterface.initInterface()

uint8_t CANInterface::initInterface(std::string interface_name, std::function< void(uint32_t, uint8_t)> on_new_dev_cb=nullptr, std::function< void(uint32_t)> on_dev_disconnect_cb=nullptr)
Description

Invokes lower level interface initialisation and starts various threads.

Parameters
DatatypeVariableDescription
std::stringinterface_nameName of CAN Interface eg. can0, vcan0...etc
std::function< void(uint32_t, uint8_t)>on_new_dev_cbCallback function which will be called when a new device is connected.
The arguments of the function are:
• CAN Node ID of the device of type uint32_t
• Value of uint8_t type variable represents the type of the device which is connected.
  • 0 means that an actuator is connected.
  • 1 means that a motor driver is connected.
  • 2 means that an IMU is connected.
  • 3 means that an NCoder is connected.
Return value of the function is void ie. it returns nothing.
std::function< void(uint32_t)>on_dev_disconnect_cbCallback function which will be called when a device is disconnected. The argument of this function is the CAN Node ID of the device of type uint32_t and return value of the function is void i.e. it returns nothing.
Returns
DatatypeDescription
uint8_tuint8_t Success(0) or Failure(1)

USBInterface.USBInterface()

USBInterface::USBInterface()
Description

Construct a new USBInterface object.

USBInterface.closeInterface()

uint8_t USBInterface::closeInterface()
Description

Closes USBInterface and running threads.

Returns
DatatypeDescription
uint8_tuint8_t Success(0) or Failure(1)

USBInterface.enterDFUMode()

ret_interface_t USBInterface::enterDFUMode()
Description

Set NLink to DFU Mode.

Returns
DatatypeDescription
ret_interface_tret_interface_t Success(0) or Failure(1)

USBInterface.eraseConfiguration()

ret_interface_t USBInterface::eraseConfiguration()
Description

Erase the configuration from NLink.

Returns
DatatypeDescription
ret_interface_tret_interface_t Success(0) or Failure(1)

USBInterface.getCANBaudRate()

ret_interface_t USBInterface::getCANBaudRate(CANBaudRate *baud_rate)
Description

Get CAN Baud Rate for NLink.

Parameters
DatatypeVariableDescription
CANBaudRate *baud_ratePointer to CANBaudRate where current baud rate will be stored
Returns
DatatypeDescription
ret_interface_tret_interface_t Success(0) or Failure(1)

USBInterface.getConnectedDevices()

std::map<uint32_t, uint8_t> USBInterface::getConnectedDevices()
Description

Get list of connected devices.

Returns
DatatypeDescription
std::map<uint32_t,uint8_t>Map array of node id's and corresponding device types which are connected.

USBInterface.getFirmwareVersion()

ret_interface_t USBInterface::getFirmwareVersion(uint8_t *fw_version_major, uint8_t *fw_version_minor, uint8_t *fw_version_revision, std::string *fw_version_commit)
Description

Get the firmware version of the device.

Parameters
DatatypeVariableDescription
uint8_t *fw_version_major-
uint8_t *fw_version_minor-
uint8_t *fw_version_revision-
std::string *fw_version_commit-
Returns
DatatypeDescription
ret_interface_tret_interface_t Success(0) or Failure(1)

USBInterface.getHardwareVersion()

ret_interface_t USBInterface::getHardwareVersion(uint8_t *hw_version_major, uint8_t *hw_version_minor, uint8_t *hw_revision)
Description

Get the hardware version of the device.

Parameters
DatatypeVariableDescription
uint8_t *hw_version_major-
uint8_t *hw_version_minor-
uint8_t *hw_revision-
Returns
DatatypeDescription
ret_interface_tret_interface_t Success(0) or Failure(1)

USBInterface.initInterface()

uint8_t USBInterface::initInterface(std::string interface_name, std::function< void(uint32_t, uint8_t)> on_new_dev_cb=nullptr, std::function< void(uint32_t)> on_dev_disconnect_cb=nullptr)
Description

Invokes lower level interface initialisation and starts various threads.

Parameters
DatatypeVariableDescription
std::stringinterface_nameName of CAN Interface eg. can0, vcan0...etc
std::function< void(uint32_t, uint8_t)>on_new_dev_cbCallback function which will be called when a new device is connected.
The arguments of the function are:
• CAN Node ID of the device of type uint32_t
• Value of uint8_t type variable represents the type of the device which is connected.
  • 0 means that an actuator is connected.
  • 1 means that a motor driver is connected.
  • 2 means that an IMU is connected.
  • 3 means that an NCoder is connected.
Return value of the function is void ie. it returns nothing.
std::function< void(uint32_t)>on_dev_disconnect_cbCallback function which will be called when a device is disconnected. The argument of this function is the CAN Node ID of the device of type uint32_t and return value of the function is void i.e. it returns nothing.
Returns
DatatypeDescription
uint8_tuint8_t Success(0) or Failure(1)
ret_interface_t USBInterface::rebootNLink()
Description

Reboot the NLink device.

Returns
DatatypeDescription
ret_interface_tret_interface_t Success(0) or Failure(1)

USBInterface.saveConfiguration()

ret_interface_t USBInterface::saveConfiguration()
Description

Save the configuration to NLink.

Returns
DatatypeDescription
ret_interface_tret_interface_t Success(0) or Failure(1)

USBInterface.setCANBaudRate()

ret_interface_t USBInterface::setCANBaudRate(CANBaudRate baud_rate)
Description

Set CAN Baud Rate for NLink.

Parameters
DatatypeVariableDescription
CANBaudRatebaud_rate
Returns
DatatypeDescription
ret_interface_tuint8_t Success(0) or Failure(1)

Python API Reference

CANInterface.CANInterface()

CANInterface(interface_name: str)
Description

CANInterface class constructor.

@param interface_name Interface identifier string.

Parameters
DatatypeVariableDescription
strinterface_name-

CANInterface.close()

close()
Description

Close the interface.

CANInterface.getConnectedDevices()

getConnectedDevices() -> 'list[int]'
Description

Get connected devices on the interface.

Returns
DatatypeDescription
'list[int]'List of CAN Node IDs of connected devices.

USBInterface.USBInterface()

USBInterface(interface_name: str)
Description

USBInterface class constructor.

@param interface_name Interface identifier string.

Parameters
DatatypeVariableDescription
strinterface_name-

USBInterface.close()

close()
Description

Close the interface.

USBInterface.enterDFUMode()

enterDFUMode() -> bool
Description

Enter Device Firmware Update Mode.

Returns
DatatypeDescription
boolTrue if successful else False.

USBInterface.eraseConfiguration()

eraseConfiguration() -> bool
Description

Erase current configuration from the device.

Returns
DatatypeDescription
boolTrue if successful else False.

USBInterface.getCANBaudRate()

getCANBaudRate() -> 'tuple[int, nmotion_transport.CANBaudRate]'
Description

Get CAN Baudrate for the interface.

Returns
DatatypeDescription
'tuple[int, nmotion_transport.CANBaudRate]'CAN Baudrate value.

USBInterface.getConnectedDevices()

getConnectedDevices() -> 'dict[int, int]'
Description

Get connected devices on the interface.

Returns
DatatypeDescription
'dict[int, int]'List of CAN Node IDs and device type of connected devices.

USBInterface.getFirmwareVersion()

getFirmwareVersion() -> 'tuple[int, int, int, str]'
Description

Get Firmware version of the device.

Returns
DatatypeDescription
'tuple[int, int, int, str]'Firmware version as major, minor, revision, commit.

USBInterface.getHardwareVersion()

getHardwareVersion() -> 'tuple[int, int, int]'
Description

Get Hardware version of the device.

Returns
DatatypeDescription
'tuple[int, int, int]'Hardware version as major, minor, revision.
rebootNLink() -> bool
Description

Reboot the NLink device.

Returns
DatatypeDescription
boolTrue if successful else False.

USBInterface.saveConfiguration()

saveConfiguration() -> bool
Description

Save current configuration to the device.

Returns
DatatypeDescription
boolTrue if successful else False.

USBInterface.setCANBaudRate()

setCANBaudRate(baudrate: nmotion_transport.CANBaudRate) -> int
Description

Set CAN Baudrate for the interface.

Parameters
DatatypeVariableDescription
nmotion_transport.CANBaudRatebaudrateCAN Baudrate to be set.
Returns
DatatypeDescription
intTrue if successful else False.
  NMotionTM  is a sub-brand of Nawe Robotics
Copyright © 2026 Nawe Robotics Private Limited