BM Cimplicity Open Interface API Reference Master
BM Cimplicity Open Interface API Reference Master
PROFICY CIMPLICITY
HMI/SCADA
Open Interface API Reference
Proprietary Notice
The information contained in this publication is believed to be accurate and reliable. However, General
Electric Company assumes no responsibilities for any errors, omissions or inaccuracies. Information
contained in the publication is subject to change without notice.
No part of this publication may be reproduced in any form, or stored in a database or retrieval system,
or transmitted or distributed in any form by any means, electronic, mechanical photocopying,
recording or otherwise, without the prior written permission of General Electric Company. Information
contained herein is subject to change without notice.
Trademark Notices
GE, the GE Monogram, and Predix are either registered trademarks or trademarks of General Electric
Company.
Microsoft® is a registered trademark of Microsoft Corporation, in the United States and/or other
countries.
We want to hear from you. If you have any comments, questions, or suggestions about our
documentation, send them to the following email address:
[email protected]
Contents
Chapter 1. About CIMPLICITY Open Interface...................................................................................... 17
Step 4. Set a CIMPLICITY Global Parameter on both the Server and Viewer.................................24
Operation Overview.............................................................................................................................34
Include Files........................................................................................................................................ 41
coprcnam............................................................................................................................................. 43
cor_logstatus....................................................................................................................................... 43
cor_long_long_from_stamp_utc......................................................................................................... 44
cor_stamp............................................................................................................................................ 45
cor_stamp_calc_utcHR....................................................................................................................... 45
cor_stamp_calcHR.............................................................................................................................. 46
cor_stamp_cmp................................................................................................................................... 47
cor_stamp_convert_to_ascii............................................................................................................... 48
cor_stamp_convert_to_ascii_utc........................................................................................................ 48
cor_stamp_get_components_utcHR.................................................................................................. 49
cor_stamp_get_componentsHR......................................................................................................... 50
cor_stamp_get_diff..............................................................................................................................51
cor_stamp_get_diffHR.........................................................................................................................51
cor_stamp_getfracHR......................................................................................................................... 52
cor_stamp_is_set.................................................................................................................................52
cor_stamp_is_valid.............................................................................................................................. 53
cor_stamp_reset.................................................................................................................................. 53
cor_stamp_set_fracHR........................................................................................................................54
ipc_deactivate......................................................................................................................................54
Contents | iv
ipc_register.......................................................................................................................................... 55
amaru_init............................................................................................................................................ 57
amaru_add_gen................................................................................................................................... 58
amaru_add_gen_stamp.......................................................................................................................60
amaru_add_update..............................................................................................................................63
amaru_add_update_ca........................................................................................................................ 66
amaru_add_update_stamp................................................................................................................. 68
amaru_add_update_stamp_ca........................................................................................................... 70
amaru_send_msg................................................................................................................................ 72
amaru_alloc_buffer..............................................................................................................................73
amaru_num_messages.......................................................................................................................74
amaru_get_resp................................................................................................................................... 75
amaru_free_buffer............................................................................................................................... 76
amaru_terminate................................................................................................................................. 76
am_defs.h.......................................................................................................................................... 105
amaru_proto.h................................................................................................................................... 130
Contents | v
Classes.............................................................................................................................................. 149
Command Handlers..........................................................................................................................151
Notes on Internationalization for the External Alarm State Management API.................................... 165
CAmvAlarm........................................................................................................................................210
CAmvClassFilter................................................................................................................................223
CAmvClassFilterList..........................................................................................................................229
CAmvConn......................................................................................................................................... 232
CAmvFieldFilter................................................................................................................................. 255
CAmvFieldFilterList........................................................................................................................... 257
CAmvResourceFilter......................................................................................................................... 261
CAmvResourceFilterList................................................................................................................... 263
CAmvSetupList..................................................................................................................................265
CAmvStateFilter................................................................................................................................ 272
CAmvStateFilterList.......................................................................................................................... 276
CAmvTimeFilter.................................................................................................................................279
user_protocol_info().......................................................................................................................... 307
user_device_info()............................................................................................................................. 307
user_open_port()............................................................................................................................... 308
user_cpu_model()..............................................................................................................................308
user_device_set_max_device_domain_count()............................................................................... 308
user_valid_point().............................................................................................................................. 308
user_read_data()............................................................................................................................... 309
user_remove_point()......................................................................................................................... 309
user_write_data()...............................................................................................................................309
user_write_point_quality() or user_write_point_quality2()..............................................................309
user_on_demand_response()........................................................................................................... 310
user_accept_unsolicited_data.......................................................................................................... 331
user_cpu_model................................................................................................................................ 332
user_cvt_data_from_device.............................................................................................................. 333
user_cvt_data_to_device...................................................................................................................335
user_device_info................................................................................................................................337
user_device_okay.............................................................................................................................. 339
user_device_set_max_device_domain_count()............................................................................... 339
user_heartbeat_device...................................................................................................................... 341
user_init..............................................................................................................................................342
user_on_demand_response..............................................................................................................343
user_open_port..................................................................................................................................344
user_proc_event_1.............................................................................................................................345
user_proc_event_2.............................................................................................................................346
user_proc_event_3.............................................................................................................................347
Contents | ix
user_proc_event_4.............................................................................................................................347
user_proc_event_5.............................................................................................................................348
user_proc_event_6.............................................................................................................................349
user_proc_event_7.............................................................................................................................349
user_proc_event_8.............................................................................................................................350
user_proc_event_9.............................................................................................................................351
user_proc_event_10.......................................................................................................................... 351
user_process_unsolicited_data........................................................................................................ 352
user_process_unsolicited_data_stamp........................................................................................... 354
user_protocol_info.............................................................................................................................358
user_read_data.................................................................................................................................. 359
user_read_diag_data......................................................................................................................... 360
user_remove_point............................................................................................................................ 362
user_term........................................................................................................................................... 363
user_valid_diag_point........................................................................................................................363
user_valid_point.................................................................................................................................365
user_write_data................................................................................................................................. 366
user_write_point_quality................................................................................................................... 369
cor_sleep............................................................................................................................................371
dcrp_align_read................................................................................................................................. 372
dcrp_call_on_time............................................................................................................................. 372
dcrp_clear_ef..................................................................................................................................... 373
dcrp_get_any_ef................................................................................................................................ 374
dcrp_get_ef........................................................................................................................................ 375
dcrp_get_port_parameters................................................................................................................376
dcrp_get_serial_settings................................................................................................................... 377
dcrp_log_status................................................................................................................................. 378
Contents | x
dcrp_notify_unsolicited_data............................................................................................................380
dcrp_rcv_unsolicited_data................................................................................................................ 380
dcrp_rcv_unsolicited_data_stamp....................................................................................................382
dcrp_release_ef................................................................................................................................. 383
dcrp_set_device_down......................................................................................................................384
dcrp_set_device_up...........................................................................................................................385
dcrp_set_ef........................................................................................................................................ 386
dcrp_stat_process............................................................................................................................. 387
dcrp_to_long_point_id....................................................................................................................... 390
dcrp_user_alarm................................................................................................................................391
ADDR_DATA....................................................................................................................................... 395
COR_STAMP...................................................................................................................................... 397
DEVICE_DATA.................................................................................................................................... 398
DOMAIN_ARRAY................................................................................................................................398
SUPPORT........................................................................................................................................... 399
TOOLKIT_QUALDATA........................................................................................................................ 408
TOOLKIT_QUALDATA2...................................................................................................................... 409
TOOLKIT_STATUS............................................................................................................................. 409
System Overview...............................................................................................................................411
External Interfaces............................................................................................................................413
PTMAP_add_alarm_ack_state..........................................................................................................439
PTMAP_add_onalarm....................................................................................................................... 440
PTMAP_add_onchange.....................................................................................................................443
PTMAP_add_point.............................................................................................................................444
PTMAP_add_pt_list........................................................................................................................... 445
PTMAP_add_setpoint....................................................................................................................... 446
PTMAP_add_setpoint_chgapproval................................................................................................. 447
PTMAP_add_sl.................................................................................................................................. 449
PTMAP_add_snapshot..................................................................................................................... 449
PTMAP_add_timedpt........................................................................................................................ 450
PTMAP_alloc_eu_data...................................................................................................................... 452
PTMAP_alloc_ptm_data....................................................................................................................452
PTMAP_cancel_all.............................................................................................................................453
PTMAP_cancel_point........................................................................................................................ 453
PTMAP_cancel_req........................................................................................................................... 454
PTMAP_cancel_sl..............................................................................................................................455
PTMAP_copy_point........................................................................................................................... 456
PTMAP_eu_conv............................................................................................................................... 457
PTMAP_fold_ack_state.....................................................................................................................458
PTMAP_free_point_list......................................................................................................................459
PTMAP_free_ptm_data..................................................................................................................... 460
PTMAP_free_ptm_rsp....................................................................................................................... 461
PTMAP_get_all.................................................................................................................................. 461
PTMAP_get_eu_info..........................................................................................................................463
PTMAP_get_eu_label........................................................................................................................ 464
PTMAP_get_init_state.......................................................................................................................464
PTMAP_get_point..............................................................................................................................465
PTMAP_get_point_ChangeApprovalinfo..........................................................................................467
PTMAP_get_point_info..................................................................................................................... 468
Contents | xiii
PTMAP_get_point_list.......................................................................................................................470
PTMAP_get_point_type.....................................................................................................................471
PTMAP_get_req.................................................................................................................................472
PTMAP_get_req_point_id..................................................................................................................473
PTMAP_get_sl................................................................................................................................... 474
PTMAP_get_sl_point......................................................................................................................... 475
PTMAP_get_struct_components..................................................................................................... 477
PTMAP_get_type............................................................................................................................... 478
PTMAP_initiate..................................................................................................................................479
PTMAP_modify_setpoint.................................................................................................................. 480
PTMAP_modifysetpoint_chgapproval............................................................................................. 480
PTMAP_remove_point...................................................................................................................... 482
PTMAP_remove_sl............................................................................................................................ 483
PTMAP_resume.................................................................................................................................484
PTMAP_rev_eu_conv.........................................................................................................................484
PTMAP_send_all............................................................................................................................... 485
PTMAP_send_point...........................................................................................................................486
PTMAP_send_req.............................................................................................................................. 487
PTMAP_send_sl................................................................................................................................ 487
PTMAP_send_sl_point...................................................................................................................... 488
PTMAP_set_all.................................................................................................................................. 489
PTMAP_set_point..............................................................................................................................489
PTMAP_set_req................................................................................................................................. 490
PTMAP_set_sl................................................................................................................................... 491
PTMAP_set_sl_point......................................................................................................................... 492
PTMAP_suspend...............................................................................................................................493
PTMAP_terminate............................................................................................................................. 494
PTMAP_wait_all.................................................................................................................................494
PTMAP_wait_point............................................................................................................................ 495
Contents | xiv
PTMAP_wait_req............................................................................................................................... 496
PTMAP_wait_sl..................................................................................................................................497
PTMAP_wait_sl_point....................................................................................................................... 498
cor_event_waitfr................................................................................................................................ 501
cor_logstatus..................................................................................................................................... 501
cor_setstatus..................................................................................................................................... 502
cor_vsetstatus................................................................................................................................... 503
ipc_deactivate....................................................................................................................................504
ipc_register........................................................................................................................................ 505
lib_get_ef............................................................................................................................................506
ALARM_ENABLED............................................................................................................................. 576
ALARM_HIGH.................................................................................................................................... 576
ALARM_LOW......................................................................................................................................577
DISP_FORMAT................................................................................................................................... 577
DISP_HIGH......................................................................................................................................... 577
DISP_LOW.......................................................................................................................................... 577
ELEMENTS.........................................................................................................................................577
EU_LABEL.......................................................................................................................................... 578
INIT_STATE........................................................................................................................................ 578
LENGTH............................................................................................................................................. 578
RAW_VALUE.......................................................................................................................................578
SIZE.................................................................................................................................................... 578
Contents | xvi
STATE.................................................................................................................................................578
TYPE...................................................................................................................................................579
VALUE.................................................................................................................................................580
WARN_ENABLED............................................................................................................................... 580
WARNING_HIGH................................................................................................................................ 580
WARNING_LOW................................................................................................................................. 580
Formats..............................................................................................................................................581
Topics.................................................................................................................................................581
Help.................................................................................................................................................... 582
Error Messages.........................................................................................................................................583
• Downtime reporting
• Production reporting
• Records of production counts at work stations
• Graphic monitoring of automatic data point values
• Fault reporting via direct point values and alarms
CIMPLICITY software's flexible system architecture and modular design allows for easy add-on of
functionality. These add-ons can be created programmatically using CIMPLICITY's API tool kits.
Important:
If you plan to work with the API tool kit, you must have Microsoft Visual Studio 2017 installed.
Login/Lo Create and customize a Login/Logout box and/or use API's to give programmed appli
gout (on page cations some control over the CIMPLICITY login/logout activities.
19)
Alarm Man Provides an interface for application programs to generate CIMPLICITY alarms based
agement (on on the specific requirements of the application.
page 30)
Alarm Interest Create a process that receives alarm information from the CIMPLICITY Alarm Manag
ed Process er.
(on page
146)
External Alarm Create an External Alarm State Manager (XASMgr) to manage CIMPLICITY alarms.
State Manage
Open Interface API Reference | 1 - About CIMPLICITY Open Interface | 18
Alarm View Provides an interface for application programmers to develop full-featured custom
er (on page alarm viewers to meet special needs.
193)
Device Com • Support communications to devices for which standard CIMPLICITY software
munications communication enablers are not available.
(on page • Provides the libraries and build procedures you need to create communication
286) enablers that perform the same functions as standard CIMPLICITY software
communication enablers.
Point Manage Provides an interface between application programs and CIMPLICITY software's ability
ment (on page to monitor data point values.
411)
CIMPLICITY to Provides CIMPLICITY access to point data from other Microsoft Windows products
Windows Serv such as Microsoft Excel through DDE.
er (on page
566)
Chapter 2. Login/Logout API
About the Login/Logout API
CIMPLICITY provides a default Login/Logout box. You can create and customize a Login/Logout box and/
or use API's to give programmed applications some control over the CIMPLICITY login/logout activities.
The easiest way to change the login box is to modify the Visual Basic Project that is supplied.
Coding your own login box is also simple if you understand:
◦ OLE Automation
◦ How to build an Automation Server using your development language (e.g. Visual C++, etc)
Oilogin.zip is a compressed zip file contains an example Visual Basic 5.0 project and the
resultant binary. You may modify the Visual Basic Project or use the contained binary. The project
implements three differently styled login pads that are suitable for use on touch screens.
The CIMPLICITY Global Parameter LOGIN_INTERFACE provides the name of the Automation Interface
implemented by your Automation Server.
The Automation Interface must provide an implementation for the following method:
Where Is
You will need to register the replacement logging control with Windows and then install it in CIMPLICITY
in order for it to take over the logging process.
You can replace the CIMPLICITY default login box with your customized login box in five easy steps.
Step 4 Set a CIMPLICITY global parameter on both the server and view
(on page er.
24)
Example
cd\LoginAPI
cimregdll CIMPLogin.ocx
Note:
For a viewer you will need to copy the CIMPLogin.ocx file to the viewer computer and
register it there.
Value Specifies
If the environment variable is not set, Login defaults to a QWERTY style keyboard.
Type Cd master .
Press Enter.
a. Press Enter.
b. Type Notepad glb_parms.idt
LOGIN_INTERFACE|1|Cimplogin.Login
6. Exit Notepad.
The DOS window appears with the cursor at the MASTER prompt.
8. Press Enter.
Open Interface API Reference | 2 - Login/Logout API | 24
Step 4. Set a CIMPLICITY Global Parameter on both the Server and Viewer
Example
Cd\cimplicity\hmi\data
Press Enter.
b. Press Enter.
6. Type:
LOGIN_INTERFACE|1|Cimplogin.Login
7. Exit Notepad.
The DOS window appears with the cursor at the data prompt.
9. Press Enter.
The new login box should appear instead of the default login box.
Several APIs exist that give programmed applications some control over the CIMPLICITY login/logout
activities. Versions exist in both C callable and basicscript callable forms.
C callable routines
COR_I4 GEFCIMPLICITY_setuserpw (on page 27) (TCHAR *proj, TCHAR *CIMPuser, TCHAR *pw)
COR_I4 GEFCIMPLICITY_remuserpw (on page 28) (TCHAR *proj, TCHAR *CIMPuser, TCHAR *pw)
Be aware that:
General Guidelines
The following routines can be called to avoid the CIMPLICITY invoked GUI.
De Use the routine to set the CIMPLICITY user and corresponding password (if there is one) for the
scrip project from which resources are about to be requested, Do this before you request any CIM
tion PLICITY resources.
• When the application requests a CIMPLICITY resource requiring a login, these set parame
ters will be used to provide the login action with data.
• These parameters remain set until cleared by an application.
• Therefore, if the system timeouts should cause a logout, a subsequent request would
again reference this data for login.
A logout can happen after all requests for resources have been removed.
Open Interface API Reference | 2 - Login/Logout API | 28
Note:
If the provided data is not valid, no attempt is made to obtain the login information via
GUI or otherwise, and no error is given. These routines can be called multiple times to
change the data that should be referenced on future login attempts without having to
clear any data already set.
Pur To enable an application to stop having logins reference the set data
pose
Rou CimLogout
tine
De After CimLogout is called, either CimLogin must be called or the similar action initiated from the Lo
scrip gin Panel, before data can be retrieved again.
tion
Rou CimLogin
tine
De This most likely will be preceded by a call to CimSetProjectUserPassword and CimLogout, to force a
scrip change in the currently logged in CIMPLICITY user.
tion
'point that will have a value configured within the previously specified project
Sub gp
trace "point value = " & pointget("\\" & proj & "\" & pointwithvalue)
end sub
sub nouser
end sub
sub testuser
end sub
sub main
call gp
'on or fetch of data may fail with error indicating user not logged in...
Call CimLogout(proj)
end sub
Chapter 3. Alarm Management API
About Alarm Management API
The Alarm Management API is included in the Integrator's Toolkit for GE Intelligent Platform's CIMPLICITY
software. This Application Program Interface (API) provides an interface for application programs to
generate CIMPLICITY alarms based on the specific requirements of the application.
The Alarm Management API functions are fully integrated with CIMPLICITY software's Base system
functionality to enhance its already powerful monitoring capability in a full range of computer integrated
manufacturing environments.
alarmapi.h cor_
thread.h
am_defs.h cor_time.h
am_errors.h ddl.h
amap_defs.h examgr.h
amaru_err.h ipc.hpp
amdd_cmd.h ipcerr.h
amdd_cont.h mf_defs.h
amdd_defs.h mfamupdi.h
amip.h mfpmterm.h
cor.h mfstatus.h
cor_event.h netcom.h
cor_mutex.h rcm.h
cor_os.h rtr_bcst.h
Open Interface API Reference | 3 - Alarm Management API | 32
cor_stat.h sc_recs.h
amaru.lib fasrtl.lib
amip.lib ipc.lib
corutil.lib cim_mf.lib
ddl.lib cim_sc.lib
exam
gr.lib
This API is written for the international environment. In an international environment, strings in
CIMPLICITY software can be multi-byte strings. If you want your code to conform to international
standards, it is recommended that you do the following when working with strings:
char *cp;
Open Interface API Reference | 3 - Alarm Management API | 33
• Avoid using a variable to hold the value of a logical character. Instead, use a pointer to a character
in the string. In particular, avoid the _tcsnextc() macro, because the value it returns appears to be
incompatible with some of the C runtime library functions.
• Use the functions _tccpy() and _tccmp() and string pointers instead of the = and == operators on
characters.
• Use GetStringTypeEx() instead of the character classification macros such as _istalpha().
• Use CharUpper() and CharLower() instead of _toupper() and _tolower().
Recommended Reading
Microsoft has several good papers on writing international code on its Developer Network DVD and its
web site To find documentation on the web site, go to http://msdn.microsoft.com/default.asp and search
for MBCS
CIMPLICITY software's Alarm Management module is responsible for maintaining the status of
outstanding alarms, or predetermined conditions of interest detected by an application process. Alarm
Management informs users of current alarm occurrences and sends information on alarm occurrences to
interested processes. Alarm Management provides a set of services to generate new alarms and update
the status of existing alarms. These services allow an application to interact with Alarm Management
capability without knowing the message structure and message passing aspects of interfacing to an
Alarm Management Resident Process.
The Alarm Management module consists of an Alarm Management Resident Process (AMRP), a
configured number of Alarm Management Allocated Processes (AMAP), and a set of utilities linked into
application programs. These utilities are referred to as the Alarm Management Application Resident
Utilities (AMARU).
Operation Overview
• Overview
• Initialize communications with AMRP.
• Generate alarm update information.
• Send alarm information.
• Terminate communications with AMRP.
Overview
Alarm Management maintains an in-memory database containing information on the current user
population and the current set of outstanding alarms. This database is updated as information on the
current user population is received from User Registration, as new alarms are generated, and as the
status of existing alarms is updated.
The status of alarms may be updated interactively by a user through the AMAP or by an application
program sending a message to the AMRP. When the status of alarms changes, new alarm counts and
dates are determined for each user. If a user's information changes, the new data is sent to the user's
Alarm Viewer.
Any process that wants to communicate with AMRP to update alarm statuses must do the following:
The amaru_init procedure initializes the utilities for communication with an Alarm Manager in the current
Interprocess Communications (IPC) network. An application must invoke this procedure in order to
communicate with Alarm Management. Typically, initialization is done once when the application process
starts up.
Application programs require the following information in order to generate or update alarms:
FR_ID The identifier of the factory resource the alarm is being generated or updated for.
REF_ID A third identifier (the Reference ID) designating the instance of the ALARM_ID/FR_ID being
generated or updated.
Alarm The value of the run time parameters to be loaded into the alarm message.
Para
meters
Alarm The identifier of the AMRP servicing the specified factory resource. This information is car
Man ried in the alarm_mgr field in the fr.dat configuration file and can be checked for the factory re
age source for which the alarm is being generated or updated.
ment ID
Together, the ALARM_ID, FR_ID, and REF_ID uniquely identify an alarm occurrence. All operations on the
same ALARM_ID, FR_ID, REF_ID combination occur on the same alarm.
Two steps are necessary in order to generate or update alarms. First, the request is added to an IPC
buffer. Then the request is sent to the appropriate AMRP. The appropriate AMRP can be determined once
the factory resource is known.
The amaru_add_gen procedure adds alarm generation information to the specified IPC buffer. The caller
is informed if the buffer is full.
The amaru_add_update procedure adds alarm update information to the specified IPC buffer. The caller is
informed if the buffer is full.
The AMRP accepts messages with multiple generation and update requests. Thus, if an application
program has multiple alarms to generate or update, these requests can be packed into a single IPC
Open Interface API Reference | 3 - Alarm Management API | 36
message and sent as a whole. The Alarm Management routines support and favor this mode of operation
as it reduces network message traffic.
The amaru_send_msg procedure sends an IPC message to the specified AMRP. The procedure handles
the redundancy aspects of the AMRP. If the specified AMRP is not available, an appropriate status is
returned to the caller.
Alarm Management receives static information on the legal set of alarms from system configuration
files at initialization. This configuration information specifies the user roles configured to see each alarm.
Alarms are generated with respect to factory resources. When an alarm is generated, all users who have
a view of the specified factory resource, and whose Role matches one of the roles the alarm is configured
to be routed to, are informed of the new alarm occurrence.
When an application no longer needs to communicate with Alarm Management, the amaru_terminate
procedure is called to end communication with the AMRP.
The Alarm Management API lets you construct application programs that generate, reset, acknowledge,
and delete alarms. The application programs can use the standard C language functions provided by
the API in order to communicate with the Alarm Management module of CIMPLICITY software's Base
System.
This API gives you transparent access to the CIMPLICITY alarm database in order generate new alarms or
modify the status of existing alarms, regardless of the physical location of the application program.
A C language subroutine interface is available for application programs modifying alarm status. The C
language interface is used on nodes where a CIMPLICITY environment is currently running.
The CIMPLICITY Alarm Management API lets application programs access the functions of CIMPLICITY
software's Alarm Management application module. Using the API requires that you do the following:.
Open Interface API Reference | 3 - Alarm Management API | 37
Overview
A sample Microsoft Visual C++ project, named amaru_demo_exe.vcxproj, is provided to build the sample
program. Use this project as a basis for constructing projects for your own applications.
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.
When you run the demo program, it will generate an alarm, then reset it.
1. From the CIMPLICITY Workbench for your project, select Command Prompt from the Tools menu.
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 (where <drive> is the disk where
your CIMPLICITY software is installed):
<drive>: cd %BSM_ROOT%\api
3. (If the environment variables are not set automatically) issue the following command to set them:
devenv CimplicityAPI.sln
5. devenv CimplicityAPI.sln
Open Interface API Reference | 3 - Alarm Management API | 38
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>
To run the sample program, enter the following command in the Command Prompt window:
amaru_demo
Important:
You must have a project running locally or the sample program will fail to run successfully.
This example shows coding necessary to add alarm generation/update requests to the IPC message
buffer until the buffer is full. When the buffer is full, a message is sent.
while (not_finished)
/* first call */
/* repeat */
repeat
COR_SUCCESS);
if (ret_stat.err_code == MF_INSUF_SPACE)
{
Open Interface API Reference | 3 - Alarm Management API | 39
/* send message */
...
} /* end while */
Note:
The alarm generation/update requests are added to the IPC message buffer. The most recent
alarm segment is not added to the message buffer if there is not sufficient space for it. Therefore
it must be kept and loaded into the next datagram as the first segment.
The following example shows how to send an alarm with multiple parameters:
#define NUM_PARAMETERS
AM_MSG_FIELD msg_field[NUM_PARAMETERS];
msg_field[0].ftype = ;
msg_field[0].field, xxx = ;
alarm_id,
fr_id,
user_or_serv_id,
resp_type,
ref_id,
key,
msg_field,
NUM_PARAMETERS,
In this example, msg_field is a pointer to the beginning of an array of parameters. The types may be
different, but they all belong to the same alarm.
Open Interface API Reference | 3 - Alarm Management API | 40
By default, newly generated CIMPLICITY alarms are assigned a timestamp indicating the alarm generation
time and duration. The Alarm Management API lets you provide your own timestamp, so that external
alarms can be synchronized to a more accurate clock. The following example shows how to generate an
alarm with an external timestamp:
COR_STAMP stamp;
yyyy = 1995;
amaru_add_gen_stamp(
"$RTR_LINK_DOWN", /* ID of alarm */
"$SYSTEM", /* ID of resource */
0, /* key */
stamp,
&ret_stat );
if (ret_stat.status != COR_SUCCESS)
printf("%s\n",ret_stat.err_msg);
goto end_of_program_am;
There is also a corresponding function amaru_add_update_stamp() in the API which can be used to
specify an external reset time for an outstanding alarm.
• Include files.
• General subroutines for the Alarm Management API.
• Application subroutines for the Alarm Management API.
Include Files
The following header files contain definitions used by Alarm Management procedures and therefore must
be included in an application program that interfaces with Alarm Management.
#include <inc_path/cor.h>
#include <inc_path/cor_stat.h>
#include <inc_path/sc_recs.h>
#include <inc_path/netcom.h>
Type definitions supporting the use of the AMARU procedures can be found in:
The general subroutines are used to get the current process name, suspend the process temporarily,
deactivate the IPC port, and register with IPC.
• coprcnam
• Get current process name
• cor_logstatus
• Write error information to the CIMPLICITY status log.
• cor_long_long_from_stamp_utc
• Convert the COR_STAMP to a long long.
• cor_stamp
• Get t"Field Definitions:e current time of day as a timestamp
• cor_stamp_calc_utcHR
• Generate a UTC timestamp for a particular date and time
• cor_stamp_calcHR
• Generate a timestamp for a particular date and time.
• cor_stamp_cmp
• Compare the order in which one COR_STAMP occurs relative to another.
• cor_stamp_convert_to_ascii
• Convert the COR_STAMP to ASCII.
• cor_stamp_convert_to_ascii_utc
• Convert the UTC COR_STAMP to ASCII.
• cor_stamp_get_components_utcHR
• Convert a UTC timestamp into its various components.
• cor_stamp_get_componentsHR
• Convert a timestamp into its various components.
• cor_stamp_get_diff
• Calculate the difference between two COR_STAMPs.
• cor_stamp_get_diffHR
• Calculate the difference between two COR_STAMPs.
• cor_stamp_getfracHR
• Get the fractional part of a COR_STAMP.
• cor_stamp_is_set
• Return whether or not the COR_STAMP is set.
• cor_stamp_is_valid
Open Interface API Reference | 3 - Alarm Management API | 43
coprcnam
Returns the current process name. The process name will be used by ipc_register along with the node
name to define the physical address of this process.
The process name is extracted from the PRCNAM environment variable, and should be unique for each
running application.
Syntax
void coprcnam (prcnam)
char *prcnam;
Input Arguments
None.
Output Arguments
Return Value
None.
cor_logstatus
Syntax
void cor_logstatus( const TCHAR *proc,
COR_BOOLEAN severe,
COR_STATUS *status )
Input Arguments
Output Arguments
None
Return Value
None
The value is sent to the status log, which is viewed through the Log Viewer application.
cor_long_long_from_stamp_utc
Syntax
long long cor_long_long_from_stamp_utc(const COR_STAMP* time_stamp);
Input Arguments
Output Arguments
NONE
Return Value
long long
Open Interface API Reference | 3 - Alarm Management API | 45
cor_stamp
Syntax
void cor_stamp ( stamp )
COR_STAMP *stamp;
Input Arguments
None.
Output Arguments
Return Value
None
cor_stamp_calc_utcHR
Generates a UTC timestamp for a particular date and time. Invalid input parameters will not cause this
function to fail.
Syntax
int cor_stamp_calcHR( stamp, yyyy, mm, dd, hh, min, sec, tt100Nano )
COR_STAMP *stamp;
int yyyy;
int mm;
int dd;
int hh;
int min;
int sec;
int tt100Nano;
Open Interface API Reference | 3 - Alarm Management API | 46
Input Arguments
dd The day. Must be in the range 1.n, where n is the number of days in the month.
Output Arguments
Return Value
int
cor_stamp_calcHR
Generate a timestamp for a particular date and time. Invalid input parameters will not cause this function
to fail.
Syntax
int cor_stamp_calcHR( stamp, yyyy, mm, dd, hh, min, sec, tt100Nano )
COR_STAMP *stamp;
int yyyy;
int mm;
int dd;
int hh;
int min;
int sec;
int tt100Nano;
Open Interface API Reference | 3 - Alarm Management API | 47
Input Arguments
dd The day. Must be in the range 1.n, where n is the number of days in the month.
Output Arguments
Return Value
int
cor_stamp_cmp
Compare the order in which one COR_STAMP occurs relative to another (which stamp occurs first; which
occurs second).
Syntax
COR_I4 cor_stamp_cmp(const COR_STAMP *time1, const COR_STAMP *time2);
Input Arguments
Output Arguments
NONE
Open Interface API Reference | 3 - Alarm Management API | 48
Return Value
COR_I4
cor_stamp_convert_to_ascii
Syntax
void cor_stamp_convert_to_ascii( const COR_STAMP *ttime, TCHAR *tasc_time, int time_format);
Input Arguments
time_- The format value can be one of many constants defined in the: ..\<CIMPLICITY installa
format tion>\api\include\inc_path\cor.h file.
Output Arguments
Return Value
NONE
cor_stamp_convert_to_ascii_utc
Syntax
void cor_stamp_convert_to_ascii_utc( const COR_STAMP *ttime, TCHAR *tasc_time, int time_format);
Input Arguments
time_- The format value can be one of many constants defined in the: ..\<CIMPLICITY installa
format tion>\api\include\inc_path\cor.h file.
Open Interface API Reference | 3 - Alarm Management API | 49
Output Arguments
Return Value
NONE
cor_stamp_get_components_utcHR
Syntax
void cor_stamp_get_components_utcHR(stamp, yyyy, mm, dd, hh,
COR_STAMP *stamp;
int *yyyy;
int *mm;
int *dd;
int *hh;
int *min;
int *sec;
int *tt100Nano;
Input Arguments
Output Arguments
Return Value
NONE
cor_stamp_get_componentsHR
Syntax
void cor_stamp_get_componentsHR(stamp, yyyy, mm, dd, hh,
COR_STAMP *stamp;
int *yyyy;
int *mm;
int *dd;
int *hh;
int *min;
int *sec;
int *tt100Nano;
Input Arguments
Output Arguments
Return Value
NONE
cor_stamp_get_diff
Syntax
COR_I4 cor_stamp_get_diff( const COR_STAMP *, const COR_STAMP * );
Input Arguments
Output Arguments
NONE
Return Value
COR_I4
cor_stamp_get_diffHR
Syntax
long long cor_stamp_get_diffHR( const COR_STAMP *, const COR_STAMP * );
Input Arguments
Output Arguments
NONE
Return Value
long long
cor_stamp_getfracHR
Syntax
int cor_stamp_getfracHR(const COR_STAMP *stamp);
Input Arguments
Output Arguments
NONE
Return Value
int
cor_stamp_is_set
Syntax
int cor_stamp_is_set( const COR_STAMP * );
Input Arguments
Output Arguments
NONE
Return Value
int
cor_stamp_is_valid
Syntax
int cor_stamp_is_valid( const COR_STAMP * );
Input Arguments
Output Arguments
NONE
Return Value
int
cor_stamp_reset
Syntax
void cor_stamp_reset(COR_STAMP *stamp);
Input Arguments
Output Arguments
NONE
Return Value
VOID
cor_stamp_set_fracHR
Syntax
void cor_stamp_set_fracHR(COR_STAMP *stamp, int frac);
Input Arguments
frac The fractional part that will be set for the cor_
stamp.
Output Arguments
NONE
Return Value
VOID
ipc_deactivate
Terminate all activities associated with the IPC. If any RR messages are outstanding for the process that
executes ipc_deactivate, a message is transmitted on its behalf. No further datagram messages can be
sent to or from a process that executes this service.
Syntax
ipc_deactivate( ret_stat, port_index);
COR_STATUS *ret_stat;
int port_index;
Open Interface API Reference | 3 - Alarm Management API | 55
Input Arguments:
Output Arguments
Return Value
ipc_register
Initialize IPC functions for datagram and logical link communications and register with the IPC router
process. ipc_register must be called prior to using any other communications functions. Following
successful execution of this function, an application can start sending and receiving datagram messages
or establish logical link communications.
Syntax
int ipc_register (ret_stat, port_index, object_name, maxlnk,
bufsiz)
COR_STATUS *ret_stat;
int *port_index;
char *object_name;
int maxlnk;
int bufsiz;
Input Arguments
objec- The name under which the process registers. The object_name in combination with the node
t_name name defines the physical address of the process. All other processes address the process with
this name. Maximum length is 10 characters.
maxlnk The maximum number of logical links this process can request. Each datagram port and each
logical link connection counts as one link.
Open Interface API Reference | 3 - Alarm Management API | 56
bufsiz The maximum message size used by this process. ipc_dg_alloc may be used to determine this
size. The maximum is MAXMSGSIZ, which is defined in netcom.h.
Output Arguments
ret_s- Pointer to status structure. When the function is not successful, ret_stat.err_code contains
tat one of the following values:
Return Value
Either COR_SUCCESS, COR_WARNING, or COR_FAILURE. If the function returns anything other than
COR_SUCCESS, additional error information can be found in ret_stat.err_msg and ret_stat.err_code.
The application subroutines are used to communicate with the Alarm Manager and send and receive
alarm messages.
• amaru_init
• Initialize the interface with Alarm Manager
• amaru_add_gen
• Add alarm generation information to datagram buffer
• amaru_add_gen_stamp
• Add alarm generation information and timestamp to datagram buffer
• amaru_add_update
Open Interface API Reference | 3 - Alarm Management API | 57
amaru_init
This initialization routine should be called at process start-up. It gathers the information necessary
to communicate with the Alarm Manager in the current IPC network. This information is used by
amaru_send_msg in order to determine the physical address of the destination AMRP.
Syntax
int amaru_init (ret_stat);
COR_STATUS *ret_stat;
Input Arguments
None.
Output Arguments
Return Value
Either COR_SUCCESS, or COR_FAILURE. If the function returns anything other than COR_SUCCESS,
additional error information can be found in ret_stat.err_msg and ret_stat.err_code.
There are no error messages generated by amaru_init itself. If the low-level routine sc_open or sc_close
fails the error status is passed unchanged to the calling program. Typically, this happens if the system
configuration data is not accessible.
amaru_add_gen
Call this subroutine to add alarm generation information to the current IPC buffer. It is the responsibility of
the application program to allocate space for the message buffer. The routine may be called repeatedly to
load multiple alarm generation segments into the message buffer.
Syntax
int amaru_add_gen (bodyptr, bodylen, first_seg,
char *bodyptr;
int bodylen;
COR_BOOLEAN first_seg;
char alarm_id[LONG_NAME_LEN+1];
char fr_id[FR_ID_LEN+1];
char ref_id[AM_REF_ID_LEN+1];
AM_RESP_TYPE resp_type;
AM_RESP_KEY key;
AM_MSG_FIELD msg_field[];
int num_fields;
COR_STATUS *ret_stat;
Input arguments
bodyptr Pointer to the beginning of the message body of the IPC buffer.
first_ Boolean value specifying whether the current generation request should be the first request in
seg the message. TRUE implies first segment.
fr_id Identifier of the factory resource for which the alarm is being generated.
user_ Used for labeling logged alarms. Usually this is the service_id of the sending process. The
or_ AMAP sends the user_id of the connected terminal.
serv_id
ref_id Used to specify unique alarms when multiple alarm definitions are generated for the same
Factory Resources. Alarm uniqueness is defined by the combination of alarm_id, fr_id, and re
f_id.
Note:
The ref_id is not displayed directly on the Alarm Manager User Interface. The ref_id,
when used, can be duplicated in a message field for display.
resp_ Used to select the type of response desired from the AMRP. The application program has
type three choices:
AM_CAPTURED_RESP - AMRP responds once the message has been captured (sent to a
standby process or journalled).
AM_FULL_RESP - AMRP responds once the message has been fully processed. A status seg
ment is returned for each request in the original message.
AM_NO_RESP - No response from AMRP to indicate that an alarm message has been re
ceived.
Note:
Only the resp_type in the first generation message of each segment is used. There
fore, it is not possible to intermix the type of responses desired within a single IPC
message..
key The key is useful when the resp_type is set to AM_FULL_RESP. The key allows the application
program to match the status segments returned with the alarm generation/update requests.
The key is specified by the application program and is returned "as is" by the AMRP.
Open Interface API Reference | 3 - Alarm Management API | 60
msg_ Pointer to the beginning of an array containing variable parameter information for the partic
field ular alarm. Each element of the array contains a type specifier and the actual field value. The
structure AM_MSG_FIELD and the valid field types can be found in the include file inc_path/am_
defs.h (on page 105).
num_ The number of variable fields in the msg_field array. There is a maximum of AM_MAX_FIELDS.
fields Each element consists of a type specifier and the actual information.
reset_ Set to TRUE to indicate that on acknowledgment, the application will update the alarm mes
follows sage, clear the alarm, and retain the acknowledgment. Otherwise, set to FALSE.
Output Arguments
Return Value
Either COR_SUCCESS, or COR_FAILURE. If the function returns anything other than COR_SUCCESS,
additional error information can be found in ret_stat.err_msg and ret_stat.err_code.
amaru_add_gen does not directly generate error codes. It passes the status set by the message
formatting routines back to the calling program. The error codes are defined in the include file inc_path/
am_errors.h.
If the source is COR_MF_ERR and the code is MF_INSUF_SPACE, the alarm generation information is not
added as the message is full. The application program should call amaru_send_msg, reset first_seg to
TRUE, and then add the information to the now empty buffer.
amaru_add_gen_stamp
Call this subroutine to add alarm generation information to the current IPC buffer with an external alarm
timestamp.
Syntax
int amaru_add_gen_stamp (bodyptr, bodylen, first_seg,
ret_stat);
char *bodyptr;
int bodylen;
COR_BOOLEAN first_seg;
char alarm_id[LONG_NAME_LEN+1];
char fr_id[FR_ID_LEN+1];
char ref_id[AM_REF_ID_LEN+1];
AM_RESP_TYPE resp_type;
AM_RESP_KEY key;
AM_MSG_FIELD msg_field[];
int num_fields;
COR_STAMP stamp;
COR_STATUS *ret_stat;
Input Arguments
bodyptr Pointer to the beginning of the message body of the IPC buffer.
first_ Boolean value specifying whether the current generation request should be the first request in
seg the message. TRUE implies first segment.
fr_id Identifier of the factory resource for which the alarm is being generated.
user_ Used for labeling logged alarms. Usually this is the service_id of the sending process. The
or_ AMAP sends the user_id of the connected terminal.
serv_id
ref_id Used to specify unique alarms when multiple alarm definitions are generated for the same
Factory Resources. Alarm uniqueness is defined by the combination of alarm_id, fr_id, and re
f_id.
Open Interface API Reference | 3 - Alarm Management API | 62
Note:
The ref_id is not displayed directly on the Alarm Manager User Interface. The ref_id,
when used, can be duplicated in a message field for display.
resp_ Used to select the type of response desired from the AMRP. The application program has
type three choices:
AM_CAPTURED_RESP - AMRP responds once the message has been captured (sent to a
standby process or journalled).
AM_FULL_RESP - AMRP responds once the message has been fully processed. A status seg
ment is returned for each request in the original message.
AM_NO_RESP - No response from AMRP to indicate that an alarm message has been re
ceived.
Note:
Only the resp_type in the first generation message of each segment is used. There
fore, it is not possible to intermix the type of responses desired within a single IPC
message..
key The key is useful when the resp_type is set to AM_FULL_RESP. The key allows the application
program to match the status segments returned with the alarm generation/update requests.
The key is specified by the application program and is returned "as is" by the AMRP.
msg_ Pointer to the beginning of an array containing variable parameter information for the par
field ticular alarm. Each element of the array contains a type specifier and the actual field value.
The structure AM_MSG_FIELD and the valid field types can be found in include file inc_path/am_
defs.h (on page 105).
num_ The number of variable fields in the msg_field array. There is a maximum of AM_MAX_FIELDS.
fields Each element consists of a type specifier and the actual information.
reset_ Set to TRUE to indicate that on acknowledgment, the application will update the alarm mes
follows sage, clear the alarm, and retain the acknowledgment. Otherwise, set to FALSE.
stamp Specifies the time at which the alarm was generated. Until the alarm is cleared, its duration
will be difference between the current time-of-day and this value.
Open Interface API Reference | 3 - Alarm Management API | 63
Output Arguments
Return Value
Either COR_SUCCESS, or COR_FAILURE. If the function returns anything other than COR_SUCCESS,
additional error information can be found in ret_stat. Other than the timestamp parameter, this function
should in all ways conform to the behavior of amaru_add_gen().
amaru_add_update
Call this subroutine to add alarm update information to the current IPC buffer. It is the responsibility of
the application program to allocate space for the message buffer. The routine may be called repeatedly to
load multiple alarm update segments into the message buffer.
The purpose of the update function is to change the state of an outstanding alarm. The states can be
changed as follows:
Note:
The contents of the alarm message field of an alarm cannot be updated. If an application needs
to display a different alarm message when a particular alarm has been cleared, the application
program must generate a new alarm occurrence with the new message and then update the new
alarm occurrence to the desired state.
Syntax
int amaru_add_update (bodyptr, bodylen, first_seg,
key, ret_stat);
char *bodyptr;
int bodylen;
COR_BOOLEAN first_seg;
char alarm_id[LONG_NAME_LEN+1];
char fr_id[FR_ID_LEN+1];
char ref_id[AM_REF_ID_LEN+1];
AM_STATE_TYPE action;
int seq_num;
AM_RESP_TYPE resp_type;
AM_RESP_KEY key;
COR_STATUS *ret_stat;
Input Arguments
bodyptr Pointer to the beginning of the message body of the IPC buffer.
first_ Boolean value specifying whether the current generation request should be the first request in
seg the message. TRUE implies first segment.
fr_id Identifier of the factory resource for which the alarm is being generated.
user_ Used for labeling logged alarms. Usually this is the service_id of the sending process. The
or_ AMAP sends the user_id of the connected terminal.
serv_id
ref_id Used to specify unique alarms when multiple alarm definitions are generated for the same
Factory Resources. Alarm uniqueness is defined by the combination of alarm_id, fr_id, and re
f_id.
Note:
The ref_id is not displayed directly on the Alarm Manager User Interface. The ref_id,
when used, can be duplicated in a message field for display.
seq_ Only used by AMAP. Application programs should pass zero (0).
num
resp_ Used to select the type of response desired from the AMRP. The application program has
type three choices:
AM_CAPTURED_RESP - AMRP responds once the message has been captured (sent to a
standby process or journalled).
AM_FULL_RESP - AMRP responds once the message has been fully processed. A status seg
ment is returned for each request in the original message.
AM_NO_RESP - No response from AMRP to indicate that an alarm message has been re
ceived.
Note:
Only the resp_type in the first generation message of each segment is used. There
fore, it is not possible to intermix the type of responses desired within a single IPC
message.
key The key is useful when the resp_type is set to AM_FULL_RESP. The key allows the application
program to match the status segments returned with the alarm generation/update requests.
The key is specified by the application program and is returned "as is" by the AMRP.
Output Arguments
Return Value
Either COR_SUCCESS, or COR_FAILURE. If the function returns anything other than COR_SUCCESS,
additional error information can be found in ret_stat.err_msg and ret_stat.err_code.
amaru_add_update does not directly generate error codes. It passes the status set by the MF-routines
back to the calling program. The error codes are defined in the inc_path/mf_defs.h include file and are
shown in Chapter 7.
If the source is COR_MF_ERR and the code is MF_INSUF_SPACE, the alarm generation information is not
added as the message if full. The application program should call amaru_send_msg, reset first_seg to
TRUE, and then add the information to the now empty buffer.
amaru_add_update_ca
Call this subroutine to add alarm update information to the current IPC buffer with Change approval
Information.
Syntax
Int amaru_add_update_ca (bodyptr, bodylen, first_seg,
char *bodyptr;
int bodylen;
COR_BOOLEAN first_seg;
char alarm_id[LONG_NAME_LEN+1];
char fr_id[FR_ID_LEN+1];
char ref_id[AM_REF_ID_LEN+1];
AM_STATE_TYPE action;
int seq_num;
AM_RESP_TYPE resp_type;
AM_RESP_KEY key;
ChangeapprovalInfo *changeapproval_obj,
COR_STATUS *ret_stat;
Input Arguments
bodyptr Pointer to the beginning of the message body of the IPC buffer.
first_- Boolean value specifying whether the current generation request should be the first request in
seg the message. TRUE implies first segment.
fr_id Identifier of the factory resource for which the alarm is being generated.
Open Interface API Reference | 3 - Alarm Management API | 67
user_- Used for labeling logged alarms. Usually this is the service_id of the sending process. The
or_- AMAP sends the user_id of the connected terminal.
serv_id
ref_id Used to specify unique alarms when multiple alarm definitions are generated for the same
Factory Resources. Alarm uniqueness is defined by the combination of alarm_id, fr_id, and
ref_id.
Note: The ref_id is not displayed directly on the Alarm Manager User Interface. The ref_id,
when used, can be duplicated in a message field for display.
resp_- Used to select the type of response desired from the AMRP. The application program has
type three choices:
AM_CAPTURED_- Responds once the message has been captured (sent to a standby process
RESP - AMRP or journalled).
AM_FULL_RESP Responds once the message has been fully processed. A status segment is
- AMRP returned for each request in the original message.
AM_NO_RESP No response from AMRP to indicate that an alarm message has been re
ceived.
Note: Only the resp_type in the first generation message of each segment is used. Therefore,
it is not possible to intermix the type of responses desired within a single IPC message..
key The key is useful when the resp_type is set to AM_FULL_RESP. The key allows the application
program to match the status segments returned with the alarm generation/update requests.
The key is specified by the application program and is returned as is by the AMRP.
changeap- A pointer to the change approval information for the alarm update operation.
proval_-
obj
Output Arguments
Return Value:
Either COR_SUCCESS, or COR_FAILURE. If the function returns anything other than COR_SUCCESS, additional error
information can be found in ret_stat. Other than the changeapproval_obj parameter, this function should
in all ways conform to the behavior of amaru_add_update().
amaru_add_update_stamp
Call this subroutine to add alarm update information to the current IPC buffer with an external alarm
timestamp.
Syntax
int amaru_add_update_stamp (bodyptr, bodylen, first_seg,
char *bodyptr;
int bodylen;
COR_BOOLEAN first_seg;
char alarm_id[LONG_NAME_LEN+1];
char fr_id[FR_ID_LEN+1];
char ref_id[AM_REF_ID_LEN+1];
AM_STATE_TYPE action;
int seq_num;
AM_RESP_TYPE resp_type;
AM_RESP_KEY key;
COR_STAMP stamp;
COR_STATUS *ret_stat;
Input Arguments
bodyptr Pointer to the beginning of the message body of the IPC buffer.
first_ Boolean value specifying whether the current generation request should be the first request in
seg the message. TRUE implies first segment.
Open Interface API Reference | 3 - Alarm Management API | 69
fr_id Identifier of the factory resource for which the alarm is being generated.
user_ Used for labeling logged alarms. Usually this is the service_id of the sending process. The
or_ AMAP sends the user_id of the connected terminal.
serv_id
ref_id Used to specify unique alarms when multiple alarm definitions are generated for the same
Factory Resources. Alarm uniqueness is defined by the combination of alarm_id, fr_id, and re
f_id.
Note:
The ref_id is not displayed directly on the Alarm Manager User Interface. The ref_id,
when used, can be duplicated in a message field for display.
seq_ Only used by AMAP. Application programs should pass zero (0).
num
resp_ Used to select the type of response desired from the AMRP. The application program has
type three choices:
AM_CAPTURED_RESP - AMRP responds once the message has been captured (sent to a
standby process or journalled).
AM_FULL_RESP - AMRP responds once the message has been fully processed. A status seg
ment is returned for each request in the original message.
AM_NO_RESP - No response from AMRP to indicate that an alarm message has been re
ceived.
Note:
Only the resp_type in the first generation message of each segment is used. There
fore, it is not possible to intermix the type of responses desired within a single IPC
message..
key The key is useful when the resp_type is set to AM_FULL_RESP. The key allows the application
program to match the status segments returned with the alarm generation/update requests.
The key is specified by the application program and is returned "as is" by the AMRP.
Open Interface API Reference | 3 - Alarm Management API | 70
stamp Specifies the update time for the alarm. If this update causes the alarm to be reset, this time
stamp will be used to compute the alarm duration.
Output Arguments
Return Value:
Either COR_SUCCESS, or COR_FAILURE. If the function returns anything other than COR_SUCCESS,
additional error information can be found in ret_stat. Other than the timestamp parameter, this function
should in all ways conform to the behavior of amaru_add_update().
amaru_add_update_stamp_ca
Call this subroutine to add alarm update information to the current IPC buffer with external alarm
timestamp and change approval Information.
Syntax
Int amaru_add_update_ca (bodyptr, bodylen, first_seg,
char *bodyptr;
int bodylen;
COR_BOOLEAN first_seg;
char alarm_id[LONG_NAME_LEN+1];
char fr_id[FR_ID_LEN+1];
char ref_id[AM_REF_ID_LEN+1];
AM_STATE_TYPE action;
int seq_num;
AM_RESP_TYPE resp_type;
AM_RESP_KEY key;
COR_STAMP stamp;
ChangeapprovalInfo *changeapproval_obj,
COR_STATUS *ret_stat;
Open Interface API Reference | 3 - Alarm Management API | 71
Input Arguments
bodyptr Pointer to the beginning of the message body of the IPC buffer.
first_- Boolean value specifying whether the current generation request should be the first request in
seg the message. TRUE implies first segment.
fr_id Identifier of the factory resource for which the alarm is being generated.
user_- Used for labeling logged alarms. Usually this is the service_id of the sending process. The
or_- AMAP sends the user_id of the connected terminal.
serv_id
ref_id Used to specify unique alarms when multiple alarm definitions are generated for the same
Factory Resources. Alarm uniqueness is defined by the combination of alarm_id, fr_id, and
ref_id.
Note: The ref_id is not displayed directly on the Alarm Manager User Interface. The ref_id,
when used, can be duplicated in a message field for display.
resp_- Used to select the type of response desired from the AMRP. The application program has
type three choices:
AM_CAPTURED_- Responds once the message has been captured (sent to a standby process
RESP - AMRP or journalled).
AM_FULL_RESP Responds once the message has been fully processed. A status segment is
- AMRP returned for each request in the original message.
AM_NO_RESP No response from AMRP to indicate that an alarm message has been re
ceived.
Note: Only the resp_type in the first generation message of each segment is used. Therefore,
it is not possible to inter-mix the type of responses desired within a single IPC message..
key The key is useful when the resp_type is set to AM_FULL_RESP. The key allows the application
program to match the status segments returned with the alarm generation/update requests.
The key is specified by the application program and is returned "as is" by the AMRP.
Open Interface API Reference | 3 - Alarm Management API | 72
stamp Specifies the update time for the alarm. If this update causes the alarm to be reset, this time
stamp will be used to compute the alarm duration.
changeap- A pointer to the change approval information for the alarm update operation.
proval_-
obj
Output Arguments
Return Value:
Either COR_SUCCESS, or COR_FAILURE. If the function returns anything other than COR_SUCCESS, additional error
information can be found in ret_stat.
Other than the changeapproval_obj parameter, this function should in all ways conform to the behavior of
amaru_add_update().
amaru_send_msg
Call this subroutine to send the IPC-datagram message containing alarm generation/updated requests
filled in by the amaru_add_gen or the amaru_add_update routine.
amaru_send_msg returns the status of the operation in the status message. Therefore, to determine if an
amaru_add_gen or amaru_add_update call is successful, the status message must be checked.
Syntax
int amaru_send_msg (port_id, wrt_buf, read_buf,
int port_id;
char *wrt_buf;
char *read_buf;
int read_buf_len;
char *alarm_mgr_id;
COR_STATUS *ret_stat;
Open Interface API Reference | 3 - Alarm Management API | 73
Input Arguments
alar ID of the AMRP to receive the message. The application can determine the alarm_mgr_id from
m_ the configuration record of the factory resource the alarm is associated with (in fr.dat). Each fac
m tory resource has an associated AMRP.
gr_id
Output Arguments
Return Value
Either COR_SUCCESS, or COR_FAILURE. If the function returns anything other than COR_SUCCESS,
additional error information can be found in ret_stat.err_msg and ret_stat.err_code.
All error codes returned by internally used procedures are passed unchanged to the calling program.
If the AMRP with the specified alarm_mgr_id cannot be found, a status of COR_FAILURE is set and the
amaru_UNKNOWN_ALARM_MGR error code is returned. This error status is defined in amaru_err.h which
is shown in Chapter 8.
amaru_alloc_buffer
Call this subroutine to create an IPC datagram buffer for alarm messages. Two calls should be made, one
for a write buffer, and one for a read buffer.
Open Interface API Reference | 3 - Alarm Management API | 74
Syntax
amaru_alloc_buffer ( alarm_write_buffer, alarm_write_len,
alarm_write_body);
IPCDG **alarm_write_buffer;
int *alarm_write_len;
char **alarm_write_body;
alarm_read_body);
IPCDG **alarm_read_buffer;
int *alarm_read_len;
char **alarm_read_body;
Input Arguments
None.
Output Arguments
Return Value
None.
amaru_num_messages
Call this subroutine to monitor the number of response messages in the allocated datagram read buffer.
Open Interface API Reference | 3 - Alarm Management API | 75
Syntax
amaru_num_messages ( alarm_read_body, ret_stat);
char *alarm_read_body;
COR_STATUS *ret_stat;
Input Arguments
alarm_ Pointer to address of datagram body in allocated buffer. (Header information contains
read_body number of alarm messages in body.)
Output Arguments
Return Value
None.
amaru_get_resp
This routine retrieves a designated response from the datagram read buffer. Given the value i, where 0<i<
the total number of messages in the buffer, the routine retrieves the status pertaining to the Ith message.
Syntax
amaru_get_resp ( alarm_read_body, i, ret_stat);
char *alarm_read_body;
int i;
COR_STATUS *ret_stat;
Input Arguments
i The number of the message to seek (0 < i < the total number of messages in the
buffer)
Open Interface API Reference | 3 - Alarm Management API | 76
Output Arguments
Return Value
None.
amaru_free_buffer
This routine is called by an application program when the number of AMARU datagram messages no
longer needs monitoring. A call must be made for each buffer allocated.
Syntax
amaru_free_buffer (alarm_write_buffer);
IPCDG *alarm_write_buffer;
amaru_free_buffer (alarm_read_buffer);
IPCDG *alarm_read_buffer;
Input Arguments
Output Arguments
None.
Return Value
None.
amaru_terminate
Call this subroutine in your application program when communication with Alarm Management Resident
Processes is no longer desired.
Open Interface API Reference | 3 - Alarm Management API | 77
Syntax
amaru_terminate()
Input Arguments
None.
Output Arguments
None.
Return Value
None.
The following sections describe the configuration files that are accessed directly by Alarm Management.
Open Interface API Reference | 3 - Alarm Management API | 78
The ALARM_DEF records designated in this configuration file define specific alarms. Each alarm is
uniquely identified by its alarm_id.
alarm_def.idx
• ack_tout
• alarm_id
• alarm_msg
• alarm_type_id
• class_id
• clr_tout
• del_opt
• description
• help_fname
• log_file
• log_opt
• manual_clear_allowed
• max_stacked
• rep_tout
ack_tout
Open Interface API Reference | 3 - Alarm Management API | 79
Defini Acknowledge Time-out option. The time in minutes that should elapse before the alarm is au
tion tomatically acknowledged. A value of zero indicates the alarm should not be automatically ac
knowledged, and a value less than zero indicates the alarm should immediately be automatical
ly acknowledged.
alarm_id
alarm_msg
Definition The alarm message format. The message contains the fixed text for the alarm and po
sition holders for the run-time parameters.
alarm_type_id
Definition The parameters in the alarm message. A group of alarm fields in an alarm message is
specified by defining alarm types.
class_id
clr_tout
Defini Clear Time-out option. The time in minutes that should elapse before the alarm condition is au
tion tomatically reset. A value of zero indicates the alarm should not be automatically reset, and a
value less than zero indicates the alarm should immediately be reset.
del_opt
Definition Code indicating when the alarm occurrence should be deleted from the system.
Valid entries are:
A Acknowledge only
R Reset only
Description
help_fname
Definition The name of a text file containing user information on what to do when the alarm
occurs.
Open Interface API Reference | 3 - Alarm Management API | 81
log_file
0 ALARM_LOG
1 EVENT_LOG.
log_opt
Maxi 4 characters
mum
Field
Length
Defini Code indicating whether or not, and if so, when, the alarm should be logged. The alarm can be
tion logged when Generated, Acknowledged, Reset, or Deleted. To specify any combination of the
above, this field contains any combination of the letters A,R,D,G.
manual_clear_allowed
Maximum 1 character
Field Length
Definition Code indicating whether or not an operator is allowed to reset this alarm from the Alarm
Management User Interface display. Valid entries are:
max_stacked
Definition The maximum number of alarm occurrences tracked for stacked alarms. A value of zero in
dicates the alarm should not be stacked. The maximum number of stacked alarms is 19.
Open Interface API Reference | 3 - Alarm Management API | 82
rep_tout
Definition Time in minutes before alarm is repeated. A value of zero means that the alarm will
not be repeated.
A|N|G|-1|0|0||1||0
A|N|G|-0|0|0||1||0
A|N|G|-1|0|0||1||0
AR|N||0|0|0||0||0
Open Interface API Reference | 3 - Alarm Management API | 83
A|N|G|-1|0|0||1||0
An ALARM_CLASS record in this configuration file defines an alarm class. The class_id uniquely identifies
the alarm class. Alarm classes are user-defined groupings for alarms. They are useful to view alarms
sorted by a user-defined criteria.
Alarm_class.idx
Entries in the alarm_class.dat file are created via interactive configuration transactions.
• class_ack_bg
• class_ack_fg
• class_alarm_bg
• class_alarm_fg
• class_id
• class_normal_bg
• class_normal_fg
• class_order
• class_title
class_ack_bg
Open Interface API Reference | 3 - Alarm Management API | 84
class_ack_fg
class_alarm_bg
class_alarm_fg
class_id
class_normal_bg
class_normal_fg
class_order
class_title
INFO|Information Alarm|5|7|3|7|0|7|0
WARN|Warning Alarm|2|0|15|0|2|7|0
An ALARM_TYPE record in this configuration file defines a type of alarm message. The alarm_type_id
uniquely identifies the alarm message type. Alarm types are useful to define and refer to common types
of alarm messages.
Alarm_type.idx
• alarm_type_id
• description
alarm_type_id
Description
Open Interface API Reference | 3 - Alarm Management API | 87
$AT_21|
An ALARM_FIELD record in this configuration file defines a field for a specific type of alarm message.)
alarm_field.idx
Open Interface API Reference | 3 - Alarm Management API | 88
• alarm_field_id
• alarm_type_id
• description
• field_format
• field_len
• field_num
• field_type
• field_use
alarm_field_id
Maximum 16 characters
Field Length
Definition Short, mnemonic description of field's purpose displayed as the field identifier during the
configuration transaction for alarm definitions of this alarm type.
alarm_type_id
Description
field_format
Maximum 10 characters
Field Length
Definition C-format string for the field. The parameter appears in the alarm message according to
the format string specified. Legal values are:
%d decimal
%o unsigned octal
%x unsigned hexadecimal
%u unsigned decimal
%c single character
%s string
%e scientific notation
%f floating point
Note:
All point values in alarm messages are passed as
strings.
field_len
Definition Number of bytes in the variable parameter. Used for character string
fields.
field_num
field_type
0 Character
1 String
2 Integer
3 Integer * 1
4 Integer * 2
5 Integer * 4
6 Boolean
7 Unsigned integer * 1
8 Unsigned integer * 2
9 Unsigned integer * 4
10 Floating point
field_use
Defin An application-specific field used to identify application information on the content of the field.
ition For instance, it is used in Point Management alarms to specify the Point Id that should be includ
ed in the alarm message. If set to '4,' Point Management inserts the configured engineering units
label into the alarm message.
* 2 field_type C-0,S-1,I-2,I1-3,4,5,B-6,U1-7,8,9
$AM_STATUS|0|5|10|%ld|0||GEN count
$AM_STATUS|1|5|10|%ld|0||UPD count
$AM_STATUS|2|5|10|%ld|0||LOG time
$AT_21|0|1|32|%s|2||
$AT_21|1|1|16|%s|1||
$DYN_CFG|1|1|16|%s|1|action|DYNCFG ACTION
Records in this file whose alarm_type_id start with "$AL_" must not be modified. These are standard
alarm types generated by CIMPLICITY software.
The record in this configuration file defines information global to a specific AMRP. The tuning parameters
should rarely be modified. They exist to make Alarm Management more responsive to certain types of
requests. The AMRP contains an effective priority scheme for determining what actions to perform next
when a number of actions are outstanding. Each time an action is passed over for execution its priority is
raised insuring that eventually the action is performed.
alarm_mgr.idx
Note:
Fields segs_to_proc through process_jrnl_prio define tuning parameters used to control AMRP
processing. These parameters are reserved for GE Digital use. If you feel that they need adjusting
on your system, please call CIMPLICITY Technical Support before making any changes.
Fields dg_input_prio through process_jrnl_prio define how AMRP activities are scheduled. Each
type of activity is assigned an initial effective priority. Each time an item is not processed, its
priority is increased by one. The priority range is from 1 to 20.
• alarm_mgr_id
• alloc_segs_to_proc
• auto_pnum
• autoupd_tout
• count_
• count_type
• date_mask
• dg_input_prio
• dyn_am_cont_mask
• dyn_am_video_mask
• gen_auto_prio
• jrnl_max
• jrnl_max_act_limit
• jrnl_min
• jrnl_status
Open Interface API Reference | 3 - Alarm Management API | 93
• jrnl_timer_period
• master_input_prio
• process_allocq_prio
• process_auto_prio
• process_jrnl_prio
• process_updq_
• segs_to_proc
• service_id
• upd_terms_prio
• ur_input_prio
alarm_mgr_id
alloc_segs_to_proc
Definition Tuning parameter: the number of AMAP request segments to process each time
slot.
auto_pnum
autoupd_tout
Field
Length
Defini Time out for processing Auto Alarms. Alarms which should be automatically Acknowledged
tion or Reset are checked after each autoupd_tout_minutes. If their timers are expired, the alarms
statuses are updated accordingly.
count_
Maximum byte
Field Length
Definition Code identifying the display attribute used for the alarm count value when displayed by
the CIMPLICITY Alarm Viewer.mask The count_mask values are:
1 Blink
2 Reverse
video
4 High intensity
8 Underline
16 Bell
To combine attributes, add their values. For example, to indicate a bell, revise video, blinking count, the
count mask value would be 19 (16+2+1). A zero can also be used to indicate the default reverse video
attribute
count_type
Defini This parameter is used to specify the meaning of the alarm count on the Context Manager
tion screens. The count can represent all alarms, all unacknowledged alarms, or all unacknowl
edged alarms still in an alarm state. Valid values are:
Open Interface API Reference | 3 - Alarm Management API | 95
0 All alarms
date_mask
Maximum byte
Field Length
Definition Code identifying the display attribute for the alarm date when displayed by the CIM
PLICITY Alarm Viewer. The date_mask values are:
1 Blink
2 Reverse
video
4 High intensity
8 Underline
16 Bell
To combine attributes, add their values. For example, to indicate a bell, revise video, blinking count, the
count mask value would be 19 (16+2+1). A zero can also be used to indicate the default reverse video
attribute
dg_input_prio
Defini Tuning parameter: the starting effective priority for standard datagram input. This is mostly for
tion messages to generate and update alarms. This value should be staticly high to insure the IPC
queues are flushed often. This helps avoid lost messages due to congestion drops.
Open Interface API Reference | 3 - Alarm Management API | 96
dyn_am_cont_mask
De Parameter defining what optional reference items appear on the screen during dynamic display
fini mode in the Alarm Management user interface. The alarm record on this screen always contains
tion the number of the alarm, time the alarm was logged, acknowledgment status, and alarm mes
sage. The optional information can be configured via this parameter according to the following
values:
To include more than one optional item, add their values. For example, to include both Alarm and Re
source IDs, enter the value of 6 (4+2). To specify no optional items, set this parameter to 0.
dyn_am_video_mask
Definition Parameter to set the video display for alarms in alarm state when the Alarm Manage
ment user interface is in dynamic display mode. Valid values are:
If any other number is specified, alarms in alarm state are displayed in normal video at
tribute.
gen_auto_prio
Definition Tuning parameter: the starting effective priority for going through the list of alarms to be
auto acknowledged or reset once the auto timer expires.
jrnl_max
Definition The maximum threshold for Journal Rollover (in blocks). If the journal file reaches this size
before the rollover takes place, the rollover is done regardless of the current Alarm Manage
ment work load.
jrnl_max_act_limit
Definition The maximum activity limit for doing the journal rollover.
Note:
This strategy is only used when the block size of the journal file is between the
minimum and maximum threshold.
jrnl_min
Field
Length
Defini The minimum threshold for Journal Rollover (in blocks). A rollover is the action of taking the
tion current alarm database, writing it to a dump file, and then clearing the journal file. When the
minimum threshold is reached, the rollover takes place as soon as a lull in alarm activity is de
tected.
jrnl_status
1 journalling is present
jrnl_timer_period
Defin The number of minutes to wait before doing a rollover. This parameter is used in conjunction
ition with the jrnl_max_act_limit which specifies an activity limit on alarms. If the activity limit is not
reached during the timer period, the journal rollover takes place. This is how the "lull in alarm ac
tivity" is specified.
master_input_prio
Definition Tuning parameter: the starting effective priority for processing input from an active
AMRP to a standby AMRP.
process_allocq_prio
Open Interface API Reference | 3 - Alarm Management API | 99
Definition Tuning parameter: the starting effective priority for processing outstanding requests by
AMAPs. A staticly high number favors users at AMAPs.
process_auto_prio
Definition Tuning parameter: the starting effective priority for processing auto alarms once
they have expired.
process_jrnl_prio
Definition Tuning parameter: the starting effective priority for processing the request to per
form a journal rollover.
process_updq_
Definition Tuning parameter: the starting effective priority for processing outstanding alarm update
and generation requests which have been added to the Alarm Management input queue.
segs_to_proc
Defi Tuning parameter: the number of Alarm Generation and Update Segments to Process each time
nition slot. This is really a measure of how long the AMRP will be performing this task. A small number
causes the AMRP to check its queues often. A larger number causes the AMRP to process more
messages before checking its queues again.
service_id
Maxi 32 characters
mum
Field
Length
Defini The service identifier of the AMRP as configured in service.dat. The AMRP determines its
tion service_id from IPC XLATE and then uses this information to key into the ALARM_MGR file to
read its global configuration data.
upd_terms_prio
Defin Tuning parameter: the starting effective priority for updating user terminals with new alarm
ition count and date information. A low value gives priority to alarms being updated and generated
during a burst of alarms. A high value gives priority to updating user terminals as alarms are
generated and updated.
ur_input_prio
Definition Tuning parameter: the starting effective priority for input regarding user population
changes from User Registration.
AMRP|AMRP|0|50|100|1|20|5|25|6|0|2|5|4|8|4|1|2|1|1|2|3|10|7|7
The records in this configuration file define the types of users who should receive information about
specific alarms.
alarm_routing.idx
Entries in the alarm_routing.dat file are created via interactive configuration transactions.
• alarm_id
• role_id
alarm_id
role_id
$ADDRESS_CONFLICT|SYSMGR
$ADDRESS_CONFLICT|USER
$ALARM_RAWLIM|SYSMGR
$ALARM_RAWLIM|USER
$AM_STATUS|SYSMGR
$DEVICE|SYSMGR
$DEVICE|USER
$DEVICE_DOWN|SYSMGR
$DEVICE_DOWN|USER
$DEVICE_FAILOVER|SYSMGR
$DEVICE_FAILOVER|USER
$RTR_LINK_DOWN|OPER
$RTR_LINK_DOWN|SYSMGR
$RTR_LINK_DOWN|USER
$UNKNOWN_FAULT|SYSMGR
$UNKNOWN_FAULT|USER
The record in this configuration files specifies an application process interested in alarms associated with
specific factory resources.
alarm_intproc.idx
• class_id
• fr_id
• log_file
• service_id
class_id
Maxi 5 characters
mum Field
Length
Definition The name of a configured alarm class. If specified, the alarms sent to the named process is
limited to only those having this class. If this field is blank, alarms of any class are sent.
fr_id
log_file
Maximum byte
Field Length
Definition Code indicating which alarms are sent to an interested process based on the type of
logging configured for the alarm: Valid values are:
service_id
Maximum 32 characters
Field
Length
Definition The service identifier as configured in service.dat of the process interested in the alarms.
The service identifier is used in a call to ipc_xlate to get the physical address of the interest
ed process.
DEVICE_1|MAINT_MGMT|HIGH|0
DEVICE_@|MAINT_MGMT|LOW|0
• am_defs.h
• amaru_proto.h
am_defs.h
The following is a partial listing of this file showing you important definitions you need to know:
#ifndef _AM_DEFS_H
#define _AM_DEFS_H
#include <inc_path/ddl.h>
#include <inc_path/rtr_bcst.h>
Open Interface API Reference | 3 - Alarm Management API | 106
#include <inc_path/counter.h>
#include <inc_path/ptm_defs.h>
#include <inc_path/am_defs_constants.h>
#include <malloc.h>
TCHAR* amrp_get_long_ref_id(const TCHAR* alarm_id, const TCHAR* ref_id, TCHAR* long_name, int long_name_len);
sizeof(TCHAR)), MAX_ALM_ID_LEN+1)
#ifndef ADHOC_DEFS_H
#include <inc_path/adhoc_defs.h>
#endif
/***************************************/
/***************************************/
/******************************************************************/
/* Alarm Status */
/******************************************************************/
/******************************************************************/
#define AM_FULL_RESP 0
#define AM_CAPTURED_RESP 1
#define AM_NO_RESP 2
/***********************************************************************/
/***********************************************************************/
Open Interface API Reference | 3 - Alarm Management API | 107
/*******************************************************************/
/* Alarm States */
/* */
/* updates. */
/* AM_UPDATE is not a state but used to indicate that the alarm might have updated values */
/***********************************************************************/
#define AM_GENERATED 0
#define AM_ACKNOWLEDGED 1
#define AM_CLEARED 2
#define AM_DELETED 3
#define AM_NONEXISTENT 4
#define AM_COMMENT_MSG 5
#define AM_NOSTATE 6
#define AM_REPEATED 7
#define AM_COMMENT_DEL 8
#define AM_UPDATE_ALARM 9
#define AM_SHELVED_ONESHOT 10
#define AM_SHELVED_TIMEOUT 11
#define AM_UNSHELVED 12
#define AM_CONFIRMED 13
#define AM_UNCONFIRMED 14
#define AM_BLOCKED_FLTR 15
#define AM_UNBLOCKED_FLTR 16
#define AM_SHELVED_ALL 17
/*****************************************************************/
/* can remain */
/*****************************************************************/
Open Interface API Reference | 3 - Alarm Management API | 108
#define AM_NUM_PERMANENT_STATES 9 /* gen, ack, clear, shelved, unshelved, confirmed, unconfirmed, blocked, unblocked
*/
#define AM_GENERATED_BIT 0
#define AM_ACKNOWLEDGED_BIT 1
#define AM_CLEARED_BIT 2
#define AM_UNSHELVED_BIT 3
#define AM_CONFIRMED_BIT 4
#define AM_UNCONFIRMED_BIT 5
#define AM_BLOCKED_FLTR_BIT 6
#define AM_UNBLOCKED_FLTR_BIT 7
#define AM_SHELVED_ALL_BIT 8
#define AM_GENERATED_ARRAY_INDEX 0
#define AM_UNSHELVED_ARRAY_INDEX 3
#define AM_CONFIRMED_ARRAY_INDEX 4
Open Interface API Reference | 3 - Alarm Management API | 109
#define AM_UNCONFIRMED_ARRAY_INDEX 5
#define AM_BLOCKED_FLTR_ARRAY_INDEX 6
#define AM_UNBLOCKED_FLTR_ARRAY_INDEX 7
#define AM_SHELVED_ALL_ARRAY_INDEX 8
/**********************/
/**********************/
#define AM_TIME_FILTER 0
#define AM_STATE_FILTER 1
#define AM_FR_FILTER 2
#define AM_CLASS_FILTER 3
#define AM_FLD_FILTER 4 // this also includes FR and CLASS filters in new setups
AM_ALARM
AM_BLOCKED
AM_NO_ALARM
*/
#define AM_ALARM 0
#define AM_BLOCKED 1
#define AM_NO_ALARM 2
/******************************************/
/******************************************/
/******************************************/
/******************************************/
} AM_TIME_STATE_FILTER;
AM_FIELD_ID fieldIndex;
AM_FIELD_FILTER_TYPE matchType;
TCHAR *filterString;
void *regExp;
TCHAR *upperCaseFilterString;
} AM_SETUP_FIELD_FILTER;
{
Open Interface API Reference | 3 - Alarm Management API | 111
AM_FIELD_ID fieldIndex;
AM_FIELD_FILTER_TYPE matchType;
TCHAR filterString[1];
} AM_FIELD_FILTER;
1) * sizeof(TCHAR))
COR_STAMP start_time;
TCHAR class_id[CLASS_ID_LEN+1];
AM_STATE_TYPE alarm_state;
TCHAR fr_id[FR_ID_LEN+1];
} AM_FILTER;
AM_FILTER_TYPE type;
AM_FILTER filter;
} AM_FILTER_PARM;
COR_STAMP gentime;
AM_STATE_TYPE alarm_state;
TCHAR alarm_msg[ALARM_MSG_LEN+1];
COR_I1 alarmLevel;
COR_I2 severity;
} AM_STACKED_INFO;
COR_STAMP gentime;
AM_STATE_TYPE alarm_state;
TCHAR alarm_msg[EXPANDED_ALARM_MSG_LEN+1];
Open Interface API Reference | 3 - Alarm Management API | 112
COR_I1 alarmLevel;
COR_I2 severity;
COR_STAMP clrtime;
} AM_STACKED_INFO_EX;
COR_STAMP gentime;
AM_STATE_TYPE alarm_state;
TCHAR alarm_msg[ALARM_MSG_LEN+1];
COR_I1 alarmLevel;
COR_I2 severity;
COR_STAMP clrtime;
} AM_STACKED_INFO_EX_V1;
COR_STAMP gentime;
AM_STATE_TYPE alarm_state;
COR_I2 severity;
COR_U1 alarmLevel;
} AM_STACKED_INFO2 ;
struct amUnicodeStringsHeader
AM_UNICODESIZE size;
AM_UNICODENUMBER number;
// AM_LOCALEID langid;
// WCHAR language[];
// BYTE unicodeMsg[length]
};
Open Interface API Reference | 3 - Alarm Management API | 113
/*********************************************************************/
/*********************************************************************/
#define AM_MAX_STACKED 19
/*************************************/
/*************************************/
#define old_AM_COMMENT_LEN 72
COR_STAMP gentime;
TCHAR alarm_comment[old_AM_COMMENT_LEN+1];
} old_AM_COMMENT_INFO;
#define AM_COMMENT2_LINE_LEN 72
COR_STAMP gentime;
TCHAR alarm_comment[AM_COMMENT2_LEN+1];
} AM_COMMENT2_INFO;
/*********************************************************************/
/*********************************************************************/
#define AM_MAX_ALARM_COMMENTS 20
/************************************/
/************************************/
#define AM_MAX_STR 73
Open Interface API Reference | 3 - Alarm Management API | 114
/********************************************/
/********************************************/
/*******************************************************************/
/* this user */
/**********************************/
/**********************************/
/***************************/
/***************************/
/*********************/
/*********************/
#define AMRP_ACTIVE 0
Open Interface API Reference | 3 - Alarm Management API | 115
#define AMRP_STANDBY 1
/***************************/
/***************************/
#define AM_CHAR 0
#define AM_STR 1
#define AM_INT 2
#define AM_COR_I1 3
#define AM_COR_I2 4
#define AM_COR_I4 5
#define AM_COR_BOOLEAN 6
#define AM_COR_U1 7
#define AM_COR_U2 8
#define AM_COR_U4 9
#define AM_FLOAT 10
#define AM_SEVERITY 11 // this is a special field that holds the alarm severity level
#define AM_LEVEL 12 // this is a special field that holds the alarm state(Alarm - hi, lo: Warning - hi, lo)
#define AM_OPC_CATEGORY 13
#define AM_OPC_CONDITION 14
#define AM_OPC_SUBCONDITION 15
#define AM_STR_CONCAT 16
#define AM_POINT_VALUE 17
#define AM_STR_TRANSLATE 18
#define AM_USER_BITS 20
#define AM_POINT_VALUE1 21
#define AM_POINT_VALUE2 22
#define AM_POINT_VALUE3 23
#define AM_POINT_VALUE4 24
#define AM_POINT_VALUE5 25
#define AM_POINT_VALUE6 26
#define AM_POINT_VALUE7 27
#define AM_POINT_VALUE8 28
#define AM_POINT_VALUE9 29
#define AM_POINT_ID1 31
#define AM_POINT_ID2 32
Open Interface API Reference | 3 - Alarm Management API | 116
#define AM_POINT_ID3 33
#define AM_POINT_ID4 34
#define AM_POINT_ID5 35
#define AM_POINT_ID6 36
#define AM_POINT_ID7 37
#define AM_POINT_ID8 38
#define AM_POINT_ID9 39
#define AM_COR_U8 40
#define AM_COR_I8 41
#define AM_STR_SHORT 42
#define AM_OPC_TYPE_CONDITION 1
Open Interface API Reference | 3 - Alarm Management API | 117
#define AM_OPC_TYPE_SIMPLE 2
#define AM_OPC_TYPE_TRAKING 3
#define AM_STATE_LEN 3
#define AM_TIME_LEN 22
/************************************************************/
/************************************************************/
COR_I4 cori4_val;
COR_I2 cori2_val;
COR_I1 cori1_val;
COR_I8 cori8_val;
COR_U4 coru4_val;
COR_U2 coru2_val;
COR_U1 coru1_val;
COR_U8 coru8_val;
COR_BOOLEAN corbool_val;
int ival;
float fval;
__int64 val64;
TCHAR chval;
TCHAR str[AM_MAX_STR+1];
* in a hybrid environment. */
COR_I1 _pad[DO_ALIGN(SIZEOF_AM_FIELD,8)];
} AM_FIELD;
AM_FIELD_TYPE ftype;
AM_FIELD field;
Open Interface API Reference | 3 - Alarm Management API | 118
} AM_MSG_FIELD;
int fld_sz ;
void *pfld_data ;
} AM_FIELD_PARMS ;
TCHAR performuserid[USER_ID_LEN + 1 ];
TCHAR performpassword[PASSWORD_LEN+1];
TCHAR verifypassword[PASSWORD_LEN+1];
} ALARM_CA_ALARM_OPER_REQ;
/*************************************/
/*************************************/
#define AM_NULL_REF_ID -1
#define AM_NULL_ID -1
/***********************************/
/***********************************/
#define AM_LOG_ALARM_FILE 0
#define AM_LOG_ALTERNATE_FILE 1
#define AM_LOG_BOTH_FILES 2
* 0123456789ABCDEF
*/
#define AM_HELPTEXT_LEN 72
#define AM_HELPTEXT_NUM_LINES 59
/*********************************************************************/
typedef struct
int seg_num ;
AM_STATE_TYPE action ;
COR_I4 seq_num ;
TCHAR *alarm_id;
TCHAR *fr_id;
TCHAR *ref_id;
TCHAR *user_or_serv_id;
COR_STAMP upd_time ;
COR_I4 version ;
char *conc_alarm_id;
TCHAR *perform_user_id;
TCHAR *perform_user_password;
TCHAR *perform_user_comments;
TCHAR *verify_user_id;
TCHAR *verify_user_password;
TCHAR *verify_user_comments;
Open Interface API Reference | 3 - Alarm Management API | 120
} AMU_UPDATE_INFO ;
#define AM_VERS_0 0
#define AM_VERS_1 1
#define AM_VERS_2 2
#define AM_VERS_8_1 15 // some alarm parameters split to provide individual parameter for each alarm level
#define AM_VERS_OFFSET 1000 // AM version 6_0 sends back the client version in AM_LIST_EX2
// so if the version is > AM_VERS_OFFSET subtract the offset and you get the correct version
/* If you add a new version, bump the current version, as all code
*/
// Prototypes
void am_alloc_init(void);
comments_wanted, int version, AM_LOCALEID langId, WCHAR *language, COR_BOOLEAN allLanguages, COR_U2 alarmRequestFlags,
*ret_stat);
ipc_version);
void am_allocq_process(void);
void am_auto_init(void);
void am_auto_start_timer(void);
void am_auto(void);
void am_auto_gen_explist(void);
void am_auto_process_explist(void);
void am_auto_slave_init(void);
void am_auto_slave_flush(void);
long * am_create_alarm_info();
void am_cmd_init(void);
int *ipc_version);
void am_comm_init(void);
void am_comm_term(void);
void am_comment_alarm(const TCHAR *alarm_id,const TCHAR *fr_id,const TCHAR *ref_id,const TCHAR *user_or_serv_id,int
void am_config_terminate(void);
void am_config_init(void);
void am_config_type_info(void);
void am_config_class(void);
void am_config_role(void);
void am_config_fr_info(void);
void am_config_init_alarm_info(void);
void am_config_global_data(void);
void am_config_init_ref_info(void);
void am_config_ptm_ack(void);
int am_config_user_setups(void);
RECORD_PTR alarm_occur_ptr,
RECORD_PTR alarm_info_ptr,
AM_STATE_TYPE prev_state,
AM_STATE_TYPE action,
BOOL sendDeleted);
void am_dd_flush(void);
void am_debug_on(void);
void am_debug_off(void);
void am_driver_reset(void);
void am_driver_inc_gen(void);
void am_driver_inc_upd(void);
void am_driver_auto(void);
first_filter_msg, const unsigned char* field_filters, int num_filters, int total_filter_bytes, struct cor_status
*ret_stat);
//fld_fmt identifies:
void am_gen_alarm(int fld_fmt, const TCHAR *alarm_id,const TCHAR *fr_id,const TCHAR *ref_id,const TCHAR
*user_or_serv_id,int seq_num,
seq_num,
*ref_id,
*ref_id,
void am_init(void);
void am_jrnl_init(void);
void am_jrnl_check_rollover(void);
void am_jrnl_terminate(void);
const TCHAR *fr_id,const TCHAR *ref_id,const TCHAR *log_id, void /*struct am_msg_field*/ *alarm_fields,
TCHAR *user_or_serv_id,
TCHAR *location);
void am_log_init(void);
void am_log_flush(void);
void am_log_terminate(void);
void am_log_load_data_field(void);
void am_master_init(void);
void am_occur_find(const TCHAR *alarm_id,const TCHAR *fr_id,const TCHAR *ref_id,const TCHAR *user_or_serv_id,long
cor_status *ret_stat);
*service_ptr);
void refresh_alarm_info_to_ptm();
void am_ptm_ack_info_flush(void);
ref_id[AM_REF_ID_LEN+1],COR_I4 seq_num);
void am_purge_init(void);
void am_report_error_init(void);
void am_report_error_wparam(const TCHAR proc_name[], COR_STATUS *ret_stat,int severity,const TCHAR param[],const TCHAR
param2[]);
*ret_stat);
void am_setup_invalidate_list(void);
int am_setup_save_ex(TCHAR *alloc_addr, TCHAR *user_id, TCHAR *setup_id, TCHAR first_filter_msg, TCHAR last_filter_msg,
int primary_filter, const AM_TIME_STATE_FILTER* ts_filter, const unsigned char *field_filters, int num_filters, int
void am_shutdown(void);
rr_flag);
void am_term_init(void);
prev_state);
void am_upd_alarm(const TCHAR *alarm_id,const TCHAR *fr_id,const TCHAR *ref_id,const TCHAR *user_or_serv_id,int action,
*user_or_serv_id,
*user_or_serv_id,
long *ref_ptr, long *service_ptr, const TCHAR *alarm_id, const TCHAR *fr_id, const TCHAR *ref_id,
const TCHAR *user_or_serv_id, COR_STAMP *upd_time, void *objCaData, struct cor_status *ret_stat);
*user_or_serv_id,
*user_or_serv_id,
long *ref_ptr, long *service_ptr, const TCHAR *alarm_id, const TCHAR *fr_id, const TCHAR
*ref_id,
*ret_stat);
Open Interface API Reference | 3 - Alarm Management API | 129
void am_upd_active_terms(void);
jrnl_recover);
void am_ur_findnew(void);
int amrp_state(void);
void amrp_remove_master_logical(void);
COR_I4 am_conc_pass_update_extmgr(DADDR *extmgr_daddr, int seg_type, TCHAR *seg_ptr, COR_I4 seg_len, COR_I4 rpt_len,
COR_STATUS *ret_stat) ;
COR_I4 am_init_extmgr() ;
TCHAR helpFile[HELP_FNAME_LEN+1],
COR_STATUS *ret_stat);
//scr 23546
blk_group_ptr);
void am_config_alarm_blk(void);
COR_I4 am_comment_file_erase(const TCHAR *palarm_id, const TCHAR *pres_id, const TCHAR *pref_id, COR_STATUS *pretstat);
void am_comment_delete (
COR_STATUS *pret_stat,
AM_STATE_TYPE action,
AM_COMMENT2_INFO *pcomment_info,
COR_STAMP *gentime,
RECORD_PTR alarm_occur_ptr,
RECORD_PTR alarm_def_ptr
) ;
#endif // _AM_DEFS_H
amaru_proto.h
This file contains function prototypes for the AMARU library. The following is a listing of this file:
#ifndef _AMARU_PROTO_H
#define _AMARU_PROTO_H
#ifdef WIN32
Open Interface API Reference | 3 - Alarm Management API | 131
#include <inc_path/ddl.h>
#include <inc_path/sc_recs.h>
#include <inc_path/am_defs.h>
#ifndef AmaruExport
#define AmaruExport
#endif
#ifdef __cplusplus
extern "C" {
#endif
TCHAR *alarm_id,
TCHAR *fr_id,
TCHAR *user_or_serv_id,
TCHAR *ref_id,
TCHAR *alarm_comment,
COR_STATUS *ret_stat);
TCHAR *setup_id,
TCHAR *user_id,
int dg_port_index,
IPCDG *send_buffer_ptr,
TCHAR *send_body_ptr,
int send_buffer_len,
IPCDG *recv_buffer_ptr,
TCHAR *recv_body_ptr,
int recv_buffer_len,
COR_STATUS *ret_stat);
TCHAR *setup_id,
TCHAR *user_id,
Open Interface API Reference | 3 - Alarm Management API | 133
int dg_port_index,
IPCDG *send_buffer_ptr,
TCHAR *send_body_ptr,
int send_buffer_len,
IPCDG *recv_buffer_ptr,
TCHAR *recv_body_ptr,
int recv_buffer_len,
COR_STATUS *ret_stat);
TCHAR *setup_id,
TCHAR *user_id,
int num_rpts,
AM_FILTER_TYPE primary_filter,
int dg_port_index,
IPCDG *send_buffer_ptr,
TCHAR *send_body_ptr,
int send_buffer_len,
IPCDG *recv_buffer_ptr,
TCHAR *recv_body_ptr,
int recv_buffer_len,
COR_STATUS *ret_stat);
AM_FILTER_TYPE filter_type,
COR_STAMP *start_time,
TCHAR *class_id,
AM_STATE_TYPE alarm_state,
TCHAR *fr_id,
COR_STATUS *ret_stat);
int amaru_tls_initialize_process();
int amaru_tls_terminate_process();
int amaru_tls_terminate_thread();
RECORD_PTR amaru_tls_get();
void amaru_force_terminate();
Open Interface API Reference | 3 - Alarm Management API | 134
int dg_port_index,
IPCDG *send_buffer_ptr,
TCHAR *send_body_ptr,
int send_buffer_len,
IPCDG *recv_buffer_ptr,
TCHAR *recv_body_ptr,
int recv_buffer_len,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
TCHAR *setup_id,
TCHAR *user_id,
int dg_port_index,
IPCDG *send_buffer_ptr,
TCHAR *send_body_ptr,
int send_buffer_len,
IPCDG *recv_buffer_ptr,
TCHAR *recv_body_ptr,
int recv_buffer_len,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
TCHAR *setup_id,
TCHAR *user_id,
int dg_port_index,
IPCDG *send_buffer_ptr,
TCHAR *send_body_ptr,
int send_buffer_len,
IPCDG *recv_buffer_ptr,
TCHAR *recv_body_ptr,
int recv_buffer_len,
RECORD_PTR amaru_root,
Open Interface API Reference | 3 - Alarm Management API | 135
COR_STATUS *ret_stat);
TCHAR *setup_id,
TCHAR *user_id,
int num_rpts,
AM_FILTER_TYPE primary_filter,
int dg_port_index,
IPCDG *send_buffer_ptr,
TCHAR *send_body_ptr,
int send_buffer_len,
IPCDG *recv_buffer_ptr,
TCHAR *recv_body_ptr,
int recv_buffer_len,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
AM_FILTER_TYPE filter_type,
COR_STAMP *start_time,
TCHAR *class_id,
AM_STATE_TYPE alarm_state,
TCHAR *fr_id,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
AM_RESP_TYPE resp_type,
AM_RESP_KEY key,
AM_MSG_FIELD msg_field[],
int num_fields,
COR_BOOLEAN reset_follows,
RECORD_PTR amaru_root,
Open Interface API Reference | 3 - Alarm Management API | 136
COR_STATUS *ret_stat);
AM_RESP_TYPE resp_type,
AM_RESP_KEY key,
AM_MSG_FIELD msg_field[],
int num_fields,
COR_BOOLEAN reset_follows,
COR_STAMP gentime,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
AM_STATE_TYPE action,
COR_I4 seq_num,
AM_RESP_TYPE resp_type,
AM_RESP_KEY key,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
AM_STATE_TYPE action,
COR_I4 seq_num,
AM_RESP_TYPE resp_type,
AM_RESP_KEY key,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
COR_I4 seg_type ,
COR_I4 seg_len ,
TCHAR *seg_ptr ,
AM_RESP_TYPE resp_type,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat) ;
AM_STATE_TYPE action,
COR_I4 seq_num,
AM_RESP_TYPE resp_type,
AM_RESP_KEY key,
COR_STAMP upd_time,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
TCHAR *alarm_id,
TCHAR *fr_id,
TCHAR *user_or_serv_id,
TCHAR *ref_id,
TCHAR *alarm_comment,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
TCHAR *alarm_id,
TCHAR *conc_alarm_id,
TCHAR *fr_id,
TCHAR *user_or_serv_id,
TCHAR *ref_id,
TCHAR *alarm_comment,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
TCHAR *alarm_id,
TCHAR *conc_alarm_id,
TCHAR *fr_id,
TCHAR *user_or_serv_id,
TCHAR *ref_id,
TCHAR *alarm_comment,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
COR_STATUS *ret_stat) ;
RECORD_PTR amaru_root,
COR_STATUS *ret_stat) ;
COR_BOOLEAN rr,
COR_STATUS *ret_stat) ;
COR_BOOLEAN rr,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat) ;
TCHAR user_or_serv_id[],
Open Interface API Reference | 3 - Alarm Management API | 140
int dg_port_index,
IPCDG *send_buffer_ptr,
TCHAR *send_body_ptr,
int send_buffer_len,
IPCDG *recv_buffer_ptr,
TCHAR *recv_body_ptr,
int recv_buffer_len,
COR_BOOLEAN local_send ,
TCHAR user_or_serv_id[],
int dg_port_index,
IPCDG *send_buffer_ptr,
TCHAR *send_body_ptr,
int send_buffer_len,
IPCDG *recv_buffer_ptr,
TCHAR *recv_body_ptr,
int recv_buffer_len,
RECORD_PTR amaru_root,
COR_BOOLEAN local_send ,
int wbodylen ,
COR_BOOLEAN enable_support ,
COR_STATUS *ret_stat ) ;
int wbodylen ,
COR_BOOLEAN enable_support ,
RECORD_PTR amaru_root ,
COR_STATUS *ret_stat );
AMU_UPDATE_INFO *pamu_update_info ,
TCHAR *body_ptr ,
int i ,
COR_STATUS *ret_stat ) ;
AM_RESP_TYPE resp_type,
AM_RESP_KEY key,
AM_MSG_FIELD msg_field[],
int num_fields,
COR_BOOLEAN havegentime,
Open Interface API Reference | 3 - Alarm Management API | 142
COR_STAMP gentime,
int cur_state,
COR_I4 cleared_time,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat);
#ifdef __cplusplus
} /* C++ */
#endif
#ifdef __cplusplus
#include <inc_path/ipc.hpp>
COR_STATUS *retstat);
COR_STATUS *retstat);
inline
TCHAR *alarm_id,
TCHAR *conc_alarm_id,
TCHAR *fr_id,
TCHAR *user_or_serv_id,
TCHAR *ref_id,
TCHAR *alarm_comment,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat,
inline
Open Interface API Reference | 3 - Alarm Management API | 143
TCHAR *alarm_id,
TCHAR *conc_alarm_id,
TCHAR *fr_id,
TCHAR *user_or_serv_id,
TCHAR *ref_id,
TCHAR *alarm_comment,
RECORD_PTR amaru_root,
COR_STATUS *ret_stat,
#endif
#endif
#endif
alarmapi.h cor_
thread.h
am_defs.h cor_time.h
am_errors.h ddl.h
amap_defs.h examgr.h
amaru_err.h ipc.hpp
amdd_cmd.h ipcerr.h
amdd_cont.h mf_defs.h
amdd_defs.h mfamupdi.h
amip.h mfpmterm.h
cor.h mfstatus.h
cor_event.h netcom.h
cor_mutex.h rcm.h
cor_os.h rtr_bcst.h
cor_stat.h sc_recs.h
amip.cpp make
file
amaru.lib fasrtl.lib
amip.lib ipc.lib
corutil.lib cim_mf.lib
ddl.lib cim_sc.lib
exam
gr.lib
This API is written for the international environment. In an international environment, strings in
CIMPLICITY software can be multi-byte strings. If you want your code to conform to international
standards, It is recommended that you do the following when working with strings:
char *cp;
• Avoid using a variable to hold the value of a logical character. Instead, use a pointer to a character
in the string. In particular, avoid the _tcsnextc() macro, because the value it returns appears to be
incompatible with some of the C runtime library functions.
• Use the functions _tccpy() and _tccmp() with string pointers instead of using the = and ==
operators on characters.
• Use GetStringTypeEx() instead of the character classification macros such as _istalpha().
• Use CharUpper() and CharLower() instead of _toupper() and _tolower().
Recommended reading
Microsoft has several good papers on writing international code on its Developer Network CD and its web
site. To find documentation on the web site, go to http://msdn.microsoft.com/default.asp and search for
MBBCS.
The Alarm Interested Process API gives you the classes command handlers, and notify handlers you need
to create your own application.
Classes
Command Handlers
Classes
Classes
The classes included in the AMIP API encapsulates alarm messages and inter-process communications.
• CAlarmUpdateInfo
• CAMIPBase
CAMIPBase
public:
CAMIPBase();
~CAMIPBase();
enum Error
errorNo=0, // no error
};
BOOL Stop();
BOOL IsRunning();
int GetLastError();
// virtual functions
};
This is the abstract base class from which you drive an AMIP object. An AMIP object provides member
functions for informing Alarm update to the application.
Start() starts the process of informing alarm update. This process can be synchronous or asynchronous.
GetLastError() return the last error value. The error values are :
errorNo No error
CAlarmUpdateInfo
class CAlarmUpdateInfo
public:
CAlarmUpdateInfo();
~CAlarmUpdateInfo(){};
CAlarmUpdateInfo(AM_UPD_INF am_upd_inf);
AM_STATE_TYPE prev_state;
AM_STATE_TYPE requested_action;
AM_STATE_TYPE final_state;
char alarm_id[ALARM_ID_LEN+1];
char fr_id[FR_ID_LEN+1];
char ref_id[AM_REF_ID_LEN+1];
char class_id[CLASS_ID_LEN+1];
char alarm_msg[ALARM_MSG_LEN+1];
COR_I1 log_file;
};
Command Handlers
Command Handlers
The command handlers included in the Alarm Interested Process API let you process an alarm message,
process a status block, perform shutdown operations and handle critical errors.
Open Interface API Reference | 4 - Alarm Interested Process API | 152
• OnAlarmInfo
• OnStatus
• OnShutdown()
• NotifyStopOnError()
OnAlarmInfo
This handler is called whenever a new alarm or event message is received by the AMIP API application.
(CAlarmUpdateInfo *pAlarmInfo)
The pAlarmInfo is a pointer to the Alarm Information structure defined in the CAlarmUpdateInfo class.
Place all the code you need to process a message in this command handler.
OnStatus
This handler is called whenever an internal error message is received. Supply code to log the message to
either the CIMPLICITY Status Log for your project or a user defined status log.(COR_STATUS *pStatus)
The pStatus is a pointer to the COR_STATUS status block. The COR_STATUS structure is defined in
cor_stat.h.
OnShutdown()
Place all the code you need to handle your application shutdown in this command handler.
NotifyStopOnError()
This handler is called whenever a critical internal error has occurred. Supply code to perform all actions
necessary to perform a clean exit.
The possible critical error values for the AMIP API are defined in the CAMPIBase class as is the
GetLastError() function you can use to get the last error value.
Important:
In order to use the Alarm Interested Process API, you must have the following software installed
on your computer:
The Alarm Interested Process 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\AMIPSAMPLE directory. It
contains:
This sample program receives alarm messages from the Alarm Manager and writes the data to the
sample.log file in the root directory of the drive where the program is run.
• In synchronous mode, the program waits in CAMIPSample until it receives an alarm message, then
processes the message.
• In asynchronous mode, the program places the call in CAMIPSample, then is free to do other things
until a message is received.
You can use the project provided with the sample as a basis for constructing projects for your own
applications.
Note:
Depending on how you install 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:
You can any existing or any newly created project to create (on page 154) and run (on page 155) the
executable for the sample program.
<drive>:
cd %BSM_ROOT%api
Where
5. (If the environment variables are not set automatically) issue the following command to set them:
Open Interface API Reference | 4 - Alarm Interested Process API | 155
This ensures that your environment variables (in particular %BSM_ROOT% and %SITE_ROOT%) are set
correctly.
devenv CimplicityAPI.sln
Note:
You can also use this procedure to test your application executable.
Step 2.1 Configure an Alarm Log Printer for the Sample Pro
(on page gram.
155)
Step 2.1. Configure an Alarm Log Printer for the Sample Program
Open Interface API Reference | 4 - Alarm Interested Process API | 156
4. Click OK.
5. Check the check boxes required for your system and enter fields to do the following.
Option Description
Log Enables alarm logging options. Types of logged alarm that can be checked are:
alarms ◦ Generated alarms
◦ Acknowledged alarms
Open Interface API Reference | 4 - Alarm Interested Process API | 157
◦ Reset alarms
◦ Deleted alarms
Checked Sends logged alarm data to the specified printer or file. Note: Check all
logged alarm check boxes if you are working with the SAMPLE program.
Checked Sends data for all alarm classes in the selected categories to the specified
printer or file.
Clear Enables Alarm Class. Sends data for the selected alarm class in the selected
categories to the specified printer or file.
Output Name of the device or path and file to which the data will be sent. Example Enter c:
\test.log
6. Click OK.
Result: The Alarm Printer dialog box closes. The printer name displays in the Workbench right
pane.
B Click Connect.
C Select MASTER_SAMPLE.
SET PRCNAM=SAMPLE
Note:
The name you use here must match the name you entered in the New Alarm Log Printer
dialog.
AMIPSAMPLE
AMIPSAMPLE ASYNC
After a few minutes, you can check the test.log file to verify that alarms are being logged.
Use amipsample.cpp as a template for writing your application. You will need to provide your own
application code for:
• main
• OnAlarmInfo
• OnStatus
• OnShutdown
• NotifyStopOnError
This ensures that your environment variables (in particular %BSM_ROOT% and %SITE_ROOT%) are
set correctly.
<drive>:
cd <directory>
where <drive> is the disk where your CIMPLICITY software is installed, and <directory> is your
application project directory.
5. If the environment variables are not set automatically, issue the following command to set them:
devenv <solution>
where:
You can test your application using any project. Just execute the same steps (on page 155) for your
application that you did for the sample program.
After you have verified that your application works correctly, you can integrate it into your CIMPLICITY
project.
The necessary steps to integrate your AMIP application into a CIMPLICITY project involves three distinct
parts.
Open Interface API Reference | 4 - Alarm Interested Process API | 161
Step Modify the system registry to inform CIMPLICITY software of the application.
4.2 (on
page
162)
When these procedures are followed correctly, the process will start when your CIMPLICITY
project starts.
After you complete these procedures, your AMIP process runs automatically when you start your
CIMPLICITY project.
1. Place your AMIP application executable in the %BSM_ROOT%exe directory (if you used the default
directory during installation, this is will be c:\Program Files (x86)\Proficy\Proficy CIMPLICITY\EXE.
2. Create a file called <appname>.RP in %BSM_ROOT%bsm_data, where <appname> can be any name
of your choosing (the name will be used again in the system registry).
Note: The <appname>.RP file is an ASCII file in CIMPLICITY standard IDT format.
|-*
5. On the second line, enter information in the following fields. Separate the fields with vertical bars (
| )
Process ID The process identifier. Create short identifier for the process
Max. per Node Maximum number of this process which can run on a single node.
Multiple Per System Can this process run on more than one node. Enter 0.
Startup Type Use RP. The process will be started after device communication processes.
|-*
ANY|SAMP_APP|BSM_ROOT:[EXE]SAMPAPP.EXE|SAMP_APP|SAMP_APP|-
SAMP_APP|20|0|1|1|0|RP|SAMPLE APPLICATION
You will need to add some entries to the Registry to allow the CIMPLICITY Configuration program to
recognize your new application.
Warning:
Making changes to the registry is very dangerous and should be done with care.
HKEY_LOCAL_MACHINE
SOFTWARE
GE Fanuc
CIMPLICITY
HMI
Open Interface API Reference | 4 - Alarm Interested Process API | 163
Products
3. Select New Key on the Edit menu to add a key for your new product. The Key Name must match the
prefix you gave to your .RP file (it does not have to be an IC product number).
4. Select New String Value on the Edit menu
a. Enter Name in the field provided
b. Press Enter twice.
c. In the Value data field, enter the name that you want to be displayed for the option when you
create a project.
5. Select New String Value on the Edit menu.
a. Enter Serial Number in the field provided
b. Press Enter.
6. Select New String Value on the Edit menu.,
a. Enter Type in the field provided
b. Press Enter twice.
c. In the Value data field, enter App.
7. Exit from the registry.
<drive>:
cd %BSM_ROOT%MASTER
IDTPOP ALARM_INTPROC
|<service_id>|$ALL$|0|B.
Open Interface API Reference | 4 - Alarm Interested Process API | 164
SCPOP ALARM_INTPROC
State transitions of CIMPLICITY alarms are normally driven by responses from CIMLPLICITY software
or custom alarm viewers. When one of these viewers, under user direction, generates a response to an
alarm, the CIMPLICITY Alarm Manager normally transitions the alarm based on its internal criteria.
If alarms are generated by an XASMgr process, the CIMPLICITY Alarm Manager does not transition these
alarms, but passes their user responses to the XASMgr that generated the alarm. The XASMgr then
decides whether the response to the alarm should be applied. If it decides the response can be applied, it
passes the response back to the CIMPLICITY Alarm Manager.
Note:
The Repeat, Acknowledge, and Reset timeouts are not applied by the Alarm Manager to alarms
generated by an XASMgr. If you require this functionality for alarms managed by an XASMgr,
the XASMgr must provide that functionality and send appropriate action requests to the Alarm
Manager.
The following C++ classes are included in this API to aid you in utilizing CIMPLICITY Alarm Management:
• AlarmGen
• CExternalAlarmManager
Use the AlarmGen class to generate alarms for and send responses to the Alarm Manager. Use the
CExternalAlarmManager class to develop your XASMgr process.
This API is written for the international environment. In an international environment, strings in
CIMPLICITY software can be multibyte strings. If you want your code to conform to international
standards, it is recommended that you do the following when working with strings:
char *cp;
• Avoid using a variable to hold the value of a logical character. Instead, use a pointer to a character
in the string. In particular, avoid the _tcsnextc() macro, because the value it returns appears to be
incompatible with some of the C runtime library functions.
• Use the functions _tccpy() and _tccmp() and string pointers instead of the = and == operators on
characters.
• Use GetStringTypeEx() instead of the character classification macros such as _istalpha().
• Use CharUpper() and CharLower() instead of _toupper() and _tolower().
Open Interface API Reference | 5 - External Alarm State Management API | 167
Recommended Reading
Microsoft has several good papers on writing international code on its Developer Network DVD and its
web site. To find documentation on the web site, go to http://msdn.microsoft.com/default.asp and search
for MBBCS.
In order to use the External Alarm State Management API for the current CIMPLICITY release, you must
have the following software installed on your computer:
The following is a list of all files distributed with the Alarm Management API. The files are loaded into
the directories indicated. The environment variable %BSM_ROOT% is the directory where the CIMPLICITY
software was installed.
alarmapi.h cor_
thread.h
am_defs.h cor_time.h
am_errors.h ddl.h
amap_defs.h examgr.h
amaru_err.h ipc.hpp
amdd_cmd.h ipcerr.h
amdd_cont.h mf_defs.h
amdd_defs.h mfamupdi.h
amip.h mfpmterm.h
cor.h mfstatus.h
cor_event.h netcom.h
cor_mutex.h rcm.h
cor_os.h rtr_bcst.h
cor_stat.h sc_recs.h
amaru.lib fasrtl.lib
amip.lib ipc.lib
corutil.lib cim_mf.lib
ddl.lib cim_sc.lib
exam rcm.lib
gr.lib
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:
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 project provided with the sample 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.
Open Interface API Reference | 5 - External Alarm State Management API | 170
• You can use any project to create and run the executable for the sample program.
• Create a sample program.
• Run a sample program.
This ensures that your environment variables (in particular %BSM_ROOT% and %SITE_ROOT%) are set
correctly.
<drive>:
cd %BSM_ROOT%\api
5. If the environment variables are not set automatically, issue the following command to set them:
devenv CimplicityAPI.sln
Prop
Value
erty
Alarm Message Enter text (e.g. for Test 1 enter TEST1 Alarm).
Alarm Route to all users. Note: Add the USER role to the Configured Roles For Alarm list.
Rout
ing
AMXASSAMPLE
Note:
The program generates all ten alarms, and then repeats the first three alarms at thirty
second intervals.
Open Interface API Reference | 5 - External Alarm State Management API | 172
17. 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.
The External Alarm State Management API gives you the classes (on page 172) , command handlers (on
page 181) , and notify handlers you need to create your own application.
• Classes
• AlarmGen methods
• CExternalAlarmManager Methods and Command Handlers
Classes
Classes
The classes included in the XASMGR API encapsulate the methods and handlers used to generate and
process alarm messages.
• AlarmGen
• CExternalAlarmManager
AlarmGen
Encapsulates the sending of alarm generation and response messages to the Alarm Manager. The
structure is:
public:
refId,COR_STAMP stamp);
CExternalAlarmManager
Encapsulates the methods and handlers used to generate and process external alarms.
public:
CExternalAlarmManager();
virtual ~CExternalAlarmManager();
LPCTSTR fr,
LPCTSTR refId,
int state,
COR_STAMP stamp,
COR_I4 clearedTime);
LPCTSTR frId,
LPCTSTR refId);
COR_STATUS *stat);
This is the abstract base class from which you drive an XASMgr object. An XASMgr object provides
member functions for processing alarm messages.
Start() starts the process of generating alarms and monitoring their state changes. This process can by
synchronous or asynchronous.
Stop() stops the process of generating alarms and monitoring alarm state changes.
AlarmGen Methods
AlarmGen Methods
The AlarmGen methods provide a partial wrapper around basic functionality that exists in the AMARU
library C functions. This wrapper is intended to simplify the effort required on the part of a developer to
generate alarms for and send alarm responses to the CIMPLICITY Alarm Manager.
Methods include:
• AckAlarm
• AckCAAlarm
• AddField
• AddSeverity
• AlarmGen
• DeleteAlarm
• DeleteCAAlarm
• GenerateAlarm
• GenerateAlarmStamp
• InitializeAmGen
• ResetAlarm
Open Interface API Reference | 5 - External Alarm State Management API | 175
• ResetCAAlarm
• ResetFields
AckAlarm
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
This method sends a message to the CIMPLICITY Alarm Manager to acknowledge the alarm identified by
the parameters.
AckCAAlarm
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
This method sends a message to the CIMPLICITY Alarm Manager to acknowledge the alarm identified by
the parameters.
AddField
Syntax
Parameters
Remarks
AddField(LPCSTR value) adds a new string parameter to an internal holding area. This parameter is
passed as an alarm message parameter with the next call to GenerateAlarm() or GenerateAlarmStamp().
AddField(int value) adds a new integer parameter to an internal holding area. This parameter is passed
as an alarm message parameter with the next call to GenerateAlarm() or GenerateAlarmStamp().
This alarm field remains effective for all subsequent GenerateAlarm() or GenerateAlarmStamp() calls until
ResetFields is called.
AddSeverity
Syntax
Parameters
Remarks
AddSeverity adds the alarm severity to an internal holding area. This parameter is passed as the alarm
message severity with the next call to GenerateAlarm() or GenerateAlarmStamp().
This alarm severity remains effective for all subsequent GenerateAlarm() or GenerateAlarmStamp() calls
until either another AddSeverity or ResetFields is called.
AlarmGen
Syntax
InitializeAlarmGen ( );
Remarks
This default constructor does basic initialization, but does not render the class ready for use. You must
call the InitializeAmGen() method before you actually use an instance of the class.
DeleteAlarm
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
This method sends a message to the CIMPLICITY Alarm Manager to delete the alarm identified by the
parameters.
DeleteCAAlarm
Open Interface API Reference | 5 - External Alarm State Management API | 178
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
This method sends a message to the CIMPLICITY Alarm Manager to delete the alarm identified by the
parameters.
GenerateAlarm
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
This method sends an alarm generation message to the CIMPLICITY Alarm Manager. Included in the
message will be any alarm message parameters created by calls to AddField() or AddSeverity() since
initialization or the last ResetField() call. The Alarm Manager uses the current time for the alarm
generation timestamp.GenerateAlarm.
Open Interface API Reference | 5 - External Alarm State Management API | 179
GenerateAlarmStamp
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
time The date and time to be used for the alarm generation time.
stamp
Remarks
This method sends an alarm generation message to the CIMPLICITY Alarm Manager. Included in the
message will be any alarm message parameters created by calls to AddField() or AddSeverity() since
initialization or the last ResetField() call. The Alarm Manager uses the timestamp given by this method
for the alarm generation timestamp.
InitializeAmGen
Syntax
Parameters
port The port index used for receiving messages from other CIMPLICITY processes (in particular, the
In Alarm Manager). If you omit this parameter or pass it as a -1, the method internally acquires its
dex own port index.
Remarks
ResetAlarm
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
This method sends a message to the CIMPLICITY Alarm Manager to reset (clear) the alarm identified by
the parameters.
ResetCAAlarm
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
This method sends a message to the CIMPLICITY Alarm Manager to reset(or Clear) the alarm identified
by the parameters.
Open Interface API Reference | 5 - External Alarm State Management API | 181
ResetFields
Syntax
ResetFields ( );
This method resets the fields to be passed with a generated alarm that requires parameters in its
message (alarm parameters are determined by the Alarm Type definition). It also resets the alarm
severity.
The CExternalAlarmManager class hides most low-level interaction with the CIMPLICITY Alarm Manager,
including the basic initiation of CIMPLCIITY IPC services, registering with the Alarm Manager as an
XASMgr, and the details of generating alarms and receiving alarm responses.
Methods include:
• Start
• Stop
• OnInited
• OnShutdown
• IsRunning
• OnCAAlarmAck
• OnAlarmAck
• OnAlarmClear
• OnCAAlarmClear
• OnAlarmDel
• OnCAAlarmDel
• report_error
• GenerateAlarmStampWithVerify
Start
Open Interface API Reference | 5 - External Alarm State Management API | 182
Syntax
Parameters
bA Flag that determines whether synchronous or asynchronous processing will be used by the
sync XASMgr. TRUE = Asynchronous processing will be used. FALSE = Synchronous processing will be
used.
Remarks
It is anticipated that an XASMgr is going to be a multi-threaded application. The start method provides
two means for this multi-threading to be accomplished.
• If you pass the parameter as FALSE, functionality continues to run in the main thread and will not
return until the CIMPLICITY project shuts down.
If you choose this method, then you will probably either already have created your own thread, or
anticipate doing it within OnInited. The need for your own thread is anticipated as it is expected that
the alarms you will be managing are probably occurring in an asynchronous fashion, and you will
need to interact independently with external devices in a fashion that could not be supported by the
unpredictability of callbacks from the CExternalAlarmManager internals.
• If you pass the parameter as TRUE, then CExternalAlarmManager creates its own thread of
execution, and the Start call returns after that thread has been spawned.
The next normal action to occur will be a call to the OnInited method. At the point CExternalAlarmManger
calls this method all preparations have been successfully completed to allow this XASMgr to generate
alarms. Do not attempt to generate or otherwise modify alarms before OnInited has been called. If you do,
those actions will not be handled appropriately, as initialization has not been completed.
Stop
Syntax
BOOL Stop( );
Open Interface API Reference | 5 - External Alarm State Management API | 183
Remarks
OnInited
Syntax
void OnInited( );
Remarks
This handler is called after the XASMgr process finishes initializing process communications.
Place all the code you need to handle XASMgr initiation in this command handler.
OnShutdown
Syntax
void OnShutdown( );
Remarks
This handler is called whenever CIMPLICITY interprocess communications indicates to the XASMgr that
the project is shutting down.
Place all the code you need to handle your application shutdown in this command handler.
IsRunning
Syntax
BOOL isRunning ( )
This method verifies that the project is running and interprocess communications are working. It returns
TRUE if everything is all right, and returns FALSE if it detects a problem.
OnAlarmAck
Open Interface API Reference | 5 - External Alarm State Management API | 184
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
OnCAAlarmAck
Syntax
void OnCAAlarmAck ( LPCTSTR alarmID, LPCTSTR frID, LPCTSRT refID , ChangeapprovalInfo* ptrCAObj)
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
OnAlarmClear
Open Interface API Reference | 5 - External Alarm State Management API | 185
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
OnCAAlarmClear
Syntax
void OnCAAlarmClear ( LPCTSTR alarmID, LPCTSTR frID, LPCTSRT refId , ChangeapprovalInfo* ptrCAObj)
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
OnAlarmDel
Open Interface API Reference | 5 - External Alarm State Management API | 186
Syntax
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
OnCAAlarmDel
Syntax
void OnCAAlarmDel ( LPCTSTR alarmID, LPCTSTR frID, LPCTSRT refID , ChangeapprovalInfo* ptrCAObj);
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
Remarks
report_error
Open Interface API Reference | 5 - External Alarm State Management API | 187
Syntax
Parameters
*stat The pointer to the COR_STATUS status block. The COR_STATUS structure is defined in cor_s
tat.h.
Remarks
GenerateAlarmStampWithVerify
Syntax
COR_I4 cleared_time );
Parameters
refId The optional Reference ID for the alarm. If you have no Reference ID, enter "" in this argu
ment.
state The current state of the alarm. Valid values are: AM_GENERATED AM_ACKNOWLEDGED
AM_CLEARED
stamp The timestamp when the alarm was originally generated. You may pass a pointer to a valid
timestamp or a null value.
cleared_ If the state is AM_CLEARED, this field contains the clear time. Otherwise, pass a null value.
time
Open Interface API Reference | 5 - External Alarm State Management API | 188
Remarks
This method is similar to the other GenerateAlarm calls. but invokes special processing within the Alarm
Manager. If the alarm specified in the method is not currently generated, the alarm will be generated. A
subsequent check is made of the alarm state of the alarm, comparing it to the requested state. If the state
of the alarm is different from the state specified in this method, then the Alarm Manager applies the state
specified by this method to the alarm. If no changes occur as a result of this call, nothing will be logged by
the Alarm Manager. If changes occur, they will be logged as configured.
Use amxasamxasamxassample.cpp as a template for writing your application. You will need to provide
your own application code for:
• main
• OnInited
• OnAlarmAck
• OnAlarmClear
• OnAlarmDel
• OnShutdown
Thread Synchronization
Your implementation of CExternalAlarmManager will have to manage its own thread synchronization.
The need for this synchronization will arise in situations where a callback method may need to access
XASMgr specific structures at the same time the corresponding thread may need to access them.
The base internals have no knowledge of what you create, and cannot help out in this area. The
responsibility for this synchronization rests completely with the XASMgr developer, and failure to deal
with this issue by appropriate use of semaphores, mutexes or other Microsoft Win32 synchronization
objects will likely result in an unreliable, unpredictable XASMgr implementation.
The sample program, as implemented, does not have need of or demonstrate these techniques. Please
refer to Microsoft documentation and samples for management of multiple threads within a process
potentially requiring simultaneous access to common data.
Open Interface API Reference | 5 - External Alarm State Management API | 189
This ensures that your environment variables (in particular %BSM_ROOT% and %SITE_ROOT%) are set
correctly.
<drive>:
cd <directory>
where <drive> is the disk where your CIMPLICITY software is installed, and <directory> is your
application project directory.
5. If the environment variables are not set automatically, issue the following command to set them:
nmake
You can test your application using any project. Just execute the same steps for your application that you
did for the sample program.
After you have verified that your application works correctly, you can integrate it into your CIMPLICITY
project.
The necessary steps to integrate your XASMgr application into a CIMPLICITY project involves three
distinct steps:
Open Interface API Reference | 5 - External Alarm State Management API | 190
After you complete these three procedures, your XASMgr process runs automatically when you start your
CIMPLICITY project.
1. Place your XASMgr application executable in the %BSM_ROOT%exe directory (if you used the default
directory during installation, this is will be c:\Program Files (x86)\Proficy\Proficy CIMPLICITY\EXE.
2. Create a file called <appname>.RP in %BSM_ROOT%bsm_data, where <appname> can be any name of
your choosing (the name will be used again in the system registry).
|-*
5. On the second line, enter information in the following fields. Separate the fields with vertical bars
(|)
Process ID The process identifier. Create short identifier for the process
Max. per Node Maximum number of this process which can run on a single node.
Multiple Per System Can this process run on more than one node. Enter 0.
Startup Type Use RP. The process will be started after device communication processes.
|-*
ANY|SAMP_APP|BSM_ROOT:[EXE]SAMPAPP.EXE|SAMP_APP|SAMP_APP|-
SAMP_APP|20|0|1|1|0|RP|SAMPLE APPLICATION
You will need to add some entries to the Registry to allow the CIMPLICITY Configuration program to
recognize your new application.
Warning:
Warning: Making changes to the registry is very dangerous and should be done with care.
32-bit systems
HKEY_LOCAL_MACHINE>SOFTWARE>GE Fanuc>CIMPLICITY>HMI>Version>Products
64-bit systems
HKEY_LOCAL_MACHINE>SOFTWARE>Wow6432Node>GE Fanuc>CIMPLICITY>HMI>Version>Products
3. Select New Key on the Edit menu to add a key for your new product. The Key Name must match the
prefix you gave to your .RP file (it does not have to be an IC product number).
4. Select New String Value on the Edit menu
Open Interface API Reference | 5 - External Alarm State Management API | 192
The Alarm Viewer API provides an interface for application programmers to develop full-featured custom
alarm viewers to meet special needs.
• Downtime reporting
• Production reporting
• Records of production counts at work stations
• Graphic monitoring of automatic data point values
• Fault reporting via direct point values and alarms
CIMPLICITY software's flexible system architecture and modular design allows for easy add-on of
functionality.
CIMPLICITY software's Alarm Management module is responsible for maintaining the status of
outstanding alarms, or predetermined conditions of interest, detected by an application process. Alarm
Management informs users of current alarm occurrences and sends information on alarm occurrences to
interested processes. Alarm Management provides a set of services to generate new alarms and update
the status of existing alarms. These services allow an application to interact with Alarm Management
Open Interface API Reference | 6 - Alarm Viewer API | 194
capability without knowing the message structure and message passing aspects of interfacing to an
Alarm Management Resident Process.
The Alarm Management module consists of an Alarm Management Resident Process (AMRP), and a
configured number of Alarm Management Allocated Processes (AMAP).
The CIMPLICITY Alarm Manager Resident Process (AMRP) is responsible for maintaining a centralized
database of current alarms. Users may view and act on these alarms with the Alarm Viewer or an Alarm
Viewer control embedded in a CimView screen.
In addition, sets of sorting and filtering preferences can be created, saved, loaded, and edited. The Alarm
Viewer API (AMV API) allows a process engineer or system integrator to develop full-featured custom
alarm viewers to meet special needs.
Important:
The Alarm Viewer API must send the short alarm length (32 characters or fewer) to perform
operations even if the alarm is assigned a longer ID. Both the short, and, if it exists, the long alarm
names are available via the API.
No changes need to be made to existing applications that use this API; the short alarm name will be in
the alarmid field used by the AlarmInfo structure in previous versions (Applications will already be using
the correct alarmid field.). If an application requires communication with CIMPLICITY v9.0 servers that
have projects with long alarm names, the only change required will be for the application to use the new
long_name field (from the AlarmInfo structure) when displaying alarm names to the user.
The AMV API is implemented as a set of C++ classes which encapsulate various aspects of the
connection between an alarm viewer process, such as the standard Alarm Viewer, and the AMRP. The
classes and their functions are summarized below.
Open Interface API Reference | 6 - Alarm Viewer API | 195
Class Description
CAmvResource A Resource
Filter
CAmvConn The class through which the connection between an alarm viewer and the Alarm
Manager is implemented.
CAmvStateFilter The set of alarm states used to filter alarms for a connection.
CAmvTimeFilter The time used to filter alarms for a connection. If enabled, only alarms after the
specified time are passed.
Connections between alarm viewers and the alarm manager are encapsulated in the CAmvConn (Alarm
Viewer Connection) class. When a CAmvConn object is constructed, you provide a number of callback
functions. The constructor starts a new thread to process alarm manager communication. This thread
calls your functions to process alarms.
This API is written for the international environment. In an international environment, strings in
CIMPLICITY software can be multibyte strings. If you want your code to conform to international
standards, It is recommended that you do the following when working with strings:
char *cp;
• Avoid using a variable to hold the value of a logical character. Instead, use a pointer to a character
in the string. In particular, avoid the _tcsnextc() macro, because the value it returns appears to be
incompatible with some of the C runtime library functions.
• Use the functions _tccpy() and _tccmp() and string pointers instead of the = and == operators on
characters.
• Use GetStringTypeEx() instead of the character classification macros such as _istalpha().
• Use CharUpper() and CharLower() instead of _toupper() and _tolower()s.
Open Interface API Reference | 6 - Alarm Viewer API | 197
Recommended Reading
Microsoft has several good papers on writing international code on its Developer Network DVD and its
web site. To find documentation on the web site, go to http://msdn.microsoft.com/default.asp and search
for MBCS.
• Schmitt, David A., International Programming for Microsoft® Windows®, ISBN 1-57231-956-9.
The CIMPLICITY Alarm Viewer API lets application programs access the functions of CIMPLICITY
software's Alarm Management Application Module. Using the API requires that you do the following:
As an aid in understanding how the CAmvConn uses the callback functions, this section gives a brief
description of the order and context of execution. The order provided here represents a very high-level
description of operation and includes only those details believed relevant to writing a custom alarm
viewer.
CALL DoConnectionFormed(context);
Call LostAM(context);
Call MaxAlarms(context);
ENDFOR
WHEN AMRP sends current alarms (in static AND dynamic mode)
CALL ClearDisp(context);
build AlarmInfo
ENDFOR
IF in dynamic mode
build AlarmInfo
CASE generate:
break;
CASE modify:
break;
CASE delete:
break
ENDSWITCH
ENDIF
The following is a list of all files distributed with the Alarm Management API. The files are loaded into
the directories indicated. The environment variable %BSM_ROOT% points to the base directory where
CIMPLICITY software was installed.
am_defs.h
am_errors.h
amaru_err.h
amaru_proto.h
cor.h
cor_event.h
cor_os.h
cor_stat.h
ddl.h
ipcerr.h
netcom.h
sc_recs.h
amvtest_exe.vcxproj
makefile
amvtest.h
main.cpp
amvtest.cpp
amaru.lib
cim_mf.lib
ddl.lib
corutil.lib
fasrtl.lib
ipc.lib
cim_sc.lib
Each CAmvConn instance can only communicate with one Alarm Manager (for one project) at a time.
However, your program can construct and maintain multiple CAmvConn objects to view alarms from
multiple projects at once.
CAmvConn Syntax
CAmvConn Syntax
CAmvConn(
void* who
RCM_ALARM_DATA *alarmData),
int alm_mod_action) = 0,
The following table summarizes the members of the constructor and their purpose:
Note that some functions are optional. If you do not need to implement an optional function, pass NULL
or 0 in place of its pointer.
Argu Description
ment
Open Interface API Reference | 6 - Alarm Viewer API | 201
Who This pointer is maintained but never used by the CAmvConn. Typically, this is a pointer to the
object which owns the CAmvConn instance. The callback functions can use this pointer to ac
cess members of the owner object.
DispFunc CAmvConn calls this function to notify the viewer of new alarm data.
ClearDisp CAmvConn calls this function when it removes all alarms from its local storage, for example
in preparations for receipt of a new static list of alarms. The viewer should remove all its lo
cally-maintained information about current alarms and typically clear the displayed list of
alarms.
LostAM CAmvConn calls this function when communication with the Alarm Manager (AM) is lost.
Max This is an optional function. CAmvConn calls this function in dynamic mode to query the viewer
Alarms about how many alarms it can handle. Typically, this routine returns a very large value.
SetDis CAmvConn calls this function with val set to FALSE before calling dispFunc, and again with val
playRe set to TRUE after calling dispFunc. Typically, when called with val set to TRUE, this function is
draw responsible for redrawing the alarm view or sending a message to the application to cause a
redraw.
Update CAmvConn calls this function to notify the viewer that the alarm count or date of last change
Count has changed.
DoRcm CAmvConn calls this function when a Remote Connection Manager error occurs. All local
Error ly-maintained information about alarms and the connection should be reset.
DoCon CAmvConn calls this function when the connection to the AMRP is complete. Due to the mul
nection ti-threaded nature of the CAmvConn processing, this can be some time after the CAmvConn con
Formed structor completes.
Notify CAmvConn calls this function in dynamic mode to notify the viewer when a new alarm has been
AlmGen generated or an existing alarm has been regenerated.
Notify CAmvConn calls this function in dynamic mode to notify the viewer of the change of state of an
AlmMod existing alarm (for example, when an alarm is acknowledged.)
CAmvConn calls this function in dynamic mode to notify the viewer when an alarm has been
deleted.
testContext Structure
Open Interface API Reference | 6 - Alarm Viewer API | 202
All of the callback functions take as their first argument a structure describing the context of the call:
struct testContext {
void *who
void *amapConn;
RCM_ALARM_DATA *alarmData);
SAmapCallbacks AmapCallbacks ;
};
The following table summarizes the fields on the testContext structure and their meaning:
Field Description
By casting the who pointer to the appropriate type, members of the owner class can be accessed. By
casting the amapConn pointer as a CAmvConn*, members of the connection can be accessed. For example:
_tprintf(_T("Project:\t%s\n"),
(CAmvConn*)(testContext->amapConn)->GetConnectedSystem());
Thus the same callback functions can be used to process all the connections for your viewer and can
determine which connection they are being called for through the amapConn pointer in the context.
SAmapCallbacks Structure
int alm_mod_action);
} SAmapCallbacks, *PSAmapCallbacks ;
The following table summarizes the fields on the SAmapCallbacks structure and their meaning:
Field Description
NotifyAlm Function to notify the viewer when a new alarm has been generated or an existing alarm
Gen has been regenerated.
NotifyAlm Function to notify the viewer of the change of state of an existing alarm.
Mod
NotifyAlm Function to notify the viewer when an alarm has been deleted.
Del
AlarmInfo Structure
Callback functions which must process alarm information also take a pointer to an AlarmInfo structure:
Open Interface API Reference | 6 - Alarm Viewer API | 204
struct AlarmInfo {
TCHAR systemName[RTR_SYSNAME_SIZE+1];
TCHAR classId[CLASS_ID_LEN+1];
TCHAR frId[FR_ID_LEN+1];
TCHAR alarmId[ALARM_ID_LEN+1];
COR_STAMP genTime;
TCHAR durationTime[COR_ASCII_TIME_LEN+1];
int numComments;
int numStacked;
TCHAR message[ALARM_MSG_LEN+1];
TCHAR action[2+1];
int state;
TCHAR stateStr[19+1];
TCHAR ackState[4+1];
COR_U1 fgColor;
COR_U1 bgColor;
int classOrder;
long *alarmRecord;
TCHAR del_opt[DEL_OPT_LEN+1];
TCHAR manual_clear_allowed;
COR_I4 seq_num;
COR_I4 generated_time;
COR_I4 cleared_time;
COR_BOOLEAN ConcedAlarm;
COR_I4 amrp_sync;
COR_I4 max_stacked;
TCHAR systemResId[FR_ID_LEN+1];
TCHAR alarm_description[SC_DESCRIPTION_LEN+1];
#if AI_PTRS
AM_STACKED_INFO *pstacked_info;
#else
AM_STACKED_INFO pstacked_info[AM_MAX_STACKED];
#endif
Open Interface API Reference | 6 - Alarm Viewer API | 205
COR_BOOLEAN info_inited;
#if AI_PTRS
AM_COMMENT2_INFO *pstacked_com;
#else
//AM_COMMENT2_INFO pstacked_com[AM_MAX_ALARM_COMMENTS];
#endif
COR_BOOLEAN comnt_inited;
TCHAR long_name[LONG_NAME_LEN+1];
};
Please note that this structure has some methods, and cannot be treated simply as a series of bytes; it
must be constructed and destructed appropriately.
The following table summarizes the fields on the AlarmInfo structure and their meaning:
Field Description
AlarmId The alarm's ID. This value should not be printed, use long_name.
StateStr The string representing the current state of the alarm: "Alarm" or "Normal."
Open Interface API Reference | 6 - Alarm Viewer API | 206
Field Description
Amrp_sync Time the AMRP sent the alarm to the Alarm Viewer.
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.
When you run the demo program, it requests class, resource and alarm data from the AMRP, then displays
the requested information.
This will ensure that your environment variables (in particular %BSM_ROOT% and %SITE_ROOT%)
are set correctly.
cd <drive>
cd %BSM_ROOT%\api
3. If the environment variables are not set automatically, issue the following command to set them:
devenv CimplicityAPI.sln
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>
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.
File Description
CAmvTest The viewer class. It has a alarm manager connection object (CAmvConn) as
one of its members and member functions which are used as AMV API call
back functions.
Member Description
File Description
RunTest - The "main program" for the class. It forms a connection, prints the
class and resource filters, requests alarms, prints current alarms, and, for dy
namic mode, sits waiting for alarm updates from AMRP.
CAlarm- A class derived from MFC's CPtrList. It is used by CAmvTest to store alarms.
List
The CAlarmList class depends on CPtrList for most of its functionality. See the
Microsoft Visual C++ documentation for more information on CPtrList meth
ods. CAlarmList adds methods for functions specific to the alarm viewer appli
cation:
The CAlarmList class depends on CPtrList for most of its functionality. See the
Microsoft Visual C++ documentation for more information on CPtrList meth
ods. CAlarmList adds methods for functions specific to the alarm viewer appli
cation:
Member Description
File Description
Main.cpp A short program that creates an instance of one of the objects and executes it's test
method.
CAlarm- A class derived from MFC's CPtrList. It is used by CAmvTest to store alarms.
List
The CIMPLICITY Alarm Viewer API lets application programs access the functions of CIMPLICITY
software's Alarm Management Application Module.
• CAmvAlarm Class
• CAmvClassFilter
• CAmvClassFilterList
• CAmvConn
• CAmvFieldFilter
• CAmvFieldFilterList
• CAmvResourceFilter
• CAmvResourceFilterList
• CAmvSetupList
• CAmvStateFilter
• CAmvStateFilterList
• CAmvTimeFilter
CAmvAlarm
CAmvAlarm Class
Each alarm generated in the CIMPLICITY system is represented by an instance of the CAmvAlarm class. The
alarm has a number of properties including:
Open Interface API Reference | 6 - Alarm Viewer API | 211
• An indication of the static severity of the alarm. Standard classes are HIGH, MEDIUM, and LOW
• The resource for the point or device which the alarm is for
• The times the alarm was generated and cleared
• Under what circumstances the alarm may be deleted from the database
• An indication of whether or not the alarm may be manually cleared
• Help file name - Alarms may have help files which can be displayed to operators to aid in resolving
the problem which caused the alarm
• Number of stacked instances of this alarm
Note:
A number of AMV API routines return pointers to CAmvAlarm objects. You should never need to
create one in your application.
The following class definition represents the CAmvAlarm class. For clarity, it has been simplified from the
actual class definition. All the user-accessible members are listed.
class CAmvAlarm {
public:
};
Open Interface API Reference | 6 - Alarm Viewer API | 212
The following table briefly describes the members of the CAmvAlarm class. The sections that follow go into
detail of the syntax and semantics of using the members.
Member Description
Amrp_ The time the AMRP sent the alarm to the viewer.
sync
Amrp_ The difference between the time the AMRP sent the alarm and the time the AMV received
sync_ the alarm. Assuming staticly fast inter-process communication, this is the number of sec
offset onds difference between the clocks on the systems where the AMRP and viewer reside.
CAmvAlarm::amrp_sync
This field contains the time the AMRP sent the alarm to the viewer.
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->amrp_sync;
Data Type
COR_I4
Example
This example calculates the number of hours and minutes an alarm was or has been in alarm state.
COR_I4 duration;
COR_I4 minutes;
COR_I4 seconds;
long ourtime;
cor_time_get_current_local(&ourtime);
if (alarm_ptr->cleared_time == 0)
duration = ourtime +
alarm_ptr->amrp_sync_offset -
alarm_ptr->generated_time;
else
duration = alarm_ptr->cleared_time -
alarm_ptr->generated_time;
See Also
CAmvAlarm::amrp_sync_offset
This field contains the difference between the time the AMRP sent the alarm and the time the alarm
viewer received the alarm.
Open Interface API Reference | 6 - Alarm Viewer API | 214
Assuming staticly fast inter-process communication, this is the number of seconds difference between
the clocks on the systems where the AMRP and viewer reside.
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->amrp_sync_offset;
Data Type
COR_I4
See Also
CAmvAlarm::Class()
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->Class();
Data Type
CAmvClassFilter*
Example
CAmvAlarm* alarm_ptr;
TCHAR id_buf[CLASS_ID_LEN+1];
alarm_ptr->ID(),
alarm_ptr->Class()->ID(id_buf));
See Also
CAmvAlarm::cleared_time
Open Interface API Reference | 6 - Alarm Viewer API | 215
Comments
If the alarm has not been cleared, this field contains a zero (0).
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->cleared_time;
Data Type
COR_I4
Example
This example calculates the number of hours and minutes an alarm was or has been in alarm state.
COR_I4 duration;
COR_I4 minutes;
COR_I4 seconds;
long ourtime;
cor_time_get_current_local(&ourtime);
if (alarm_ptr->cleared_time == 0)
duration = ourtime +
alarm_ptr->amrp_sync_offset -
alarm_ptr->generated_time;
else
duration = alarm_ptr->cleared_time -
alarm_ptr->generated_time;
See Also
CAmvAlarm::curr_comment
Comments
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->curr_comment;
Data Type
COR_I4
Example
This example enables or disables a button to display operator comments based on the presence of
comments for the alarm.
CAmvAlarm* alarm_ptr;
int i;
if (alarm_ptr->curr_comment > 0) {
EnableCommentButton();
} else {
DisableCommentButton();
See Also
CAmvAlarm::curr_stacked
If an alarm happens multiple times before it is acknowledged by an operator, the instances of the alarm
may be "stacked" so that the history of the alarm may be viewed.
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->curr_stacked;
Open Interface API Reference | 6 - Alarm Viewer API | 217
Data Type
COR_I1
Example
This example prints an alarm messages and, if there are any stacked alarms, it prints the number of
stacked alarm instances.
CAmvAlarm* alarm_ptr;
_tprintf(_T("%s"), alarm_ptr->->stacked_data[0].alarm_msg);
if (alarm_ptr->curr_stacked > 1) {
_tprintf(_T("\n"));
See Also
CAmvAlarm::DeleteOptions()
This field contains the criteria for deleting an alarm instance. The criteria can be one or both of the
following:
Comments
• Alarms are deleted only if they meet the specified deletion criteria. The criteria are that the alarm
has been cleared (returned to normal state) or acknowledged.
• An alarm with delete options of AM_ACK_CHAR (acknowledged) is deleted when the operator
acknowledges it, even if it has not been cleared.
• An alarm with delete options of AM_CLR_CHAR (cleared) is automatically deleted when it clears
even if it has not been acknowledged.
• An alarm with delete options of AM_ACK_CHAR and AM_CLR_CHAR must be cleared and
acknowledged before it can be deleted.
Open Interface API Reference | 6 - Alarm Viewer API | 218
Syntax
CAmvAlarm* alarm_ptr
alarm_ptr->DeleteOptions()
Data Type
TCHAR*
Example
This example sets a verbose prompt for the user to tell them what the deletion requirements are.
Requirement = CAmvStateFilter::ack_clear_msg();
else if
Requirement = CAmvStateFilter::ack_only_msg();
else if
Requirement = CAmvStateFilter::clear_only_msg();
See Also
CAmvAlarm::generated_time
Comments
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->generated_time;
Open Interface API Reference | 6 - Alarm Viewer API | 219
Data Type
COR_I4
Example
This example calculates the number of hours and minutes an alarm was or has been in alarm state.
COR_I4 duration;
COR_I4 minutes;
COR_I4 seconds;
long ourtime;
cor_time_get_current_local(&ourtime);
if (alarm_ptr->cleared_time == 0)
duration = ourtime +
alarm_ptr->amrp_sync_offset -
alarm_ptr->generated_time;
else
duration = alarm_ptr->cleared_time -
alarm_ptr->generated_time;
See Also
CAmvAlarm::ID(id_buf)
This field contains the pointer to the buffer that contains the Alarm ID string.
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->ID(TCHAR* id_buf);
Data Type
TCHAR*
Example
Open Interface API Reference | 6 - Alarm Viewer API | 220
CAmvAlarm* alarm_ptr;
TCHAR id_buf[ALARM_ID_LEN+1];
_tprintf(_T("%s\n"), alarm_ptr->ID(id_buf);
CAmvAlarm::ManualClearAllowed()
This field indicates whether an operator can reset this alarm from the Alarm Viewer display. It contains
one of the following values:
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->ManualClearAllowed();
Data Type
COR_BOOLEAN
Example
if (!alarm_ptr->ManualClearAllowed()) {
CAmvAlarm::max_stacked
This field contains the maximum number of alarms that can be stacked.
Syntax
CAmvAlarm* alarm_ptr;
alarm_ptr->max_stacked;
Open Interface API Reference | 6 - Alarm Viewer API | 221
Data Type
COR_I4
CAmvAlarm::stacked_com
Each AM_COMMENT_INFO structure records a comment entered for an alarm by a user along with the
time the comment was generated.
The number of comments currently associated with the alarm is found in CAmvAlarm::curr_comment.
Syntax
AM_COMMENT_INFO stacked_com[AM_MAX_ALARM_COMMENTS];
Data Type
typedef struct am_comment_info {
COR_STAMP gentime;
TCHAR alarm_comment[AM_COMMENT_LEN+1];
} AM_COMMENT_INFO;
Example
This example prints the comments for an alarm and the time the comments were created.
CAmvAlarm* alarm_ptr;
int i;
_tprintf(_T("%ld %ld\t%s"),
alarm_ptr->stacked_com[i].genTime.yyyymmdd,
alarm_ptr->stacked_com[i].genTime.hhmmsstt,
alarm_ptr->stacked_com[i].alarm_comment);
See Also
CAmvAlarm::stacked_data
Each AM_STACKED_INFO structure records the generation time, current alarm state, and alarm message
for an instance of the alarm.
The number of instances currently associated with the alarm is found in CAmvAlarm::curr_stacked.
Comments
Syntax
AM_STACKED_INFO stacked_data[AM_MAX_STACKED+1
Data Type
typedef struct am_stacked_info {
COR_STAMP gentime;
AM_STATE_TYPE alarm_state;
TCHAR alarm_msg[ALARM_MSG_LEN+1];
} AM_STACKED_INFO;
Example
This example prints the stacked instances for an alarm and the time the instances occurred.
CAmvAlarm* alarm_ptr;
int i;
_tprintf(_T("%ld %ld\t%s"),
alarm_ptr->stacked_data[i].genTime.yyyymmdd,
alarm_ptr->stacked_data[i].genTime.hhmmsstt,
alarm_ptr->stacked_data[i].alarm_msg);
See Also
Open Interface API Reference | 6 - Alarm Viewer API | 223
CAmvClassFilter
CAmvClassFilter
A CAmvClassFilter controls whether alarms of the corresponding class will be passed from AMRP to the
viewer.
The following class definition represents the CAmvClassFilter class. For clarity, it has been simplified from
the actual class definition. All the user-accessible members are listed.
class CAmvClassFilter {
public:
};// CAmvClassFilter
The following table briefly describes the members of the CAmvClassFilter class. The sections that follow
go into detail of the syntax and semantics of using the members.
Member Description
Open Interface API Reference | 6 - Alarm Viewer API | 224
Disable() Don't have AMRP send alarms for this class to the viewer
Enable() Have AMRP send alarms for this class to the viewer
IsEnabled() Will alarms for this class be sent to the viewer by the AMRP
CAmvClassFilter::class_ack_bg
This member specifies the background color for alarms that are in the acknowledged state.
Comments
Syntax
CAmvClassFilter* class_ptr;
class_ptr->class_ack_bg;
Data Type
COR_I2
CAmvClassFilter::class_ack_fg
This member specifies the foreground color for alarms which are in the acknowledged state.
Open Interface API Reference | 6 - Alarm Viewer API | 225
Comments
Syntax
CAmvClassFilter* class_ptr;
class_ptr->class_ack_fg;
Data Type
COR_I2
CAmvClassFilter::class_alarm_bg
This member specifies the background color for alarms which are in the alarm state.
Comments
Syntax
CAmvClassFilter* class_ptr;
class_ptr->class_alarm_bg;
Data Type
COR_I2
CAmvClassFilter::class_alarm_fg
This member specifies the foreground color for alarms which are in the alarm state.
Comments
Syntax
CAmvClassFilter* class_ptr;
class_ptr->class_alarm_fg;
Data Type
COR_I2
CAmvClassFilter::class_normal_bg
This member specifies the background color for alarms that are in the normal state.
Comments
Syntax
CAmvClassFilter* class_ptr;
class_ptr->class_normal_bg;
Data Type
COR_I2
CAmvClassFilter::class_normal_fg
This member specifies the foreground color for alarms that are in the normal state.
Comments
Syntax
CAmvClassFilter* class_ptr;
class_ptr->class_normal_fg;
Open Interface API Reference | 6 - Alarm Viewer API | 227
Data Type
COR_I2
CAmvClassFilter::class_order
The static priority of the alarm class. Zero is the highest priority.
Comments
Syntax
CAmvClassFilter* class_ptr;
class_ptr->class_order;
Data Type
int
CAmvClassFilter::class_title
The alarm class description as configured in Alarm Classes from the Workbench.
Comments
Syntax
CAmvClassFilter* class_ptr;
class_ptr->class_title;
Data Type
TCHAR[CLASS_TITLE_LEN+1]
Example
This example prints the ID and description of all the alarm classes for which alarms will be displayed.
CAmvConn* AmvConn;
CAmvClassFilter* class_ptr;
TCHAR id_buf[CLASS_ID_LEN+1];
Open Interface API Reference | 6 - Alarm Viewer API | 228
class_ptr != NULL;
class_ptr = AmvConn->ClassFilters->Next(class_ptr)) {
if (class_ptr->IsEnabled()) {
_tprintf(_T("%s\t%s\n"),
class_ptr->ID(id_buf),
class_ptr->class_title);
CAmvClassFilter::Disable()
Disable the alarm class filter so that AMRP does not send alarms of this class to the viewer.
Syntax
CAmvClassFilter* class_ptr;
class_ptr->Disable();
Data Type
void
See Also
CAmvClassFilter::Enable()
Enable the alarm class filter so that AMRP sends alarms of this class to the viewer.
Syntax
CAmvClassFilter* class_ptr;
class_ptr->Enable();
Data Type
void
Open Interface API Reference | 6 - Alarm Viewer API | 229
See Also
CAmvClassFilter::ID()
Retrieves the class ID for the alarm class and puts it in the user-supplied buffer. Returns a pointer to that
buffer.
Syntax
CAmvClassFilter* class_ptr;
TCHAR id_buf[CLASS_ID_LEN+1];
class_ptr->ID(id_buf);
Data Type
TCHAR*
CAmvClassFilter::IsEnabled()
Returns TRUE if alarms for this class will be sent to the viewer, FALSE otherwise.
Syntax
CAmvFilter* filter_ptr;
filter_ptr->IsEnabled()
Data Type
BOOL
CAmvClassFilterList
CAmvClassFilterList
The CAmvClassFilterList class provides methods to loop through all the class filters currently in use.
The list is built from data supplied by the AMRP. Filters cannot be added to, or removed from, the list.
Open Interface API Reference | 6 - Alarm Viewer API | 230
class CAmvClassFilterList {
public:
COR_STATUS* ret_stat);
};
The following table briefly describes the members of the CAmvClassFilterList class. The sections that
follow go into detail of the syntax and semantics of using the members.
Member Description
CAmvClassFilterList::First()
If the filter list or the connection is in an invalid state, the return value is NULL and the ret_stat->status is
COR_FAILURE.
Syntax
CAmvClassFilter* class_ptr;
CAmvClassFilterList* class_list;
class_ptr = class_list->First(&ret_stat);
Data Type
CAmvClassFilter*
Open Interface API Reference | 6 - Alarm Viewer API | 231
Example
CAmvConn* AmvConn;
CAmvClassFilter* class_ptr;
TCHAR id_buf[CLASS_ID_LEN+1];
class_ptr = AmvConn->ClassFilters->Next(class_ptr,
&ret_stat))
_tprintf(_T("%s\n"), class_ptr->ID(id_buf));
See Also
CAmvClassFilterList::Next()
Syntax
CAmvClassFilter* class_ptr;
CAmvClassFilterList* class_list;
Data Type
CAmvClassFilter*
See Also
CAmvConn
CAmvConn
The connection between an alarm viewer and the Alarm Manager is implemented via the CAmvConn class.
When you create a new instance of this class, you provide a number of call-back functions which are
called in response to events such as new data from the Alarm Manager or loss of connection.
The following class definition represents the CAmvConn class. For clarity, it has been simplified from the
actual class definition. All the user-accessible members are listed.
class CAmvConn {
public:
CAmvConn(
void* who
int val),
RCM_ALARM_DATA *alarmData),
int alm_mod_action) = 0,
~CAmvConn();
Open Interface API Reference | 6 - Alarm Viewer API | 233
/* Connection management */
void SetAction (on page 245) (const AlarmInfo *pAI, const TCHAR *action,
COR_STATUS *ret_stat);
COR_STATUS* ret_stat);
TCHAR **ackState);
TCHAR *str),
void *helpText,
COR_STATUS *ret_stat);
/* Setup management */
/* Mode control */
AM_FILTER_TYPE PrimaryFilter;
CAmvFieldFilterList* FieldFilters;
};//CAmvConn
Member Description
CAmvConn() The constructor for the class. You must provide pointers to call-back functions for
various events.
ClassFilters A pointer to a CAmvClassFilterList which can be used to work with class filters for
the connection.
ConfigurationAl Returns TRUE if the user is allowed to create, modify, or delete viewer setups.
lowed
FieldFilters A pointer to a CAmvFieldFilterList which can be used to work with field filters for
the connection.
GetConnectedSys Get the name of the project the connection is talking to.
tem()
ResourceFilters A pointer to a CAmvResourceFilterList which can be used to work with resource fil
ters for the connection.
Open Interface API Reference | 6 - Alarm Viewer API | 235
Member Description
SetAction() Mark the alarm with up to two actions to be sent to AMRP the next time Update-
List() is called.
SetStateInfo() Get the state and acknowledgment strings from a numeric alarm state.
Setups A pointer to a CAmvSetupList object which can be used to create, edit, activate,
and save viewer setups for the connection.
ShouldReconnect() TRUE if the connection should try to reestablish communication if they are lost.
StateFilters A pointer to a CAmvStateFilterList which can be used to work with alarm state fil
ters for the connection.
TimeFilter A pointer to a CAmvTimeFilter which can be used to control the time filtering of
alarms for the connection.
CAmvConn::AddComment()
Send a new alarm comment to the AMRP. On return, ret_stat->status is COR_SUCCESS if no errors were
encountered.
Syntax
void AddComment(const AlarmInfo *pAI, LPCTSTR comment,
COR_STATUS* ret_stat);
Data Type
void
Open Interface API Reference | 6 - Alarm Viewer API | 236
Example
COR_STATUS ret_stat;
if(ret_stat.status == COR_SUCCESS) {
ListComments();
} else {
MessageBox(IDS_ERRLOSTAM);
CAmvConn::AMAP_CONNECT
Syntax
enum AMAP_CONNECT { NOT_CONNECTED, CONNECTED, RESYNCING };
See Also
CAmvConn::BreakConnection()
Comments
Call this class member to break, and possibly reestablish, a connection to the AMRP when a
communication error is detected.
Syntax
CAmvConn* amvConn;
amvConn->BreakConnection()
Open Interface API Reference | 6 - Alarm Viewer API | 237
Data Type
void
CAmvConn::CAmvConn()
Construct a new alarm management connection and provide callback functions to be called as events
occur.
Comments
Much of the work of the Alarm Viewer is done through the callback functions. Depending on application
requirements, the callbacks can directly handle the event or send messages so that the event is handled
in the main message loop of the program.
Syntax
CAmvConn(
void* who
int val),
RCM_ALARM_DATA *alarmData),
int state),
int alm_mod_action) = 0,
Data Types
CAmvConn uses the textContext (on page 201), SAmapCallbacks (on page 203), and AlarmInfo (on
page 203) structures.
See Also
CAmvConn::ClassFilters
Through this pointer, the individual class filters for the connection may be accessed.
Syntax
CAmvConn* amvConn;
CAmvClassFilterList* ClassFilters;
ClassFilters = amvConn->ClassFilters;
Data Type
CAmvClassFilterList*
See Also
CAmvConn::ConfigurationAllowed()
Returns TRUE if the user is allowed to create, modify, or delete viewer setups.
Syntax
CAmvConn* amvConn;
amvConn->ConfigurationAllowed()
Data Type
BOOL
CAmvConn::DeleteAllowed()
Open Interface API Reference | 6 - Alarm Viewer API | 239
Syntax
CAmvConn* amvConn;
amvConn->DeleteAllowed()
Data Type
BOOL
CAmvConn::FieldFilters()
Syntax
CAmvConn* amvConn;
CAmvFieldFilterList* FieldFilters;
FieldFilters = amvConn->FieldFilters;
Data Type
CAmvFieldFilterList*
CAmvConn::FormConnection()
Syntax
void FormConnection(LPCTSTR project, COR_STATUS* ret_stat)
Data Type
void
Example
This example allocates and initializes a new connection object then tries to connect to a project.
COR_STATUS ret_stat;
S_CallbackAddAlarm,
S_CallbackResetContent,
Open Interface API Reference | 6 - Alarm Viewer API | 240
S_CallbackLostAM,
S_MaxAlarms,
S_SetDisplayRedraw,
S_UpdateCount,
S_DoRcmError,
S_DoConnectionFormed,
S_CallbackNotifyAlmGen,
S_CallbackNotifyAlmMod,
S_CallbackNotifyAlmDel);
amvConn->FormConnection(project, &ret_stat);
if(retstat.status != COR_SUCCESS) {
delete amvConn;
MessageBox(ret_stat.err_msg);
return;
See Also
CAmvConn::GetConnectedSystem()
Syntax
LPCTSTR GetConnectedSystem()
Data Type
LPCTSTR
Example
CAmvConn* amvConn;
_tprintf(_T("Connected to %s\n"),
amvConn->GetConnectedSystem());
Open Interface API Reference | 6 - Alarm Viewer API | 241
See Also
CAmvConn::IsAlarmManagerConnected()
Syntax
IsAlarmManagerConnected()
Data Type
BOOL
CAmvConn::IsConnected()
Syntax
AMAP_CONNECT IsConnected();
Data Type
enum AMAP_CONNECT { NOT_CONNECTED, CONNECTED, RESYNCING };
Example
TCHAR StatusString[16];
switch (IsConnected()) {
case NOT_CONNECTED:
break;
case CONNECTED:
strcpy(StatusString, "Connected");
break;
case RESYNCING:
Open Interface API Reference | 6 - Alarm Viewer API | 242
strcpy(StatusString, "Resyncing");
break;
CAmvConn::OperHelpRequest()
Display operator help for an alarm. The AddHelpLine() callback function gets called for each line in the
help file. It is passed the helpText pointer in arg and a pointer to the line of help text in str.
Syntax
void OperHelpRequest(TCHAR *alarmId,
TCHAR *str),
void *helpText,
COR_STATUS *ret_stat);
Data Type
void
Example
box->AddString(str);
CAmvAlarm* alarm_ptr;
TCHAR id_buf[ALARM_ID_LEN+1];
CListBox HelpText;
amvConn->OperHelpRequest(alarm_ptr->ID(id_buf),
S_AddHelpLine,
(void *)HelpText,
&ret_stat);
Open Interface API Reference | 6 - Alarm Viewer API | 243
CAmvConn::PrimaryFilter()
Returns the type of sorting currently being used by AMRP when sending static alarm lists.
Syntax
AM_FILTER_TYPE PrimaryFilter()
Data Type
typedef int AM_FILTER_TYPE;
CAmvConn::RequestAlarms()
Syntax
RequestAlarms(COR_STATUS *ret_stat);
Data Type
void
Example
ResetAlarmList();
amvConn->RequestAlarms(&ret_stat);
if (ret_stat.status != COR_SUCCESS) {
MessageBox(IDS_ERRLOGMSG);
}
Open Interface API Reference | 6 - Alarm Viewer API | 244
CAmvConn::ResetConnection()
This method cleans up the connection when communication is lost or when the CAmvConn is deleted.
Syntax
CAmvConn* amvConn;
amvConn->ResetConnection()
Data Type
void
Example
amvConn->ResetConnection();
CAmvConn::ResourceFilters
Through this pointer, the individual resource filters for the connection may be accessed.
Syntax
CAmvConn* amvConn;
CAmvResourceFilterList* ResourceFilters;
ClassFilters = amvConn->ResourceFilters;
Data Type
CAmvResourceFilterList*
See Also
CAmvConn::ResumeDynamic()
Comments
When the viewer is showing the user modal dialogs like property sheets for setup parameters, dynamic
updates should be suspended.
Syntax
ResumeDynamic(COR_STATUS *ret_stat);
Data Type
void
Example
if (IsStatic()) {
EditSetups()
else
amvConn->SuspendDynamic();
EditSetups();
amvConn->ResumeDynamic();
See Also
CAmvConn:SetAction()
Mark the alarm with up to two actions to be sent to the AMRP the next time UpdateList() is called.
Comments
Up to two actions may be set in a two-character string. The valid characters are:
Open Interface API Reference | 6 - Alarm Viewer API | 246
Clearing an alarm requires that the user be allowed to manually clear alarms. This may be checked with
CAmvAlarm::ManualClearAllowed().
Deleting an alarm requires that the user be allowed to manually delete alarms. This may be checked with
CAmvAlarm::DeleteAllowed().
Syntax
SetAction(const AlarmInfo *pAI, const TCHAR *action,
COR_STATUS *ret_stat);
Data Type
void
Example
TCHAR action[3];
if (amvConn->DeleteAllowed())
action[0] = AM_DEL_CHAR;
amvConn->UpdateList(&status);
return TRUE;
else
return FALSE;
Open Interface API Reference | 6 - Alarm Viewer API | 247
See Also
(When change approval is required) Mark the alarm with up to two actions to be sent to the AMRP the
next time UpdateList() is called.
Comments
Up to two actions may be set in a two-character string. The valid characters are:
Clearing an alarm requires that the user be allowed to manually clear alarms. This may be checked with
CAmvAlarm::ManualClearAllowed() .
Deleting an alarm requires that the user be allowed to manually delete alarms. This may be checked with
CAmvAlarm::DeleteAllowed() .
Syntax
SetAction(const AlarmInfo *pAI, const TCHAR *action,
Data Type
void
Example
Open Interface API Reference | 6 - Alarm Viewer API | 248
TCHAR action[3];
ALARM_CA_ALARM_OPER_REQ caInfo;
if (amvConn->DeleteAllowed())
action[0] = AM_DEL_CHAR;
if(AMValarmInfo->GetChangeApprovalInfo())
Else
amvConn->UpdateList(&status);
return TRUE;
else
return FALSE;
CAmvConn::SetPrimaryFilter
Set the sort order for alarm lists coming from AMRP.()
Comments
This controls the order of alarms as provided to the DispFunc() callback. In some cases, it may be better
to not worry about sorting in the connection and to let the display list do the sorting.
A change in sort order will not take place until Setups->FilterSetup() is called.
Syntax
SetPrimaryFilter(AM_FILTER_TYPE type)
Data Type
void
CAmvConn::SetStateInfo()
Get the alarm state and acknowledge state strings from the numeric state.
Syntax
SetStateInfo(AM_STATE_TYPE alarmState, TCHAR **state,
TCHAR **ackState);
Data Type
void
CAmvConn::SetToDynamic()
Set the connection to dynamic mode so alarm events are sent by AMRP as they occur.
Comments
In dynamic mode, each alarm event (generate, acknowledge, clear) is sent as it occurs and the connection
calls the Notify callbacks.
Open Interface API Reference | 6 - Alarm Viewer API | 250
Syntax
amvConn->SetToDynamic(COR_STATUS *ret_stat);
Data Type
void
CAmvConn::SetToStatic()
Set the connection to static mode so that alarm updates are only sent by AMRP in response to
RequestAlarms() calls.
Syntax
amvConn->SetToStatic(COR_STATUS *ret_stat);
Data Type
void
CAmvConn::SetupList()
Comments
Retrieving saved setups can be time consuming because of the inter-process communication and disk
access involved, and because of the potentially large amount of data exchanged. Therefore, setups are
not retrieved until they are requested with this function. CAmvConn::SetupList() must be called for the
connection before the CAmvSetupList member functions of the CAmvConn::Setups are called.
Syntax
CAmvConn* amvConn;
amvConn->SetupList(COR_STATUS *ret_stat);
Data Type
void
Example
Open Interface API Reference | 6 - Alarm Viewer API | 251
Retrieve saved setups from AMRP and print the setup IDs.
CAmvConn* amvConn;
int I;
amvConn->SetupList();
_tprintf(_T("%s\n"), amvConn->Setups->Setup(i));
See Also
CAmvConn::Setups
Use this pointer to access the saved Alarm Viewer setups for the connection. CAmvConn::SetupList()
must be called for the connection before the CAmvSetupList member functions of the
CAmvConn::Setups are called.
Syntax
CAmvConn* amvConn;
CAmvSetupList* amvSetups;
amvSetups = amvConn->Setups;
Data Type
CAmvSetupList*
Example
Load a setup, save it under a new ID, and make it the default.
CAmvConn* amvConn;
amvConn->Setups->DoLoad(setup_id, &ret_stat);
amvConn->Setups->Update(new_setup_id);
amvConn->Setups->DoSave(new_setup_id, &ret_stat);
amvConn->Setups->DoSetD(new_setup_id, &ret_stat);
amvConn->Setups->FilterSetup();
Open Interface API Reference | 6 - Alarm Viewer API | 252
See Also
CAmvConn::ShouldReconnect()
Syntax
ShouldReconnect()
Data Type
BOOL
Example
if(amvConn->ShouldReconnect())
tryReconnect = TRUE;
ResetConnectionDisplay(amvConn);
if(!tryReconnect)
amvConn->SetStateString(IDS_LOSTSERVER);
CAmvConn::StateFilters
Through this pointer, the individual state filters for the connection may be accessed.
Open Interface API Reference | 6 - Alarm Viewer API | 253
Syntax
CAmvConn* amvConn;
CAmvStateFilterList* StateFilters;
StateFilters = amvConn->StateFilters
Data Type
CAmvStateFilter*
See Also
CAmvConn::SuspendDynamic()
Syntax
SuspendDynamic(COR_STATUS *ret_stat);
Data Type
void
Example
if (IsStatic()) {
EditSetups()
else
amvConn->SuspendDynamic();
EditSetups();
amvConn->ResumeDynamic();
See Also
Open Interface API Reference | 6 - Alarm Viewer API | 254
CAmvConn::TimeFilter
A pointer to the time filter which restricts what alarms are sent from AMRP to the viewer.
Syntax
CAmvConn* amvConn;
CAmvTimeFilter* TimeFilter;
TimeFilter = amvConn->TimeFilter;
Data Type
CAmvTimeFilter*
Example
amvConn->TimeFilter->Enable();
See Also
CAmvConn::UpdateList()
Syntax
CAmvConn* amvConn;
amvConn->UpdateList(COR_STATUS* ret_stat)
Data Type
void
Open Interface API Reference | 6 - Alarm Viewer API | 255
See Also
CAmvFieldFilter
CAmvFieldFilter
A CAmvFieldFilter controls whether alarms that match the field filter will be passed from AMRP to the
viewer.
The following class definition represents the CAmvFieldFilter class. For clarity, it has been simplified from
the actual class definition. All the user-accessible members are listed.
class CAmvFieldFilter {
public:
AM_FIELD_ID field_id;
AM_FIELD_FILTER_TYPE type;
TCHAR filter_string[ALM_SETUP_FF_LEN+1];
};// CAmvFieldFilter
The following table briefly describes the members of the CAmvFieldFilter class. The sections that follow
provide details about the syntax and semantics of using the members.
Member Description
filter_ The text string that will be used to perform the match.
string
CAmvFieldFilter::field_id
Open Interface API Reference | 6 - Alarm Viewer API | 256
This member specifies the ID of the field that will be checked for a match.
Comments
#define AM_FF_FIELD_UNUNSED 0
#define AM_FF_FIELD_ALARM_ID 1
#define AM_FF_FIELD_ALARM_MSG 2
#define AM_FF_FIELD_ALARM_DESCRIPTION 3
Syntax
CAmvFieldFilter* field_filter;
field_filter->field_id = AM_FF_FIELD_ALARM_ID;
Data Type
COR_U1
CAmvFieldFilter::type
Comments
The following values indicate the type of match that will be performed:
#define AM_FF_MATCH_TYPE_SUBSTRING 0
#define AM_FF_MATCH_TYPE_WILDCARD 1
Syntax
CAmvFieldFilter* field_filter;
field_filter->type = AM_FF_MATCH_TYPE_REGEX;
Data Type
COR_U1
CAmvFieldFilter::filter_string
This member specifies the text string that will be used to perform the match.
Open Interface API Reference | 6 - Alarm Viewer API | 257
Comments
This is the string used in the match. All matches ignore case.
AM_FF_MATCH_TYPE_SUBSTRING - For this type, the string has to match part of the target string.
AM_FF_MATCH_TYPE_WILDCARD - For this type, the string has to exactly match the target string using * and ? as wildcard
characters.
AM_FF_MATCH_TYPE_REGEX - For this type, the string has to exactly match the target string using an ECMAScript-compliant
regular expression.
Syntax
CAmvFieldFilter* field_filter;
_tcscpy(field_filter->filter_string, _T("*ID*"));
Data Type
TCHAR
CAmvFieldFilterList
CAmvFieldFilterList
The CAmvFieldFilterList class provides methods to loop through all the field filters currently in use. The
list is built from data supplied by AMRP.
public:
void RemoveAllFieldFilters();
};// CAmvFieldFilterList
The following table briefly describes the members of the CAmvFieldFilterList class. The sections that
follow provide details about the syntax and semantics of using the members.
Member Description
CAmvFieldFilterList::First()
This member returns a pointer to the first field filter in the list. If the filter list or the connection is in an
invalid state, the return value is NULL and ret_stat->status is COR_FAILURE.
Syntax
CAmvFieldFilter* field_ptr;
CAmvFieldFilterList* field_list;
field_ptr = field_list->First(&ret_stat);
Data Type
CAmvFieldFilter*
Example
COR_STATUS ret_stat;
CAmvConn* AmvConn;
CAmvFieldFilter* field_ptr;
Open Interface API Reference | 6 - Alarm Viewer API | 259
field_ptr = AmvConn->FieldFilters->First(&ret_stat);
AmvConn->FieldFilters->RemoveFieldFilter(field_ptr);
CAmvFieldFilterList::Next()
This member returns a pointer to the next field filter in the list.
Syntax
CAmvFieldFilter* field_ptr;
CAmvFieldFilterList* field_list;
Data Type
CAmvFieldFilter*
CAmvFieldFilterList::AddFieldFilter()
Syntax
AM_FIELD_ID field_id;
AM_FIELD_FILTER_TYPE filter_type;
LPCTSTR filter_string;
CAmvFieldFilter* field_ptr;
CAmvFieldFilterList* field_list;
Data Type
CAmvFieldFilter*
Example
CAmvConn* AmvConn;
CAmvFieldFilter* field_ptr;
CAmvFieldFilterList::RemoveFieldFilter()
This member removes the specified field filter from the list and frees the record.
This procedure will break the First/Next traversal, so do not perform it as part of a First/Next loop.
Syntax
CAmvFieldFilter* field_ptr;
CAmvFieldFilterList* field_list;
field_list->RemoveFieldFilter(field_ptr);
Data Type
void
Example
COR_STATUS ret_stat;
CAmvConn* AmvConn;
CAmvFieldFilter* field_ptr;
field_ptr = AmvConn->FieldFilters->First(&ret_stat);
AmvConn->FieldFilters->RemoveFieldFilter(field_ptr);
CAmvFieldFilterList::RemoveAllFieldFilters()
This member removes all field filters from the list and frees the record.
Syntax
CAmvFieldFilterList* field_list;
field_list->RemoveFieldFilter();
Data Type
void
Example
CAmvConn* AmvConn;
AmvConn->FieldFilters->RemoveAllFieldFilters(field_ptr);
CAmvResourceFilter
CAmvResourceFilter
The CAmvResourceFilter class controls whether alarms with the corresponding resource will be passed
from AMRP to the viewer.
The following class definition represents the CAmvResourceFilter class. For clarity, it has been simplified
from the actual class definition. All the user-accessible members are listed.
class CAmvResourceFilter {
public:
};// CAmvResourceFilter
The following table briefly describes the members of the CAmvResourceFilter class. The sections that
follow go into detail about the syntax and semantics of using the members.
Member Description
Disable() Don't have AMRP send alarms for this resource to the viewer
Enable() Have AMRP send alarms for this resource to the viewer
ID() Resource ID
IsEnabled() Will alarms for this resource be sent to the viewer by the AM
RP
Open Interface API Reference | 6 - Alarm Viewer API | 262
CAmvResourceFilter::Disable()
Disables the resource filter so that AMRP does not send alarms for this resource to the viewer.
Syntax
CAmvResourceFilter* resource_ptr;
resource_ptr->Disable();
Data Type
void
See Also
CAmvResourceFilter::Enable()
Enables the resource filter so that AMRP sends alarms for this resource to the viewer.
Syntax
CAmvResourceFilter* resource_ptr;
resource_ptr->Disable();
Data Type
void
CAmvResourceFilter::ID()
Retrieves the ID for the resource and puts it in the user-supplied buffer. Returns a pointer to that buffer.
Syntax
CAmvResourceFilter* resource_ptr;
TCHAR id_buf[FR_ID_LEN+1];
resource_ptr->ID(id_buf);
Open Interface API Reference | 6 - Alarm Viewer API | 263
Data Type
TCHAR*
CAmvResourceFilter::IsEnabled()
Syntax
CAmvResourceFilter* resource_ptr;
resource_ptr->IsEnabled();
Data Type
BOOL
CAmvResourceFilterList
CAmvResourceFilterList
The CAmvResourceFilterList class provides methods to loop through all the resource filters currently in
use.
The list is built from data supplied by the AMRP. Filters cannot be added to, or removed from, the list.
class CAmvResourceFilterList {
public:
COR_STATUS* ret_stat);
};
The following table briefly describes the members of the CAmvResourceFilterList class. The sections that
follow go into detail of the syntax and semantics of using the members.
Member Description
CAmvResourceFilterList::First()
Comments
If the filter list or the connection is invalid, NULL is returned and ret_stat >status is set to COR_FAILURE.
Syntax
CAmvResourceFilter* resource_ptr;
CAmvResourceFilterList* resource_list;
resource_ptr = resource_list->First(&ret_stat);
Data Type
CAmvResourceFilter*
Example
CAmvConn* amvConn;
CAmvResourceFilter* resource_ptr;
TCHAR id_buf[FR_ID_LEN+1];
for (resource_ptr =
amvConn->ResourceFilters->First(&ret_stat);
resource_ptr =
amvConn->ResourceFilters->Next(resource_ptr,
&ret_stat))
_tprintf(_T("%s\n"), resource_ptr->ID(id_buf));
}
Open Interface API Reference | 6 - Alarm Viewer API | 265
See Also
CAmvResourceFilterList::Next()
Comments
If the filter list or the connection is found to be invalid, NULL is returned and ret_stat->status is set to
COR_FAILURE.
Syntax
CAmvResourceFilter* resource_ptr;
CAmvResourceFilterList* resource_list;
COR_STATUS ret_stat;
Data Type
CAmvResourceFilter*
See Also
CAmvSetupList
CAmvSetupList
The CAmvSetupList class provides the methods necessary to create, edit, save, and activate saved alarm
viewer setups.
There is a pointer to an instance of this class on the CAmvConn class. You should not create instances of
this object in your program.
Open Interface API Reference | 6 - Alarm Viewer API | 266
class CAmvSetupList {
public:
int Number();
};
The following table briefly describes the members of the CAmvResourceFilterList class. The sections that
follow go into detail of the syntax and semantics of using the members.
Member Description
CAmvSetupList::DoClear()
Syntax
CAmvConn* amvConn;
amvConn->Setups->DoClear(COR_STATUS* ret_stat);
Data Type
void
CAmvSetupList::DoDel()
Syntax
CAmvConn* amvConn;
Data Type
void
CAmvSetupList::DoLoad()
Load the named setup from the database and make it the current setup, filtering by resource, state, time,
and class as appropriate.
Open Interface API Reference | 6 - Alarm Viewer API | 268
Syntax
CAmvConn* amvConn;
Data Type
void
CAmvSetupList::DoSave()
Syntax
CAmvConn* amvConn;
Data Type
void
CAmvSetupList::DoSetD()
Set the named setup as the default for this user. The next time the user starts a viewer, this setup will be
loaded automatically.
Comments
Syntax
CAmvConn* amvConn;
Data Type
int
Example
This example tries to set the default setup and checks the return value.
Open Interface API Reference | 6 - Alarm Viewer API | 269
MessageBox(ret_stat.err_msg);
CAmvSetupList::Exists()
Comments
Returns COR_SUCCESS if the AMRP was successfully queried regarding setup existence. Returns
COR_FAILURE otherwise.
If the return value is COR_SUCCESS, ret_stat->err_code is TRUE if the setup exists, FALSE if it does not.
Syntax
CAmvConn* amvConn;
Data Type
int
Example
} else
Exists = ret_stat->err_code;
CAmvSetupList::FilterSetup()
Send the filter parameters for the currently selected setup to the AMRP and put them in effect.
Open Interface API Reference | 6 - Alarm Viewer API | 270
Syntax
CAmvConn* amvConn;
amvConn->Setups->FilterSetup(TCHAR* setupID,
COR_STATUS* ret_stat);
Data Type
void
See Also
CAmvConn: UpdateList() CAmvConn::UpdateList() (on page 254)
CAmvSetupList::Number()
Syntax
CAmvConn* amvConn;
i = amvConn->Setups->Number()
Data Type
int
Example
amvConn->SetupList();
_tprintf(_T("%s\n"), amvConn->Setups->Setup(i));
CAmvSetupList::Setup()
Syntax
CAmvConn* amvConn;
TCHAR* str;
Data Type
TCHAR*
See Also
CAmvSetupList:Number() CAmvSetupList::Number() (on page 270)
CAmvSetupList::SetupID()
Get a pointer to the ID of the current setup or retrieve the ID of the current setup into a user-supplied
buffer.
Syntax
CAmvConn* amvConn;
amvConn->Setups->SetupID();
amvConn->Setups->SetupID(TCHAR setupID[]);
Data Type
const TCHAR*
Example
CAmvSetupList::Update()
Syntax
CAmvConn* amvConn;
amvConn->Setups->Update(TCHAR setupID[]);
Open Interface API Reference | 6 - Alarm Viewer API | 272
Data Type
Void
CAmvStateFilter
CAmvStateFilter
The CAmvStateFilter class controls whether alarms with the corresponding state will be passed from
AMRP to the Viewer.
The following class definition represents the CAmvStateFilter class. For clarity, it has been simplified from
the actual class definition. All the user-accessible members are listed.
class CAmvStateFilter {
public:
};// CAmvStateFilter
Member Description
CAmvStateFilter::ack_clear_msg()
This function returns a user-readable string that describes cleared and acknowledged alarms.
Syntax
TCHAR* p = ack_clear_msg();
Data Type
TCHAR*
See Also
CAmvAlarm:DeleteOptions() CAmvAlarm::DeleteOptions() (on page 217)
CAmvStateFilter::ack_only_msg()
Syntax
TCHAR* p = ack_only_msg();
Data Type
TCHAR*
See Also
CAmvStateFilter::clear_only_msg()
This function returns a user-readable string that describes cleared, unacknowledged alarms.
Open Interface API Reference | 6 - Alarm Viewer API | 274
Syntax
TCHAR* p = clear_only_msg();
Data Type
TCHAR*
See Also
CAmvStateFilter::Disable()
Disable the state filter so that AMRP does not send alarms in this state to the viewer.
Syntax
CAmvStateFilter* State_ptr;
State_ptr->Disable();
Data Type
void
See Also
CAmvStateFilter::Enable()
Enable the state filter so that AMRP sends alarms in this state to the viewer.
Syntax
CAmvStateFilter* state_ptr;
state_ptr->Disable();
Data Type
void
Open Interface API Reference | 6 - Alarm Viewer API | 275
See Also
CAmvStateFilter::IsEnabled()
Returns TRUE if AMRP will send the viewer alarms in this state.
Syntax
CAmvStateFilter* state_ptr;
state_ptr->IsEnabled();
Data Type
BOOL
CAmvStateFilter::State()
Comments
If the filter or connection is found to be invalid, AM_NONEXISTENT is returned and ret_stat->status is set
to COR_FAILURE.
Open Interface API Reference | 6 - Alarm Viewer API | 276
Syntax
AM_STATE_TYPE state;
CAmvStateFilter* state_ptr;
state = state_ptr->State(&ret_stat)
Data Type
typedef int AM_STATE_TYPE;
CAmvStateFilterList
CAmvStateFilterList
The CAmvStateFilterList class provides methods to loop through all the state filters currently in use.
The list is built from data supplied by the AMRP. Filters cannot be added to, or removed from the list.
The following class definition represents the CAmvStateFilterList class. For clarity, it has been simplified
from the actual class definition. All the user-accessible members are listed.
class CAmvStateFilterList {
COR_STATUS* ret_stat);
};// CAmvStateFilterList
The following table briefly describes the members of the CAmvStateFilterList class. The sections that
follow go into detail of the syntax and semantics of using the members.
Member Description
Open Interface API Reference | 6 - Alarm Viewer API | 277
ClearFilter()
CAmvStateFilterList::ClearAll()
Syntax
CAmvConn* amvConn;
amvConn->StateFilters->ClearAll()
Data Type
void
CAmvStateFilterList::ClearFilter()
Syntax
CAmvConn* amvConn;
amvConn->StateFilters->ClearFilter(AM_STATE_TYPE state)
Data Type
void
CAmvStateFilterList::First()
Comments
If the filter list or the connection is found to be invalid, NULL is returned and ret_stat->status is set to
COR_FAILURE.
Syntax
CAmvConn* amvConn;
CAmvStateFilter* state_ptr;
COR_STATUS ret_stat;
state_ptr = amvConn->StateFilters->First(&ret_stat);
Data Type
CAmvStateFilter*
See Also
CAmvStateFilterList::IsFiltered()
Returns TRUE if alarms in the specified state will be sent to the viewer.
Syntax
CAmvConn* amvConn;
amvConn->StateFilters->IsFiltered(AM_STATE_TYPE state)
Data Type
BOOL
CAmvStateFilterList::Next()
Comments
If the filter list or the connection is found to be invalid, NULL is returned and ret_stat->status is set to
COR_FAILURE.
Open Interface API Reference | 6 - Alarm Viewer API | 279
Syntax
CAmvConn* amvConn;
CAmvStateFilter* state_ptr;
Data Type
CAmvStateFilterList::SetFilter()
Syntax
CAmvConn* amvConn;
amvConn->StateFilters->SetFilter(AM_STATE_TYPE state)
Data Type
void
CAmvTimeFilter
CAmvTimeFilter
The time filter tells the AMRP not to send alarms before a specified time.
There is a CAmvTimeFilter on the CAmvConn class. You should never have to create one of your own.
Open Interface API Reference | 6 - Alarm Viewer API | 280
The following class definition represents the CAmvTimeFilter class. For clarity, it has been simplified from
the actual class definition. All the user-accessible members are listed.
class CAmvTimeFilter {
public:
};// CAmvTimeFilter
The following table briefly describes the members of the CAmvTimeFilter class. The sections that follow
go into detail of the syntax and semantics of using the members.
Member Description
IsEnabled() Will alarms sent to the viewer by AMRP be limited by the timestamp speci
fied.
CAmvTimeFilter::Disable()
Disable time filtering so that all alarms, no matter how old, are sent to the viewer.
Syntax
CAmvConn* amvConn;
amvConn->TimeFilter->Disable()
Open Interface API Reference | 6 - Alarm Viewer API | 281
Data Type
void
See Also
CAmvTimeFilter::Enable()
Enable time filtering so that only alarms after the specified time are sent to the viewer.
Syntax
CAmvConn* amvConn;
amvConn->TimeFilter->Enable()
Data Type
void
CAmvTimeFilter::IsEnabled()
Syntax
CAmvConn* amvConn;
amvConn->TimeFilter->IsEnabled()
Data Type
BOOL
CAmvTimeFilter::SetTimeStamp()
Syntax
CAmvConn* amvConn;
amvConn->TimeFilter->SetTimeStamp(COR_STAMP* ts)
Open Interface API Reference | 6 - Alarm Viewer API | 282
Data Type
void
Example
Set the time filter to pass only alarms occurring after 8am on 13 February 1991
COR_STAMP ts;
ts->yyyymmdd = 19910213;
ts->hhmmsstt = 08000000;
amvConn->TimeFilter->SetTimeStamp(&ts);
See Also
CAmvTimeFilter::TimeStamp()
Syntax
CAmvConn* amvConn;
amvConn->TimeStamp->TimeStamp()
Data Type
COR_STAMP*
See Also
• AlarmInfo
• SAmapCallbacks
• textContext
The CAmvConn methods also use the following CIMPLICITY standard data types:
• AM_STACKED_INFO
• COR_BOOLEAN
• COR_I2
• COR_I4
• COR_STAMP
• COR_STATUS
• RCM_ALARM_DATA
AM_STACKED_INFO
The AM_STACKED_INFO structure contains information about stacked alarms. Its format is:
COR_STAMP gentime;
AM_STATE_TYPE alarm_state;
TCHAR alarm_msg[ALARM_MSG_LEN+1];
} AM_STACKED_INFO;
COR_BOOLEAN
The COR_BOOLEAN definition is used for Boolean data types. Its format is:
COR_I2
The COR_I2 definition is used for two-byte signed integer values. Its format is:
Open Interface API Reference | 6 - Alarm Viewer API | 284
COR_I4
The COR_I4 definition is used for four-byte signed integer values. Its format is:
COR_STAMP
COR_U4 dummy1;
COR_U4 dummy2;
} COR_STAMP;
COR_STATUS
The COR_STATUS structure contains status information about a subroutine or function called in the code.
Its format is.
} COR_STATUS;
RCM_ALARM_DATA
The RCM_ALARM_DATA structure is used to record the current alarm count, the date the latest alarm was
generated, and the display attributes for the alarm count and alarm date displays. Its format is:
Open Interface API Reference | 6 - Alarm Viewer API | 285
typedef struct {
int alarm_count;
COR_I2 alarm_count_attr;
COR_I2 alarm_date_attr;
TCHAR alarm_date[16];
} RCM_ALARM_DATA;
Chapter 7. Device Communications Toolkit
About the Device Communications Toolkit
The Device Communications (Devcomm) Toolkit:
• Enables you to support communications to devices for which standard CIMPLICITY software
communication enablers are not available. It provides you with the libraries and build procedures
you need to create communication enablers that perform the same functions as standard
CIMPLICITY software communication enablers.
• Is intended for application development programmers responsible for creating code that will
access devices for which standard CIMPLICITY software communication enablers are not
available.
• Requires familiarity with system design, programming concepts, the Visual C++ programming and
CIMPLICITY product features.
The Device Communications Toolkit supports a set of functions that enables a custom communication
enabler to:
When you create a custom communication enabler, the set of functions you support may be limited by the
device, the protocol used in communicating with the device, or the scope of your implementation.
The following illustration shows you how a custom communication enabler is integrated into the standard
CIMPLICITY software environment.
Before you can run the executable, you must create configuration files that identify:
After you create the executable and configuration files and place them in the appropriate locations,
you may configure the enabler in CIMPLICITY software and run it.
Following is a sample of how the user-customized subroutines fit into the overall execution of the enabler.
The order provided here represents a very high-level description of operation and includes only those
details believed relevant to customizing an enabler.
INITIALIZATION
CALL user_init()
...
CALL user_open_port()
CALL user_protocol_info();
...
IF supported.use_default_domain_count == TOOLKIT_NO
CALL user_device_set_max_device_domain_count()
ENDIF
CALL user_device_info()
IF supported.model_req == TOOLKIT_YES
CALL user_cpu_model()
ENDIF
FOREACH DEVICE_POINT
CALL user_valid_point()
CALL user_remove_point()
ENDIF
ENDFOR
IF supported.det_dev_status == TOOLKIT_YES
CALL user_device_okay()
ENDIF
ENDFOR
...
...
Open Interface API Reference | 7 - Device Communications Toolkit | 289
WHEN
UNSOLICITED_DATA_RECEIVED:
IF support.unsolic_req == TOOLKIT_YES
CALL user_process_unsolicited_data()
ENDIF
ENDIF
TIME_TO_SCAN_POINT_VALUES:
IF support.read_req == TOOLKIT_YES
CALL user_read_data()
CALL user_cvt_data_from_device()
ENDIF
SET_POINT:
IF support.write_req == TOOLKIT_YES
CALL user_cvt_data_to_device()
CALL user_write_data()
ENDIF
WRITE_POINT_QUALITY:
IF support.unsolicited_quality_data == TOOLKIT_YES
IF supported.extended_user_bits == TOOLKIT_YES
CALL user_write_point_quality2()
ELSE
CALL user_write_point_quality()
ENDIF
ENDIF
DEMAND_STATUS_UPDATE:
CALL user_on_demand_response()
ELSE
CALL user_on_demand_response()
ENDIF
TIME_TO_RETRY_FAILED_DEVICES:
IF supported.use_default_domain_count == TOOLKIT_NO
CALL user_device_set_max_device_domain_count()
Open Interface API Reference | 7 - Device Communications Toolkit | 290
CALL user_device_info()
IF supported.model_req == TOOLKIT_YES
CALL user_cpu_model()
ENDIF
FOREACH DEVICE_POINT
CALL user_valid_point()
ENDFOR
IF supported.det_dev_status == TOOLKIT_YES
CALL user_device_okay()
ENDIF
ENDFOR
NEW_POINT_DYNAMICALLY_CONFIGURED:
IF existing point
CALL user_remove_point()
CALL user_valid_point()
CALL user_remove_point()
IF poll-once point
CALL user_read_data()
CHECK_DEVICE_STATUS:
CALL user_heartbeat_device
ENDIF
SHUTDOWN:
Cleanup
CALL user_term()
USER_EVENT_1:
CALL user_proc_event_1()
USER_EVENT_2:
CALL user_proc_event_2()
USER_EVENT_3:
CALL user_proc_event_3()
USER_EVENT_4:
CALL user_proc_event_4()
USER_EVENT_5:
CALL user_proc_event_5()
Open Interface API Reference | 7 - Device Communications Toolkit | 291
USER_EVENT_6:
CALL user_proc_event_6()
USER_EVENT_7:
CALL user_proc_event_7()
USER_EVENT_8:
CALL user_proc_event_8()
USER_EVENT_9:
CALL user_proc_event_9()
USER_EVENT_10:
CALL user_proc_event_10()
END WHEN
In an international environment, strings in CIMPLICITY software can be multibyte strings. If you want your
code to conform to international standards, It is recommended that you do the following when working
with strings:
char *cp;
…
Open Interface API Reference | 7 - Device Communications Toolkit | 292
• Avoid using a variable to hold the value of a logical character. Instead, use a pointer to a character
in the string. In particular, avoid the _tcsnextc() macro, because the value it returns appears to be
incompatible with some of the C runtime library functions.
• Use the functions _tccpy() and _tccmp() and string pointers instead of the = and == operators on
characters.
• Use GetStringTypeEx() instead of the character classification macros such as _istalpha().
• Use CharUpper() and CharLower() instead of _toupper() and _tolower().
Recommended Reading
Microsoft has several good papers on writing international code on its Web site. To find documentation
on the web site, go to http://msdn.microsoft.com and search for MBCS.
Schmitt, David A., Internationalization Programming for Microsoft® Windows®, ISBN 1-57231-956-9
A port typically corresponds to a hardware interface such as a serial port or network adapter. Multiple
copies of the same enabler may run concurrently to support several ports.
Open Interface API Reference | 7 - Device Communications Toolkit | 293
A port can connect to one or more devices. Usually these devices are addressed by CPU ID, network
address, or both.
A device contains one or more domains which are addressed by domain index.
A domain is a contiguous region of homogeneous data elements that are selected by domain offset.
Examples of domain elements are bits, bytes, and words. A domain that is bit-addressable is called a "bit
domain" or a "digital domain".
A domain that is made up of multi-bit elements (such as bytes or words), is called an "analog domain"
because its elements can hold analog values.
A point is an ID and other attributes associated with one or more contiguous elements in a domain.
Multiple points of the same or different type may be configured for the same address in a domain.
Point types need not match domain types. For example, analog values can be made up of multiple bits in
a bit domain, and bits can be extracted from elements in analog domains.
Within the data buffers used by CIMPLICITY software, all data is handled in bytes.
• Bit data is stored packed, 8 bits per byte with the most significant bit to the left.
• Multi-byte data is stored little-endian (least significant bytes first). Floating point values are in 4-
byte IEEE format, unless you set use_dp_flag in the SUPPORT structure to TOOLKIT_YES. In that
case, floating point values are in 8-byte format.
Multiple points in the same domain may be grouped by the toolkit into a cache for more efficient polling.
A cache is a range of memory in a domain that covers one or more points. All points in the cache have
the same update criteria and scan rate multiplier. When a point I/O routine is called, the Point ID in the
ADDR_DATA structure is for the "top" (or first) point in the cache.
Determine if point and alarm identifiers will be identified by their display or internal representa
tions.
Determine the form of addressing used to configure points for the enabler.
• It is defined in a configuration file (the configuration file defines the choices for device model for
any CIMPLICITY software device configured for the protocol).
• The model information from configuration is available to the user-customizable functions (the
enabler can perform model verification of devices).
By default, the number of device domains that any device may have is defined by the constant
TOOLKIT_MAX_DEVICE_DOMAINS, which is defined in
%BSM_ROOT%\api\include\inc_path\toolkit.h.
This default may be made larger or smaller based on the requirements of the interface.
No more than 16384 domains may be defined although practical limitations based on the size of the
device communication interface itself may dictate a lower limit.
All configured points must translate into a domain and offset. Memory locations that share the same
characteristics and that can be read contiguously should be grouped to form a domain.
Point and alarm ids can be represented either by an internal identifier or by using a display name
configured in the application.
Application designers can choose the format in which the data is to be provided by the device
communication interface.
Functions and macros are provided to convert the internal name to the display name, where required,
such as storing the information in an external system or in logging error messages for an end user.
Determine the Form of Addressing Used to Configure Points for the Enabler
Stan For standardized addressing, the number and name for each supported model is predefined
dard in the configuration file, domain.cfg. The point address is of the form DOMAIN_NAME and an
Ad offset.
dress
ing
Cus For customized addressing, a free-format field of ASCII characters is used to specify a point
tom Ad address. Do not use *, - or | in the address field as they have a special meaning in the configu
dress ration files.
ing
No checks are performed at configuration time to determine whether the format of the ad
dress is correct. It is the enabler's responsibility to validate the point address and translate the
address into a domain and offset.
Features are defined on a protocol basis, but may be further limited on a device basis. Supported features
are listed below:
Supporting this functions allows the enabler to attempt model-specific verification for each device.
Supporting this function allows the enabler to attempt to read data from the device's memory.
This function must be supported if setpoints are to work. When writing bit-data, the data must first be
read before the data will be written.
Support of this function permits the enabler to support unsolicited requests from the device.
If this feature is not selected, the enabler determines device status based on the success of reading
the device's memory. If, after the configured number of retries, the read is unsuccessful, the device is
considered to be down and a $DEVICE_DOWN alarm is generated.
• If a function is listed as optional, the original template does not require modification.
1. Determine the name of the port(s) on which the enabler will run
2. Define the name of the protocol(s) the enabler will support
3. Define the name of the enabler
◦ The build procedure produces an .exe and a .dll file for the enabler.
The default names in the build procedure are tlkitusr.exe and tlkituser.dll.
domain.cfg (optional)
Open Interface API Reference | 7 - Device Communications Toolkit | 297
< product>.proto
< product>.model
Where
< product> is a protocol product name that you define. You must also use the product name when
you add entries to the Registry.
6. Define a directory location, outside of the CIMPLICITY directory structure, to store master copies of
these configuration files.
This will ensure that the configuration files are still available after you perform updates on your
CIMPLICITY software.
7. (After you make changes in the master copies of these files) do the following.
a. Merge or copy domain.cfg to %SITE_ROOT%\master and %SITE_ROOT%\data. See Merging
the Domain Configuration Data into a Project (on page 323) for more information.
b. Copy <product>.proto to %BSM_ROOT%\bsm_data.
c. Copy <product>.model to %BSM_ROOT%\bsm_data.
Note:
You can find sample files in the %BSM_ROOT%\api\dc_api directory.
The Device Communications Toolkit gives you a set of functions that you can customize for each enabler
you implement.
user_accept_unsolicited_data()
user_cpu_model()
user_cvt_data_from_device()
user_cvt_data_to_device()
user_device_info()
Open Interface API Reference | 7 - Device Communications Toolkit | 298
user_device_okay()
user_device_set_max_device_domain_count()
user_heartbeat_device()
user_init()
user_on_demand_response()
user_open_port()
user_proc_event_1()
user_proc_event_2()
user_proc_event_3()
user_proc_event_4()
user_proc_event_5()
user_proc_event_6()
user_proc_event_7()
user_proc_event_8()
user_proc_event_9()
user_proc_event_10()
user_process_unsolicited_data()
user_process_unsolicited_data_stamp()
user_protocol_info()
user_read_data()
user_read_diag_data()
user_remove_point()
user_term()
user_valid_point()
user_valid_diag_point()
user_write_data()
user_write_point_quality() or user_write_point_quality2()
Open Interface API Reference | 7 - Device Communications Toolkit | 299
user_accept_unsolicited_data()
Filename: usrtm_accept.c
Indicates whether unsolicited data, received when the function is called, should be processed.
This function is called only when unsolicited data is received between polls.
user_cpu_model()
Filename: usrtm_cpumdl.c
user_cvt_data_from_device()
Filename: usrtm_cvtfrm.c
user_cvt_data_to_device()
Filename: usrtm_cvtto.c
user_device_info()
Filename: usrtm_dvin.c
Determines device specific information (such as memory locations) and device-specific supported
features (read/write support, etc.)
user_device_okay()
Filename: usrtm_dev_ok.c
user_device_set_max_device_domain_count())
Open Interface API Reference | 7 - Device Communications Toolkit | 300
Filename: usrtm_maxdom.c
Defines the maximum number of domains for the device when custom domain size is defined.
user_heartbeat_device()
Filename: usrtm_hrtbt.c
Verifies communications with a device running on the acting secondary in a host redundant
configuration..
user_init()
Filename: usrtm_init.c
Performs initialization functions specific to the interface being created. This is the first user routine called
by the Toolkit. It should do all the setup needed for the other user routines.
user_on_demand_response()
Filename: usrtm_dmdres.c
Defines the protocol-specific processing performed when the demand state of a point configured with an
update criteria of ondemand transitions into or out of demand.
user_open_port()
Filename: usrtm_opport.c
user_proc_event_1()
Filename: usrtm_evt1.c
user_proc_event_2()
Filename: usrtm_evt2.c
Open Interface API Reference | 7 - Device Communications Toolkit | 301
user_proc_event_3()
Filename: usrtm_evt3.c
user_proc_event_4()
Filename: usrtm_evt4.c
user_proc_event_5()
Filename: usrtm_evt5.c
user_proc_event_6()
Filename: usrtm_evt6.c
user_proc_event_7()
Filename: usrtm_evt7.c
user_proc_event_8()
Filename: usrtm_evt8.c
user_proc_event_9()
Filename: usrtm_evt9.c
Open Interface API Reference | 7 - Device Communications Toolkit | 302
user_proc_event_10()
Filename: usrtm_evt10.c
user_process_unsolicited_data()
Filename: usrtm_unso.c
user_process_unsolicited_data_stamp()
Filename: usrtm_unsost.c
user_protocol_info()
Filename: usrtm_protin.c
Defines features supported by the device and the protocol used to communicate with the device.
user_read_data()
Filename: usrtm_readda.c
Gets the requested data from the designated portion of the device's memory.
user_read_diag_data()
Filename: usrtm_readdiag.c
user_remove_point()
Open Interface API Reference | 7 - Device Communications Toolkit | 303
Filename: usrtm_rm_pt.c
Performs user specific processing when a previously validated point is to be removed from processing
within the current configuration.
user_term()
Filename: usrtm_term.c
user_valid_point()
Filename: usrtm_valpt.c
Performs point validation and in some cases translates the point address to domain and offset.
user_valid_diag_point()
Filename: usrtm_valdiagpt.c
user_write_data()
Filename: usrtm_wrda.c
Writes the provided data to the requested portion of the device's memory.
user_write_point_quality() or user_write_point_quality2()
Filename: usrtm_wrtpqual.c
Subroutine Guidelines
Open Interface API Reference | 7 - Device Communications Toolkit | 304
• Required subroutines.
• Optional subroutines.
• Subroutines that must be customized.
• Read and write request note.
Required Subroutines
You must design the following subroutines irrespective of the supported options:
user_device_info()
user_protocol_info()
Optional Subroutines
Below is a list of subroutines that are optional regardless of implemented functions. These functions
may be called within the enabler, but the templates for these subroutines should suffice when no
customization is required.
• user_init()
• user_on_demand_response()
• user_open_port()
• user_proc_event_1()
• user_proc_event_2()
• user_proc_event_3()
• user_proc_event_4()
• user_proc_event_5()
• user_proc_event_6()
• user_proc_event_7()
• user_proc_event_8()
• user_proc_event_9()
• user_proc_event_10()
• user_remove_point()
• user_term()
Below is a list of subroutines that must be customized based on the list of supported features:
For Subroutine
Open Interface API Reference | 7 - Device Communications Toolkit | 305
and/or
• user_write_point_quality2()
Read and Write requests to devices are often grouped to improve efficiency. A grouped request fails if any
point in the group is invalid. For this reason, it is strongly recommended that regardless of addressing-
mode, you should use user_valid_point() to verify that data at the configured memory location is readable
if read requests are supported.
Implementation Checklist
Implementation Checklist
Important:
The files in this directory will be overwritten when you un-install, reinstall, or upgrade your
CIMPLICITY software. For each enabler you develop
1. Create a separate directory and copy files from %BSM_ROOT%\api\dc_api to that directory.
2. Develop your software in the separate directory.
guide:
Guidelines
Follow the guidelines in Decisions to be Made Prior to Implementing an Enabler and generate the
list of supported memory locations, models and features. Based on this list, design each of the
needed subroutines.
Files
The following gives you a brief list of the subroutines to be updated and items that you need to
take into consideration when updating them.
user_protocol_info()
user_device_info()
user_open_port()
user_cpu_model()
user_device_set_max_device_domain_count()
user_valid_point()
user_read_data()
user_remove_point()
user_write_data()
Open Interface API Reference | 7 - Device Communications Toolkit | 307
user_write_point_quality() or user_write_point_quality2()
user_on_demand_response()
If enabler-specific initialization and termination steps are required, implement user_init() in user_init.c and
user_term() in usrtm_term.c.
user_protocol_info()
Determine the supported features for the protocol and implement user_protocol_info() in usrtm_protin.c.
Supported features may be further limited on a device by device basis.
user_device_info()
1. Determine the list of supported features for each device. The list of supported features must be a
subset of those supported by the protocol. Also, determine the list of supported memory locations.
2. Memory locations sharing the same characteristics and which can be read contiguously should be
grouped to form a domain.
3. Assign a domain index to each domain. If using standard addressing, each domain should also
be assigned a name of up to 16 characters. The domain index must be between '0' and '254', and
should be sequential. Each domain must have a unique index (and where standard addressing is
used, a unique name).
4. Determine the value used to identify the first memory location in each domain.
5. Determine the number of elements in each domain.
6. Determine the form of addressing used to reference an element in the domain. The available forms
are:
user_open_port()
If a port must be opened to communicate with the device, implement user_open_port() in usrtm_opport.c
to perform this function.
Any initialization of the port that must be done through the operating system should be performed in this
routine. In addition, the baud rate and parity passed to this routine may be overridden by the routine.
user_cpu_model()
This function should perform device-specific verification such as model verification. Communications
with the device to perform this function may be performed by the subroutine. The template is located in
usrtm_cpu_mdl.c.
user_device_set_max_device_domain_count()
is TOOLKIT_NO
The maximum number of defined domains that the software will allow is 16384.
Practical considerations for performance and size may impose a smaller limit.
user_valid_point()
If custom addressing is used, this function must translate the string form of the address to its
corresponding domain and offset. If the address is invalid or the address is out of the range, the point
should be returned as invalid.
Regardless of addressing mode, if the device has configurable memory, this function should determine
whether the point address is a valid one. One method for accomplishing this is to attempt to read the
Open Interface API Reference | 7 - Device Communications Toolkit | 309
data value from the configured location in the device's memory. A second method is to read the memory
configuration from the device and use this information to determine if the address is valid.
user_read_data()
This function translates the given address into a physical memory location. It then queries the device
to request the data starting at the given location for the given number of bytes. The information is then
returned via the data buffer along with the status indicating the status of the read.
user_remove_point()
user_write_data()
This function translates the given address to a physical memory location and requests that the device
change a range of memory starting from this address to the values contained in the data buffer.
user_write_point_quality() or user_write_point_quality2()
user_accept_unsolicited_data() should return TRUE if the processing for received unsolicited data is
performed asynchronously.
user_on_demand_response()
To build and link a customized communication enabler for your CIMPLICITY system, you must install the
Device Communications Toolkit API and the Microsoft Visual C++ compiler.
The build procedure for the Device Communications Toolkit produces two files:
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 automatically, you will
have to set them manually or run the following to set them before building any user programs.
< drive>
cd %BSM_ROOT%\api
where <drive> is the disk where your CIMPLICITY software is installed (for example, C:).
3. If environment variables are not set automatically, issue the following command to set them.
5. Modify the toolkit project to include the compilation and linking of any additional files created for
your customized communication enabler.
6. Right-click the project in Solution Explorer.
7. Select Build on the Popup menu.
The customized communication enabler is built.
Note:
The executable and .dll file will be located automatically in %BSM_ROOT%\exe.
• Process overview.
• Special characters In configuration files.
• Definition of terms.
Process Overview
Some characters have special significance in CIMPLICITY configuration files and should only be
used in the following ways:
Ver | The vertical bar is interpreted as a field delimiter. This character should be avoided.
tical
Bar
Open Interface API Reference | 7 - Device Communications Toolkit | 313
Dash - The dash is interpreted as a continuation character when placed at the end of a line of
an ASCII configuration file. Users should avoid placing a dash at the end of a field of
configuration data.
As * The asterisk is interpreted as a comment character when positioned in the first position
ter of a record. Users should avoid placing an asterisk as the first character of identifiers.
isk
The first line in the <product>.proto, <product>.model, and domain.cfg files must consist solely of
these characters in this order:
|-*
Do not use any of these characters in the data fields of those configuration files.
Definition of Terms
Port Prefix Three to six character prefix used to identify ports of the same type.
Note:
Port Prefix and Port Type are used interchangeably.
Protocol Common name used to refer to the protocol supported by the en
abler.
First, you will need to add some entries to the Registry to allow the CIMPLICITY Configuration program to
recognize your new device communication interface (devcom).
Important:
Making changes to the Registry is very dangerous and should be done with care.
Open Interface API Reference | 7 - Device Communications Toolkit | 314
32-bit machines
64-bit machines
4. Click Edit>Add Key on the Registry Editor menu bar to add a key for your new devcom.
Important: The Key Name must be in upper-case and match the <product> prefix you gave to your
.proto and .model files.
• <product>.proto
• Sample configuration file.
• Protocol field definitions.
Open Interface API Reference | 7 - Device Communications Toolkit | 315
<product>.proto
The <product>.proto file contains the information needed to install the protocol as part of your
CIMPLICITY system.
NETW|501|BSM_ROOT:[exe]netw_rp.exe|20|1|NET|1|20|10|2|54|1|-
10|1000|1000|1000|50|1|3|1|1|1|19200|2|-
N|30|N|3|900|N|N
• protocol_id
• protocol_number
• image_name
• Priority
• PM_flags
• port_prefix
• low_index
• high_index
• Base
• address_type
• allow_unsolicited
• min_points_to_poll
• forced_poll_count
• load_buffer_size
• cache_buffer_size
• min_scan
• scan_units
• dead_count
• read_all
• poll_state
• max_associations
• baud_rate
Open Interface API Reference | 7 - Device Communications Toolkit | 316
• parity
• check_health
• response_period
• restart
• threshold
• retry_period
• kill_process
• fail_process
protocol_id
protocol_number
Unique number required for each user-protocol (must be unique to the CIMPLICITY system).
Valid values range from 500 - 999 (values outside this range are reserved for use by GE Digital).
image_name
Fully qualified name of the executable (that is, the full path name from the top of the Base (or Root)
directory.
Priority
Process priority.
PM_flags
Process Management startup and shutdown options for this process. Set the flag according to the
following:
1 Cause Process Management to wait for a check-in message from this process when it is initializing.
This value must always be used.
2 Cause Process Management to not generate an alarm when the process terminates
Open Interface API Reference | 7 - Device Communications Toolkit | 317
8 The Process Manager can reset the Process Down alarm that gets generated when this process ter
minates.
You can sum values to combine options. For example, if you want to have Process Management wait for a
check-in message and reset the Process Down alarm, enter a "9" in this field.
port_prefix
3- to 6-character prefix defining the base name used for the port or group of ports being defined.
Example
‘COM’ or ‘TCP_IP’.
Note:
Port prefixes should always be upper-case. Valid port IDs are defined based on the concatenation
of the port prefix with an index (except for noted special case).
low_index
Note:
If the port being defined is a single port that does not end in a digit, both the Low and High values
should be set to '-1' to indicate that no range is allowed for this port prefix.
high_index
Note:
If the port being defined is a single port that does not end in a digit, both the Low and High values
should be set to '-1' to indicate that no range is allowed for this port prefix.
Open Interface API Reference | 7 - Device Communications Toolkit | 318
Base
10 Decimal
address_type
1. Standard addressing
2. Custom addressing
allow_unsolicited
Defines the update criteria available for points using this protocol.
You can sum values to combine options. For example, if you want to support Unsolicited and On Demand
unsolicited data, enter a 3 in this field.
The recommended default for this field is 48 (On Change and On scan point updates available).
min_points_to_poll
When the enabler determines it is time to query a device for point values, it groups the points within like
domains into caches. By definition, a cache starts at a given memory location and spans a given number
of bytes.
Open Interface API Reference | 7 - Device Communications Toolkit | 319
Polling of points may be interrupted by certain events such as a request to set a point value. The
min_points_to_poll variable defines how many caches must be processed before the query of point values
may be interrupted.
forced_poll_count
load_buffer_size
If the values differ, than the lesser of the values will take precedence
poll_buffer_size
cache_buffer_size
For Toolkit-derived enablers, set this value to the max_buffer_size defined in user_protocol_info.
If the values differ, than the lesser of the values will take precedence.
min_scan
This number along with the units defined in scan_units defines the minimum scan rate to be used for this
driver. All point scan rates are multiples of the minimum scan rate.
scan_units
2 Seconds
3 Minutes
4 Hours
Open Interface API Reference | 7 - Device Communications Toolkit | 320
dead_count
The length of time the driver will wait before declaring a device dead. This number is a multiple of the
minimum scan rate.
read_all
poll_state
The initial state of the point polling function. Select one of the following:
0 Disabled
1 Enabled
max_associations
baud_rate
Number stored for the baud rate in the port parameter settings
parity
check_health
Default N (recommended).
When enabled, messages are sent to the process to determine if it is running correctly.
Example
response_period
When Process Health is enabled, the number of seconds that elapse between polls for health checks.
restart
When process health is enabled, this enables or disables the restart of a process as a result of the
detection of a problem through process health.
Default N (recommended).
threshold
When Process Health is enabled, the number of times the process can be restarted, within the number of
seconds specified by the response period, before it is failed in Process Health.. Recommended default
value is 3.
retry_period
When process health is enabled, this is the number of seconds in which the restart threshold is
operational.
kill_process
When process health is enabled, specifies whether the process should be terminated if it does not
respond when it is polled.
Default N (recommended).
fail_process
When a project is running on a cluster and process health is enabled, specifies whether the project should
be failed when the selected process fails.
Default N (recommended).
The <product>.model file defines the device models supported by a protocol. Each combination of
protocol and model must be defined in a separate record.
Important:
Model numbers must be unique across CIMPLICITY. If you have more than one protocol, you
cannot re-use the same model number in different <product>.model files.
Application configuration uses this information during device configuration to generate the list of models
that can be configured for a device executing on a port running the given protocol.
Open Interface API Reference | 7 - Device Communications Toolkit | 323
To define a pair of models, Model A1 and Model A1-Plus that are valid for the SLP protocol, the entries
would be as follows:
|-*
SLP|Model A1|500
SLP|Model A1-Plus|501
• protocol_id
• model
• model_number
protocol_id
ASCII string of up to 35 characters identifying the protocol (must be defined in the protocol file).
Model
model_number
Value should be between 500 and 999 (values outside this range are reserved by GE Digital).
After you have modified <product>.proto and <product>.model files, copy the files to the %BSM_ROOT%
\bsm_data directory.
After you have defined the domain.cfg file for the enabler, you need to merge the information in this file
into the domain.cfg file for each project where you want to use the enabler. To do this:
1. From the CIMPLICITY Workbench for the project, select Command Prompt... from the Tools menu.
This will ensure that you environment variables (in particular %BSM_ROOT% and %SITE_ROOT%
are set correctly.
2. To update or create the domain.cfg file in %SITE_ROOT%\master, you need to do one of the
following:
a. If you currently have a %SITE_ROOT%\master\domain.cfg file, issue the following
commands to merge the domain information for your new enabler:
cd %SITE_ROOT%\master
notepad domain.cfg
a. In the Notepad window, copy the information from your domain.cfg into the opened file.
b. Close and save the modified domain.cfg file.
c. If you do not have a %SITE_ROOT%\master\domain.cfg file, copy your domain.cfg file to the
%SITE_ROOT%\master directory.
3. Issue the following command to copy the updated domain.cfg file to %SITE_ROOT%\data:
Accessible memory that can be read contiguously and that shares the same characteristics, are typically
grouped together to form a domain.
Elements within a domain must be readable/writable by a single request to read or write via
user_read_data and user_write_data.
Open Interface API Reference | 7 - Device Communications Toolkit | 325
An additional configuration file is required if an enabler uses the standard addressing scheme. The file,
domain.cfg, defines the different types of memory supported for each device model. The file must exist in
the %SITE_ROOT%\master and %SITE_ROOT%\data directories.
Use the domain names and domain indexes defined in this file when defining the starting address, size,
and address type of standard domains in user_device_info.
model|domain_name|domain_index
Note:
The maximum number of domains is defined by the symbol TOOLKIT_MAX_NUM_DOMAINS. The
current value of the symbol is found in %BSM_ROOT%\api\include\inc_path\toolkit.h. This value
should not be changed.
The following is the domain.cfg file used by the Device Communications Toolkit API:
|-*
MODELA|REG_PLC|0
MODELA|INP_PLC|1
MODELA|OUT_PLC|2
MODELA|INOVR_PLC|3
MODELA|OUTOVR_PLC|4
MODELA|SP_PLC|5
MODELA|UL_PLC|6
Open Interface API Reference | 7 - Device Communications Toolkit | 326
• If the enabler uses a custom mode of addressing, domain.cfg must still exist, but the file may be
empty.
• domain.cfg must exist in the %SITE_ROOT%\master and %SITE_ROOT%\data directories.
• When creating an enabler, care must be taken to avoid conflicts with other existing custom
enablers.
Note:
Site and Application configuration must be run before the enabler can be used within CIMPLICITY
software.
A demonstration application is distributed with the Device Communications Toolkit API. It is an example
of a very simple driver enabler. The demonstration is an application where device memory is simulated.
No actual communication with a device is involved, hence no protocol is needed. In this example the
device name is TOOLKIT_DEVICE, and there are 7 different types of memory (domains), as follows:
Name Size
SP_PLC 32 bytes
The demo may be built and installed as a CIMPLICITY software application as discussed below.
Open Interface API Reference | 7 - Device Communications Toolkit | 327
Note:
The hardware and software requirements for building the demo program are the same as those
for building any driver enabler.
A sample Microsoft C++ project, tlkittst_dll.vcxproj, is provided to build the demonstration program.
Use this project as a basis for constructing projects for your own application.
This will ensure that your environment variables (in particular %BSM_ROOT% and %SITE_ROOT%)
are set correctly.
<drive>
cd %BSM_ROOT%\api
where <drive> is the disk where your CIMPLICITY software is installed (for example, C:).
3. If the environment variables are not set automatically, issue the following command to set them:
devenv CimplicityAPI.sln
8. Now update or create the domain.cfg file in %SITE_ROOT%\master. You need to do one of the
following:
Open Interface API Reference | 7 - Device Communications Toolkit | 328
▪ notepad domain.cfg
9. Issue the following command to copy the updated domain.cfg file to %SITE_ROOT%\data:
10. Create the TLKITTST key in the Registry (on page 313) .
11. Under the TLKITTST key, create a Value Name of Name with the string TLKITTST Devcom and the
Value Name of Type with the string Protocol
The demonstration communication enabler should now be able to run.
Programming Notes
Programming Notes
The following restrictions apply when customizing the Device Communications Toolkit to create an
enabler:
• On each new release of CIMPLICITY software, Toolkit derived applications should be recompiled
and re-linked to ensure compatibility with the new release.
• Whenever upgrading, copy all user-written functions and header files to another directory prior to
performing the upgrade. Failure to save these files will result in their replacement by the template
files distributed with the product.
• Use cor_sleep instead of Sleep or SleepEx within the application.
• User functions that return both comm_status and status should set status to TOOLKIT_FAILURE
when comm_status is not TOOLKIT_SUCCESS.
• The function user_read_data may be asked to read up to 7 bits beyond the end of a bit domain.
This will occur when a bit within the last byte of the domain is configured. The bits outside of the
domain should be set to zero (0) by the user_read_data function.
• When unsolicited data is received and processed by user_process_unsolicited_data, only those
configured points whose address exactly matches the start address will reflect the changed value
because of processing by user_process-unsolicited_data. If a point has an update criteria other
Open Interface API Reference | 7 - Device Communications Toolkit | 329
than UNSOLICITED, the point value will be updated during normal polling based on the update
criteria.
• Array points that extend beyond the end of memory are not checked. The communications
interface checks that the first element of the array is within bounds, but does not check if any of
the following elements is out of bounds. Points configured beyond the end of memory will cause
reads of the device to fail, resulting in the unavailability of point data.
A CIMPLICITY software event flag is a bit within a predefined data structure. Applications can reserve
some event flags to indicate some condition has occurred. Routines are provided to SET and CLEAR the
event flag.
The enabler calls predefined (user-defined) functions when an event flag is SET. Ten (10) event flags are
available to the enabler.
• dcrp_call_on_time
• dcrp_clear_ef
• dcrp_get_any_ef
• dcrp_get_ef
• dcrp_release_ef
• dcrp_set_ef
Note:
Some operating systems provide primitives for defining and manipulating event flags. It is
recommended that the CIMPLICITY software-provided routines be used instead to avoid conflict
with CIMPLICITY software routines within the enabler.
The Device Communications Toolkit reserves 10 event flags for use with user-customized
subroutines and provides functions for reserving and manipulating the event flags.
Event flags should be cleared within the user-defined function for processing the event flag.
Open Interface API Reference | 7 - Device Communications Toolkit | 330
user_accept_unsolicited_data
user_cpu_model
user_cvt_data_from_device
user_cvt_data_to_device
user_device_info
user_device_okay
user_device_set_max_device_domain_coun
t()
user_heartbeat_device
user_init
user_on_demand_response
user_open_port
user_proc_event_1
user_proc_event_2
user_proc_event_3
user_proc_event_4
user_proc_event_5
user_proc_event_6
user_proc_event_7
user_proc_event_8
user_proc_event_9
user_proc_event_10
user_process_unsolicited_data
user_process_unsolicited_data_stamp
Open Interface API Reference | 7 - Device Communications Toolkit | 331
user_protocol_info
user_read_data
user_read_diag_data
user_remove_point
user_term
user_valid_diag_point
user_valid_point
user_write_data
user_write_point_quality
user_accept_unsolicited_data
usrtm_accept.c
Syntax
int user_accept_unsolicited_data()
Input Arguments
None.
Output Arguments
None.
Return Value
• TRUE
• FALSE
If FALSE, do not process the unsolicited data received at this time. No attempt is made to read the
unsolicited data unless one of the following occurs:
user_cpu_model
Is called during initialization and verifies the configuration of the device model.
usrtm_cpumdl.c
Syntax
void user_cpu_model(DEVICE_DATA *device_struct,
int *comm_status,
int *status)
Input Arguments
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
Output Arguments
comm_status
status
Indicates whether the function successfully obtained all of the requested information. Valid values are:
Open Interface API Reference | 7 - Device Communications Toolkit | 333
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
user_cvt_data_from_device
Converts data from the general toolkit format to a format compatible with the given point type.
The Device Communications Toolkit calls user_read_data() to read data for multiple points at the same
address. The data returned by user_read_data() should be in a format consistent with the device domain
and the host data format.
• For example, data from a word domain should be returned in little endian format (least significant
byte first). If data in the device is in big endian format (most significant byte first), you should byte
swap the data within user_read_data().
The Device Communications Toolkit calls user_cvt_data_from_device() for individual points to perform
data conversions specific to the point data type.
• For example, if the point data type is INT (16 bit integer), it may be necessary to byte swap the little
endian data returned from user_read_data().
usrtm_cvtfrom.c
Syntax
void user_cvt_data_from_device ( DEVICE_DATA *device_struct,
ADDR_DATA *address_struct,
int element_cnt,
int element_size,
int pnt_data_type,
char *data_buffer)
Open Interface API Reference | 7 - Device Communications Toolkit | 334
Input Arguments
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit>.
element_cnt
element_size
pnt_data_type
Is the CIMPLICITY point type. The standard CIMPLICITY point types supported by the Device
Communications Toolkit are:
• TOOLKIT_BOOLEAN
• TOOLKIT_BITSTRING
• TOOLKIT_OCTETSTRING
• TOOLKIT_TEXTPOINT
• TOOLKIT_UNSIGNED_ANALOG8
• TOOLKIT_UNSIGNED_ANALOG16
• TOOLKIT_UNSIGNED_ANALOG32
• TOOLKIT_ANALOG8
• TOOLKIT_ANALOG16
• TOOLKIT_ANALOG32
• TOOLKIT_FLOATINGPOINT
• TOOLKIT_UNSIGNED_ANALOG64
• TOOLKIT_ANALOG64
Open Interface API Reference | 7 - Device Communications Toolkit | 335
Output Parameters
data_buffer
Return Value
None.
user_cvt_data_to_device
Converts data from the format for the given point type to the general toolkit format.
The Device Communications Toolkit calls user_write_data() to write to the same device domain from
various points of different data types. The user_write_data() subroutine assumes data is in little endian
format (least significant byte first) and is otherwise consistent with the data type of the device domain.
• For example, an SINT (8 bit integer) point can be configured in a bit domain and used to set eight
(8) bits at a time, or the individual bits can be set with BOOL setpoints.
The Device Communications Toolkit calls user_cvt_data_to_device() for individual points to perform data
conversion specific to the point data type.
• For example, if the point data type is not SINT (8 bit integer), it may be necessary to swap bytes or
swap words in the point data to make it little endian for user_write_data().
usrtm_cvtto.c
Syntax
void user_cvt_data_to_device ( DEVICE_DATA *device_struct,
ADDR_DATA *address_struct,
int element_cnt,
int element_size,
int pnt_data_type,
char *data_buffer)
Open Interface API Reference | 7 - Device Communications Toolkit | 336
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
element_cnt
element_size
pnt_data_type
Is the CIMPLICITY point type. The standard CIMPLICITY point types supported by the Device
Communications Toolkit are:
• TOOLKIT_BOOLEAN
• TOOLKIT_BITSTRING
• TOOLKIT_OCTETSTRING
• TOOLKIT_TEXTPOINT
• TOOLKIT_UNSIGNED_ANALOG8
• TOOLKIT_UNSIGNED_ANALOG16
• TOOLKIT_UNSIGNED_ANALOG32
• TOOLKIT_ANALOG8
• TOOLKIT_ANALOG16
• TOOLKIT_ANALOG32
• TOOLKIT_FLOATINGPOINT
• TOOLKIT_UNSIGNED_ANALOG64
• TOOLKIT_ANALOG64
Open Interface API Reference | 7 - Device Communications Toolkit | 337
Output Parameters
data_buffer
Return Value
None.
user_device_info
Defines the device-specific characteristics for the accessible memory on the device.
Accessible memory sharing the same characteristics, and which can be read contiguously, is typically
grouped together to form a domain. Elements within a domain must be readable/writable by a single
request to read or write via user_read_data() and user_write_data().
usrtm_dvin.c
Syntax
void user_device_info(DEVICE_DATA *device_struct,
int *num_domains,
DOMAIN_ARRAY *domain,
SUPPORT *supported,
int *comm_status,
int *status)
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
Output Parameters
num_domains
domains
Is a pointer to an array of domain structures which define the characteristics of each group of memory
locations.
The number of elements in the structure is either TOOLKIT_MAX_DEVICE_DOMAINS or the value returned by
user_device_set_max_device_domain_count() if use_default_domain_count is set in the supported structure
for the protocol.
The first domain element is domain[0], and all elements through domain[*num_domains - 1] should
contain valid data.
supported
Is a pointer to a structure defining the supported options for the device. SUPPORT (on page 399) is a
typedef to a structure defined in <inc_path/toolkit.h>.
comm_status
status
Indicates whether the function successfully obtained all of the requested information. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
Open Interface API Reference | 7 - Device Communications Toolkit | 339
Programming Note
The default value for each option is the value set in user_protocol_info(). A field whose value
is TOOLKIT_NO cannot be reset to TOOLKIT_YES in this function. If the value for a return by
user_protocol_info() is TOOLKIT_NO and it is reset to TOOLKIT_YES in this function, the new value is
ignored.
user_device_okay
Defines whether the given device is able to communicate with the enabler at the time the function was
invoked. This function may be called during initialization.
usrtm_dev_ok.c
Syntax
int user_device_okay(DEVICE_DATA *device_struct)
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
Output Parameters
None
Return Value
• TRUE
• FALSE
If FALSE, the device is not able to communicate with the communication enabler.
user_device_set_max_device_domain_count()
Open Interface API Reference | 7 - Device Communications Toolkit | 340
usrtm_maxdom.c
Syntax
int * max_domains_allowed,
int *comm_status,
int *status);
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
Output Parameters
max_num_domains_allowed
Defines the maximum number of device domains that can be configured. Valid values are between 1 and
16384 although practical limitations including due to size and/or performance may impose a lessor upper
limit.
comm_status
status
Indicates whether the function successfully obtained all of the requested information. Valid values are:
Open Interface API Reference | 7 - Device Communications Toolkit | 341
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
user_heartbeat_device
The device_struct and address_struct are initialized by the Toolkit to refer to a valid device and address
in that device. Depending on your protocol requirements, you may be able to read the data to verify
communications.
usrtm_hrtbt.c
Syntax
void user_heartbeat_device (DEVICE_DATA *device_struct,
ADDR_DATA *address_struct,
int length,
int *comm_status,
int *status);
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
address_struct
Is a pointer to a valid point address for the device. ADDR_DATA (on page 395) is a typedef to a structure
defined in <inc_path/toolkit.h>.
length
Open Interface API Reference | 7 - Device Communications Toolkit | 342
Contains the number of bytes of data which should be readable at the specified address.
Output Parameters
comm_status
status
Indicates whether the function successfully obtained all of the requested information. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
user_init
Performs enabler-specific initialization tasks. It is called when the enabler starts, and its uses might
include setting up shared memory regions, signal handlers and exit handlers.
usrtm_init.c
Syntax
void user_init(int *status)
Input Parameters
None
Open Interface API Reference | 7 - Device Communications Toolkit | 343
Output Parameters
status
Indicates whether the function successfully obtained all of the requested information. Valid values are:
Return Value
None.
user_on_demand_response
This routine is only applicable for points with an update criteria of either On Demand On Change or On
Demand On Scan. This routine is called whenever the demand status for one of these points is changed.
This lets you perform device specific actions for the specified point when its demand status changes.
usrtm_dmdres.c
Syntax
void user_on_demand_response (ADDR_DATA *address_struct,
int ptState,
int *status)
Input Parameters
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
ptState
Output Parameters
status
Indicates whether the function successfully obtained all of the requested information. Valid values are:
Return Value
None.
user_open_port
usrtm_opport.c
Syntax
void user_open_port(char *port_id,
int *baud_rate,
int *parity,
int *status)
Input Parameters
port_id
The name provided is in upper-case characters and identifies the port name on the computer.
baud_rate
Open Interface API Reference | 7 - Device Communications Toolkit | 345
Is the pointer to the baud rate selected for the given port_id.
parity
• TOOLKIT_NO_PARITY
• TOOLKIT_EVEN_PARITY
• TOOLKIT_ODD_PARITY
Output Parameters
status
Return Value
None.
user_proc_event_1
usrtm_evt1.c
Syntax
int user_proc_event_1()
Input Parameters
None
Open Interface API Reference | 7 - Device Communications Toolkit | 346
Output Parameters
None
Return Value
user_proc_event_2
usrtm_evt2.c
Syntax
int user_proc_event_2()
Input Parameters
None
Output Parameters
None
Return Value
user_proc_event_3
usrtm_evt3.c
Syntax
int user_proc_event_3()
Input Parameters
None
Output Parameters
None
Return Value
user_proc_event_4
usrtm_evt4.c
Syntax
int user_proc_event_4()
Input Parameters
None
Open Interface API Reference | 7 - Device Communications Toolkit | 348
Output Parameters
None
Return Value
user_proc_event_5
usrtm_evt5.c
Syntax
int user_proc_event_5()
Input Parameters
None
Output Parameters
None
Return Value
user_proc_event_6
usrtm_evt6.c
Syntax
int user_proc_event_6()
Input Parameters
None
Output Parameters
None
Return Value
user_proc_event_7
usrtm_evt7.c
Syntax
int user_proc_event_7()
Input Parameters
None
Open Interface API Reference | 7 - Device Communications Toolkit | 350
Output Parameters
None
Return Value
user_proc_event_8
usrtm_evt8.c
Syntax
int user_proc_event_8()
Input Parameters
None
Output Parameters
None
Return Value
user_proc_event_9
usrtm_evt9.c
Syntax
int user_proc_event_9()
Input Parameters
None
Output Parameters
None
Return Value
user_proc_event_10
usrtm_evt10.c
Syntax
int user_proc_event_10()
Input Parameters
None
Open Interface API Reference | 7 - Device Communications Toolkit | 352
Output Parameters
None
Return Value
user_process_unsolicited_data
usrtm_unso.c
Syntax
void user_process_unsolicited_data(DEVICE_DATA *device_struct,
char *data,
ADDR_DATA *start_address,
int *sizeof_data,
int *more,
int *comm_status,
int *status)
Input Parameters
None
Output Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
Open Interface API Reference | 7 - Device Communications Toolkit | 353
data
If the devcomm has indicated support for quality data by setting support.unsolicited_quality_data to
TOOLKIT_YES and support.extended_user_bits to TOOLKIT_NO, then the following code illustrates how the
buffer should be handled:
If the devcomm has indicated support for quality data by setting support.unsolicited_quality_data to
TOOLKIT_YES and support.extended_user_bits to TOOLKIT_YES, then the following code illustrates how the
buffer should be handled:
The data pointer now points to the area containing the point values. Any quality data changes indicated by
the masks and values will be applied to all points serviced by the return buffer.
TOOLKIT_QUALDATA (on page 408) and TOOLKIT_QUALDATA2 are typedefs to a structure defined in
<inc_path/toolkit.h>.
start_address
Is a pointer to a structure that defines domain starting addresses in the device memory. ADDR_DATA (on
page 395) is a typedef to a structure defined in <inc_path/toolkit.h>.
If standard addressing is used, the domain_index and domain_offset should be correctly set.
sizeof_data
Contains the number of bytes of data (must be less than TOOLKIT_MAX_INTERNAL_BUFFER bytes).
more
Indicates whether there is more unsolicited data to be processed. Valid values are:
comm_status
status
Indicates whether the function successfully obtained all of the requested information. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
user_process_unsolicited_data_stamp
Retrieves unsolicited data from a device and returns the data and timestamp.
usrtm_unsost.c
Open Interface API Reference | 7 - Device Communications Toolkit | 355
Syntax
void user_process_unsolicited_data_stamp(DEVICE_DATA *device_struct,
char *data,
ADDR_DATA *start_address,
int *sizeof_data,
int *more,
COR_STAMP *timestamp,
int *comm_status,
int *status)
Input Parameters
None
Output Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
data
If the devcomm has indicated support for quality data by setting support.unsolicited_quality_data to
TOOLKIT_YES and support.extended_user_bits to TOOLKIT_NO, then the following code illustrates how the
buffer should be handled:
If the devcomm has indicated support for quality data by setting support.unsolicited_quality_data to
TOOLKIT_YES and support.extended_user_bits to TOOLKIT_YES, then the following code illustrates how the
buffer should be handled:
Open Interface API Reference | 7 - Device Communications Toolkit | 356
The data pointer now points to the area containing the point values. Any quality data changes indicated by
the masks and values will be applied to all points serviced by the return buffer.
TOOLKIT_QUALDATA (on page 408) and TOOLKIT_QUALDATA2 are typedefs to a structure defined in
<inc_path/toolkit.h>.
start_address
Is a pointer to a structure that defines domain starting addresses in the device memory. ADDR_DATA (on
page 395) is a typedef to a structure defined in <inc_path/toolkit.h>.
If standard addressing is used, the domain_index and domain_offset should be correctly set.
sizeof_data
Contains the number of bytes of data (must be less than TOOLKIT_MAX_INTERNAL_BUFFER bytes).
more
Indicates whether there is more unsolicited data to be processed. Valid values are:
timestamp
Is a pointer to a structure that defines the timestamp to be used to record the time at which the data is
reported. COR_STAMP is a typedef to a structure defined in <inc_path/cor.h>.
Open Interface API Reference | 7 - Device Communications Toolkit | 357
comm_status
status
Indicates whether the function successfully obtained all of the requested information. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
Programming Note
char *data,
ADDR_DATA *start_address,
int *sizeof_data,
int *more,
COR_STAMP *timestamp,
int *comm_status,
int *status)
int I;
reg_plc_data[3]++
start_address->domain_index = 0;
start_address->domain_offset = 3;
Open Interface API Reference | 7 - Device Communications Toolkit | 358
*sizeof_data=2;
*more = FALSE;
*comm_status = TOOLKIT_SUCCESS;
*status = TOOLKIT_SUCCESS
timestamp->yyyymmdd = 19950912;
timestamp->hhmmsstt = 16120300;
return;
user_protocol_info
Defines the Device Communications Toolkit features that are supported in this customized
communication enabler.
usrtm_protin.c
Syntax
void user_protocol_info(int *max_buffer_size,
SUPPORT *supported)
Input Parameters
None.
Output Parameters
max_buffer_size
Defines the amount of data (in bytes) that can be transferred between the device and the enabler in one
operation.
supported
Open Interface API Reference | 7 - Device Communications Toolkit | 359
Is a pointer to a structure defining the supported options for the device. SUPPORT is a typedef to a
structure defined in <inc_path/toolkit.h> .
Return Value
None.
user_read_data
Reads data from specific memory locations from the device's memory.
usrtm_reada.c
Syntax
void user_read_data(DEVICE_DATA *device_struct,
ADDR_DATA *address_struct,
int length,
char *data,
int *comm_status,
int *status);
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
length
Output Parameters
data
Open Interface API Reference | 7 - Device Communications Toolkit | 360
Is a pointer to an array that contains the data that was read from the device.
For data from bit (TOOLKIT_BIT) domains, bit data should be packed into bytes so that the leftmost bit is
the most significant.
For domains whose element size is greater than one byte, the bytes should be ordered in the same way as
they are ordered by the underlying operating system on which the enabler is to run.
comm_status
TOOLKIT_BAD_DATA Received response from device but it contained invalid data such as an incorrect
checksum.
status
Indicates whether the function read all the data. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
user_read_diag_data
usrtm_readdiag.c
Syntax
void user_read_diag_data(DEVICE_DATA *device_struct,
ADDR_DATA *address_struct,
int length,
char *data,
int *comm_status,
int *status);
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
length
Output Parameters
data
Is a pointer to an array that contains the data that was read from the enabler.
• For diagnostic bits, data should be packed into bytes so that the leftmost bit is the most
significant.
• For domains whose element size is greater than one byte, the bytes should be ordered in the same
way as they are ordered by the underlying operating system on which the enabler is to run.
comm_status
status
Indicates whether the function read all the data. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
user_remove_point
Performs enabler-specific processing when a previously valid point is removed from the configuration.
usrtm_rm_pt.c
Syntax
void user_remove_point(DEVICE_DATA *status,
ADDR_DATA *address_struct)
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
Open Interface API Reference | 7 - Device Communications Toolkit | 363
Output Parameters
None.
Return Value
None.
user_term
Performs enabler-specific termination tasks. This function is called following a request from CIMPLICITY
software for the enabler to terminate. Its uses include cleaning up shared memory regions and
disassociating from the device.
usrtm_term.c
Syntax
void user_term(int *status)
Input Parameters
None
Output Parameters
status
Return Value
None.
user_valid_diag_point
Open Interface API Reference | 7 - Device Communications Toolkit | 364
usrtm_valdiagpt.c
Syntax
void user_valid_diag_point(DEVICE_DATA*device_struct,
ADDR_DATA*address_struct,
int *valid_pt,
int *comm_status,
int *status)
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
Output Parameters
valid_pt
comm_status
status
Indicates whether the function read all the data. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
user_valid_point
Defines whether the point is valid. Where custom addressing is used, both the domain_index and offset
for the point must be determined.
usrtm_valpt.c
Syntax
void user_valid_point(DEVICE_DATA*device_struct,
ADDR_DATA *address_struct,
int *valid_pt,
int *comm_status,
int *status)
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
Open Interface API Reference | 7 - Device Communications Toolkit | 366
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
Output Parameters
valid_pt
comm_status
status
Indicates whether the function read all the data. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was the
FAILURE result of a communication failure.
Return Value
None.
user_write_data
Open Interface API Reference | 7 - Device Communications Toolkit | 367
usrtm_wrda.c
Syntax
void user_write_data(DEVICE_DATA *device_struct,
ADDR_DATA *address_struct,
int length,
char *data,
int *download_req,
int download_comp,
int *comm_status,
int *status)
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
length
data
For data from bit (TOOLKIT_BIT) domains, bit data is packed into bytes so that the leftmost bit is the most
significant.
Bit data is always accessed in multiples of 8 bits, so write requests near the end of a bit domain must
ignore extra bits that would be beyond the end of the domain.
Open Interface API Reference | 7 - Device Communications Toolkit | 368
For domains whose element size is greater than one byte, the bytes are ordered in the same way as they
are ordered by the underlying operating system where the enabler is running.
download_req
download_comp
Output Parameters
comm_status
TOOLKIT_BAD_DATA Received response from device but it contained invalid data such as an incorrect
checksum.
status
Indicates whether the function read all the data. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was
FAILURE the result of a communication failure.
Open Interface API Reference | 7 - Device Communications Toolkit | 369
Return Value
None.
user_write_point_quality
usrtm_wrtpqual.c
Syntax
void user_write_point_quality(DEVICE_DATA *device_struct,
ADDR_DATA *address_struct,
TOOLKIT_QUALDATA *pqualdata,
int *comm_status,
int *status)
Input Parameters
device_struct
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
address_struct
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
pqualdata
Is the pointer to the quality data to be written. TOOLKIT_QUALDATA (on page 408) is a typedef to a
structure defined in <inc_path/toolkit.h>.
Output Parameters
comm_status
status
Indicates whether the function read all the data. Valid values are:
TOOLKIT_ Function did not complete successfully. Check comm_status to see if the failure was
FAILURE the result of a communication failure.
Return Value
None.
cor_sleep
dcrp_align_read
dcrp_call_on_time
dcrp_clear_ef
dcrp_get_any_ef
dcrp_get_ef
dcrp_get_port_parameters
dcrp_get_serial_settings
Open Interface API Reference | 7 - Device Communications Toolkit | 371
dcrp_log_status
dcrp_notify_unsolicited_data
dcrp_rcv_unsolicited_data
dcrp_rcv_unsolicited_data_
stamp
dcrp_release_ef
dcrp_set_device_down
dcrp_set_device_up
dcrp_set_ef
dcrp_stat_process
dcrp_to_long_point_id
dcrp_user_alarm
cor_sleep
Syntax
int cor_sleep(int time_to_sleep)
Input Parameters
time_to_sleep
Output Parameters
None
Return Value
dcrp_align_read
Selects the method the toolkit uses when reading or writing data in digital domains. Call this subroutine
once in user_init().
Syntax
int dcrp_align_read (int flag)
Input Parameters
flag
Indicates how bits in a digital domain are to be read or written. Set the parameter to one of the following:
TRUE Calculate the byte the requested bit belongs in and read that byte.
FALSE Read one byte starting at the point's address. This may cause the user read function to read da
ta beyond the valid address if the bit requested is at the end of the domain.
dcrp_call_on_time
Asynchronously calls the given function after at least the specified time period has passed.
Syntax
int dcrp_call_on_time (int time,
int time_unit,
char *function,
int timer_id)
Input Parameters
time
time_unit
Defines the units for the amount of time. Valid values are:
Open Interface API Reference | 7 - Device Communications Toolkit | 373
• TOOLKIT_TIME_TICKS
• TOOLKIT_TIME_SECONDS
• TOOLKIT_TIME_MINUTES
• TOOLKIT_TIME_HOURS
function
timer_id
Is a unique identifier for timer being set to track previously defined time interval. Value should be between
1 and 200.
Output Parameters
None
Return Value
On TOOLKIT_FAILURE, the function specified in the argument list will not be called.
dcrp_clear_ef
Syntax
int dcrp_clear_ef(int *ef)
Input Parameters
ef
Is a pointer to the event flag to be cleared. Valid values for the event flag are:
Open Interface API Reference | 7 - Device Communications Toolkit | 374
TOOLKIT_USER_EVENT_1
TOOLKIT_USER_EVENT_2
TOOLKIT_USER_EVENT_3
TOOLKIT_USER_EVENT_4
TOOLKIT_USER_EVENT_5
TOOLKIT_USER_EVENT_6
TOOLKIT_USER_EVENT_7
TOOLKIT_USER_EVENT_8
TOOLKIT_USER_EVENT_9
TOOLKIT_USER_EVENT_10
Output Parameters
None
Return Value
dcrp_get_any_ef
Reserves the next available USER event flag for Enabler use.
Syntax
Input Parameters
None
Open Interface API Reference | 7 - Device Communications Toolkit | 375
Output Parameters
ef
TOOLKIT_USER_EVENT_1
TOOLKIT_USER_EVENT_2
TOOLKIT_USER_EVENT_3
TOOLKIT_USER_EVENT_4
TOOLKIT_USER_EVENT_5
TOOLKIT_USER_EVENT_6
TOOLKIT_USER_EVENT_7
TOOLKIT_USER_EVENT_8
TOOLKIT_USER_EVENT_9
TOOLKIT_USER_EVENT_10
Return Value
dcrp_get_ef
Syntax
int dcrp_get_ef(int *ef)
Open Interface API Reference | 7 - Device Communications Toolkit | 376
Input Parameters
ef
Is a pointer to the event flag to be reserved. Valid values for the event flag are:
• TOOLKIT_USER_EVENT_1
• TOOLKIT_USER_EVENT_2
• TOOLKIT_USER_EVENT_3
• TOOLKIT_USER_EVENT_4
• TOOLKIT_USER_EVENT_5
• TOOLKIT_USER_EVENT_6
• TOOLKIT_USER_EVENT_7
• TOOLKIT_USER_EVENT_8
• TOOLKIT_USER_EVENT_9
• TOOLKIT_USER_EVENT_10
Output Parameters
None
Return Value
dcrp_get_port_parameters
Gets the parameter string for non-serial ports. The user_open_port() routine is passed only baud rate and
parity which may not apply to non-serial ports. Use this routine to access the parameter string for the port.
Syntax
void dcrp_get_port_parameters(char *port_id, char *parameters)
Input Parameters
port_id
Open Interface API Reference | 7 - Device Communications Toolkit | 377
Output Parameters
parameters
dcrp_get_serial_settings
Gets the serial port parameters. The user_open_port() routine is passed only baud rate and parity. Use
this routine to access data bits, stop bits, and flow control settings.
Syntax
void dcrp_get_serial_settings(char *port_id,
COR_I2 data_bits,
COR_I2 stop_bits,
COR_BOOLEAN *rts_cts_control,
COR_BOOLEAN *xon_xoff_control)
Input Parameters
port_id
Output Parameters
data_bits
stop_bits
Is the number of stop bits supported by the protocol value. Valid value is 1 or 2.
Open Interface API Reference | 7 - Device Communications Toolkit | 378
rts_cts_control
Indicates whether the RTS (Ready To Send) and CTS (Clear To Send) lines are used for hardware flow
control. This field contains one of the following:
TRUE Raise RTS and check CTS before transmitting data. This usually suggests that your serial port
Data Control Block (DCB) setup includes the following:
dcb.fOutxCtsFlow = TRUE;
dcb.fRtsControl = RTS_CONTROL_TOGGLE;
xon_xoff_control
Indicates whether the XON/XOFF software flow control is to be used. This field contains one of the
following:
TRUE XON/XOFF flow control is used. This usually suggests that your serial port Data Control Block
(DCB) setup includes the following:
dcb.fOutX = TRUE;
dcb.fInX = TRUE;
dcrp_log_status
Syntax
void dcrp_log_status(int status,
char *module,
int reference,
Open Interface API Reference | 7 - Device Communications Toolkit | 379
int log,
char *message)
Input Parameters
status
• TOOLKIT_SUCCESS
• TOOLKIT_WARNING
• TOOLKIT_FAILURE
module
Contains the name of module logging the information (only first 16 characters are printed).
reference
log
TRUE Causes the information to be logged to the Status Log and the .err file for the process.
FA Indicates a fatal error. The information is logged to the Status Log and the .err file for the
TAL process, then the process exits.
message
Contains the message to be logged. The message should be no longer than 79 characters and should not
contain special characters such as control characters or new lines.
Output Parameters
None
Return Value
None
Open Interface API Reference | 7 - Device Communications Toolkit | 380
dcrp_notify_unsolicited_data
Notifies the Toolkit that unsolicited data has been received (must be called before unsolicited data
between polls can be processed).
Syntax
void dcrp_notify_unsolicited_data(int *status)
Input Parameters
None
Output Parameters
status
Return Value
None
dcrp_rcv_unsolicited_data
Syntax
int dcrp_rcv_unsolicited_data(char *device_id,
ADDR_DATA *addr_data,
int sizeof_data,
char *data_buffer,
int *status)
Input Parameters
device_id
Open Interface API Reference | 7 - Device Communications Toolkit | 381
Contains the Device ID for the device originating the unsolicited data.
addr_data
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
sizeof_data
data_buffer
• For data from bit (TOOLKIT_BIT) domains, bit data should be packed into bytes so that the left
most bit is the most significant.
• For domains whose element size is greater than one byte, the bytes should be ordered in the same
way as ordered by the underlying operating system on which the enabler is to run.
The caller is responsible for managing the data buffer (this might include allocating and de-allocating the
space or using a static data structure to maintain the data).
Output Parameters
status
Return Value
dcrp_rcv_unsolicited_data_stamp
Syntax
int dcrp_rcv_unsolicited_data_stamp(device_id, addr_data,
char *device_id;
ADDR_DATA *addr_data;
int sizeof_data
char *data_buffer;
COR_STAMP *pStamp
int *status;
Input Parameters
device_id
addr_data
Is a pointer to the address from which the data was read. ADDR_DATA (on page 395) is a typedef to a
structure defined in <inc_path/toolkit.h>.
sizeof_data
data_buffer
• For data from bit (TOOLKIT_BIT) domains, bit data should be packed into bytes so that the leftmost
bit is the most significant.
• For domains whose element size is greater than one byte, the bytes should be ordered in the same
way as ordered by the underlying operating system on which the enabler is to run.
Open Interface API Reference | 7 - Device Communications Toolkit | 383
The caller is responsible for managing the data buffer (this might include allocating and deallocating the
space or using a static data structure to maintain the data).
pStamp
Is a pointer to the structure defining the timestamp to be used to record the time at which the data is
reported. COR_STAMP is a typedef to a structure defined in <inc_path/cor.h>.
Output Parameters
status
Return Value
dcrp_release_ef
Syntax
int dcrp_release_ef(int *ef)
Input Parameters
ef
TOOLKIT_USER_EVENT_1
TOOLKIT_USER_EVENT_2
TOOLKIT_USER_EVENT_3
TOOLKIT_USER_EVENT_4
TOOLKIT_USER_EVENT_5
TOOLKIT_USER_EVENT_6
TOOLKIT_USER_EVENT_7
TOOLKIT_USER_EVENT_8
TOOLKIT_USER_EVENT_9
TOOLKIT_USER_EVENT_10
Output Parameters
None
Return Value
dcrp_set_device_down
Syntax
int dcrp_set_device_down(char *device_id,
int *status)
Open Interface API Reference | 7 - Device Communications Toolkit | 385
Input Parameters
device_id
Contains the Device ID for the device whose status is to be set DOWN (UNAVAILABLE).
Output Parameters
status
Return Value
Important:
DCRP_SET_DEVICE_DOWN cannot be called until USER_READ_DATA (on page 359) or
USER_READ_DIAG_DATA (on page 360) is called first.
dcrp_set_device_up
Syntax
int dcrp_set_device_up(char *device_id,
int *status)
Open Interface API Reference | 7 - Device Communications Toolkit | 386
Input Parameters
device_id
Contains the Device ID for the device whose status is to be set UP (AVAILABLE).
Output Parameters
status
Return Value
dcrp_set_ef
Syntax
int dcrp_set_ef(int *ef)
Input Parameters
ef
TOOLKIT_USER_EVENT_1
TOOLKIT_USER_EVENT_2
Open Interface API Reference | 7 - Device Communications Toolkit | 387
TOOLKIT_USER_EVENT_3
TOOLKIT_USER_EVENT_4
TOOLKIT_USER_EVENT_5
TOOLKIT_USER_EVENT_6
TOOLKIT_USER_EVENT_7
TOOLKIT_USER_EVENT_8
TOOLKIT_USER_EVENT_9
TOOLKIT_USER_EVENT_10
Output Parameters
None
Return Value
dcrp_stat_process
dcrp_stat_process
Updates device communication statistics kept inside the enabler based on communication status and
completion status and returns the normalized communication status.
The common code calls dcrp_stat_process() after each call to user_read_data() and user_write_data().
If those routines make multiple requests of the device, or if other routines, such as user_valid_point() or
user_device_info() access the device, they should call dcrp_stat_process() to process the status values
and update the device communication status.
Open Interface API Reference | 7 - Device Communications Toolkit | 388
Syntax
TOOLKIT_STATUS dcrp_stat_process (DEVICE_DATA *device,
TOOLKIT_STATUS comm_status,
TOOLKIT_STATUS status)
Input Parameters
device
Is a pointer to the structure defining device data. DEVICE_DATA (on page 398) is a typedef to a structure
defined in <inc_path/toolkit.h>.
comm_status
Is the communication status where TOOLKIT_STATUS (on page 409) is a typedef to an ENUM defined in
<inc_path/toolkit.h>.
• TOOLKIT_WRITE_FAILED
• TOOLKIT_TIMEOUT
• TOOLKIT_BAD_DATA
• TOOLKIT_SUCCESS
• TOOLKIT_FAILURE
status
• TOOLKIT_SUCCESS
• TOOLKIT_FAILURE
• TOOLKIT_REPLY_LATER
Output Parameters
None
Return Value
dcrp_stat_process Algorithm
SWITCH (comm_status) {
CASE TOOLKIT_WRITE_FAILED:
CASE TOOLKIT_READ_TIMEOUT:
break;
CASE TOOLKIT_BAD_DATA:
break;
CASE_TOOLKIT_SUCCESS:
IF status != TOOLKIT_REPLY_LATER
ENDIF
break;
CASE TOOLKIT_UNSOLICITIED:
comm_status = TOOLKIT_SUCCESS;
break;
CASE TOOLKIT_FAILURE:
break:
ENDSWITCH
IF comm_status != TOOLKIT_SUCCESS
ENDIF
ELSE
ENDIF
ENDIR
SWITCH (comm_status) {
CASE TOOLKIT_WRITE_FAILED:
CASE TOOLKIT_READ_TIMEOUT:
CASE TOOLKIT_BAD_DATA:
comm_status = TOOKIT_FAILURE;
break;
CASE TOOLKIT_UNSOLICITED:
comm_status = TOOLKIT_SUCCESS;
break;
ENDSWITCH
return comm_status;
dcrp_to_long_point_id
Syntax
TCHAR *dcrp_to_long_point_id (TCHAR *short_name)
Input Parameters
short_name
Output Parameters
None.
Open Interface API Reference | 7 - Device Communications Toolkit | 391
Return Parameters
Point to the display name representation. If there is no match found, a pointer to a NULL string is
returned.
dcrp_user_alarm
Syntax
void dcrp_user_alarm (char *alarm_msg,
char *gen_or_clr,
char *device_id,
int *status)
Input Parameters
alarm_msg
gen_or_clear
• TOOLKIT_GENERATE_ALARM
• TOOLKIT_CLEAR_ALARM
device_id
Identifies the CIMPLICITY software device for which the alarm will be generated or cleared.
Output Parameters
status
This appendix lists the files that comprise the Device Communication Driver Toolkit. The installation may
be verified by checking to see that all files were provided.
The subroutines described in this manual are found in the following files:
%BSM_ROOT%\api\dc_api\user_accept.c
%BSM_ROOT%\api\dc_api\user_cpu_mdl.c
%BSM_ROOT%\api\dc_api\user_cvtfrm.c
%BSM_ROOT%\api\dc_api\user_cvtto.c
%BSM_ROOT%\api\dc_api\user_dev_ok.c
%BSM_ROOT%\api\dc_api\user_dmdres.c
%BSM_ROOT%\api\dc_api\user_dvin.c
%BSM_ROOT%\api\dc_api\user_evt1.c
%BSM_ROOT%\api\dc_api\user_evt10.c
%BSM_ROOT%\api\dc_api\user_evt2.c
%BSM_ROOT%\api\dc_api\user_evt3.c
%BSM_ROOT%\api\dc_api\user_evt4.c
%BSM_ROOT%\api\dc_api\user_evt5.c
%BSM_ROOT%\api\dc_api\user_evt6.c
%BSM_ROOT%\api\dc_api\user_evt7.c
%BSM_ROOT%\api\dc_api\user_evt8.c
%BSM_ROOT%\api\dc_api\user_evt9.c
%BSM_ROOT%\api\dc_api\user_hrtbt.c
%BSM_ROOT%\api\dc_api\user_init.c
%BSM_ROOT%\api\dc_api\user_maxdom.c
%BSM_ROOT%\api\dc_api\user_protin.c
Open Interface API Reference | 7 - Device Communications Toolkit | 393
%BSM_ROOT%\api\dc_api\user_read_da.c
%BSM_ROOT%\api\dc_api\user_read_diag.c
%BSM_ROOT%\api\dc_api\user_term.c
%BSM_ROOT%\api\dc_api\user_unso.c
%BSM_ROOT%\api\dc_api\user_unsost.c
%BSM_ROOT%\api\dc_api\user_valdiagpt.c
%BSM_ROOT%\api\dc_api\user_valpt.c
%BSM_ROOT%\api\dc_api\user_wrtdata.c
%BSM_ROOT%\api\dc_api\user_wrtpqual.c
%BSM_ROOT%\api\dc_api\usropen_port.c
The object libraries needed for the Device Communications Toolkit API are:
%BSM_ROOT%\api\lib\amaru.lib
%BSM_ROOT%\api\lib\corutil.lib
%BSM_ROOT%\api\lib\dc_common.lib
%BSM_ROOT%\api\lib\dd_common.lib
%BSM_ROOT%\api\lib\ddl.lib
%BSM_ROOT%\api\lib\fasrtl.lib
%BSM_ROOT%\api\lib\ipc.lib
%BSM_ROOT%\api\lib\cim_mf.lib
%BSM_ROOT%\api\lib\pm.lib
%BSM_ROOT%\api\lib\cim_sc.lib
%BSM_ROOT%\api\lib\toolkit.lib
%BSM_ROOT%\api\lib\tools.lib
The include files described in this document are found in the following locations:
%BSM_ROOT%\api\dc_api\inc_path\globals.h
%BSM_ROOT%\api\include\inc_path\toolkit.h
The command file described in this document is found in the following location:
Open Interface API Reference | 7 - Device Communications Toolkit | 394
%BSM_ROOT%\api\dc_api\makefile
tlkittst_dll.vcxproj
The template source files discussed in this document are found in the following locations:
%BSM_ROOT%\api\dc_api\usrtm_accept.c
%BSM_ROOT%\api\dc_api\usrtm_cpumdl.c
%BSM_ROOT%\api\dc_api\usrtm_cvtfrm.c
%BSM_ROOT%\api\dc_api\usrtm_cvtto.c
%BSM_ROOT%\api\dc_api\usrtm_dev_ok.c
%BSM_ROOT%\api\dc_api\usrtm_dmdres.c
%BSM_ROOT%\api\dc_api\usrtm_dvin.c
%BSM_ROOT%\api\dc_api\usrtm_evt1.c
%BSM_ROOT%\api\dc_api\usrtm_evt10.c
%BSM_ROOT%\api\dc_api\usrtm_evt2.c
%BSM_ROOT%\api\dc_api\usrtm_evt3.c
%BSM_ROOT%\api\dc_api\usrtm_evt4.c
%BSM_ROOT%\api\dc_api\usrtm_evt5.c
%BSM_ROOT%\api\dc_api\usrtm_evt6.c
%BSM_ROOT%\api\dc_api\usrtm_evt7.c
%BSM_ROOT%\api\dc_api\usrtm_evt8.c
%BSM_ROOT%\api\dc_api\usrtm_evt9.c
%BSM_ROOT%\api\dc_api\usrtm_hrtbt.c
%BSM_ROOT%\api\dc_api\usrtm_init.c
%BSM_ROOT%\api\dc_api\usrtm_maxdom.c
%BSM_ROOT%\api\dc_api\usrtm_opport.c
%BSM_ROOT%\api\dc_api\usrtm_protin.c
%BSM_ROOT%\api\dc_api\usrtm_readda.c
%BSM_ROOT%\api\dc_api\usrtm_rm_pt.c
%BSM_ROOT%\api\dc_api\usrtm_term.c
%BSM_ROOT%\api\dc_api\usrtm_unso.c
%BSM_ROOT%\api\dc_api\usrtm_unsost.c
%BSM_ROOT%\api\dc_api\usrtm_valpt.c
%BSM_ROOT%\api\dc_api\usrtm_wrda.c
%BSM_ROOT%\api\dc_api\usrtm_wrtpqual.c
Open Interface API Reference | 7 - Device Communications Toolkit | 395
The template configuration files discussed in this document are found in the following locations:
%BSM_ROOT%\api\dc_api\domain.cfg
%BSM_ROOT%\api\dc_api\TLKITTST.MODEL
%BSM_ROOT%\api\dc_api\TLKITTST.PROTO
%BSM_ROOT%\api\dc_api\TLKITUSR.MODEL
%BSM_ROOT%\api\dc_api\TLKITUSR.PROTO
• ADDR_DATA
• COR_STAMP
• DEVICE_DATA
• DOMAIN_ARRAY
• SUPPORT
• TOOLKIT_QUALDATA
• TOOLKIT_QUALDATA2
• TOOLKIT_STATUS
ADDR_DATA
int type;
int domain_index;
int domain_offset;
int point_type;
int elements;
} ADDR_DATA;
Where:
point_type is the point data type. The standard CIMPLICITY point types supported by the Device
Communications Toolkit are:
full_address is the ASCII representation of the address to be used if the device supports addresses up to
256 characters, and support.use_long_addresses is set to TOOLKIT_YES.
COR_STAMP
COR_U4 dummy1;
COR_U4 dummy2;
} COR_STAMP;
Where:
Note:
Use cor_stamp_get_componentsHR (on page 50) to decompose the time into its corresponding
components .
Open Interface API Reference | 7 - Device Communications Toolkit | 398
DEVICE_DATA
int model;
int cpu_id;
int in_use ;
} DEVICE_DATA;
Where
model is the configured model number of the device. This number is defined in the <product>.model file.
cpu_id is the configured CPU ID of the device. his information is defined when you configure the device in
your CIMPLICITY project.
device_id is the device identifier. This information is defined when you configure the device in your
CIMPLICITY project.
network_addr is the network address of the device. This information is defined when you configure the
device in your CIMPLICITY project.
DOMAIN_ARRAY
int domain_index;
int start_addr;
int domain_size;
int addr_type;
char caching;
} DOMAIN_ARRAY;
Where:
domain_index is the internal reference used to access the information about the given domain. If you use
standard addressing, this field must match the domain index assigned to the domain name in domain.cfg.
domain_name is the ASCII name used to reference the domain. If you use standard addressing, this
name must match a domain name in domain.cfg.
start_addr is the numeric value corresponding to the first memory location within the domain.
addr_type is the type of addressing used in the domain. Valid values are:
• TOOLKIT_BIT
• TOOLKIT_BYTE
• TOOLKIT_WORD
• TOOLKIT_4BYTE
• TOOLKIT_8BYTE
SUPPORT
Open Interface API Reference | 7 - Device Communications Toolkit | 400
char read_req;
char write_req;
char upload_req;
char dnload_req;
char ondemand_req;
char start_req;
char stop_req;
char model_req;
char unsolic_req;
char det_dev_status;
char host_redundancy;
char read_addr_req;
char write_addr_req;
char timestamp_unso_pt;
char adhoc_req;
char use_dp_fp;
char network_redundancy;
char set_array_element;
char vlist_addressing;
char use_long_addresses;
char unsolicited_quality_data;
char saved_device_req;
char dyn_cfg_req;
char extended_user_bits;
char allow_64_bit_ints;
char use_custom_cache_blocks;
char use_long_point_id;
char use_custom_domain_count;
char state_unso_pt;
char use_custom_persisted;
char feature1;
char feature2;
char feature3;
char feature4;
Open Interface API Reference | 7 - Device Communications Toolkit | 401
char feature5;
char feature6;
char feature7;
} SUPPORT;
Where:
read_req
indicates whether or not it is possible to read from the device's memory using the implemented protocol.
Set to:
write_req
Indicates whether or not it is possible to write to the device's memory using the implemented protocol.
Set to:
upload_req
Set to TOOLKIT_NO.
Open Interface API Reference | 7 - Device Communications Toolkit | 402
dnload_req
Set to TOOLKIT_NO.
ondemand_req
Set to:
start_req
Set to TOOLKIT_NO.
stop_req
Set to TOOLKIT_NO.
model_req
Indicates whether or not verification that communication with a device with the correct CPU model is
occurring.
Set to:
unsolic_req
Open Interface API Reference | 7 - Device Communications Toolkit | 403
Set to:
det_dev_status
Set to:
host_redundancy indicates whether or not Host Redundancy is supported for this device.
read_addr_req
Set to TOOLKIT_NO.
write_addr_req
Set to TOOLKIT_NO.
timestamp_unso_pt
Indicates whether or not a user-provided timestamp is sent with unsolicited data. This field is meaningful
only if unsolic_req is set to TOOLKIT_YES.
Open Interface API Reference | 7 - Device Communications Toolkit | 404
Set to:
adhoc_req
Set to:
use_dp_fp
Set to:
Set to TOOLKIT_NO.
set_array_element
Indicates whether a set array element request should be processed by the devcom.
Set to:
vlist_addressing
Set to TOOLKIT_NO.
use_long_addresses
Indicates whether or not the device communications supports point addresses up to 256 characters.
Set to:
unsolicited_quality_data
Set to:
saved_dev_req
Set to TOOLKIT_NO.
dyn_cfg_req
Set to:
extended_user_bits
Indicates whether or not extended user bits will be used to represent the quality data..
Set to:
TOOLKIT_ If extended bits are supported. This means TOOLKIT_QUALDATA2 will be used to repre
YES sent the quality data.
TOOLKIT_ If extended bits are not supported. This means TOOLKIT_QUALDATA will be used to repre
NO sent the quality data.
allow_64_bit_ints
Indicates whether or not the device communications supports 64 bit signed or unsigned integer point
types..
Set to:
use_custom_cache_blocks
Set to TOOLKIT_NO.
use_long_point_id
Indicates whether or not the device communications will receive point ids using their display format or
internal representation.
Set to:
use_default_domain_count
Indicates whether or not the device communications will define the maximum number of domains per
device based on user defined value or TOOLKIT_MAX_DEVICE_DOMAINS.
Set to:
TOOLKIT_ If the maximum number of possible device domains on the device is user-defined
YES
state_unso_points
Set to:
use_custom_persisted
Feature1
Set to TOOLKIT_NO.
Feature2
Set to TOOLKIT_NO.
Open Interface API Reference | 7 - Device Communications Toolkit | 408
Feature3
Set to TOOLKIT_NO.
Feature4
Set to TOOLKIT_NO.
Feature5
Set to TOOLKIT_NO.
Feature6
Set to TOOLKIT_NO.
Feature7
Set to TOOLKIT_NO.
TOOLKIT_QUALDATA
} TOOLKIT_QUALDATA2 ;
Where:
sys_flags is reserved for future use. Set the value to zero (0).
Open Interface API Reference | 7 - Device Communications Toolkit | 409
sys_changed_mask is reserved for future use. Set the value to zero (0).
The value is set by the Toolkit devcom as determined by the developer. Bit definitions are assigned by the
developer. It is anticipated that the bit definitions match an attribute set definition in the project.
user_changed_mask indicates which bits of user_flags are part of the update. Bits in user_flags will be
ignored unless their corresponding bits in user_changed_mask are set to 1.
TOOLKIT_QUALDATA2
of interest in
sys_qual_flags */
of interest in
user_qual_flags */
} TOOLKIT_QUALDATA2 ;
Where:
sys_flags is reserved for future use. Set the value to zero (0).
sys_changed_mask is reserved for future use. Set the value to zero (0).
The value is set by the Toolkit devcom as determined by the developer. Bit definitions are assigned by the
developer. It is anticipated that the bit definitions match an attribute set definition in the project.
user_changed_mask indicates which bits of user_flags are part of the update. Bits in user_flags will be
ignored unless their corresponding bits in user_changed_mask are set to 1.
TOOLKIT_STATUS
Open Interface API Reference | 7 - Device Communications Toolkit | 410
typedef enum {
TOOLKIT_SUCCESS = 1,
TOOLKIT_FAILURE = 2,
TOOLKIT_WARNING = 0,
TOOLKIT_UNSUPPORTED = 3,
TOOLKIT_REPLY_LATER = 4,
TOOLKIT_RESPONSE_REQ = 5,
TOOLKIT_RESPONSE_NO_REQ = 6,
TOOLKIT_GMR_PARTIAL_WRITE_FAIL = 7,
TOOLKIT_WRITE_FAILED,
TOOLKIT_READ_TIMEOUT,
TOOLKIT_BAD_DATA,
TOOLKIT_UNSOLICITED
TOOLKIT_SUCCESS_NO_DATA
TOOLKIT_NO_CHANGE_APPROVAL_SUPPORT,
TOOLKIT_CHANGEAPPROVAL_FAIL
} TOOLKIT_STATUS;
Chapter 8. Point Management API
About Point Management API
Point Management API provides an interface between application programs and CIMPLICITY software's
ability to monitor data point values.
Point Management is a product option for GE Digital' CIMPLICITY software. This Application Program
Interface (API) is fully integrated with CIMPLICITY software's Base System functionality to enhance
its already powerful monitoring capability in a full range of computer integrated manufacturing
environments.
Point Management is a set of processes and functions that manages CIMPLICITY points. Mechanisms
are provided to define points, to distribute point data across networked systems, and to generate alarms
based on pre-configured conditions. Each CIMPLICITY point is identified by a Point ID and may be either a
device point or a derived point.
A device point is one whose value is associated directly with a data source such as a PLC device.
A derived point (also known as a virtual point) is a data point whose value is calculated by an arithmetic
or logical expression.
System Overview
The Point Management Resident Process (PTMRP) receives point data from other processes, responds to
application requests for point data, and generates alarms when point data is outside configured limits.
Applications that need access to point data send requests to a PTMRP. These messages are sent using
the Point Management Application Library (PTMAP). It is the job of PTMAP to determine which PTMRP is
responsible for a specific point. Thus, applications do not need to be aware of the location of point data in
a system with multiple PTMRPs.
The Point Translation Process (PTX) manages point configuration data for applications. PTX accesses
configuration data when Point Management starts up, and sends that configuration data to applications
on request. Applications do not communicate directly with PTX. Application requests to PTMAP result in
communications between PTX and the application.
The Derived Point Process (PTMDP) provides a mechanism for summarizing information about the
system, or identifying conditions that can only be recognized by evaluating several pieces of data. The
Derived Point Process collects point data from the Point Management Resident Processes and uses that
data to determine the value of derived points. Once the value of a derived point is established, the PTMRP
that handles the point is sent the new value. The point data may then be accessed by applications.
Derived points are configured by specifying a point and an expression that is used to calculate the point's
value. The expression may contain arithmetic, logical, and bitwise operators. Several Derived Point
Processes may exist in a system, each handling a subset of derived point data.
The Point Management Application Library (PTMAP) is a function library through which applications
access Point Management data. PTMAP accepts requests from the application, accesses configuration
data through communications with PTX, and relays those requests on to a PTMRP. PTMAP receives
responses back from PTMRP and provides mechanisms for sending those responses to the application.
Defining an application that works with Point Management requires that points be defined through
configuration data. Points that are device points must have Device Communications configuration as well.
Open Interface API Reference | 8 - Point Management API | 413
External Interfaces
Device Communication
PTMRPs interface with Device Communications subsystems in order to receive point data values. Each
PTMRP is capable of receiving data from multiple Device Communication processes.
The relationship between a PTMRP and Device Communications processes is defined in the configuration
file, DEVCOM_PROC. The ptmgmt_process_id field in DEVCOM_PROC specifies the PTMRP to which the
Device Communication process sends data.
Alarm Management
The PTMRPs interface with Alarm Management in order to notify Alarm Management of alarm
conditions. The PTMRPs recognize alarm conditions by comparing point data values provided by Device
Communications with alarm limits configured in Point Management configuration files. When a point data
value exceeds its alarm limits, Point Management assembles an alarm message and sends that message
to Alarm Management.
PTMRPs interface with application processes that need to access point data. Application processes
communicate with the PTMRPs through an application library (PTMAP) that manages the exchange of
data with the PTMRPs.
Application processes make requests through PTMAP using shopping lists. Requests for points are
added to shopping lists by specifying the point address that was returned by the PTMAP_add_point
function. The application library accesses the Point Translation Process to determine which PTMRP
handles that point.
This API is written for the international environment. In an international environment, strings in
CIMPLICITY software can be multi-byte strings. If you want your code to conform to international
standards, GE Digital recommends that you do the following when working with strings:
Open Interface API Reference | 8 - Point Management API | 414
char *cp;
• Avoid using a variable to hold the value of a logical character. Instead, use a pointer to a character
in the string. In particular, avoid the _tcsnextc() macro, because the value it § Use the functions
_tccpy() and _tccmp() and string pointers instead of the = and == operators on characters.
• Use GetStringTypeEx() instead of the character classification macros such as _istalpha().
• Use CharUpper() and CharLower() instead of _toupper() and _tolower().
Recommended Reading
Microsoft has several good papers on writing international code on its Developer Network CD and its web
site. To find documentation on the web site, go to http://msdn.microsoft.com/default.asp and search for
MBBCS.
Schmitt, David A., Internationalization Programming for Microsoft ® Windows ®, ISBN 1-57231-956-9
The Point Management Application Program Interface provides a C language interface to the CIMPLICITY
software Point database. Using the C functions, you may create C language applications that can receive
current point data from standard CIMPLICITY software devices. Once developed, these applications will
run on any CIMPLICITY computer in your enterprise.
The Point Management API consists of a set of object libraries and include files you use to customize
your application. It also includes seven example programs to help you design and validate your own
applications. These programs are ptq_snap.c, ptq_onchange.c, ptq_onchgstru.c, ptq_setpoint.c,
ptq_setpt._eu.c, ptm_monitor.c, and ptm_script.c
• Understand the general and Point Management specific subroutine interfaces provided by
CIMPLICITY software's Point Management capability.
• Understand the Point Configuration requirements described in the CIMPLICITY Base System User
Document.
• Code appropriate application programs.
• Compile and link the programs as explained in this chapter.
• Be familiar with the Point Configuration file structure.
The following is a list of all files distributed with the Point Management API. The files are loaded into the
directory indicated. The environment variable %BSM_ROOT% is the directory where CIMPLICITY software
was installed.
adhoc_defs.h
cimpoint.hpp
cor.h
Open Interface API Reference | 8 - Point Management API | 416
cor_event.h
cor_mutex.h
cor_os.h
cor_stat.h
cor_strver.h
cor_time.h
ddl.h
gfclass.hpp
ipcerr.h
netcom.h
noshare_ext.h
ptexp_defs.h
ptm_defs.h
ptm_errors.h
ptm_ms.h
ptmap_defs.h
ptmap_proto.h
rtr_bcst.h
sc_recs.h
ssdef.h
ptmap.lib
ipc.lib
cim_sc.lib
cim_mf.lib
ddl.lib
fasrtl.lib
corutil.lib
tools.lib
makefile
ptq_snap.c
ptq_onchange.c
ptq_onchgstru.c
ptq_setpoint.c
Open Interface API Reference | 8 - Point Management API | 417
ptq_setpt_eu.c
ptm_monitor.c
ptm_script.c
monitor.input
script.input
Overview
A sample Microsoft Visual C++ makefile, is provided to build the sample programs. Use this makefile as
a basis for constructing makefiles for your own applications.
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 automatically, you will have to set them
manually or run the following to set them before building any user programs.
From the CIMPLICITY Configuration cabinet for your project, select Command Prompt from the Tools
menu.
1. 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 (where drive is the disk where
your CIMPLICITY software is installed):
<drive>:
cd %BSM_ROOT%\api\ptm_api
3. If the environment variables are not set automatically, issue the following command to set them:
The API process name must be stored in the PRCNAM environment variable for a sample 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>
The following sample programs demonstrate how point information is collected on the system.
ptq_snap.c Data via SNAPSHOT requests. The application receives only the point data value when the
request is processed.
ptq_on Data via ONCHANGE requests. The application receives the current point data value, and
change.c then receives an updated point data value whenever the data value changes.
The following sample programs demonstrate how point values can be modified.
When you run any of the PTQ programs, you will be prompted to enter a Point ID. The point ID that you
specify must be:
Open Interface API Reference | 8 - Point Management API | 419
• For a point that has been configured through the application configuration functions.
• Defined in the current running project.
If the point is not in the current running project, an error message such as "Null Point Address" is
displayed. The system must be updated with that configuration data.
Before you run any of the test programs (or one of your own applications), you must always be sure that
the CIMPLICITY processes have completed their startup.
Note:
When you run the ptm_monitor and ptm_script programs, you will be prompted for an input file to
be used. Sample monitor.input and script.input files are provided for references.
Run ptq_snap
ptq_snap
The PTQ> prompt appears. You can display point values or point attribute information.
• To display a point value, enter the Point ID for the point you want to display then press Enter.
• To display attribute information for a point, enter the Point ID for the point followed by a period
(.) and the attribute name you want to display, then press Enter. You can use any of the attributes
documented in Point Attribute Descriptions.
Always enter the Point ID in upper-case characters since the point data base is case sensitive. The
sample program does not allow you to view Point IDs that contain embedded spaces.
After you press Enter, the current value for the point in the point management data base is displayed.
Remember that this is the current value in the data base. The frequency with which the point is collected
by the system is determined by the point's configured scan rate. If the configured rate is 5 seconds, there
may be as much as a five second delay between changes at the controller and in the point management
data base.
The point value is displayed with engineering units conversion if so configured. After the value is shown,
the PTQ> appears again, and you may enter another Point ID.
Run ptq_onchange
Open Interface API Reference | 8 - Point Management API | 420
ptq_onchange
The PTQ> prompt appears. You can display point values or point attribute information.
• To display a point value, enter the Point ID for the point you want to display then press Enter.
• To display attribute information for a point, enter the Point ID for the point followed by a period
(.) and the attribute name you want to display, then press Enter. You can use any of the attributes
documented in Point Attribute Descriptions.
Always enter the Point ID in upper-case characters since the point database is case sensitive. You will not
be able to view Point IDs that contain embedded spaces.
After you press Enter, the current value for the point in the point management database is displayed.
Remember that this is the current value in the database. The frequency with which the point is collected
by the system is determined by the point's configured scan rate. If the configured rate is 5 seconds, there
may be as much as a five second delay between changes at the controller and in the point management
data base.
The point value is displayed with engineering units conversion if so configured. After the value is shown,
the program waits for a new value to be received from point management. Whenever the value in the
point management data base changes, that value is sent to the program, and the value is displayed on the
terminal. Press Ctrl+C to terminate the program.
Run ptq_onchgstru
If you have a communications enabler (like Siemens H1-TF) that supports Structure points, you can use
this test program to display them.
ptq_onchgstru
The PTQ> prompt appears. Enter the Point ID for the Structure point you want to display and press Enter.
After you press Enter, the current value for the Structure point in the point management database
is displayed. Remember that this is the current value in the database. The frequency with which the
Structure point is collected by the system is determined by the Structure point's configured scan rate. If
the configured rate is 5 seconds, there may be as much as a five second delay between changes at the
controller and in the point management data base.
Open Interface API Reference | 8 - Point Management API | 421
The Structure point field values are displayed with engineering units conversion if so configured. After
the values are shown, the program waits for the Structure point update to be received from point
management. Whenever one of the fields changes value, the Structure point is sent to the program, and
the updated field values are displayed on the terminal. Press Ctrl+C to terminate the program.
ptq_setpoint
ptq_setpt_eu
For either of these programs, the PTQ_SETPOINT> prompt appears. Enter the Point ID for the point you
want to display and press Enter. The Point ID should be entered in upper-case characters since the point
data base is case sensitive. You are not able to modify point values for tag names that contain embedded
spaces.
Note:
The point you select must have read/write access. Also, for ptq_setpt_eu, the point must have
linear or custom conversion defined
After you press Enter, the Value> prompt appears if you are running ptq_setpoint, or the Converted Value>
prompt appears if you are running ptq_setpt_eu. Enter the new point value in raw data or engineering
units, as indicated by the prompt, and press Enter.
After you press Enter, the program attempts to change the value of the point. The results of this attempt
are displayed and the program terminates.
Run ptm_monitor
The program ptm_monitor requires an input file that contains a list of Point IDs for points to be monitored.
A sample monitor.input file is included with the API. The last word of the input file must be the word EXIT,
and each Point ID must be on a separate line.
ptm_monitor
Open Interface API Reference | 8 - Point Management API | 422
The Input File: prompt appears. Enter the name of the file that contains the list of points to be monitored.
Every time one of the points in the input file changes value, the new value will be displayed.
Note:
The point management API does not support referencing the following points in the same
request:
Run ptm_script
The program ptm_script requires an input file that contains a list of Point IDs and values to be set. A
sample script.input file is included with the API. The following commands are also valid in this file:
WAIT The program will wait <n> seconds before processing the next
record.
PAUSE The program will wait until the user presses Enter.
EXIT The program will stop reading the input file and terminate.
ptm_script
<filename>
Every time one of the points in the input file changes value, the new value is displayed.
PTMAP provides the application interface to point data. Its function library provides the following
services:
Open Interface API Reference | 8 - Point Management API | 423
Man Each point to be accessed by an application must be added to a local store of point data.
age Lo
cal Point
Data
Speci Once a point is added to the local store, the application may make requests for that point da
fy Re ta. For example, the application may request receipt of a point's data value every time the val
quests ue changes.
Group Requests may be organized into Shopping Lists. A Shopping List represents a group of re
Re quests that the application makes at one time. The application can organize its requests in
quests any number of Shopping Lists.
Send Re Once requests have been specified and grouped together, the application transmits that infor
quests mation to a PTMRP. The actual sending of the requests is handled by PTMAP.
Wait After requests have been made, the application may wait for responses to be returned. The
for Re application may choose to wait for single responses to be returned or for complete sets of re
sponses sponses.
Receive Once responses have been received by PTMAP, the application is notified (either by explicitly
Re waiting or by testing an event flag) that responses are available. The application may then ac
sponses cess each response and the data that has been returned.
To develop an efficient application you will usually design the application so the least number of
messages are passed between the application and Point Management.
• The application to Point Management when you send a request to point management,
• Point Management to the application when your application receives a data value (multiple
requests and data values do get packed into the messages when possible).
Requests Comments
SNAPSHOT Most efficient way to get a value required only once. However, when a value must be re
trieved multiple times, SNAPSHOT requests will be staticly inefficient. This is because two
Open Interface API Reference | 8 - Point Management API | 424
messages are required to collect a single data value: one to send the request; and another
when the data value is sent to your application.
TIMED more efficient when a value is required periodically, because once your application makes
the request of Point Management, it never has to do so again. On the other hand, if the
time interval specified in the TIMED request is short (a few seconds or less), your applica
tion will consume substantial CPU resources because it will be receiving data values fre
quently.
ON (Like timed requests) are more efficient when a value must be monitored in an ongoing
CHANGE fashion, because once your application makes the request of Point Management, it never
has to do so again. Since your process will be informed whenever the point value changes,
you receive the data only when necessary. Depending on the frequency of changes in point
value, the polling rate for the point, and the requirements of your application, ONCHANGE
requests may be more or less efficient than TIMED requests.
Point Comments
Type
Digi There should be no reason (other than programming convenience) for requesting points on a
tal TIMED basis. Your application should always request that the point be requested ONCHANGE.
Ana Consider the frequency at which you really need to track the data. If your analog values tend to
log change slowly with small fluctuations, it may be better to make timed requests.
Example You have configured an analog point that it is sampled every 5 seconds, i.e. the base
scan rate for the device is 5 seconds and the point is configured to be scanned at 1 times the
base scan rate. The dynamics of the point are such that it changes every 5 seconds, but within
a range that is insignificant to your application. In this case it may be better to request the val
ues on a TIMED basis at 1 minute intervals if small fluctuations in value matter little to your ap
plication. Note that although your application receives the point every minute, status monitor
ing screens will continue to receive the point whenever it changes. If you think that under no cir
cumstance is it necessary for the point to be sampled at 5 second intervals, you should consider
changing the scan rate for the point.
On-Alarm Requests
On-Alarm requests provide the ability to request notification from PTMRP, when the alarm state of a point
changes. Each point can have four alarm limits defined, each of which defines an alarm state. These
Open Interface API Reference | 8 - Point Management API | 425
states are referred to as Alarm High, Warning High, Warning Low, and Alarm Low. The following diagram
illustrates these states:
Errors that occur during calls to PTMAP are recorded in the COR_STATUS structure and returned to
the application. Unless noted otherwise in the function descriptions, all PTMAP functions return either
COR_SUCCESS, COR_WARNING, or COR_FAILURE. If either COR_WARNING or COR_FAILURE is returned,
additional information is returned in the status structure: the err_msg field is filled with an error message
and the err_code field contains the PTMAP error code.
COR_STATUS;
A list of error codes for all Point Management processes is included in Appendix A.
PTMAP maintains a local data store of point information for each application. The application must
declare the points that it accesses before using that point in a Point Management request.
Applications declare the points with the function PTMAP_add_point. When that function is called, PTMAP
communicates with PTX (the Point Translation Process) to validate that the point is configured in the
system and to access the point's configuration data.
Once a point has been added to the local data store, it can be referenced in multiple requests.
PTMAP maintains the point in its local store until the application removes it by calling the function
PTMAP_remove_point.
Applications create Shopping Lists and add requests to the Shopping Lists in order to access Point
Management services. Point Management provides the following services through requests:
Re Description
quest
Type
On- Point Management returns the current value of a specified point to the application and then re
Change turns the point value every time that the point changes. To stop receiving point values, the ap
plication must cancel the request.
Open Interface API Reference | 8 - Point Management API | 427
On- Point Management returns the value of a specified point when it enters into an alarm state.
Alarm Point Management will continue to send the value whenever the point changes state. To stop
receiving point values, the application must cancel the request.
On-Ac Point Management returns the value of a specified point when the alarm acknowledge status
knowl of the point changes. Point Management will continue to send the value whenever the alarm
edge acknowledge status changes. To stop receiving point values, the application must cancel the
request.
Timed Point Management returns the value of a specified point after the expiration of a designated
time interval. Point Management reinitiates the interval when it sends point data and sends the
point data again after the interval next expires. To stop receiving point values, the application
must cancel the request.
Re Description
quest
Type
Snap Point Management returns the current value of a specified point to the application. The applica
shot tion must send the request a second time in order to receive another value.
Setpoint The application sends a data value to Point Management to be downloaded to a de
vice.
Requests cannot be added to null Shopping Lists. That is, before any add requests are issued for a
particular Shopping List, a PTMAP_add_sl must have been issued to define the Shopping List. After
requests have been added to a Shopping List, the Shopping List must be sent to Point Management to
register the request with a PTMRP.
Modify Requests
Once a request has been added to a Shopping List, it remains on that Shopping List until it is removed.
PTMAP provides a function to modify "Setpoint" requests existing on a Shopping List. Other Shopping
List requests cannot be modified using this function. Instead, they are canceled (using one of the
PTMAP_cancel functions) and then added in the modified state.
PTMAP provides the ability to suspend and resume the receipt of responses from Point Management.
These functions should be used whenever the application will be unable to accept responses from the
PTMRP. For example, if the application must synchronously accept user input for an undetermined length
of time, it should suspend requests before allowing user input, and resume requests when interaction with
the user has completed.
Open Interface API Reference | 8 - Point Management API | 429
During the time that responses are suspended, the application does not receive "On-Change", "On-Alarm",
"On-Acknowledge", and Timed requests. When responses are resumed, the application is sent all point
values for which "On-Change", "On-Alarm", "On-Acknowledge", and Timed requests were made.
Enable/Disable Requests
PTMAP provides the ability to selectively enable or disable requests that have been added to Shopping
Lists. Once the request has been added to the Shopping List, the application must set its state as either
enabled or disabled. If the request is disabled, it will not be sent to the PTMRP.
Cancel Requests
PTMAP provides functions to cancel outstanding requests. When a request has been sent to the PTMRP,
the application is considered to have an outstanding request until PTMRP responds. "On-Alarm", "On-
Acknowledge", or "On-Change" requests cause the application to have outstanding requests until the
request has been canceled.
Open Interface API Reference | 8 - Point Management API | 430
Applications must cancel requests to stop the PTMRP from responding to the request. Responses
received prior to the cancellation of the request must be processed before deleting that request using
PTMAP_get functions.
In order for an application to send requests to Point Management, it must use the PTMAP_send functions
described in this section. (Responses to requests can be accessed using PTMAP_get functions)
Once an application has sent requests to Point Management, it must wait for responses to be returned.
The application can use one of two strategies for recognizing that responses have been received. The
application can check the event flag that was passed to PTMAP in the PTMAP_initiate function; the event
flag is set high when a response is received. Or the application can call a PTMAP_wait function to wait for
the receipt of one or more responses.
Once responses have been received, the application may call one of the PTMAP_get functions to access
the responses.
Once Point Management returns responses to the application process, the application may call one of
the PTMAP_get functions to access the responses. The PTMAP_get functions allow the application to
specify the responses that it is interested in. Each PTMAP_get function returns a single response and
must be called iteratively to get all responses. An error is returned when there are no more responses
to be returned. For example, after sending a Shopping List containing four "Snapshot" requests and
waiting for the responses, the application should call PTMAP_get_sl four times to get the responses. If
the application calls PTMAP_get_sl a fifth time, COR_WARNING is returned.
In addition to checking the return status on the PTMAP_get function (returned in retstat argument) the
application must check the status of the response which is returned in the rsp_stat argument. Depending
on the rsp_stat->status value, rsp_ptr points to a ptm_rsp record containing the response data as follows:
Open Interface API Reference | 8 - Point Management API | 432
COR_ set * valid Point ID Point state; no data, no stamp, data present if last
WARNING known value is available
After accessing required information following a PTMAP_get function, applications must deallocate this
structure by calling the PTMAP_free_ptm_rsp function. See the next section for additional information on
accessing point data.
Once the application has responses in the form of PTM_RSP structure, it is possible to access the point
value and point state information. The application has access to the response structure (PTM_RSP) and
to the data structure (PTM_DATA) that is part of the response structure. The data value returned to the
application is the raw value. The application may choose to convert that data to a real number and also
retrieve the engineering-units label for the point.
• BSM_ROOT%\api\include\inc_path\ptm_defs.h
• %BSM_ROOT%\api\include\inc_path\ptmap_defs.h
PTM_POINT_STATE state;
UCHAR _fill1[2];
COR_U1 rsp_complete;
COR_STAMP timestamp;
UCHAR default_data;
UCHAR alarm_enabled;
UCHAR warning_enabled;
UCHAR ack_occurred;
COR_I2 array_index;
PTM_DATA *data;
} PTM_RSP;
State The point state. The state of the point indicates if it is in a normal state, an alarm state, or if the
point is unavailable. See the next section for complete documentation on the alarm state.
The other fields listed in the structure are reserved for use by GE Digital.
PTM_DATA_TYPE type;
PTM_DATA_LENGTH len;
PTM_ELEMENTS elem;
UCHAR fill[PTM_DATA_FILL];
COR_I1 value[PTM_MAXSIZE];
} PTM_DATA;
Note:
Never declare a variable as PTM_DATA since PTM_MAXSIZE can equal 64K.
Memory for PTMAP data must be allocated and deallocated using the following functions:
• PTMAP_alloc_ptm_data
• PTMAP_alloc_eu_conv
• PTM_free_ptm_data
• Data structures can be copied from one record to another already allocated record using
Open Interface API Reference | 8 - Point Management API | 435
PTMAP provides access to point configuration data for applications. PTMAP acquires the configuration
data from the Point Management Translation Process (PTX) when the point is added to the local data
store. The application has access to the points data size, type and length.
A (on C (on E (on F (on G (on I (on M (on R (on S (on T (on W (on
page page page page page page page page page page page
436) 436) 437) 437) 437) 438) 438) 438) 438) 439) 439)
• PTMAP_add_alarm_ack_state
• PTMAP_add_setpoint_chgapproval
• PTMAP_add_onalarm
• PTMAP_add_sl
• PTMAP_add_onchange
• PTMAP_add_snapshot
• PTMAP_add_point
• PTMAP_add_timedpt
• PTMAP_add_pt_list
• PTMAP_alloc_eu_data
• PTMAP_add_setpoint
• PTMAP_alloc_ptm_data
PTMAP_cancel_all
Open Interface API Reference | 8 - Point Management API | 437
PTMAP_cancel_point
PTMAP_cancel_req
PTMAP_cancel_sl
PTMAP_copy_point
• PTMAP_eu_conv
•
•
• PTMAP_fold_ack_state
•
•
• PTMAP_free_point_list
•
•
• PTMAP_free_ptm_data
•
•
• PTMAP_free_ptm_rsp
•
•
• PTMAP_get_all
• PTMAP_get_point_type
• PTMAP_get_eu_info
• PTMAP_get__req
• PTMAP_get_eu_label
• PTMAP_get_req_point_id
• PTMAP_get_init_state
• PTMAP_get_sl
Open Interface API Reference | 8 - Point Management API | 438
• PTMAP_get_point
• PTMAP_get_sl_point
• PTMAP_get_point_ChangeApprovalInfo
• PTMAP_get_struct_components
• PTMAP_get_point_info
• PTMAP_get_type
• PTMAP_get_point_List
•
•
• PTMAP_initiate
•
•
• PTMAP_modify_setpoint
• PTMAP_modifysetpoint_chgapproval
• PTMAP_remove_point
•
•
• PTMAP_remove_sl
•
•
• PTMAP_resume
•
•
• PTMAP_rev_eu_conv
•
•
S
Open Interface API Reference | 8 - Point Management API | 439
PTMAP_send_all PTMAP_set_point
PTMAP_send_point PTMAP_set_req
PTMAP_send_req PTMAP_set_sl
PTMAP_send_sl PTMAP_set_sl_point
PTMAP_send_sl_point PTMAP_suspend
PTMAP_set_all
• PTMAP_terminate
•
•
PTMAP_wait_all PTMAP_wait_sl
PTMAP_wait_point PTMAP_wait_sl_point
PTMAP_wait_req
PTMAP_add_alarm_ack_state
This subroutine adds a request to receive point information when the point's alarm acknowledges state
changes.
Point Management sends the information whenever the acknowledge state of the point changes. Use
PTMAP_fold_ack_state to determine the new state of the point.
Syntax
int PTMAP_add_alam_ack_state ( sl_adr, point_adr,
req_adr, retstat )
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
PTMAP_ADDR *req_adr;
COR_STATUS *retstat;
Open Interface API Reference | 8 - Point Management API | 440
Input Arguments
Output Arguments
ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
Return Value
PTMAP_add_onalarm
This subroutine adds a request to receive a point value when an alarm condition exists. Point
Management sends the point value to the requester when the point is in an alarm condition.
The alarm condition is specified as a combination of Alarm or Warning and High or Low. For example, it is
possible to request to be notified about an Alarm High condition or a WarningLow condition, or any other
combination. When the status of the point satisfies the specified condition, Point Management sends
the point value. Point Management continues to send the value whenever a point value enters the state
specified by the alarm condition until the request is canceled.
The following table shows the relationship between the setting of the parameters aw_state and high_low,
and the point state when your application receives notification. For example, the table shows that if
aw_state = PTM_AW_ALARM and high_low = PTM_LOW, your application will receive the point data when
the point state goes into Alarm Low state.
An On-Alarm request may only be made for point types for which alarms may be defined. That is, an "On-
Alarm" request may not be made for BITSTRING, OCTET_STRING, and CHARACTER_STRING types, or for
points that are more than one element in length.
Syntax
int PTMAP_add_onalarm ( sl_adr, point_adr, aw_state,
high_low, immediate,
req_adr, retstat )
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
PTM_AW aw_state;
PTM_HIGH_LOW high_low;
COR_BOOLEAN immediate
PTMAP_ADDR *req_adr;
COR_STATUS *retstat;
Input Arguments
high_ The variance direction for which the alarm state applies. The possibilities are:
low
im Set to TRUE if the application requires an immediate response from Point Management contain
medi ing the point value whether or not the point is in alarm state. Following the immediate response,
ate the point value is sent to the application only when the alarm state of the point changes.
Output Arguments
ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_INVAL_ONALARM_LIMIT
PTMAP_INVAL_ONALARM_STATE
PTMAP_INVAL_DATA_TYPE
PTMAP_INVAL_ELEMENTS
Open Interface API Reference | 8 - Point Management API | 443
Return Value
PTMAP_add_onchange
This subroutine adds a request to a shopping list to receive a point value each time the point value
changes. The current value of the point is returned by Point Management, and then sent whenever the
point value changes. The point value is collected on each change in its value until the request is canceled
or requests are suspended.
Syntax
PTMAP_add_onchange ( sl_adr, point_adr, req_adr,
retstat )
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
PTMAP_ADDR *req_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Open Interface API Reference | 8 - Point Management API | 444
Return Value
PTMAP_add_point
This subroutine adds a point to the local data store of point information. All points that are referenced in
other PTMAP functions must first be added via a call to PTMAP_add_point. When PTMAP_add_point is
called, the point's configuration data is accessed. Designated configuration information is available.
Syntax
int PTMAP_add_point ( point_id, full, point_adr,
retstat )
char *point_id;
COR_BOOLEAN full;
PTMAP_ADDR *point_adr;
COR_STATUS *retstat;
Input Arguments
point_ Unique identifier for the point. The point must be defined in configuration data. To request the
id point's value, just enter the Point ID. To request the value of an attribute for the point, enter the
Point ID followed by a period (.) and the attribute name. See Point Attribute Descriptions for a
list of value attributes.
Output Arguments
point_ A pointer to the point record that was created. This pointer can be saved by the application to
adr access PTMAP data on a point basis.
Ret Pointer to status structure. The following error may be returned (see Appendix A for an explana
stat tion of this code):
PTMAP_POINT_ALRDY_ADDED
PTMAP_PT_ADR_NOTF
Return Value
PTMAP_add_pt_list
This subroutine adds points to the local data store from a list of points. This function can be used in place
successive calls to PTMAP_add_point when several points are to be added to the local data store.
In order to use this function, an array of PTMAP_PT_LIST structs must first be allocated. The array must
contain one struct for each point plus one as a terminating record. Each element of the array must be
populated and the last used record should be given a NULL Point ID and point address.
typedef struct
RECORD_PTR ptr;
COR_I4 seq_num;
} PTMAP_ADDR;
typedef struct
char *point_id;
PTMAP_ADDR *addr;
} PTMAP_PT_LIST;
PTMAP_ADDR contains values for each point added from the list.
The following C macro has been defined to load the point list:
#define LOAD_PT_LIST(dest,pt_id,point_addr)\
dest.point_id = pt_id;\
dest.addr = point_addr;\
When you load the point list, the pt_id field can contain a Point ID or a Point ID followed by a period (.) and
an attribute name. For more information on point attributes, see Point Attribute Descriptions.
Syntax
int PTMAP_add_pt_list ( point_list, full, retstat )
PTMAP_PT_LIST *point_list;
COR_BOOLEAN full;
COR_STATUS *retstat;
Open Interface API Reference | 8 - Point Management API | 446
Input Arguments
Output Arguments
ret Pointer to status structure. The following error may be returned (see Appendix A for an explana
stat tion of this code):
PTMAP_POINT_ALRDY_ADDED
PTMAP_POINT_ADR_NOTF
Return Value
PTMAP_add_setpoint
This subroutine adds a "Setpoint" request to a Shopping List. Point Management downloads the specified
value to the device address designated by the point. The application must have a pointer to a PTM_DATA
struct containing the data value. This structure must be allocated by a call to PTM_alloc_ptm_data.
Syntax:
point_value,req_adr,
retstat )
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
PTM_DATA *point_value;
PTMAP_ADDR *req_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_DATA_NULLPTR
PTMAP_DATA_TYPE_MISMATCH
PTMAP_DATA_LEN_MISMATCH
PTMAP_DATA_ELEM_MISMATCH
Return Value
PTMAP_add_setpoint_chgapproval
This subroutine adds a setpoint request to a shopping list, including the change approval information.
Point Management downloads the specified value to the device address designated by the point. The
application must have a pointer to a PTM_DATA struct containing the data value.
Syntax
int PTMAP_add_setpoint_chgapproval ( sl_adr,
point_adr,
point_value,
req_adr,
Open Interface API Reference | 8 - Point Management API | 448
changeapproval_obj,
retstat )
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
PTM_DATA *point_value;
PTMAP_ADDR *req_adr;
ChangeapprovalInfo *changeapproval_obj;
COR_STATUS *retstat;
Input Arguments
changeap- A pointer to the change approval information for the setpoint operation. If there is no
proval_obj change approval data, this should be NULL.
Output Arguments
adr
Ret- Pointer to status structure. The following warnings may be returned. PTMAP_ADDR_PTR_
stat NULL PTM_BAD_PERFORMUSRID_PASSWORD PTM_BAD_VERIFYUSRID_PASSWORD PTMAP_
CHANGEAPPROVAL_SAME_USERID
PTMAP_DATA_ELEM_MISMATCH PTMAP_DATA_LEN_MISMATCH
PTMAP_DATA_NULLPTR
PTMAP_SL_ADR_NULL
PTM_INVAL_CHANGEAPPROVAL_LEVEL PTM_INVAL_CHANGEAPPROVAL_RESOURCESETPOINT
PTM_INVAL_PERFORMUSERID PTM_INVAL_VERIFYUSERID
Return Value
PTMAP_add_sl
Once a Shopping List has been created, applications may add requests to the Shopping List and send
those requests to Point Management. An application may create any number of Shopping Lists and add
any number of points to that list. (These numbers are limited only by virtual memory use.) The application
is returned a Shopping List identifier that uniquely identifies this Shopping List.
Syntax
int PTMAP_add_sl (sl_adr, retstat)
PTMAP_ADDR *sl_adr;
COR_STATUS *retstat;
Input Arguments
None.
Output Arguments
sl_ Shopping List identifier that may be used in calls to add/remove points to/from Shopping List or
adr to send the Shopping List.
Return Value
COR_SUCCESS.
PTMAP_add_snapshot
This subroutine adds a request for a "Snapshot" of a point to a Shopping List. The current point value is
returned by Point Management after the Shopping List has been sent.
Open Interface API Reference | 8 - Point Management API | 450
Syntax
PTMAP_add_snapshot ( sl_adr, point_adr, req_adr,
retstat )
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
PTMAP_ADDR *req_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Return Value
PTMAP_add_timedpt
This subroutine adds a request to a shopping list for a point value at regular time intervals. The current
value of the point will be returned by Point Management and then will be sent to the requesting process
at regular time intervals. The length of the time interval is specified in the call to the function. The point
values are sent until the request is canceled, or requests are suspended. If timed point requests are
Open Interface API Reference | 8 - Point Management API | 451
outstanding when requests are resumed, point values are sent immediately after resuming requests, and
the delay intervals are timed from that time.
Syntax
PTMAP_add_timedpt ( sl_adr, point_adr, interval,
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
COR_I4 interval;
COR_I4 units;
PTMAP_ADDR *req_adr;
COR_STATUS *retstat;
Input Arguments
Inter Integer specifying the length of time which Point Management is to wait between sending point
val values.
Units Integer which specified the time units to which interval refers. It must be one of the following:
PTM_HOURS, PTM_MINUTES, or PTM_SECONDS.
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_INV_TIME_UNIT
Open Interface API Reference | 8 - Point Management API | 452
Return Value
PTMAP_alloc_eu_data
This subroutine allocates memory for PTM_DATA structure and sets the length, type, and element fields.
Syntax
PTM_DATA *PTMAP_alloc_eu_data ()
PTM_DATA *result
Input Arguments
None
Output Arguments
Return Value
PTMAP_alloc_ptm_data
This subroutine allocates memory for PTM_DATA structure and sets the length, type, and element fields.
Syntax
PTM_DATA *PTMAP_alloc_ptm_data (type, len, elem)
PTM_DATA_TYPE type;
PTM_DATA_LENGTH len;
PTM_ELEMENTS elem;
Input Arguments
Output Arguments
None.
Return Value
Note:
A null will be returned if virtual memory for the process is exhausted.
PTMAP_cancel_all
This subroutine cancels all outstanding requests that have been made by the application. Shopping Lists
that have been created may still be referenced. Following a call to PTMAP_cancel_all, Point Management
does not send any more responses.
Syntax
int PTMAP_cancel_all (retstat)
COR_STATUS *retstat;
Input Arguments
None.
Output Arguments
Return Value
PTMAP_cancel_point
This subroutine cancels all outstanding requests for a point. If multiple requests have been made
for a point in different Shopping Lists, each of those requests are canceled. This function sends the
Open Interface API Reference | 8 - Point Management API | 454
cancellation request to Point Management and waits for a response before returning control to the
application.
Syntax
int PTMAP_cancel_point (point_adr, retstat)
PTMAP_ADDR *point_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following error may be returned (see Appendix A for an explana
stat tion of this code):
PTMAP_ADDR_PTR_NULL
Return Value
PTMAP_cancel_req
This subroutine cancels a request that has been sent to Point Management. For example, if an "On-
Change" request has been sent to Point Management, this function can be used to cancel that request.
When this request is made, a message is sent to Point Management, and the application waits until a
response is received from Point Management. The request is still part of the Shopping List, but it is no
longer active. The request can be made active by sending the Shopping List a second time.
Syntax
int PTMAP_cancel_req (can_req_adr, retstat)
PTMAP_ADDR *can_req_adr;
COR_STATUS *retstat;
Open Interface API Reference | 8 - Point Management API | 455
Input Arguments
can_req_ The identifier that was returned when the request was
adr made.
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_REQ_ADR_NULL
PTMAP_REQ_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_REQ_NOT_OUT
Return Value
PTMAP_cancel_sl
This subroutine cancels all requests made via a specified Shopping List. PTMAP cancels the outstanding
requests in the specified Shopping List.
Syntax
int PTMAP_cancel_sl (sl_adr, retstat)
PTMAP_ADDR *sl_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_REQ_ADR_NULL
PTMAP_REQ_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Return Value
PTMAP_copy_point
This subroutine copies the data value of a source point to a destination point.
Syntax
int PTMAP_copy_point (dest_point, src_point, retstat)
PTM_DATA *dest_point;
PTM_DATA *src_point;
COR_STATUS *retstat;
Input Arguments
Output Arguments
The following errors may be returned if either the source or destination point record is NULL or if
the record definitions are note the same (see Appendix A for an explanation of this code):
Open Interface API Reference | 8 - Point Management API | 457
PTMAP_DATA_NULLPTR
PTMAP_DATA_TYPE_MISMATCH
PTMAP_DATA_LEN_MISMATCH
PTMAP_DATA_ELEM_MISMATCH
Return Value
PTMAP_eu_conv
This subroutine converts a raw data value to a real number with engineering units. The application passes
the raw value and is returned a real value and an engineering units string. The conversion is defined by
configuration data for the data point in the file, EU_CONV. If no conversion has been specified, an error is
returned.
Syntax
int PTMAP_eu_conv (point_id, pt_val, result, eu_label,
retstat)
*point_id;
PTM_DATA *pt_val;
PTM_DATA *result;
char *eu_label;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Re Point value structure containing the converted value (FLOATINGPOINT). Result is a PTM_DATA
sult structure. Space for this structure must be allocated by a call to PTMAP_alloc_eu_data.
Open Interface API Reference | 8 - Point Management API | 458
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an explana
stat tion of this code):
PTMAP_INVAL_POINT_ID
PTMAP_HAS_NOT_EU_CONV
PTMAP_INVAL_EU_RES_TYPE
Return Value
PTMAP_fold_ack_state
• PTM_NORMAL
• PTM_ALARM_HIGH
• PTM_ALARM_LOW
• PTM_WARNING_HIGH
• PTM_WARNING_LOW
• PTM_ALARM
• PTM_WARNING
• PTM_AVAILABLE
• PTM_OUT_OF_RANGE
• PTM_UNAVAILABLE
Whenever an alarm that was generated by Point Management is acknowledged by any source, the
Alarm Manager sends notification of that fact to the Point Manager. This information is passed by Point
Manager to all PTMAP clients in the PTM_RSP structure.
• PTM_NORMAL_NOACK
• PTM_ALARM_HIGH_NOACK
Open Interface API Reference | 8 - Point Management API | 459
• PTM_ALARM_LOW_NOACK
• PTM_WARNING_HIGH_NOACK
• PTM_WARNING_LOW_NOACK
• PTM_ALARM_NOACK
• PTM_WARNING_NOACK
• PTM_AVAILABLE_NOACK
• PTM_OUT_OF_RANGE_NOACK
• PTM_UNAVAILABLE_NOACK
This subroutine lets you fold the NOACK state of a point into the standard point state, and create the
additional point states. These additional point states are recognized by the expression processor that is
used for derived points and for graphic object annunciation.
Syntax
int PTMAP_fold_ack_state (state, ack_occurred)
PTM_POINT_STATE state;
int ack_occurred;
Input Arguments
Output Arguments
None.
Return Value
New alarm state. If the alarm has been acknowledged, the original alarm state is returned. If the alarm
has not been acknowledged, one of the "NOACK" states will be returned.
PTMAP_free_point_list
This subroutine deletes the lists compiled by PTMAP_get_point_list (on page 470) , thus freeing the
used memory.
Open Interface API Reference | 8 - Point Management API | 460
Syntax
void PTMAP_free_point_list(pszPoints)
WCHAR *pszPoints;
Input Arguments
Output Arguments
Return Value
None.
PTMAP_free_ptm_data
Memory for the PTM_DATA structure is not automatically deallocated. Applications must use the
PTMAP_free_ptm_data function to deallocate memory for ptm_data. This function returns the value NULL
in ptm_data_ptr, where ptm_data_ptr is a pointer to a PTM_DATA structure.
Syntax
PTM_DATA *PTMAP_free_ptm_data (ptm_data_ptr)
PTM_DATA *ptm_data_ptr
Input Arguments
Output Arguments
Return Value
None.
PTMAP_free_ptm_rsp
Memory for the PTM_RSP structure is not automatically deallocated. Applications must use the
PTMAP_free_ptm_rsp function to deallocate memory for ptm_rsp. This function returns the value NULL
in ptm_rsp_ptr, where ptm_rsp_ptr is a pointer to a PTM_RSP structure. This function also deallocates
memory for the PTM_DATA structure ptm_rsp_ptr -> data.
Syntax
PTM_RSP *PTMAP_free_ptm_rsp (ptm_rsp_ptr)
PTM_RSP *ptm_rsp_ptr;
Input Arguments
Output Arguments
Return Value
None.
PTMAP_get_all
This subroutine gets the responses that have been returned by Point Management. This function should
be called following one of the PTMAP_wait functions. PTMAP_get_all must be called once to access
each response.
PTMAP_get_all will return with a success status if it has any response to be returned to the application.
Otherwise, it returns a failure status.
Open Interface API Reference | 8 - Point Management API | 462
Syntax
int PTMAP_get_all (req_adr, sl_adr, point_adr,
retstat)
PTMAP_ADDR *req_adr;
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
int *rsp_type;
COR_STATUS *rsp_stat;
PTM_RSP **rsp_ptr;
COR_STATUS *retstat;
Input Arguments
None
Output Arguments
req_ Pointer to the request for which the response was generated..
adr
Retstat Pointer to status structure. The following warnings may be returned (see Appendix A for an ex
planation of this code):
PTMAP_NO_RSP_RCV
PTMAP_RCV_QUE_ERR
Return Value
PTMAP_get_eu_info
This subroutine accesses the point data type, the engineering units label, and a pointer to the conversion
expression.
Syntax
int PTMAP_get_eu_info (point_id, expr_ptr, eu_label,
eu_type, retstat)
char *point_id;
char **expr_ptr;
char *eu_label;
PTM_DATA_TYPE *eu_type;
COR_STATUS *retstat;
Input Arguments
Output Arguments
expr_ Pointer to a translated expression in a database. (Space neither has to be allocated or deallo
ptr cated.)
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_INVAL_POINT_ID
PTMAP_HAS_NOT_EU_CONV
Return Value
PTMAP_get_eu_label
This subroutine returns the eu_label value from the point record. Note that it is not necessary to have
defined conversion expressions in a configuration procedure in order to use this function.
Syntax
int PTMAP_get_eu_label (point_id, eu_label, retstat)
char *point_id;
char *eu_label;
COR_STATUS *retstat;
Input Arguments
OUTPUT ARGUMENTS:
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_INVAL_POINT_ID
Return Value
PTMAP_get_init_state
This subroutine gets the configured state for the point from the POINT configuration file. Points can be
configured and set to either ENABLED or DISABLED. If the point is disabled, no data is collected for that
point.
Syntax
int PTMAP_get_init_state (point_addr, init_state,
retstat)
PTMAP_ADDR *point_addr;
Open Interface API Reference | 8 - Point Management API | 465
COR_BOOLEAN *init_state;
COR_STATUS *retstat;
Input Arguments
Output Arguments
init_s Either TRUE (the point was configured to be enabled) or FALSE (the point was configured to be
tate disabled).
Retstat Pointer to status structure. The following errors may be returned (see Appendix A for an expla
nation of this code):
PTMAP_ADR_PTR_NULL
PTMAP_PT_ADR_NULL
PTMAP_PT_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Return Value
PTMAP_get_point
This subroutine gets the response to a request for a specific point. If more than a single request is
outstanding for a point, this function should be called once for each request. If no response is available
for the specified request, this function returns COR_WARNING.
Syntax
int PTMAP_get_point (point_adr, sl_adr, req_adr,
retstat)
PTMAP_ADDR *point_adr;
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *req_adr;
int *rsp_type;
Open Interface API Reference | 8 - Point Management API | 466
COR_STATUS *rsp_stat;
PTM_RSP **rsp_ptr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
req_ Pointer to the request for which the response was generated..
adr
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADR_PTR_NULL
PTMAP_PT_ADR_NULL
PTMAP_PT_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_NO_RSP_RCV
PTMAP_RCV_QUE_ERR
Return Value
PTMAP_get_point_ChangeApprovalinfo
This subroutine sends a request to Point Management for information about the point data type including
change approval information.
Syntax
data_type,
data_length,
elements,
data_size,
display_format,
change_approval_mask,
retstat)
PTMAP_ADDR *point_adr;
PTM_DATA_TYPE *data_type;
PTM_DATA_LENGTH *data_length;
PTM_ELEMENTS *elements;
COR_I4 *data_size;
CHAR *display_format;
int *change_approval_mask;
COR_STATUS *retstat;
Input Arguments
Output Arguments
format
change_- Flag indicating what type of change approval is required for the point
ap-
mask
If (change_approval_mask & PTM_CHANGEAPPROVAL_UNSIGNEDWRITES)
• To test whether the point is configured to require a performer and verifier authorization:
Retstat Pointer to status structure. The following errors (on page 546) may be returned. PTMAP_
ADR_PTR_NULL PTMAP_PT_ADR_NULL PTMAP_PT_ADR_NOTF PTMAP_SEQ_NUM_MIS
MATCH PTM_POINT_HASCHANGEAPPROVAL: PTM_NO_PERFORMUSERID: PTM_NO_VERI
FYUSERID: PTM_BAD_PERFORMUSRID_PASSWORD: PTM_BAD_VERIFYUSRID_PASSWORD:
PTM_NO_PERFORM_PRIV: PTM_NO_VERIFY_PRIV: PTM_INVAL_CHANGEAPPROVAL_LEVEL:
PTM_INVAL_CHANGEAPPROVAL_RESOURCESETPOINT: PTM_INVAL_PERFORMUSERID: PT
M_INVAL_VERIFYUSERID: PTMAP_CHANGEAPPROVAL_SAME_USERID: PTM_VERIFIER_PASS
WORD_EXPIRED: PTM_PERFORMER_PASSWORD_EXPIRED:
Return Value
PTMAP_get_point_info
This subroutine sends a request to Point Management for information about the point data type.
Open Interface API Reference | 8 - Point Management API | 469
Syntax
int PTMAP_get_point_info (point_adr, data_type,
data_length, elements,
data_size, display_format,
retstat)
PTMAP_ADDR *point_adr;
PTM_DATA_TYPE *data_type;
PTM_DATA_LENGTH *data_length;
PTM_ELEMENTS *elements;
COR_I4 *data_size;
CHAR *display_format
COR_STATUS *retstat;
Input Arguments
Output Arguments
Retstat Pointer to status structure. The following errors may be returned (see Appendix A for an
explanation of this code):
PTMAP_ADR_PTR_NULL
PTMAP_PT_ADR_NULL
PTMAP_PT_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Open Interface API Reference | 8 - Point Management API | 470
Return Value
PTMAP_get_point_list
This subroutine can retrieve the list of points in any of the following points.
• In manual mode.
• With modified alarm limits.
• With disabled alarms.
Syntax
WCHAR*PTMAP_get_point_list (pszProject,
nListType,
retstat);
const WCHAR*pszProject;
int nListType;
COR_STATUS*retstat;
Input Arguments
Output Arguments
Return Value
NULL terminated list of strings with each individual point id separated with a new line: \n.
Note:
Memory used by this subroutine return can be freed using PTMAP_free_point_list (on page
459).
PTMAP_get_point_type
This function provides the user with the Point Type ID for the Point ID that was provided.
This routine can only return a valid Point Type ID if the point has already been added to the internal list of
points through the PTMAP_add_pt function call.
Syntax
int PTMAP_get_point_type (point_id, point_type_id,
retstat)
char *point_id;
char *point_type_id;
COR_STATUS *retstat;
Input Arguments
point_id The Point ID of the point for which you want to know the Point Type ID.
Output Arguments
Retstat Pointer to status structure. The following errors may be returned (see Appendix A for an ex
planation of this code):
PTMAP_INVAL_POINT_ID
Return Value
PTMAP_get_req
This subroutine gets the response to a specific request. If the call is successful, Point Management
returns the following:
• Pointers to the Shopping List and point associated with the request;
• A status;
• A value.
If no response is available for the specified request, this function returns COR_WARNING.
Syntax
int PTMAP_get_req (req_adr, sl_adr, point_adr,
retstat)
PTMAP_ADDR *req_adr;
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
int *rsp_type;
COR_STATUS *rsp_stat;
PTM_RSP **rsp_ptr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Retstat Pointer to status structure. The following errors may be returned (see Appendix A for an expla
nation of this code):
PTMAP_ADR_PTR_NULL
PTMAP_REQ_ADR_NULL
PTMAP_REQ_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_NO_RSP_RCV
PTMAP_RCV_QUE_ERR
Return Value
PTMAP_get_req_point_id
This subroutine retrieves the identifier of the point for into the buffer specified by the parameter point_id
when
If the buffer length identified by point_id_len is too short to hold the entire point identifier with null
termination, the returned value will have been truncated.
Syntax
Input Arguments
req_addr Value returned from a valid PTMAP routine which added a request for a
point.
Output Arguments:
retstat Pointer to a COR_STATUS structure to receive any errors that might oc
cur.
PTMAP_get_sl
This subroutine gets the responses associated with a Shopping List. It should be called following one of
the PTMAP_wait functions. PTMAP_get_sl must be called once to access each response on the shopping
list. For example, after sending a Shopping List containing four "Snapshot" requests and waiting for the
responses, the application should call PTMAP_get_sl four times to get the responses. If the application
calls PTMAP_get_sl a fifth time, COR_WARNING is returned.
Syntax
int PTMAP_get_sl (sl_adr, req_adr, point_adr,
retstat)
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *req_adr;
PTMAP_ADDR *point_adr;
int *rsp_type;
COR_STATUS *rsp_stat;
PTM_RSP **rsp_ptr;
COR_STATUS *retstat;
Input Arguments
sl_adr The Shopping List used to send the requests that are to be
processed.
Output Arguments
req_adr Pointer to the request for which the response was generated..
Retstat Pointer to status structure. The following errors may be returned (see Appendix A for an expla
nation of this code):
PTMAP_ADR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_NO_RSP_RCV
PTMAP_RCV_QUE_ERR
Return Value
PTMAP_get_sl_point
This subroutine gets the response to a request for a specific point on a Shopping List. The point and
Shopping List are specified by the application. This function must be called once for each outstanding
response. If no response is available for the specified request, this function returns COR_WARNING.
Syntax
int PTMAP_get_sl_point (sl_adr, point_adr, req_adr,
retstat)
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
PTMAP_ADDR *req_adr;
int *rsp_type;
COR_STATUS *rsp_stat;
Open Interface API Reference | 8 - Point Management API | 476
PTM_RSP **rsp_ptr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
req_ Pointer to the request for which the response was generated..
adr
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_NO_RSP_RCV
PTMAP_RCV_QUE_ERR
Return Value
PTMAP_get_struct_components
PTMAP_get_struct_components
This subroutine provides the ability to get the information regarding a structure point type that is
necessary to decompose the raw point data into the various structure components. When a response
for a structure point is received, the data for all of the components are packed into a single value in the
response message. By calling PTMAP_get_struct_components, you can get information regarding the
order, type, size, and offset of each component within the point value.
This function only provides the structure layout; it does not process the data in the point value.
Syntax
int PTMAP_get_struct_components (point_type_id,
struct_details,
length, comp_qty,
retstat)
*point_type_id;
STRUCT_DETAILS_PTR struct_details;
COR_U2 *length;
COR_U2 *comp_qty;
COR_STATUS *retstat;
Input Arguments
struc A pointer to the record structure STRUCT_DETAILS. This will be populated with the list of com
t_de ponents and their information. If you pass a NULL in this pointer, only the length and total num
tails ber of components are returned.
Output Arguments
length The overall length, in bytes, of the STRUCTURE, including any filler needed for data alignment.
com The total number of distinct components that are defined for the STRUCTURE. The STRUCT_DE
p_qty TAILS record is made up of arrays, and this is the maximum number of valid entries that should
be used.
Open Interface API Reference | 8 - Point Management API | 478
ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_INV_PT_TYPE
PTMAP_TYPE_NOT_STRUCT
PTMAP_COMP_INVALID
PTMAP_SEQ_NUM_MISMATCH
Return Value
COR_I4 comp_offset;
COR_U2 comp_elem;
COR_U2 comp_data_type;
COR_U2 comp_data_length;
} *STRUCT_DETAILS_PTR;
PTMAP_get_type
This subroutine gets the configured data type for the point from the POINT_TYPE configuration file.
Syntax
int PTMAP_get_type (point_adr, data_type, retstat)
PTMAP_ADDR *point_adr;
PTM_DATA_TYPE *data_type;
COR_STATUS *retstat;
Open Interface API Reference | 8 - Point Management API | 479
Input Arguments
Output Arguments
Retstat Pointer to status structure. The following errors may be returned (see Appendix A for an expla
nation of this code):
PTMAP_ADR_PTR_NULL
PTMAP_PT_ADR_NULL
PTMAP_PT_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Return Value
PTMAP_initiate
This subroutine initiates Point Management services. The application must supply an event flag that is
used to communicate the completion of Point Management Requests.
Syntax
int PTMAP_initiate (event_flag, retstat)
COR_I4 event_flag;
COR_STATUS *retstat;
Input Arguments
Event_ The event flag used to communicate completion of Point Management re
flag quests.
Open Interface API Reference | 8 - Point Management API | 480
Output Arguments
Return Value
PTMAP_modify_setpoint
This subroutine modifies an existing "Setpoint" request. The application must specify the request and
the new point value. Following a call to this function the application must call a PTMAP_send function to
initiate the download to the device.
Syntax
PTMAP_modify_setpoint(point_value, req_adr, retstat)
PTM_DATA *point_value;
PTMAP_ADDR *req_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Return Value
PTMAP_modifysetpoint_chgapproval
Open Interface API Reference | 8 - Point Management API | 481
This subroutine modifies an existing setpoint request requiring change approval. The application must
specify the request and the new point value. Following a call to this function, the application must call a
PTMAP_send function to initiate the download to the device.
Syntax
int PTMAP_modify_setpoint_chgapproval ( point_adr,
point_value,
req_adr,
changeapproval_obj,
retstat )
PTMAP_ADDR *point_adr;
PTM_DATA *point_value;
PTMAP_ADDR *req_adr;
ChangeapprovalInfo *changeapproval_obj;
COR_STATUS *retstat;
Input Arguments
changeap- A pointer to the change approval information for the setpoint operation. If there is no
proval_obj change approval data, this should be NULL.
Output Arguments
adr
Ret- Pointer to status structure. The following warnings may be returned. PTMAP_REQ_NOT_ENBL
stat PTMAP_REQ_CUR_OUT PTMAP_REQ_NOT_FOUND
Return Value
PTMAP_remove_point
Before calling this function, the application must ensure that no responses to outstanding requests exist
for this point. For example, if the application used this point in an "On-Change" request, the application
must cancel that request before removing the point since "On-Change" requests remain outstanding until
they are canceled.
In the case of "Snapshot" and other one-time requests, the request is no longer outstanding when Point
Management has sent a response to an application's request for a point value and the application has
accessed the response. In addition, when the point is removed, all requests associated with that point are
deleted. (Standing and one-time requests are described in the next section.)
Name:PTMAP_remove_point
Description
If requests are deleted from shopping lists, a warning is returned to the application.
Syntax
int PTMAP_remove_point (point_addr, retstat)
PTMAP_ADDR *point_addr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTM_REM_OUTST_REQ
PTM_PTM_PT_NOTF
Open Interface API Reference | 8 - Point Management API | 483
PTM_RSP_DELETED
Return Value
PTMAP_remove_sl
This subroutine deletes a Shopping List from the application. If any responses are outstanding for
requests on the Shopping List, PTMAP returns an error. If no responses are outstanding, PTMAP deletes
each request that was added to the Shopping List and returns the number of requests that were deleted in
the "err_ref" field of the status structure.
Syntax
int PTMAP_remove_sl (sl_addr, retstat)
PTMAP_ADDR *sl_addr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTM_REM_OUTST_REQ
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_RSP_DELETED
Open Interface API Reference | 8 - Point Management API | 484
Return Value
PTMAP_resume
This subroutine resumes receiving responses from the PTMRP after a call to PTMAP_suspend.
Syntax
int PTMAP_resume (retstat)
COR_STATUS *retstat;
Input Arguments
None.
Output Arguments
Return Value
PTMAP_rev_eu_conv
This subroutine converts a point value from engineering units to the raw value. This function is necessary
for those applications that accept (or compute) a point value in engineering units format and need to
download that point to a PLC as a RAW value. This is the normal scenario for points that have engineering
units conversion. Point values are sent to and received from point management as integers, and are
converted to or from engineering units (floating point values) by the application.
If the point is configured with CUSTOM conversion, you must configure a Reverse expression for the point.
If the point is configured with LINEAR conversion, a Reverse expression is automatically created for the
point.
Synopsis
int PTMAP_rev_eu_conv ( point_id, eu_value, result,
ret_stat )
Open Interface API Reference | 8 - Point Management API | 485
char *point_id;
double eu_value;
PTM_DATA **result;
COR_STATUS *ret_stat;
Input Arguments
Output Arguments
Result A pointer to the address of a PTM_DATA struct that will receive the result of the computation.
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_INVAL_POINT_ID
PTMAP_HAS_NOT_EU_CONV
Return Value
PTMAP_send_all
This subroutine sends all requests on all existing Shopping Lists to the appropriate PTMRP. If a request is
already outstanding or disabled, the request is ignored. New requests are now flagged as "outstanding." If
no requests are sent, a warning is returned. PTMAP returns control to the application after the response
or group of responses for the point have been received.
Syntax
int PTMAP_send_all (retstat)
COR_STATUS *retstat;
Open Interface API Reference | 8 - Point Management API | 486
Input Arguments
None.
Output Arguments
Ret Pointer to status structure. The following warnings may be returned (see Appendix A for an ex
stat planation of this code):
PTMAP_NO_REQ_SENT
PTMAP_REQ_NOT_FOUND
Return Value
PTMAP_send_point
ThIS subroutines sends all requests for a specified point to the appropriate PTMRP. If a request is already
outstanding or disabled, the request is ignored. New requests are now flagged as "outstanding." If no
requests are sent, a warning is returned. PTMAP returns control to the application after the response or
group of responses for the point have been received.
Syntax
int PTMAP_send_point (point_adr, retstat)
PTMAP_ADDR *point_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following warnings may be returned (see Appendix A for an ex
stat planation of this code):
PTMAP_NO_REQ_SENT
PTMAP_REQ_NOT_FOUND
Open Interface API Reference | 8 - Point Management API | 487
Return Value
PTMAP_send_req
This subroutine sends a specific request to PTMRP. If the request is already outstanding or disabled, a
warning is returned. PTMAP returns control to the application after the response or group of responses
for the request have been received.
Syntax
int PTMAP_send_req (req_adr, retstat)
PTMAP_ADDR *req_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following warnings may be returned (see Appendix A for an ex
stat planation of this code):
PTMAP_REQ_NOT_ENBL
PTMAP_REQ_CUR_OUT
PTMAP_REQ_NOT_FOUND
Return Value
PTMAP_send_sl
This subroutine sends all requests on a specified Shopping List request to the appropriate PTMRP. If
a request is already outstanding or disabled, the request is ignored. New requests are now flagged as
"outstanding." If no requests are sent, a warning is returned. PTMAP returns control to the application
after the response or group of responses for the point have been received.
Open Interface API Reference | 8 - Point Management API | 488
Syntax
int PTMAP_send_sl (sl_adr, retstat)
PTMAP_ADDR *sl_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following warnings may be returned (see Appendix A for an ex
stat planation of this code):
PTMAP_NO_REQ_SENT
PTMAP_REQ_NOT_FOUND
Return Value
PTMAP_send_sl_point
This subroutine sends all requests on a Shopping List for a specific point to the appropriate PTMRP. If
a request is already outstanding or disabled, the request is ignored. New requests are now flagged as
"outstanding." If no requests are sent, a warning is returned. PTMAP returns control to the application
after the response or group of responses for the point have been received.
Syntax
int PTMAP_send_sl_point (sl_adr, point_adr, retstat)
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
COR_STATUS *retstat;
Input Arguments
Point_ A point ID created by a call to PTMAP_add_point that identifies the point the requests are as
adr sociated with.
Output Arguments
ret Pointer to status structure. The following warnings may be returned (see Appendix A for an ex
stat planation of this code):
PTMAP_NO_REQ_SENT
PTMAP_REQ_NOT_FOUND
Return Value
PTMAP_set_all
Syntax
int PTMAP_set_all (enabled_state, retstat)
COR_BOOLEAN enabled_state;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Return Value
PTMAP_set_point
Open Interface API Reference | 8 - Point Management API | 490
This subroutine enables or disables a point that has been added to the local data store.
Syntax
int PTMAP_set_point (point_adr, enabled_state,
retstat)
PTMAP_ADDR *point_adr;
COR_BOOLEAN enabled_state;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Return Value
PTMAP_set_req
This subroutine disables or enables an existing request. When a request is disabled, it is ignored if it is
part of a Shopping List that is sent to Point Management.
Syntax
int PTMAP_set_req (req_adr, enabled_state, retstat)
PTMAP_ADDR *req_adr;
Open Interface API Reference | 8 - Point Management API | 491
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Return Value
PTMAP_set_sl
This subroutine disables or enables all requests in a Shopping List. This function is useful when an
application needs to disable all but a few points. All points can be disabled and then a few points can be
selectively enabled using PTMAP_set_req.
Syntax
int PTMAP_set_sl (sl_adr, enabled_state, retstat)
PTMAP_ADDR *sl_adr;
COR_BOOLEAN enabled_state;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Return Value
PTMAP_set_sl_point
This subroutine enables or disables all requests for a specified point on a Shopping List.
Syntax
int PTMAP_set_sl_point (sl_adr, point_adr,
enabled_state, retstat)
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
COR_BOOLEAN enabled_state;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_PT_ADR_NULL
PTMAP_PT_ADDR_NOTF
PTMAP_SL_ADR_NULL
PTMAP_SL_ADDR_NOTF
PTMAP_SEQ_NUM_MISMATCH
Return Value
PTMAP_suspend
This subroutine suspends all requests that have been made to Point Management. While requests have
been suspended, no responses are sent to the application by the PTMRP.
Syntax
int PTMAP_suspend (retstat)
COR_STATUS *retstat;
Input Arguments
None.
Output Arguments
Return Value
PTMAP_terminate
Syntax
int PTMAP_terminate (retstat)
COR_STATUS *retstat;
Input Arguments
None.
Output Arguments
Return Value
PTMAP_wait_all
This subroutine waits for responses to any outstanding request. Using the wait_flag argument, the
application specifies whether PTMAP should wait for either all or any responses. PTMAP returns control
to the application after the response or group of responses have been received.
Syntax
int PTMAP_wait_all (wait_flag, retstat)
int wait_flag;
COR_STATUS *retstat;
Input Arguments
wait_ Either PTM_NEXT (wait for the next response) or PTM_ALL (wait until responses have been made
flag for all outstanding requests for that Shopping List). A warning is returned if no outstanding re
sponses exist.
Open Interface API Reference | 8 - Point Management API | 495
Output Arguments
ret Pointer to status structure. The following warning may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_REQ_NOT_OUT
Return Value
PTMAP_wait_point
This subroutine waits for a response from Point Management for a specified point. The application may
specify whether to wait for the next response or for all outstanding responses for the point. PTMAP
returns control to the application after the response or group of responses for the point have been
received.
Syntax
int PTMAP_wait_point (point_adr, wait_flag, retstat)
PTMAP_ADDR *point_adr;
int wait_flag;
COR_STATUS *retstat;
Input Arguments
wait_ Either PTM_NEXT (wait for the next response) or PTM_ALL (wait until responses have been
flag made for all outstanding requests for that point).
Output Arguments
ret Pointer to status structure. The following errors may be returned (see Appendix A for an explana
stat tion of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_PT_ADR_NULL
PTMAP_PT_ADR_NOTF
Open Interface API Reference | 8 - Point Management API | 496
PTMAP_SEQ_NUM_MISMATCH
PTMAP_REQ_NOT_OUT
Return Value
PTMAP_wait_req
This subroutine waits for the Point Management response for a specified request. PTMAP maintains
control until the response has been received, then returns control to the application.
Syntax
int PTMAP_wait_req (req_adr, retstat)
PTMAP_ADDR *req_adr;
COR_STATUS *retstat;
Input Arguments
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_REQ_ADR_NULL
PTMAP_REQ_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_REQ_NOT_OUT
Open Interface API Reference | 8 - Point Management API | 497
Return Value
PTMAP_wait_sl
This subroutine waits for a response to a Shopping List request. The application may specify whether to
wait for all responses to the requests in the Shopping List, or any response to a request in the Shopping
List. PTMAP returns control to the application after the response or group of responses for requests in
the specified Shopping List have been returned.
Syntax
int PTMAP_wait_sl (sl_adr, wait_flag, retstat)
PTMAP_ADDR *sl_adr;
int wait_flag;
COR_STATUS *retstat;
Input Arguments
wait_ Either PTM_NEXT (wait for the next response) or PTM_ALL (wait until responses have been
flag made for all outstanding requests for that Shopping List).
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_REQ_NOT_OUT
Open Interface API Reference | 8 - Point Management API | 498
Return Value
PTMAP_wait_sl_point
This subroutine waits for a response to a request for a point in a Shopping List. The application may
specify whether to wait for all or any responses to the requests for the point in the Shopping List. PTMAP
returns control to the application after the response or group of responses for requests in the specified
Shopping List have been returned.
Syntax
int PTMAP_wait_sl_point (sl_adr, point_adr,
wait_flag, retstat)
PTMAP_ADDR *sl_adr;
PTMAP_ADDR *point_adr;
int wait_flag;
COR_STATUS *retstat;
Input Arguments
wait_ Either PTM_NEXT (wait for the next response) or PTM_ALL (wait until responses have been
flag made for all outstanding requests for that Shopping List).
Output Arguments
Ret Pointer to status structure. The following errors may be returned (see Appendix A for an expla
stat nation of this code):
PTMAP_ADDR_PTR_NULL
PTMAP_SL_ADR_NULL
PTMAP_SL_ADR_NOTF
PTMAP_SEQ_NUM_MISMATCH
PTMAP_REQ_NOT_OUT
Return Value
The following macros can be used to access point values. The first argument of each macro is a pointer
to a PTM_DATA structure. The second argument specifies the element number.
Macros are provided which may be used to access OCTET_STRING and CHAR_STRING data types. Each
macro can be used to copy one element of the PTM_DATA structure to or from a memory location. The
length of the element copied is determined from the PTM_DATA structure.
The following macros will copy an element of the PTM_DATA structure to a location in memory. In these
macros, x is a pointer to memory, y is a pointer to a PTM_DATA structure, and z is the element in y which
is to be copied.
• GET_OCTSTR(x,y,z)
• GET_CHRSTR(x,y,z)
Open Interface API Reference | 8 - Point Management API | 500
The following macros will copy data from a location in memory to an element of the PTM_DATA structure.
In these macros, x is a pointer to a PTM_DATA structure, y is the element in x to which data is to be
copied, and z is a pointer to memory.
• SET_OCTSTR(x,y,z)
• SET_CHRSTR(x,y,z)
Macros are provided which may be used to access BITSTRING data types. One macro can be used to get
the value of a single bit in BITSTRING data in a PTM_DATA structure and one macro can be used to set a
single bit in BITSTRING data in a PTM_DATA structure.
The following macro will return the value of a bit in a BITSTRING. In this macro, x is a pointer to a
PTM_DATA structure, and y is the number of the bit to be returned. The first bit in the bitstring is bit 0. This
macro returns a value of 0 or 1.
• GETBITVAL(x,y)
The following macro will set a single bit in a BITSTRING data structure. In this macro, x is a pointer to a
PTM_DATA structure, y is the number of the bit to be set, and z is the value to set the bit. The first bit in
the bitstring is bit 0.
• SETBITVAL(x,y,z)
• Cor_event_waitfr
• Wait For An Event Flag To Be Set
• cor_logstatus
• Write error status information to the next available record
• cor_setstatus
• Write values to the cor_status structure.
• Cor_sleep
• Suspend Process Temporarily
• Cor_vsetstatus
• Write values and a formatted message to the cor_status structure.
Open Interface API Reference | 8 - Point Management API | 501
• Ipc_deactivate
• Deactivate Port
• Ipc_register
• Register With IPC
• Lib_get_ef
• Assign An Event Flag
cor_event_waitfr
Use this subroutine to wait for the specified event flag to be set. Return is made with COR_SUCCESS when
the flag is set. If the wait fails, return is made with COR_FAILURE.
Syntax
COR_I4 cor_event_waitfr(event_flag, ret_stat)
COR_STATUS *ret_stat;
Input Arguments
Output Arguments
Return Value
cor_logstatus
Use this function to write error status information to the next available record in the CIMPLICITY status
log (COR_STATUS.LOG).
Open Interface API Reference | 8 - Point Management API | 502
Syntax
void cor_logstatus( const TCHAR *proc,
COR_BOOLEAN severe,
COR_STATUS *status )
Input Arguments
proc The name of the calling procedure where the error is detected.
se- Is situation severe error (FALSE, TRUE, FATAL). A value of FATAL will cause your application to
vere terminate after the error message has been logged.
sta- Pointer to the status block (COR_STATUS structure) containing error info.
tus
Output Arguments
None
Return Value
None
The value is sent to the status log, which is viewed through the Log Viewer application. The err_reported
(on page 425) field will be updated to indicate that this error has been logged.
cor_setstatus
Syntax
COR_STATUS *cor_setstatus( int result, int source, int code, int ref,
Input Arguments
result COR_WARNING, COR_SUCCESS, or COR_FAILURE: 0 - Error detected - non fatal. 1 - No error, all
errors corrected. 2 - Fatal error detected.
source Error source; the code that identifies the source subsystem.
ref Error reference , used to distinguish the difference between two errors with the same error
code.
Output Arguments
status Pointer to the status block (COR_STATUS structure) that is set with input argument val
ues.
Return Value
COR_STATUS
The value is sent to the status log, which is viewed through the Log Viewer application.
Syntax
int cor_sleep (secs)
int secs;
Input Arguments
Output Arguments
None.
Return Value
None.
cor_vsetstatus
Use this function to write values and a formatted message to the cor_status structure.
Open Interface API Reference | 8 - Point Management API | 504
Syntax
COR_STATUS* __cdecl cor_vsetstatus(int result, int source, int code, int ref,
Input Arguments
result COR_WARNING, COR_SUCCESS, or COR_FAILURE: 0 - Error detected - non fatal. 1 - No error, all
errors corrected. 2 - Fatal error detected.
source Error source; the code that identifies the source subsystem.
ref Error reference , used to distinguish the difference between two errors with the same error
code.
msg Error message. Note: The message can contain format arguments and format specifiers to con
trol how the message will appear if output to the status log by cor_logstatus (on page 501).
Output Arguments
status Pointer to the status block (COR_STATUS structure) that is set with input argument val
ues.
Return Value
COR_STATUS
ipc_deactivate
Use this subroutine to terminate all activities associated with the IPC. If any RR messages are
outstanding for the process that executes ipc_deactivate, a message is transmitted on its behalf. No
further datagram messages can be sent to or from a process that executes this service.
Syntax
ipc_deactivate( retstat, port_index);
COR_STATUS *retstat;
int port_index;
Open Interface API Reference | 8 - Point Management API | 505
Input Arguments
Output Arguments
Return Value
ipc_register
Use this subroutine to initialize IPC functions for datagram and logical link communications and register
with the IPC router process.
ipc_register must be called prior to using any other communications functions besides ipc_dg_alloc
or ipc_dg_free. Following successful execution of this function, an application can start sending and
receiving datagram messages or establish logical link communications.
Syntax
int ipc_register ( retstat, port_index, object_name,
maxlnk, bufsiz)
COR_STATUS *retstat;
int *port_index;
char *object_name;
int maxlnk;
int bufsiz;
Input Arguments
ob The name under which the process registers. The object_name in combination with the node
ject_ name defines the physical address of the process. All other processes address the process
name with this name. Maximum length is 10 characters.
Open Interface API Reference | 8 - Point Management API | 506
Maxlnk The maximum number of logical links this process can request. Each datagram port and each
logical link connection counts as one link.
Bufsiz The maximum message size used by this process. ipc_dg_alloc may be used to determine this
size. The maximum is MAXMSGSIZ, which is defined in netcom.h.
Output Arguments
Retstat Pointer to status structure. When the function is not successful, retstat.err_code contains one
of the following values:
Return Value
If the function returns anything other than COR_SUCCESS, additional error information can be found in
retstat.err_msg and retstat.err_code.
lib_get_ef
Syntax
COR_I4 lib_get_ef (&event_flag)
int event_flag;
Open Interface API Reference | 8 - Point Management API | 507
Input Arguments
Output Arguments
None.
Return Value
COR_SUCCESS or COR_FAILURE.
Point Management configuration data defines the data points for the system and the way in which Point
Management handles individual points. Configuration data controls the following functions:
Alarm Generation When to generate alarms, and the content of the alarm mes
sage.
Configuration data is entered on-line using configuration transactions covered in the CIMPLICITY Base
System User's documentation. This is true except for the POINT_TYPE configuration file, which is supplied
containing default data for the system; and the PTMGMT configuration file, which is set up by Site
Configuration.
The following sections detail the Point Management configuration data and describe its use. In
developing applications, you can refer to this section for definitions of the configuration data that Point
Management has access to.
You can write applications that access any of the points defined through the CIMPLICITY System
configuration functions. Keep in mind, however, that the system must always be updated with new or
modified configuration data before your application will be able to access the new configuration. You
Open Interface API Reference | 8 - Point Management API | 508
must be sure that your Point Management application is stopped and restarted when the system is
updated.
The Point Management Parameters file identifies the Point Management resident processes and the
maximum number of application processes that can communication with them.
• ptmgmt_process_id
• ptmgmt_ipc_que_siz
ptmgmt_process_id
ptmgmt_ipc_que_siz
Definition Maximum number of processes that can communicate simultaneously with the pt
mgmt_process_id.
Open Interface API Reference | 8 - Point Management API | 509
MASTER_PTM0_RP|20
The Point Type file defines the data types and lengths supported by CIMPLICITY software. All points
identified must reference one of the types in this file. Point types are defined by Point Management and
cannot be added by applications. The default point types shown below are supplied with the system.
• data_length
• data_type
• point_type_id
data_length
data_type
Definition Integer value associated with point_type. (See second column be
low.)
BOOLEAN 0 BOOL
OCTETSTRING 2 APPLICATION
CHARSTRING 3 STRING
INTEGER*1 7 SINT
INTEGER*2 8 INT
INTEGER*2 9 DINT
Note:
Point Management treats floating point values as double precision values.
point_type_id
Definition Unique point type identifier. Default point types are shown in the first column of the
sample .idt file below.
Open Interface API Reference | 8 - Point Management API | 511
The default point management point types (in their default lengths) are given in the following example of
an ASCII file used to provide point type configuration data:
3D_BCD|5|0
4D_BCD|5|0
4STATE|4|0
BOOL|0|0
BYTE|1|8
DINT|9|0
DWORD|1|32
INT|8|0
MMS_EVE_DIAG|2|6
OCTETSTRING_2|2|2
REAL|10|0
RECIPE|8|0
S6X_CLOCK|2|12
S6_CLOCK|2|6
SINT|7|0
SPC_ATT_1|2|2
SPC_ATT_2|2|4
SPC_ATT_4|2|8
SPC_DEF_1|2|5
SPC_DEF_2|2|6
SPC_DEF_4|2|8
STRING|3|1
STRING_20|3|20
STRING_8|3|8
STRING_80|3|80
UDINT|6|0
Open Interface API Reference | 8 - Point Management API | 512
UINT|5|0
USINT|4|0
WORD|1|16
A point can specify either a device point or a derived point. Each point has an identifier that is unique in
the system.
• access_filter
• access_flag
• alarm_criteria
• alarm_high
• alarm_id
• alarm_low
• alarm_state
• alarm_str_id
• deadband
• description
• deviation_ptid
• display_format
• elements
• eu_exists
Open Interface API Reference | 8 - Point Management API | 513
• eu_label
• first_index
• fr_id
• last_index
• point_id
• point_state
• point_type_id
• proc_vars
• pt_origin
• range_high
• range_low
• range_state
• rate_time_
• rate_time_interval
• setpt_check_ptid
• trigger_check_ptid
• warning_high
• warning_low
• warning_state
Note:
• Alarms may be specified only for points that are integers (SINT, INT, DINT, USINT, UINT, UDINT),
Boolean (BOOL), or floating decimal point (REAL).
• Alarms may not be specified for points that contain more than a single element.
• To specify an alarm for a BOOLEAN point, specify a 1 or 0 as any of the alarm limits.
access_filter
Definition Determines whether or not the point can be accessed by the enterprise. E = can be
accessed.
access_flag
Open Interface API Reference | 8 - Point Management API | 514
0 Read access
1 Write access
2 Read/Write access
alarm_criteria
Maximum Byte
Field Length
Definition The method to be used for evaluating alarm conditions. Valid entries are 1 for absolute
alarming, 2 for deviation alarming, or 4 for rate of change alarming.
alarm_high
Definition High alarm limit (see note below). If the point value equals or exceeds this limit an
alarm is generated.
alarm_id
Definition The alarm ID (from ALARM_DEF.DAT) that will be used when alarms are gener
ated.
alarm_low
Open Interface API Reference | 8 - Point Management API | 515
Definition Low alarm limit (see note below). If the point value equals or falls below this limit an
alarm is generated.
alarm_state
alarm_str_id
If not 0, this value indicates the related set of range/warning/alarm messages defined in that
configuration file which Point Management will send to Alarm Management when the point state changes
instead of the default messages.
Deadband
Maxi 10 characters
mum
Field
Length
Definition Value defining tolerance below the upper alarm limits or above the lower alarm limit. If
no deadband is defined, the alarm state of the point changes each time the alarm limit is
passed (in either direction).
A deadband is useful for points whose values may fluctuate near the alarm limit. The deadband value
specifies that a point in an alarm state remains in the alarm state the value is equal to the alarm limit plus
the deadband value.
For example, if a high alarm limit is 100 and the deadband is 5, an alarm is generated when the point value
equals 100. However, the point is considered in an alarm state until it reports a value below 95 (the alarm
Open Interface API Reference | 8 - Point Management API | 516
limit plus the deadband). If a low alarm limit is 10 and the deadband is 5, an alarm is generated when the
point value equals 10. However, the point is considered in an alarm state until it reports a value above 15
(the alarm limit plus the deadband).
Description
deviation_ptid
Definition The Point ID that the current point will be compared with when checking for a devi
ation alarm.
display_format
Maxi 10 characters
mum
Field
Length
Definition A C format string (for example, %.2f) defining the way in which the point value is to be dis
played (for example, with or without leading zeros, the number of decimal places, the total
number of characters.)
Elements
Definition Number of elements of the point. Arrays of a point_type are created by setting this
value greater than one.
eu_exists
Open Interface API Reference | 8 - Point Management API | 517
Maximum Byte
Field Length
Definition Flag defining whether or not engineering unit conversion exists of this point. It will have
one of the following values:
1 A record having the same ID as the point record is defined in eu_conv.dat to provide
engineering conversion specifications.
0 No record is defined.
Note:
If this field is set to 1 and eu_conv.dat contains an eu_rev_exp (reverse-engineering-units
expression), the values for warning_high, warning_low, alarm_high,alarm_low, range_high,
range_low, and deadband are converted using that expression. Otherwise unconverted values are
used for these parameters.
eu_label
Definition Engineering unit label. The label returned with the floating point number by the func
tion that performs the conversion.
first_index
Maximum Integer
Field Length
Definition The first data element in the array to be accessed. (all arrays are assumed to be indexed
starting at 1) Must be less than or equal to the elements argument.
fr_id
Maximum 16 characters
Field Length
Open Interface API Reference | 8 - Point Management API | 518
Definition Factory resource ID from fr.dat. When Point Management generates an alarm, it passes
this ID to Alarm Management to indicate the origin of the alarm.
last_index
Maximum Integer
Field Length
Definition The last data element in the array to be accessed. Must be less than or equal to the ele
ments argument and greater than or equal to first_index.
point_id
Defini Unique point identifier. Embedded spaces and special characters (other than $) are allowed.
tion However, the standard format requires that the first character be alphabetic and the remaining
characters be alphanumeric or underscore (no embedded spaces).
If a non-standard Point ID is used in an expression, (for example, for a derived point) the ID
must be enclosed in quotation marks.
point_state
point_type_id
proc_vars
Maximum Integer
Field
Length
Definition The number of process variables represented by this point. Must be set to one if elements
is set to one. If elements is set to a value greater than one, this may be one (1) or a factor of
elements.
pt_origin
Maxi Byte
mum Field
Length
0 Derived point
1 Device point
2 Global point
Code 2 is used for derived points whose values may be modified by multiple processes.
These origin constants are defined in %BSM_ROOT%\api\include\inc_path\ptm_defs.h
range_high
Definition High range limit (see note below). Point Management discards values that equal or
exceed this limit.
range_low
Open Interface API Reference | 8 - Point Management API | 520
Definition Low range limit (see note below). Point Management discards values that equal or
fall below this limit.
range_state
rate_time_
Maximum Integerunit
Field Length
Definition The units associated with rate_time_interval for a point using rate-of-change alarming.
Valid entries are 1 for seconds, 60 for minutes, or 3600 for hours.
rate_time_interval
Definition The size of the sample interval for a point using rate-of-change alarming.
setpt_check_ptid
De Also known as the safety point. If a safety point is defined for a point, and a setpoint request is
fini made for the point, the current value of the safety point is evaluated. If the safety point evaluates
tion to zero or the point is unavailable, the setpoint request will be denied. If the safety point evalu
ates to a non-zero value, the setpoint request will be permitted.
Open Interface API Reference | 8 - Point Management API | 521
trigger_check_ptid
Definirtion The Point ID used as the Availability Trigger for this point. This point is only available
if its Availability Trigger is "True".
warning_high
Definition High warning limit (see note below). If the point value equals or exceeds this limit a
warning alarm is generated.
warning_low
Definition Low warning limit (see note below). If the point value equals or falls below this limit a
warning alarm is generated.
warning_state
An example of an ASCII file that might be used to provide this configuration data is:
|-* point_id|point_type_id|warning_high|warning_low-
* |alarm_high|alarm_low|range_high|range_low|deadband-
* |FR_ID|alarm_id|alarm_str_id|eu_exists|range_state-
* |alarm_state|warning_state|point_state|elements-
Open Interface API Reference | 8 - Point Management API | 522
* |first_index|last_index|pt_origin|access_flag-
* |eu_label|display_format|description
POINT_001|ANALOG_16||||||||SERIES_6||0|1|0|0|0|1|1|1-
|1|1|0|Furlongs|%d|Example point 1
POINT_002|ANALOG_16|||100|0||||SERIES_6|D1_RANGE|0|0-
|0|1|0|1|1|1|1|1|0||-%d|Example point 2
POINT_003|FLOATING||||||||||0|0|0|0|0|1|1|0|0|0|0|-
The Device Point file contains all device specific configuration data for device points.
• addr
• addr_offset
• addr_type
• analog_deadband
• device_id
• flags
• point_id
• raw_data_type
• scan_point
Open Interface API Reference | 8 - Point Management API | 523
• scan_rate
• trigger_point
• trigger_type
• trigger_value
point_id
device_id
addr_type
Definition The full address of the device. This field contains one of the following val
ues:
1 VARIABLE NAME
2 FULLY QUALIFIED
3 LOGICAL ADDRESS
4 UNCONSTRAINED
Addr
addr_offset
trigger_type
0 NO TRIGGER
1 ONCHANGE
2 EQ
3 LT
4 GT
5 LE
6 GE
trigger_value
Definition For trigger_types other than DL_NO_TRIGGER and DL_ONCHANGE, the value to be
compared with the trigger_point value.
trigger_point
Definition Point ID of the point whose value is checked using the trigger_type and trigger_
value.
Open Interface API Reference | 8 - Point Management API | 525
Note:
The trigger function allows points to be read conditionally based on the value of another (trigger)
point.
scan_rate
Definition The frequency of the scan. This is an integral multiple of the scan rate for the de
vice.
scan_point
Maxi Integer
mum
Field
Length
Defini Enable/disable scanning of point. This field contains one of the following values:
tion
1 ONCHANGE
2 ONSCAN (that is, according to the scan rate defined in the previous parameter) format of
data as stored on the device - for example, BCD, EBCDIC, etc. used to translate from de
vice data to internal data.
raw_data_type
analog_deadband
Open Interface API Reference | 8 - Point Management API | 526
Maxi 10 characters
mum Field
Length
Definition A value used to filter out changes in the raw value of the point. The raw value must change
by at least this much before the point value is updated in CIMPLICITY software.
Flags
Maximum Byte
Field Length
Definition Defines how the point will be scanned after a setpoint. Set to 0 for normal scanning or
set to 1 to scan immediately after doing the setpoint.
An example of an ASCII file that might be used to provide this configuration data is:
|-* point_id|DEVICE_ID|addr_type|addr|addr_offset|
* trigger_type|trigger_value|trigger_point|scan_rate |
* scan_point|raw_data_type
POINT_001|gef1_resp|3|R65|0|0|||1|1|0
POINT_002|gef1_resp|3|R66|0|0|||1|1|0
Derived points are points whose values are derived from other points. Each derived point has an
expression that references other device or derived points. The expression, which may contain arithmetic,
logical, and bitwise operations as well as some Point Management defined functions, is defined in the
Derived Point configuration file.
• calculation_type
• description
• DP_flag
• init_value
• local
• output_units
• point_expression
• point_id
• point_set_interval
• point_set_time
• process_id
• ptmgmt_process_id
• reset_point_id
• rollover_val
• trigger_point_id
• variance_value
calculation_type
0 equation point
3 average point
4 maximum capture
Open Interface API Reference | 8 - Point Management API | 528
5 minimum capture
6 global
9 timer/counter
10 histogram
Description
DP_flag
Maximum Byte
Field Length:
Definition True if an init-value is specified, and the value of the DP_flag defines the search se
quence for the initial value of the point. The settings are as follows:
0 unavailable
init_value
Local
Maximum Byte
Field Length
Definition When TRUE this indicates that the computed point value cannot be accessed outside of
the derived point process and alarms cannot be generated.
output_units
point_expression
Definition An expression containing point identifiers, constants, and either arithmetic or logical op
erators. The expression may be up to 78 characters in length.
Note:
If another Point ID is used in the expression, it must be in the recognized format, or else the
Point ID must be enclosed in single quotation marks – for example, '1 - this is a point_id'. The
recognized format is an alphabetic first character followed by alphanumeric characters and/or an
underscore. If a Point ID contains embedded blanks or non-alphanumeric characters (other than
underscore) or does not begin with a letter, its format is not standard.
point_id
point_set_interval
Open Interface API Reference | 8 - Point Management API | 530
point_set_time
process_id
ptmgmt_process_id
reset_point_id
Defini Point identifier from point.dat for the reset point upon which this point is dependent. The reset
tion point can be any type of point; however, a Boolean type is recommended. Whenever the reset
point changes, all of its dependent points are reset.
rollover_val
trigger_point_id
Definition Point identifier from point.dat for the trigger point upon which this point is de
pendent.
variance_value
Definition The variance threshold for accumulator points and has no meaning for all other
types of points.
An example of an ASCII file that might be used to provide this configuration data is:
|-* point_id|PROCESS_ID|PTMGMT_PROCESS_ID|-
* point_expression|description|local|init_value|-
* dp|flag|calcultion_type|variance_value|-
* reset_point_id|trigger_point|rollover_val|-
* ouput_units|point_set_time|point_set_internal
POINT_003|PTM_DP|PTM_RP|POINT_001 * 2.0||0|17|1
Logi AND, OR, XOR, NOT. Can include only Boolean points types.
cal
Bit BAND, BXOR, BNOT. Can contain only Boolean and integer
wise point types.
Func ALARM(), A2(), WARNING(), A1(), ALARM_HI(), AH2(), Return a Boolean result depending on
tions ALARM_LO(), AL2() WARNING_HI(), AH1(), WARNING_ the alarm state of the point.
LO(), AL1(), and AL()
Equation Points
Expression points are the typical derived points whose values are derived from the results of an arithmetic
expression (the point_expression field in derived_point.dat.
Accumulator Points
The accumulator point keeps a running total of changes in the source point values. The accumulator can
be either a signed integer, an unsigned integer or a floating point data type and can have one of two forms
of operation:
A Delta Accumulator point keeps a running total of the delta between the previous value of the results an
arithmetic expression (the point_expression field in derived_point.dat) and the current value. The delta
accumulator point may be a signed or unsigned integer or a floating point data type.
Open Interface API Reference | 8 - Point Management API | 534
The value for a delta accumulator is initialized to zero, or if a Startup Condition is specified it is initialized
according to the Startup Condition. The first update of the accumulator occurs after the second update of
the point_expression value. Updates continue until a Reset Condition occurs.
A Reset Condition occurs when the value in the reset_point_id changes. At that point, the value of the
Delta Accumulator is reset to the init_value or if the init_value is not present, it is reset to zero(0). The
value in the reset_point_id can be changed by an operator or automatically by software.
You must set a variance_value for a Delta Accumulator. This is the maximum acceptable delta value that
can be added to the accumulator. In the event of a variance condition, the system logs a message to the
Status Log. Counting continues from the new value, but the delta is not added to the accumulator.
You may set a rollover_val for a Delta Accumulator. This is the maximum acceptable value for the point. If
you do not specify a rollover value, the data type for the source point in the Equation is used as the default
Rollover value.
When a Rollover condition occurs, the accumulator point is set to an adjusted value which accounts for
the data overflow and a message is logged in the Status Log.
A Value Accumulator point keeps a running total of the changes in an expression by adding the current
value of the expression to the Value Accumulator. The Value Accumulator may be a signed or unsigned
integer or a floating point data type.
The value for a Value Accumulator is initialized to zero, or if a Startup Condition is specified, it is initialized
according to the Startup Condition. Updates continue until a Reset Condition occurs.
A Reset Condition occurs when the value in the reset_point_id changes. At that point, the value of the
Value Accumulator is reset to the init_value or if the init_value is not present, it is reset to zero(0). The
value in the reset_point_id can be changed by an operator or automatically by software.
A Delta Accumulator point keeps a running total of the delta between the previous value of the results an
arithmetic expression (the point_expression field in derived_point.dat) and the current value. The delta
accumulator point may be a signed or unsigned integer or a floating point data type.
The value for a delta accumulator is initialized to zero, or if a Startup Condition is specified it is initialized
according to the Startup Condition. The first update of the accumulator occurs after the second update of
the point_expression value. Updates continue until a Reset Condition occurs.
Open Interface API Reference | 8 - Point Management API | 535
A Reset Condition occurs when the value in the reset_point_id changes. At that point, the value of the
Delta Accumulator is reset to the init_value or if the init_value is not present, it is reset to zero(0). The
value in the reset_point_id can be changed by an operator or automatically by software.
You must set a variance_value for a Delta Accumulator. This is the maximum acceptable delta value that
can be added to the accumulator. In the event of a variance condition, the system logs a message to the
Status Log. Counting continues from the new value, but the delta is not added to the accumulator.
You may set a rollover_val for a Delta Accumulator. This is the maximum acceptable value for the point. If
you do not specify a rollover value, the data type for the source point in the Equation is used as the default
Rollover value.
When a Rollover condition occurs, the accumulator point is set to an adjusted value which accounts for
the data overflow and a message is logged in the Status Log.
Average Points
The average point maintains the average value for a source point. The average point can be either a
signed integer, an unsigned integer or a floating point data type. The average is calculated as an eight byte
floating point data type, and the result is cast into the resultant data type as defined by the point_type_id
of the average point. The average value is calculated as the accumulation of the deviation from the
average point data divided by the number of samples taken.
The sample_count value is the number of source points in the average point calculation. In the event the
sample_count value overflows the maximum unsigned integer value, then the average point will reset and
log a message with the Status Log.
The average value is maintained in the average point until a Reset condition occurs.
A Reset condition occurs when the reset point is changed causing the average point to reset. The reset
causes the average point to be reset to the configured init_value from derived_point.dat and, if the
init_value is not present, then the average point has no value until a new data value is received. The reset
point could be activated by an operator or automatically by the system.
Specifications: The average point is a derived point with the calculation_type set to 3.
Open Interface API Reference | 8 - Point Management API | 536
Note:
For integer type points the resultant data will rounded to the nearest integer which may result in
loss of accuracy. Therefore, it is suggested that average points be floating point type.
The maximum capture point maintains the maximum value encountered for a point. The maximum
capture point can be either a signed integer, an unsigned integer or a floating point data type. The
maximum capture point is determined by comparing the current source point value with the maximum
value, and if the current value is greater than the maximum value, the current value is then stored as the
maximum capture point. The maximum value is maintained in the maximum capture point until a Reset
condition occurs.
A Reset condition occurs when the reset point is changed causing the maximum capture point to
reset. The reset causes the maximum capture point to be reset to the configured init_value from
derived_point.dat and, if the init_value is not present, then the maximum point has no value until a new
data value is received. The reset point could be activated by an operator or automatically by the system.
Specifications: The maximum capture point is a derived point with the calculation_type set to 4.
The minimum capture point maintains the minimum encountered value for a point. The minimum capture
point can be a signed integer, an unsigned integer or a floating point data type. The minimum capture
point is determined by comparing the current source point value with the minimum value, and if the
current value is less than the minimum value, the current value is then stored as the minimum capture
point. The minimum value is maintained in the minimum capture point until a Reset condition occurs.
A Reset condition occurs when the reset point is changed causing the minimum capture point to
reset. The reset causes the minimum capture point to be reset to the configured init_value from
derived_point.dat and, if the init_value is not present, then the minimum point has no value until a new
data value is received. The reset point could be activated by an operator or automatically by the system.
Specifications: The minimum capture point is a derived point with the calculation_type set to 5.
Global Points
Global points are derived points whose values are updated by CIMPLICITY software applications, custom
applications using the Point Management API, or through standard Setpoint functions.
Open Interface API Reference | 8 - Point Management API | 537
Specifications: The global point is a derived point with the calculation_type set to 6.
Transition high accumulator points accumulate the number of times the value of the expression in the
point_expression field transitions from a zero to a non-zero value. During the execution of a CIMPLICITY
project, a Transition High Accumulator point remains in its latest state even if the points it depends on
become unavailable.
A Reset condition occurs when the reset point is updated, causing the transition high accumulator point
to reset. The reset point can be activated by an operator or automatically by the system.
Determining a transition takes into consideration the calculation type of the equation and the point type of
the transition high accumulator point. For example:
• If the transition high accumulator point is DINT, and the equation uses floating point arithmetic, the
result of the calculation is rounded to the nearest integer. Thus, a value of 0.1 is considered to be
zero, and a value of 0.6 is considered to be non-zero.
• If the transition high accumulator point is FLOAT, and the equation uses floating-point arithmetic,
then a transition from 0 to 0.1 is counted as a transition from a zero to a non-zero value.
Specifications
The transition high accumulator point is a derived point with the calculation_type set to 7.
Equation with override points are similar to equation points. They use the expression you specify in the
point_expression field to update the point's value. The expression may contain one or more device or
derived Point IDs, along with constant values, arithmetic operations, logical operations, bit operations or
alarm functions.
In addition, the value of an equation with override point may be updated by CIMPLICITY software
applications, custom applications using the Point Management API, or through standard Setpoint
functions. The changed value remains in effect until one of the source points for the expression changes
and the expression is recalculated.
A Reset condition occurs when the reset point is updated. This will cause the equation with override point
to be reset to the current value of its expression.
Open Interface API Reference | 8 - Point Management API | 538
Specifications
The equation with override point is a derived point with the calculation_type set to 8.
Timer/Counter Points
Each time the equation evaluates to a value greater than zero, the event is considered to be in its HIGH
state and:
• The count field, stored in the first element of the timer/counter array is incremented by one.
• The current system time is stored in the third element of the timer/counter array.
Each time the equation evaluates to a value equal to or less than zero, or one or more source points are
unavailable, the event is considered to be in its LOW state and:
• The duration field, stored in the second element, is incremented by the duration of the last event.
This duration is calculated by subtracting the start time of the last event from the current system
time.
• The last event time, stored in the third array element is zeroed.
A Reset condition occurs when the reset point is updated. This will cause the timer/counter array to be
reset to zero or init_value (if it is defined)
Specifications
Histogram Points
Open Interface API Reference | 8 - Point Management API | 539
Histogram points record the frequency at which the value of a point, identified in the point_expression
field, occurs within specific range intervals. This information is typically displayed graphically as a
histogram.
Each time a new point sample is received, the counter for the range that includes the value in the
histogram point is updated.
A histogram point must be configured as an array point. You must specify the number of elements in the
array as six (6) greater than the number of range intervals you desire. The system uses the six additional
array elements to maintain the following data:
The display_low_lim and display_high_lim fields are used to specify the lower and upper range values
within which the point values are expected to occur. The range intervals are calculated based on these
limits and the number of array elements specified.
A Reset condition occurs when the reset point is updated. This will cause the histogram array to be reset
to zero or init_value (if it is defined).
Specifications
• The histogram point is a derived point with the calculation_type set to 10.
• The number of elements in a histogram point equals the number of ranges plus six.
Point Management provides the capability to convert data values collected from devices into
real numbers. To use this function, the application accesses a conversion expression from Point
Management's Engineering Unit Conversion file. PTMRP applies that expression to the collected data
value and converts the point value to a real number for display in an alarm message. In addition, the
Open Interface API Reference | 8 - Point Management API | 540
application may call a PTMAP function that accesses the configuration data, performs the conversion,
and returns a floating point value to the application.
• description
• eu_expression
• eu_rev_exp
• high_raw_limit
• lin_conv_flag
• low_raw_limit
• point_id
Note:
The eu_expression should take into account the decimal precision you desire. for example, an
eu_expression of %P/10 converts a point value of 125 to 12.0 while the expression %P/10.0
converts the same point value (125) to 12.5.
Description
eu_expression
Open Interface API Reference | 8 - Point Management API | 541
Definition Expression used to convert the data value. The expression may contain the fol
lowing:
Arithmetic operators - +, -, /, *
Place holders - the point in the expression is designated by the place holder %P.
(%P-10)*3.5+7
If another Point ID is used in the expression, it must be in the recognized format, or else the Point ID
must be enclosed in single quotation marks -- for example, '1 - this is a pointid'. The recognized format
is an alphabetic first character followed by alphanumeric characters and/or an underscore. If a Point ID
contains embedded blanks or non-alphanumeric characters (other than underscore) or does not begin
with a letter, its format is not standard.
eu_rev_exp
Defini An expression that can be used to convert a real number to an unconverted value. If no ex
tion pression is provided for this field, Point Management assumes that alarm, warning, range, and
deadband values are in a format that does not need conversion.
high_raw_limit
lin_conv_flag
low_raw_limit
point_id
An example of an ASCII file that might be used to provide this configuration data is:
|-* point_id|eu_expression|description|eu_rev_exp|-
* lin_conv_flag|low_raw_limit|high_raw_limit|
POINT_001|(%P - 5) / 100|||0||
This file is configured to provide user-defined strings that replace the default Point Management strings
in alarm messages generated by Point Management. These strings are substituted in place of the default
strings, "Hi-2", "Lo-2", "Hi-1", "Lo-1", in alarm messages when the alarm state is requested as part of the
alarm message.
• alarm_hi_str
• alarm_low_str
• alarm_str_id
• warning_hi_str
• warning_lo_str
alarm_hi_str
alarm_low_str
alarm_str_id
Defini Integer identifying the record number of the set of strings. This key is referenced by the alar
tion m_str_id field in the point.dat configuration file. The value must be less than 100 (that is. no
more than 100 defined strings) for performance reasons.
warning_hi_str
warning_lo_str
This file contains information pertaining to the display of point values. It provides display limits which
must be configured for points that are used to control objects with a dynamic fill attribute on screens
used by the CIMPLICITY System Base product, Status Monitoring, or objects that are used in trend charts.
• display_lim_high
• display_lim_low
• point_id
• screen_id
display_lim_high
display_lim_low
point_id
screen_id
Definition Valid only for CIMPLICITY software. Identifies a screen to access based on point
type.
Point Management allows for the saving of derived point data in the event the system is shutdown. The
derived point data is stored in a disk file for retrieval during the next system startup.
Specifications:
Note:
The impact on performance of the system is related to the number of points that have been
identified as save points. The save point process is I/O intensive such that the points are written
Open Interface API Reference | 8 - Point Management API | 546
to a static fixed record file as they are processed from the Point Management system; thus the
more points defined as save points, the greater the impact on the entire system performance.
The following codes are returned by the Point Management Expression Processor.
Num
Defined Constant Description
ber
Num
Defined Constant Description
ber
23520 RELOP_LIST_ILLE EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE or GE expected
GAL_OP
23524 BOR_LIST_ILLEGAL_ EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE, GE or BOR expected
OP
23528 BXOR_LIST_ILLE EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE, GE, BOR or BXOR expected
GAL_OP
Num
Defined Constant Description
ber
23532 BAND_LIST_ILLE EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE, GE, BOR, BXOR or BAND expect
GAL_OP ed
23534 ADDOP_LIST_ILLE EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE, GE, BOR, BXOR, BAND, + or - ex
GAL_OP pected
23536 MULOP_LIST_ILLE EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE, GE, BOR, BXOR, BAND, +, -, * or /
GAL_OP expected
Num
Defined Constant Description
ber
23550 BITSTR_TRUNCATED Bitstring specified exceeds max size, max size used
23551 OCTETSTR_TRUN Octetstring specified exceeds max size, max size used
CATED
Num
Defined Constant Description
ber
23569 TEXTSTR_TRUNCAT Text string specified exceeds max size, max size used
ED
23581 TRIOP_TYPE_NO Possible results from trinary expression must be same type
MATCH
23582 TRIOP_LIST_ILLE Expecting EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE, GE, BOR, BXOR,
GAL_OP BAND, +, -, *, /, SHL, SHR, MOD, ^, or ?
Open Interface API Reference | 8 - Point Management API | 551
Num
Defined Constant Description
ber
23586 POWOP_LIST_ILLE Expecting EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE, GE, BOR, BXOR,
GAL_OP BAND, +, -, *, /, SHL, SHR, MOD or ^
23588 SHFTOP_LIST_ILLE Expecting EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE, GE, BOR, BXOR,
GAL_OP BAND, +, -, *, /, SHL or SHR
23590 MODOP_LIST_ILLE Expecting EOL, ), OR, XOR, AND, EQ, NE, LT, GT, LE, GE, BOR, BXOR,
GAL_OP BAND, +, -, *, /, SHL, SHR or MOD
23595 PTEXP_UPG_HEAD The following point_id(s) listed below conflict with a new
ER1
Num
Defined Constant Description
ber
Num
Defined Constant Description
ber
24001 PTMDP_SELF_LOOP Point depends only on itself, will cause an infinite loop
24005 PTMDP_RSP_POINT_ID Point_id received in response record not found in hash ta
ble
24006 PTMDP_NOT_MY_REQUEST The response received does not match any request sent
Num
Defined Constant Description
ber
24017 PTMDP_BAD_DELTA_ACCUM : Delta accum point must have exactly one source
24018 PTMDP_POINT_USE_NOT_FOUND DMS point use record not found - structure error
Num
Defined Constant Description
ber
24040 PTMDP_PS_GET_ERROR Error when getting saved point data for point :
24041 PTMDP_PS_SET_ERROR Error when setting saved point data for point :
Error codes that can originate from PTMRP, and be sent to Application Processes are:
Num
Defined Constant Description
ber
Num
Defined Constant Description
ber
24522 PTM_POINT_NOT_IN_VIEW Resource for point not in user's view - setpoint disallowed
Error codes that can be set directly by the Point Management Resident Process are:
Open Interface API Reference | 8 - Point Management API | 556
24568 PTMRP_NOT_OWNER_DP Not the owner derived point process for specified point
24585 PTMRP_ALARM_MGR_NOT_IN_ No alarm mgr found in SC Alarm Mgr file for alarm mgr =
SC
24586 PTMRP_PROC_ID_NOT_IN_SC PTM proc ID not found in SC Proc Id file for proc id =
24588 PTMRP_POINT_TYPE_NOT_IN_ Point type not found in SC point type file for point =
SC
24597 PTMRP_INV_SAFPT_TYPE Safety point <%s> is invalid type for point <%s>
Open Interface API Reference | 8 - Point Management API | 558
24598 PTMRP_INV_SAFPT_PT Safety point <%s> not allowed for Derived point <%s>
24600 PTMRP_SAF_BAD_CONFIG Safety point <%s> not configured for point <%s>
24601 PTMRP_INV_DEVPT_TYPE Deviation point <%s> is invalid type for point <%s>
24602 PTMRP_DEV_BAD_CONFIG Deviation point <%s> not configured for point <%s>
24604 PTMRP_SAFETY_FAIL Setpoint fail: <%s> - Safety point <%s> SET TO FALSE
24606 PTMRP_DEVPT_ABS_LIMIT Using Alarm Limit absolute value for Deviation point =
24610 PTMRP_NO_REDUND_SVC Host redundancy specified but single PTM service config
ured
24624 PTMRP_INVALID_BUF_VALUE Invalid maximum point buffering and duration for point =
24625 PTMRP_ADHOC_REQ
Num
Defined Constant Description
ber
Num
Defined Constant Description
ber
25012 PTMAP_REQ_MISMATCH Mismatch between function call and actual request type
Num
Defined Constant Description
ber
25040 PTMAP_INVAL_MASK_POINT Point data length too long for ONMASK request
Num
Defined Constant Description
ber
25056 PTMAP_RESYNCHRONIZING
25062 PTMAP_POINT_IN_USE_MOD
IFIED
Num
Defined Constant Description
ber
Error codes that can be sent from the Point Translation Process are:
Num
Defined Constant Description
ber
26001 PTX_UNKNOWN_SEGMENT Unknown Segment Sent - See err_ref for Segment Num
ber
Num
Defined Constant Description
ber
26030 PTX_ADHOC_PTM_NOTFOUND Point By Address Device (%.32s) has not Point Manager.
Num
Defined Constant Description
ber
Note:
Consult the Microsoft Web site for a list of Windows operating systems that are supported for
DDE.
You can use CWSERV on a Microsoft Excel spreadsheet to display point information, and to update
setpoints in the CIMPLICITY point database.
Important:
Beginning with CIMPLICITY v9.0, CWSERV supports point names that are longer than 32
characters. However, it supports a maximum of 255 characters that includes both the point ID
and point attribute.
Example
The following macro is used in an Excel spreadsheet to display the value of a point in that project.
=CWSERV|POINT!pointName.VALUE
Where
The maximum length for the point ID is 255 - 6 characters = 249 characters.
1. Start CWSERV
The first time you enter point information into a spreadsheet, the following dialog box will be displayed:
This dialog box will also be displayed if you open a spreadsheet that contains CWSERV commands and
the CWSERV server is not active.
This dialog box will appear every time you open the spreadsheet:
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 568
Click Yes to reconnect to CWSERV to access data. If CWSERV is not running, you will be asked if you want
to start it. Click Yes to start CWSERV.
If you are connecting to the project for the first time, or your login timeout has expired, the CIMPLICITY
Login dialog box for the project is displayed.
Enter your CIMPLICITY username and password and click OK. Your spreadsheet will now start to display
the CIMPLICITY data you requested in the CWSERV commands.
CWSERV Icon
While the server is active, you will see this icon on your terminal screen:
1. Select the cell where you want the point information to appear.
2. Enter the CWSERV formula in the cell, then press Enter.
For example, to display the raw value for the point CWSERV_VIRT, you would type:
=cwserv|point!cwserv_virt.raw_value
3. Select a range of cells (horizontal or vertical) where you want the point information to appear.
4. Enter the CWSERV formula, and enclose the point information within single quotes, then press Ctrl
+Shift+Enter.
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 569
For example, to display the raw values for the ten-item array CWSERV_ARRAY in a column on your
spreadsheet, you would type
=cwserv|point!'cwserv_array.raw_value[0:9c]'
You can write Excel macros to update setpoints in CIMPLICITY software from a spreadsheet. These
macros will use the DDE POKE request. You can use this request to change the value or raw_value
attributes of a CIMPLICITY point.
Important:
Setpoint security is not enforced. A user can set any CIMPLICITY point that has write access,
regardless of the setpoint security restrictions configured within the CIMPLICITY system. You
must establish appropriate operational practices and procedures to prevent undesired setpoint
operations, and users must follow these practices and procedures carefully.
Macro Example
Sub Poke()
Application.DDETerminate channel
End Sub
When you perform a large number of DDE POKE requests from an application such as Microsoft Excel, the
DDE server application may fall behind. Under Excel, this will cause some requests to timeout and fail.
ManyPoints
channel=INITIATE("cwserv","point")
=POKE(channel,"point001.value",Sheet1!D4)
=POKE(channel,"point002.value",Sheet1!D5)
=POKE(channel,"point003.value",Sheet1!D6)
=POKE(channel,"point004.value",Sheet1!D7)
=WAIT(NOW() + "00:00:01")
=POKE(channel,"point005.value",Sheet1!E4)
=POKE(channel,"point006.value",Sheet1!E5)
=POKE(channel,"point007.value",Sheet1!E6)
=POKE(channel,"point008.value",Sheet1!E7)
=WAIT(NOW() + "00:00:01")
=POKE(channel,"point009.value",Sheet1!F4)
=POKE(channel,"point010.value",Sheet1!F5)
=POKE(channel,"point011.value",Sheet1!F6)
=POKE(channel,"point012.value",Sheet1!F7)
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 571
=TERMINATE(channel)
=RETURN()
Depending on the performance and configuration of your computer, your delay requirements may vary.
1. Select a location on your spreadsheet where you want to enter the point's setpoint value. Make a
note of the sheet name and cell location.
2. If you have not already done so, select Toolbars on the View menu and activate the Drawing
toolbar.
3. Select Record Macro on the Tools menu on your spreadsheet.
4. Select Record New Macro on the Record Macro submenu. The Record New Macro dialog box will
open.
5. Enter your new macro name in the Macro Name box.
6. Click Options.
7. Select This Workbook from the Store In input box.
8. Select MS Excel 4.0 Macro from the Language box.
9. Click OK.
A new Macro sheet will be created and the macro name will be placed in the first cell (R1C1) of the
sheet.
Whenever a user enters the setpoint in the cell referenced by the macro, then clicks the button, the
setpoint value will be sent to CIMPLICITY software.
Two spreadsheet and macro sets are given here. The first spreadsheet and macro show you how to
display all the attributes of a single point, and perform a setpoint on that point. The second spreadsheet
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 572
and macro show you how to display the raw values for an array point and perform a setpoint on the entire
array.
The following spreadsheet was configured to display all available point attributes for CWSERV_VIRT, and
to let the user perform a setpoint on that point.
R5C3 =cwserv|point!cwserv_virt.value
R6C3 =cwserv|point!cwserv_virt.state
R7C3 =cwserv|point!cwserv_virt.disp_format
R8C3 =cwserv|point!cwserv_virt.eu_label
R9C3 =cwserv|point!cwserv_virt.alarm_high
R10C3 =cwserv|point!cwserv_virt.warn_high
R11C3 =cwserv|point!cwserv_virt.warn_low
R12C3 =cwserv|point!cwserv_virt.alarm_low
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 573
R13C3 =cwserv|point!cwserv_virt.disp_high
R14C3 =cwserv|point!cwserv_virt.disp_low
R15C3 =cwserv|point!cwserv_virt.alarm_enabled
R16C3 =cwserv|point!cwserv_virt.warn_enabled
R17C3 =cwserv|point!cwserv_virt.init_state
The following macro is the one associated with the Set button above.
set_point
channel=INITIATE("cwserv","point")
=POKE(channel,"cwserv_virt.value",Sheet1!R19C3)
=TERMINATE(channel)
=RETURN()
To change the setpoint, enter the new point value in cell R19C3, then click Set.
• Display the raw values for CWSERV_ARRAY, an array point with ten (10) elements, and
• Let a user perform a setpoint on the array:
1. Highlight the number of rows or columns to match the number of elements of the row to be
displayed. (Cells R5C3 through R14C3 were selected.)
2. Enter the SCSERV command. For example,
=cwserv|point!'cwserv_array.raw_value[0:9c]'
Note:
You must press Ctrl+Shift+Enter when entering a formula for a range of cells on the
spreadsheet. If you press Enter, only the first cell of the range will contain data. In the case
of array points, this means that only the first array element's value is displayed.
The following macro is the one associated with the Set button above.
Array
channel=INITIATE("cwserv","point")
=POKE(channel,"cwserv_array.raw_value[0:9]",Sheet1!R5C4:R14C4)
=TERMINATE(channel)
=RETURN()
To change the setpoint, enter the new values in R5C4 through R14C4, and click Set.
Generally, a DDE command consists of three elements - the name of the service being used, the topic, and
the item.
The format of a particular DDE command depends on how it has been implemented in the application
where you are using it.
=cwserv|point!<point_id>.<attribute>[n:mD]
Where
< is the CIMPLICITY Point ID whose data is being retrieved. You may enter an unqualified or fully
point_ qualified (by project or node name) Point ID.
id>
<at is the point attribute (on page 576) of interest. If you do not enter an attribute, CWSERV uses
tribute> "VALUE" as the default.
n:m is the range of array elements desired. If you do not enter a range, CWSERV uses "[0]" as the
default. Enter "[n]" to specify a single element of an array.
D If you have requested a range of elements, use this field to specify the display format. Enter "C"
to display the elements in a column, or "R" to display the elements in a row. If you do not enter
a display format, CWSERV uses "C" as the default. Note: Consult the CIMPLICITY Help Desk for
updated examples.
=cwserv|point!analog_point
This syntax will display the current state of the point ANALOG_POINT:
=cwserv|point!analog_point.state
This syntax will display the sixth through tenth values of the array point ARRAY_POINT in a row:
=cwserv|point!'array_point.value[5:9R]'
This syntax will display the value of the point ANALOG_POINT in the TEST project:
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 576
=cwserv|point!\\test\analog_point.value
• ALARM_ENABLED
• ALARM_HIGH
• ALARM_LOW
• DISP_FORMAT
• DISP_HIGH
• DISP_LOW
• ELEMENTS
• EU_LABEL
• INIT_STATE
• LENGTH
• RAW_VALUE
• SIZE
• STATE
• TYPE
• VALUE
• WARN_ENABLED
• WARNING_HIGH
• WARNING_LOW
ALARM_ENABLED
Indicates whether high/low alarms are enabled or disabled for this point. You will see one of the following
values:
ALARM_HIGH
Displays the Alarm High value for the point. This field is only valid for the following point types:
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 577
• ANALOG
• APPL
If the point's value exceeds this number, the point is in ALARM HIGH state.
ALARM_LOW
Displays the Alarm Low value for the point. This field is only valid for the following point types:
• ANALOG
• APPL
If the point's value is less than this number, the point is in ALARM LOW state.
DISP_FORMAT
Displays the format used when displaying the point's value in Alarm Viewer, Status Log messages, or
CimView.
DISP_HIGH
Displays the high limit for the display value for this point. This field is only valid for the following point
types:
• ANALOG
• APPL
DISP_LOW
Displays the low limit for the display value for this point. This field is only valid for the following point
types:
• ANALOG
• APPL
ELEMENTS
EU_LABEL
Displays the engineering units label for the point. The label can be up to eight (8) characters long.
INIT_STATE
Indicates whether the point is enabled or disabled. You will see one of the following values:
LENGTH
Displays the length of the point. This field is only meaningful for the following point types:
• BITSTRING
• OCTETSTRING
RAW_VALUE
SIZE
STATE
The point's current state depends on its point class and alarm conditions.
For all point classes, the states that can be displayed are:
NORMAL The point's value is within normal limits, and no alarms are outstanding.
UN If the point is a device point, communications with the device have failed, and the point can
AVAILABLE no longer be read. If the point is a virtual point, one or more of the source points that com
prise this point is unavailable.
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 579
For Analog and APPL point classes, the additional states that can be displayed are:
ALARM The point's value is greater than the high alarm limit.
HIGH
ALARM The point's value is less than the low alarm limit.
LOW
WARNING The point's value is greater than the warning high limit and less than the alarm high limit.
HIGH
WARNING The point's value is less than the warning low limit and greater than the alarm low limit.
LOW
OUT OF The point is an Analog or APPL device point with engineering units conversion, and its val
RANGE ue exceeds one of its conversion limits.
For the Digital (Boolean) point class, the additional states that can be displayed are:
WARNING You will only see this message if Enable Alarms has been reset, Enable Warning is set, and
the point's value is in the alarm state.
TYPE
Displays the point's type. You will see one of the following:
• BOOLEAN
• BITSTRING
• OCTETSTRING
• CHARACTERSTRING
• UNSIGNED INTEGER 1
• UNSIGNED INTEGER 2
• UNSIGNED INTEGER 4
• INTEGER 1
• INTEGER 2
• INTEGER 4
• FLOATING POINT
• STRUCTURE
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 580
Note:
OCTETSTRING points are not currently supported by CWSERV. If you try to display such a point's
VALUE or RAW_VALUE attribute, "#NAME?" will be displayed on the Excel spreadsheet.
VALUE
Displays the converted (EU) value of the point. If there is no conversion, the raw value is displayed.
If you do not enter an attribute in the CWSERV command, this is the default attribute that is
displayed.RAW_VALUE.
WARN_ENABLED
Indicates whether high/low warnings are enabled or disabled for this point.
WARNING_HIGH
Displays the Warning High value for the point. This field is only valid for the following point types:
• ANALOG
• APPL
If the point's value is greater than this number, but less than the Alarm High number, the point is in
WARNING HIGH state.
WARNING_LOW
Displays the Warning Low value for the point. This field is only valid for the following point types:
• ANALOG
• APPL
If the point's value is less than this number, but greater than the Alarm Low number, the point is in
WARNING LOW state.
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 581
Formats
=cwserv|system!formats
CF_TEXT
System Items
=cwserv|system!sysitems
Formats
Help
SysItems
Topics
Topics
Open Interface API Reference | 9 - CIMPLICITY to Windows Server | 582
=cwserv|system!topics
System
POINT
Help
=cwserv|system!help
This server provides clients with access to current CIMPLICITY point data.
The items under the POINT topic are in the following format:
point_id.attr[start:endR]
start and end = beginning and ending indices of an array point [default = 0], and
R = Row formatting for array elements (tab deliminated) [default = Column (<CR><LF> deliminated)].
Error Messages
If the VALUE or RAW_VALUE field displays "******", there is a problem reading the point data from the
device.
If a field displays "#N/A", the attribute you requested does not contain a value.
If a field displays "#NAME?", you can have one of several problems; for example:
When you see a "#NAME?" error in a field, check your project's Status Log file for detailed information on
the cause of the problem.
You can access CWSERV from a networked supported operating system using Microsoft NetDDE. This
requires that you first set up a DDE Share on the Server node where CWSERV is running. Then, when
referencing CWSERV through DDE on the client, you must be sure to indicate that you are using NetDDE.
The following are a few notes to help in this operation.
start DDEShare
2. When the DDE Share window opens, select DDE Shares … on the Shares menu.
3. Click Add a Share….
Once you have setup the DDE Share on the server and CWSERV is running, you can access CWSERV
from a client node. The syntax is slightly different than if CWSERV were running locally. The Service or
Application name becomes the node name together with NDDE$. The topic name is the DDE Share name
you just created. The Item name remains the same as it would locally.
When accessing CWSERV from EXCEL, you must put the Service/Application and Topic names in single
quotes because of the '$' characters.
To access the value of the point, GEF_DEMO_ASETPT, from the node ALBP64, type the following:
'\\albp64\ndde$'|'CWSERV$'!GEF_DEMO_ASETPT.value