Knowledge Base

Back

How to use the ASD:Commandline Client

November 10, 2011

The commands that are presented in this section must be typed in the command prompt. It is recommended to start the command prompt using the "Start->All Programs->ASD Suite Release 3 V8.0.0->ASD Client Command Prompt" item.

    Note:
  • In case you want a specific default starting directory as start-up folder for the ASD:Commandline Client started via the ASD Client Command Prompt you have to change line 11 in the "ASDPrompt.bat" file which you can find in the folder specified during installation.
  • In case you want to use the ASD:Commandline Client using the regular DOS prompt it is recommended to add to the PATH environment variable the full path to the folder where the ASD:Suite is installed.
  • In case you have installed previous versions of the ASD:Commandline Client and you want to ensure that the latest version of the ASD:Commandline Client is used whenever you call “asdc” in the regular DOS prompt you have to remove from the PATH environment variable all references to folders where the respective versions were installed.

You can specify all server connection settings on the command line. However, you do not have to do this each time the ASD:Suite successfully makes a connection, the associated connection settings are stored as default values for the ASD:Commandline Client. Therefore, it is wise to make a connection with the ASD:Suite once before starting to use the ASD:Commandline Client.

Upgrade ASD models using the command line

The ASD:Converter is a command-line tool which upgrades an ASD model built with previous major releases of the ASD:Suite. The added value of the ASD:Converter is that multiple models can be upgraded in one go, by creating a batch file and specify one line for each model which needs to be upgraded, instead of opening each model in the ASD:Suite.

For details on how to use the ASD:Converter please type "ModelConverter" at the command prompt.

As a result of upgrading a model via the ASD:Converter the ASD model is upgraded and saved in the new format.

Update interface changes in designs

The ASD:Commandline Client will perform model reconciliation if there are no "reconcile conflicts" in your model. In other words you can update design models after changes in the related interface models without the need to open them in the ASD:Suite.

You should type in the command line the following command to reconcile your design model:

asdc --reconcile <modelfilename>.

In case you receive the following error: "Error: model cannot be reconciled automatically, please reconcile the model manually using the ASD:Suite", i.e. there are "reconcile conflicts" in your design model, you have to reconcile the design model by following the instructions described in "Fix reconcile conflicts".

Generate code using the ASD:Commandline Client

With the ASD:Commandline Client it is possible also to use the ASD:Suite from the command-line, i.e. without the need to start the ASD:Suite. This enables automatic code generation during a build process, i.e. the ASD:Commandline Client is intended to be used in a Makefile.

Note: You can use the Makefile to ensure that unmodified models are not regenerated unnecessarily.

Before generating code with the ASD:Commandline Client, the configuration settings must be set in the ASD:Suite or must be mentioned in the command.

Generating source code using the ASD:Commandline Client is done using the following command:

asdc -g -v <code_generator_version> -l <language> -o <output-dir> <modelfilename>

The language can be ‘cpp’, ‘csharp’, 'c' or 'java'. This copies all generated source files to the specified directory on your workstation.

Note: The "-v <code_generator_version>", "-l <language>" and -o <output-dir>” options override the related settings specified in the ASD model file.

For example:

asdc -g -v 8.0.0 -l cpp -o X:\code Alarm.dm

generates all C++ source code for the Alarm design model into the directory  X:\code, while

asdc -g -v 8.0.0 -l csharp IAlarm.im

generates C# source code for the IAlarm interface model into the source file path that has been specified in the IAlarm.im model file.

    Note:
  • Before the generated code can be compiled and executed, the following steps need to be performed:
    • The ASD:Runtime source must be downloaded from the ASD:Server, see instructions in "Download the ASD:Runtime using the ASD:Commandline Client" or in "Download the ASD:Runtime using the ASD:Suite".
    • The files in which user defined parameter types are defined has to be made available during compilation. For details see "Ensure correct referencing of user defined types".
  • In case you receive the following error message: "Error: model not reconciled yet, please reconcile model first using the ASD:Suite", we recommend that you run first the following command: asdc --reconcile <modelfilename>. This allows you to update design models after changes in the related interface models. In case you receive the following error: "Error: model cannot be reconciled automatically, please reconcile the model manually using the ASD:Suite", i.e. there are "reconcile conflicts" in your design model, you have to reconcile the design model by following the instructions described in "Fix reconcile conflicts".

Generate Stub code for Foreign components using the ASD:Commandline Client

Stub code generation can be initiated also by using the ASD:Commandline Client. You should type in the command prompt the following command:

asdc --generate-stub -v <code_generator_version> -l <language> -n <component-name> -t <singleton/multiple> <interface-model>

The language can be ‘cpp’, ‘csharp’, 'c' or 'java'. The component-name denotes the name used for the generated files. The component-type denotes the type of the component, singleton or multiple, for which stub code is generated. The default for component-type is multiple.

Note: If you specify singleton as Component Type and the execution model of your model is SingleThreaded you will get the following error message: "Singleton stub cannot be generated for an interface with the SingleThreaded Execution Model. Use option "--component-type multiple"". For details see "Specify execution model".

For more details on stub code generation see "Generate Stub code for foreign components using the ASD:Suite" and for more details on the "--generate-stub" option of the ASD:Commandline Client type in the command prompt: asdc --generate-stub -h.

Download the ASD:Runtime using the ASD:Commandline Client

The ASD:Runtime software package for a desired target language using the ASD:Commandline Client can be obtained using the following steps:

  1. Open a DOS command prompt. This can be done by opening the Windows Start Menu and then selecting the "ASD Suite Release 3 V8.0.0->ASD Client Command Prompt" item from program list.
  2. Type in the following command at the DOS prompt:

    asdc -r -v <code_generator_version> -l <language> -o <output-dir>

    • Replace <code_generator_version> with the version of the ASD:Runtime you wish to download
    • Replace <language> with ‘cpp’ (C++), ‘csharp (C#)’, 'c (C)' or 'java' (Java).
    • Replace <output-dir> with the path where you wish the ASD:Runtime files to be downloaded.

      For example: asdc -r -v 8.0.0 -l cpp -o X:\code\asd downloads the files of C++ ASD:Runtime 8.0.0 into the "X:\code\asd" directory.