Sample Program

The External Alarm State Management API contains a sample program that demonstrates the use of this API. You can find the source file and make file for this program in the %BSM_ROOT%\api\amxasmgr directory. It contains:

amxassample.cpp

The sample application source code

makefile

Makefile that creates the sample executable

This sample program generates up to ten alarms and processes Acknowledge, Clear, and Delete requests passed to it by the Alarm Manager.

Note: The program generates each of the alarms you create, then repeats the first three alarms every thirty seconds.

You can use the makefile provided with the sample as a basis for constructing makefiles 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.

\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat

You can use the CIMPDEMO project to create and run the executable for the sample program.

Create a sample program.

Run a sample program.

Create a Sample Program

  1. From the Start menu, select the CIMPLCIITY menu.

  2. Select Demo Project.

  3. In the CIMPLICITY Workbench for CIMPDEMO, select Command prompt... from the Tools menu.

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

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

<drive>:

cd %BSM_ROOT%\api\AMXASMGR

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

  1. If the environment variables are not set automatically, issue the following command to set them:

\Program Files\Microsoft Visual Studio 8\Common7\Tools\vsvars32.bat

  1. Now build the executable:

nmake

Run a Sample Program

The sample program in the CimpDemo project is amxassample.exe.

  1. Create the R1 resource and assign it to all available users.

  2. Create ten alarms named Test1 through Test10. When you create each alarm, give it the following properties:

  1. For Alarm Definition, set Alarm Class to HIGH, leave Alarm Type blank, and enter some text (for example, for Test1 enter TEST1 Alarm) in the Alarm Message field.

  2. For Alarm Routing, route the alarm to all users  (Add the USER role to the Configured Roles For Alarm list).

  3. For Alarm Options, check both Deletion Requirements check boxes, select None for all Automatic Actions, set the Maximum Stacked to 20, and check the Manual Reset Allowed check box.

  1. Update the CIMPDEMO project configuration.

  2. Start the project.

  3. When project startup is complete, select Command prompt... from the Tools menu.

  4. To run the sample program. type:

AMXASSAMPLE

  1. The sample program starts generating alarms.

Note: The program generates all ten alarms, and then repeats the first three alarms at thirty second intervals.

  1. You can acknowledge, reset and delete these alarms through an Alarm Viewer. The Alarm Manager sends the action you request to the sample program. The sample program then asks you if you want to perform the action you requested. If you confirm the action, the sample program sends a message to the Alarm Manager to execute the action. If you do not confirm the action, it is not performed.

More information

Sample program listing.

External Alarm State Management getting started.