Alarm Viewer API Sample Program

About this task

This topic describes how to Build and Run the Demo (sample) program. A sample Microsoft Visual C++ project, amvtest_exe.vcxproj, is provided to build the sample program. Use this project as a basis for constructing projects for your own applications.
Note: Depending on how you installed Visual C++, the INCLUDE, LIB, and PATH environment variables may not be automatically set when you install MSDEV. If they are not set, you will have to set them manually or run the following to set them before building any user programs.
for /F "tokens=* USEBACKQ" %F in (`"%PROGRAMFILES(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath`) do set VSPATH=%F call "%VSPATH%\Common7\Tools\VsDevCmd.bat"

When you run the demo program, it requests class, resource and alarm data from the AMRP, then displays the requested information.

To build the sample program, do the following:

Procedure

  1. Click Tools>Command Prompt on your project's CIMPLICITY Workbench menu bar.

    This will ensure that your environment variables (in particular %BSM_ROOT% and %SITE_ROOT%) are set correctly.

  2. In the Command Prompt window, issue the following commands:

    cd <drive>

    cd %BSM_ROOT%\api

    Where <drive> is the disk where your CIMPLICITY software is installed.

  3. If the environment variables are not set automatically, issue the following command to set them:
    for /F "tokens=* USEBACKQ" %F in (`"%PROGRAMFILES(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -property installationPath`) do set VSPATH=%F call "%VSPATH%\Common7\Tools\VsDevCmd.bat"
  4. Now start Visual Studio:

    devenv CimplicityAPI.sln

  5. Open the Solution Explorer.
  6. Right click amvtest_exe.
  7. Select Build on the Popup menu.

    Run the Demo (Sample) Program

    The API process name must be stored in the PRCNAM environment variable for the program to run. The name is an arbitrary character string of up to 10 characters. To create PRCNAM, enter the following command in the Command Prompt window:

    set PRCNAM=<name>

    where <name> is the API process name.

    To run the sample program, enter the following command in the Command Prompt window:

    amvtest

    You will be prompted for a project name and asked if you want to run in dynamic mode.

    Once a connection to the AMRP has been formed, the test program will print out the Classes and Resources for which alarms will be processed. It will then request a list of current alarms from AMRP and print them out.

    If running in dynamic mode, the program will wait for updates from AMRP and print them out as they are received.

    To end the sample program, type EXIT and press return.