NI-XNET API for LabVIEW and C

XNET Database Add Alias.vi

  • Updated2023-11-11
  • 4 minute(s) read
 XNET Database Add Alias.vi

XNET Database Add Alias.vi

Purpose

Adds a new alias to a database file.

Format

Inputs

CAN FD ISO mode sets the way the API processes ISO FD frames. For a description of these modes, refer to CAN FD, ISO Versus Non-ISO.
0 ISO
1 Non-ISO
2 ISO Legacy
default FD baud rate sets the default FD baud rate for a CAN database that does not internally specify the FD baud rate. If this call replaces an existing alias with the same name, the previous default FD baud rate will be retained if this value is set to zero (0).
default baud rate provides the default baud rate, used when filepath refers to a CANdb database (.dbc) or an NI-CAN database (.ncd). These database formats are specific to CAN and do not specify a cluster baud rate. Use this default baud rate to specify a default CAN baud rate to use with this alias. If filepath refers to a FIBEX database (.xml), AUTOSAR database (.arxml), or LIN LDF file, the default baud rate parameter is ignored. The FIBEX and LDF database formats require a valid baud rate for every cluster, and NI-XNET uses that baud rate as the default. If this call replaces an existing alias with the same name, the previous default baud rate will be retained if this value is set to zero (0).
ignore application protocol is applicable only to a database with a J1939 application protocol, and sets whether the API should ignore the application protocol and process J1939 frames as raw CAN frames (True), or process them as J1939 frames (False).
alias provides the desired alias name. Alias names are more flexible than other XNET database objects. Alias names must match the following rules:
  • Begin with a letter (a-z, A-Z), number (0-9), hyphen (-), or underscore (_).
  • May contain spaces and the following symbols: ! # $ % & ' ( ) + - ; = ` { } ~
  • Must not end with a space.

If the alias name already exists, this VI changes the previous filepath to the specified filepath.

filepath provides the path to the CANdb, FIBEX, or LDF file. Commas are not allowed in the alias name, because the XNET Database Get List VI parses the alias list as a comma-separated list of strings.
error in is the error cluster input (refer to Error Handling).

Outputs

error out is the error cluster output (refer to Error Handling).

Description

NI-XNET uses alias names for database files. The alias names provide a shorter name for display, allow for changes to the file system without changing the application, and enable efficient deployment to LabVIEW Real-Time (RT) targets.

This VI is supported on Windows only. For LabVIEW RT, you can pass the new alias to the XNET Database Deploy VI to transfer an optimized binary image of the database to the LabVIEW RT target. After deploying the database, you can use the alias name in any VI for the Windows host and the LabVIEW RT target.

Linux Considerations

Saving Database Files

On Linux, environment variable NIXNET_USE_SYSTEM_LOCALE determines whether NI-XNET saves database files using its default locale setting of en_US.cp1252 (0) or the current system locale (1).

Importing Database Files

To set the locale used for importing files, define a "locale" key in a Javascript Object Notation (JSON) file in the same path as the database. Note that a JSON file must be saved with UTF-8 encoding. For example, in a file .import.json that resides in the same file path as the database, you can define the following key to import database files using a locale of en_US.iso88591:

{
"locale": "en_US.iso88591"
}

If no JSON configuration file is present during import, the NIXNET_USE_SYSTEM_LOCALE environment variable controls whether the file is imported using the default NI-XNET locale setting en_US.cp1252 (0) or the current system locale (1).

Log in to get a better experience