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
From the Start menu, select the CIMPLCIITY menu.
Select Demo Project.
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.
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
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
Now build the executable:
nmake
Run a Sample Program
The sample program in the CimpDemo project is amxassample.exe.
Create the R1 resource and assign it to all available users.
Create ten alarms named Test1 through Test10. When you create each alarm, give it the following properties:
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.
For Alarm Routing, route the alarm to all users (USER role to the Configured Roles For Alarm list).
theFor 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.
Update the CIMPDEMO project configuration.
Start the project.
When project startup is complete, select Command prompt... from the Tools menu.
To run the sample program. type:
AMXASSAMPLE
The sample program starts generating alarms.
Note: The program generates all ten alarms, and then repeats the first three alarms at thirty second intervals.
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.
Sample program listing. |
|
External Alarm State Management getting started. |