Professional Documents
Culture Documents
b0400bj B
b0400bj B
b0400bj B
REV B
I/A Series®
NetAPI MFC Class
March 3, 2003
Invensys, AIM*API, AIM*AT, AIM*DataLink, AIM*Explorer, AIM*Historian, Foxboro, FoxAPI, and
I/A Series are trademarks of Invensys plc, its subsidiaries, and affiliates.
Tables..................................................................................................................................... xi
Preface................................................................................................................................. xiii
Audience ................................................................................................................................ xiii
Organization .......................................................................................................................... xiii
Revision Information ............................................................................................................. xiv
Related Documents ................................................................................................................ xiv
Request For Comments .......................................................................................................... xiv
1. Overview ........................................................................................................................... 1
NetAPI MFC Methods ............................................................................................................. 2
iii
B0400BJ – Rev B Contents
CloseFoxAPISet ...................................................................................................................... 25
ConfigureFoxHistory .............................................................................................................. 26
ConnectToServer .................................................................................................................... 33
ConnectToServerByName ...................................................................................................... 34
CreateEventMsgDef ................................................................................................................ 35
DisconnectFromServer ............................................................................................................ 36
dqObjectChange ..................................................................................................................... 37
EngUnits ................................................................................................................................. 38
EnumServerAlias ..................................................................................................................... 39
EnumServerHistorians ............................................................................................................ 40
FetchObjectIndex ................................................................................................................... 41
FetchObjectName ................................................................................................................... 42
FileRead .................................................................................................................................. 43
FileStat .................................................................................................................................... 44
FormatData ............................................................................................................................ 45
FormatDataAndTimeStamp ................................................................................................... 46
FoxHistSystem ........................................................................................................................ 47
GetAccessInfo ......................................................................................................................... 48
GetAliasPath ........................................................................................................................... 49
GetAllBlocks ........................................................................................................................... 50
GetAllCompounds .................................................................................................................. 51
GetBlkDescription .................................................................................................................. 52
GetBlockCompounds ............................................................................................................. 53
GetBlockParams ...................................................................................................................... 54
GetCompBlockAndType ........................................................................................................ 55
GetCompoundBlocks ............................................................................................................. 56
GetConfigFile ......................................................................................................................... 57
GetDirList .............................................................................................................................. 58
GetFile .................................................................................................................................... 59
GetFoxAPIVersion .................................................................................................................. 61
GetFoxHistGroups ................................................................................................................. 62
GetFoxHistMessageColumns .................................................................................................. 63
GetFoxHistMessageData ......................................................................................................... 64
Method 1 ........................................................................................................................... 64
Method 2 ........................................................................................................................... 65
GetFoxHistMessageGroupKeys ............................................................................................... 68
iv
Contents B0400BJ – Rev B
GetFoxHistConfigSessionRTPNames ..................................................................................... 69
GetFoxHistRTPDefinition ..................................................................................................... 70
GetFoxHistRTPValues ........................................................................................................... 74
GetHistArchiveGroups ........................................................................................................... 77
GetHistData ........................................................................................................................... 78
Method 1 ........................................................................................................................... 78
Method 2 ........................................................................................................................... 79
Method 3 ........................................................................................................................... 80
GetHistGroups ....................................................................................................................... 82
GetHistGrpMembers .............................................................................................................. 83
Method 1 ........................................................................................................................... 83
Method 2 ........................................................................................................................... 83
GetHistItemList ...................................................................................................................... 85
GetHistOperations .................................................................................................................. 86
GetHistVersion ....................................................................................................................... 87
GetHostID .............................................................................................................................. 88
GetIAVersion .......................................................................................................................... 89
GetMaxEntries ........................................................................................................................ 90
GetMaxSet .............................................................................................................................. 91
GetMessageData ..................................................................................................................... 92
Method 1 ........................................................................................................................... 92
Method 2 ........................................................................................................................... 93
GetMessageGroup ................................................................................................................... 95
GetMsgGroupAndName ......................................................................................................... 96
GetObjectCount ..................................................................................................................... 97
GetPackageUsers ..................................................................................................................... 98
GetPathAlias ........................................................................................................................... 99
GetServerBinDir ................................................................................................................... 100
GetServerDir ......................................................................................................................... 101
GetServerID .......................................................................................................................... 102
GetServerInfo ........................................................................................................................ 103
GetServerInstDir ................................................................................................................... 104
GetServerName ..................................................................................................................... 105
GetServerStatus ..................................................................................................................... 106
GetServerTimeout ................................................................................................................. 107
GetServerType ...................................................................................................................... 108
GetSetItemNames ................................................................................................................. 109
GetSetNames ........................................................................................................................ 110
v
B0400BJ – Rev B Contents
vi
Contents B0400BJ – Rev B
vii
B0400BJ – Rev B Contents
viii
Figures
1-1. I/A Series NetAPI MFC Interface with Various I/A Series Resources ............................ 1
2-1. Setup Welcome Dialog Box .......................................................................................... 5
2-2. Choose Destination Location Dialog Box ..................................................................... 6
2-3. Installation Complete Dialog Box ................................................................................. 7
2-4. Sample an_init.cfg File .................................................................................................. 8
ix
B0400BJ – Rev B Figures
x
Tables
1-1. I/A Series NetAPI MFC Methods ................................................................................. 2
2-1. AISnet Keywords .......................................................................................................... 9
4-1. Server Access Levels ..................................................................................................... 48
4-2. Configurable Reduction Group Operations ................................................................ 86
4-3. Configurable Historian Operations ........................................................................... 114
5-1. CDataElement Class Data Types .............................................................................. 159
A-1. Error Codes and Strings Returned by NetAPI MFC Class ........................................ 161
B-1. Status Definition with I/A Series Object Manager and AIM*Historian ..................... 167
B-2. I/A Series Object and AIM*Historian RTP Value Types ........................................... 168
B-3. Status Returned by Reductions APIs ......................................................................... 170
B-4. Reduction Value Types ............................................................................................. 171
xi
B0400BJ – Rev B Tables
xii
Preface
This document describes the I/A Series® NetAPI MFC Class software and how it is used to
access the I/A Series distributed control system, I/A Series Historian applications and
AIM*Historian instances.
Audience
This document is intended for programmers and other software professionals who are
developing or maintaining Microsoft® Windows® applications that require networked access to
an I/A Series system. The reader should have a working knowledge of Microsoft’s C++ implemen-
tations and Microsoft Foundation Class (MFC) programming.
Organization
This document is organized into seven sections:
♦ Chapter 1 “Overview” provides an introduction to the NetAPI MFC Class.
♦ Chapter 2 “Installation and Configuration” describes how to install and configure the
NetAPI MFC Class on the development machine using the distribution CD and
sample files.
♦ Chapter 3 “Using the NetAPI MFC Class” describes how to create instances of the
class and lists the server connection and data access methods included in the NetAPI
MFC Class.
♦ Chapter 4 “CFoxAPIServer Class Methods Reference” is a reference guide to the
methods available with NetAPI MFC Class CFoxAPIServer.
♦ Chapter 5 “CDataElement Class Methods Reference” describes the methods available
with NetAPI MFC Class CDataElement.
♦ Appendix A “Error Messages” lists error codes and strings issued by the NetAPI MFC
Class.
♦ Appendix B “Object Status and Value Types” describes the status words and value
types of I/A Series objects and AIM*Historian real-time points (RTPs) and reduction
RTPs.
xiii
B0400BJ – Rev B Preface
Revision Information
The following changes were made to this document for release of AIM*AT® 3.2:
♦ Chapter 2 “Installation and Configuration”
Updated to include support for additional Microsoft platforms.
♦ Chapter 3 “Using the NetAPI MFC Class”
Expanded to include methods related to time stamps.
♦ Chapter 4 “CFoxAPIServer Class Methods Reference”
Expanded to include methods related to time stamps.
Related Documents
Refer to the following documents for information on the APIs that the class uses to access
I/A Series resources and on related AIM*AT programs:
♦ AIM*API User’s Guide (B0193YN)
♦ AIM*Historian User’s Guide (B0193YL)
♦ AIM*AT Installation Guide (B0193YM)
♦ FoxAPI User’s Guide (B0193UD)
♦ Integrated Control Software Concepts (B0193AW)
♦ Integrated Control Block Descriptions (B0193AX).
xiv
1. Overview
This chapter provides an overview of the I/A Series NetAPI MFC Class.
The I/A Series NetAPI MFC Class is an implementation of Microsoft Foundation Class (MFC)
technology designed to simplify interface requirements with the I/A Series system resources. The
application interface enables more efficient development of Windows based programs that access
I/A Series systems and AIM*AT servers.
The class provides a C++ wrapper around an extensive library of C language calls developed earlier
with Networked FoxAPI™ software and AIM*API™ software. The class provides a thread-safe
connection interface, and simplifies the interface requirements, as developers use fewer, more
advanced C++ methods, and yet have all of the functionality and access of the earlier APIs.
The I/A Series NetAPI MFC Class consists of a single public object, CFoxAPIServer, which
defines methods for initialization, connection to I/A Series and AIM*AT Servers, and access to
real-time data, files, and process history.
The NetAPI MFC Class software consists of a header file, a library file, and a runtime DLL
that are installed on the application host. When the class is invoked, it creates an instance of the
object, which is destroyed at completion of the program. The methods transparently exploit
existing FoxAPI and AIM*API calls in the library to connect with the servers and access their data
(Figure 1-1).
Application Host
NetAPI MFC
Class
Networked FoxAPI
AIM*API
Figure 1-1. I/A Series NetAPI MFC Interface with Various I/A Series Resources
1
B0400BJ – Rev B 1. Overview
2
2. Installation and Configuration
This chapter describes how to install and configure the I/A Series NetAPI MFC Class on the
development machine using the distribution CD and sample files.
The I/A Series NetAPI MFC software is distributed on a single CD-ROM. The CD includes
program files and an InstallShield® application that copies the software to the selected directories
on the development machine and updates the Windows or Windows NT® Registry.
The included program files are:
foxapiserver.h Header file that defines attributes and methods for the class.
apiserv32.lib Library of C++ calls that wrap around Networked FoxAPI and AIM*API
functions calls.
apiserv32.dll Runtime dynamic link library (DLL). This file must be ported to the
application hosts along with shared MFC libraries MFC42.dll and
MSVCRT.dll when the application is put into production.
errorstr.dat ASCII file that provides a descriptive string for each error code returned
from the target servers. This file must be ported to the application hosts
when the program is put into production. You can modify the strings
using a text editor to provide more detailed explanations. Appendix A
“Error Messages” lists the file contents.
an_init.cfg Sample client initialization file used by the application to identify target
servers and set trace options and other parameters. This file is used on
both the development machine and the application hosts. See “Develop-
ment Configuration” on page 8 for a description of the file keywords and
instructions on modifying an_init.cfg.
The development machine, and later the application hosts, communicate with various I/A Series
stations and AIM*API servers via a TCP/IP connection. If the servers are running AIM*API 3.1
or later, the NetAPI MFC Class software may use the server configuration file to determine server
names, path aliases and other data necessary for connection. For Networked FoxAPI server and
for AIM*API 3.0 and earlier, you must load the client initialization file (an_init.cfg) onto the
development and application hosts. The Setup program creates a Registry entry on the develop-
ment machine that identifies the location of the file. An application hosts’ Registry must also be
updated to define the location of the file.
NOTE
When debugging, make sure you link to the debug version of the libraries:
apiserv32d.lib and apiserv32d.dll.
3
B0400BJ – Rev B 2. Installation and Configuration
System Requirements
I/A Series NetAPI MFC Class is an implementation of Microsoft Foundation Class technology,
and is designed for application development using Microsoft Visual Studio. The application host
can be any of the following Microsoft platforms:
♦ Windows 95
♦ Windows 98
♦ Windows NT 4.0
♦ Windows 2000
♦ Windows XP.
The software also requires a TCP/IP connection with the target servers. Each server must be
running either Networked FoxAPI software or AIM*API software. The class does not require
authorization to access the servers, as the class has full access privileges with the APIs.
The I/A Series NetAPI MFC Class requires Microsoft Visual Studio, Version 6.0 with Service
Pack 3 or later. As an MFC extension class, the software uses shared MFC libraries. When you
begin a project, you must use the MFC Libraries as a shared DLL.
4
2. Installation and Configuration B0400BJ – Rev B
3. Click Next.
Setup displays the license agreement.
5
B0400BJ – Rev B 2. Installation and Configuration
4. Click OK to indicate that you have read the license and agree with the terms.
Setup displays the Choose Destination Location dialog box (Figure 2-2). You can
install the software in any directory, but it is strongly recommended that you use the
default, C:\Program Files\The Foxboro Company\NetAPI_MFC_Class.
6
2. Installation and Configuration B0400BJ – Rev B
5. Click Next to accept the default selection, or use the Browse feature to select a
different destination directory and then click Next.
Setup copies the software to the selected directory and creates the following Registry
entry:
HKEY_LOCAL_MACHINE\Software\SimSci\Aim\Settings\an_init =
<drive:>\<path>\an_init.cfg
where drive and path define the directory selected in the Choose Destination Location
dialog box (Figure 2-2).
When the NetAPI MFC application is executed, the DLL references this file for server
connections and other settings. The DLL also creates the following Registry entries:
HKEY_LOCAL_MACHINE\Software\SimSci\Aim\Settings\BroadcastWait
HKEY_LOCAL_MACHINE\Software\SimSci\Aim\Settings\DisableBroadcast
Setup announces completion of the installation with the Installation Complete dialog
box (Figure 2-3).
7
B0400BJ – Rev B 2. Installation and Configuration
Development Configuration
When an instance of the I/A Series NetAPI MFC Class is started, it uses a network broadcast to
identify servers. If the target servers are running AIM*AT 3.1 or later and they are configured to
respond to the broadcasts, they provide the application with client configuration information
from their server initialization files. The application also checks the local an_init.cfg file for server
connections. During installation, a sample copy of this file is placed in the program directory at
the location identified in the Registry.
An an_init.cfg file may already exist on the host if the machine is already used for AIM*AT
programs such as AIM*Historian and AIM*DataLink™. The I/A Series NetAPI MFC Class relies
on the Registry entry to point to the correct file.
The file an_init.cfg is a keyword file similar to Windows initialization (*.ini) files with section
labels in brackets.
There are two required sections:
[AISnet] Defines trace options and maximum server interactions
[TCPIP] Specifies the path, protocol, and network API of the target servers.
8
2. Installation and Configuration B0400BJ – Rev B
The [TCPIP] section keywords are the IP names or aliases of the target servers. Each alias is
equated with three parameters:
The entry uses the following format:
<server name> = "<IP address> <port number> /dev/tcp 1024"
To modify the sample configuration file:
1. Open the an_init.cfg file using Notepad or another text editor.
2. Modify AISnet parameters as required.
You may want to revisit these parameters later in the project.
3. Identify the target servers in the [TCPIP] section.
a. For server name, use whatever alias is to be used in the client application.
The server names in Figure 2-4 are letterbugs of I/A Series workstations.
b. Enter the full TCP/IP address of the target server.
c. Set the port number to 45678 if the server is an AIM*AT server. Set the port
number to 55555 if the server is a FoxAPI server.
In Figure 2-4, three servers are AIM*AT servers. The [TCPIP] entry that is com-
mented out is for an I/A Series station that was accessed using a
Networked FoxAPI instance.
d. Enter the protocol specification exactly as shown in the format and the examples.
9
B0400BJ – Rev B 2. Installation and Configuration
10
3. Using the NetAPI MFC Class
This chapter describes creating instances of the class and lists the server connection and data
access methods included in the I/A Series NetAPI MFC Class.
Creating a Project
The I/A Series NetAPI MFC Class is designed for use with Microsoft Visual Studio. When you
begin a project, make sure you use the MFC Libraries as a shared DLL. When debugging, be sure
to link to the apiserv32d.lib and aipserv32d.dll libraries.
The following methods create a new instance of the class by duplicating the existing class:
MyServer= pMyServer
which uses overloaded operator= as declared in the operation:
void operator= (CFoxAPIServer * pServer);
or
CFoxAPIServer MyServer(pMyServer);
The default destructor virtual ~CFoxAPIServer(); is included in the class. Use good
programming practices and clear the instance upon completion of the program using:
delete pMyServer;
11
B0400BJ – Rev B 3. Using the NetAPI MFC Class
NOTE
A NetAPI MFC instance connects to one server at a time. Create multiple instances
to connect simultaneously with multiple servers.
Method Page
ConnectToServer page 33
ConnectToServerByName page 34
DisconnectFromServer page 36
EnumServerAlias page 39
GetConfigFile page 57
GetServerInfo page 103
GetServerStatus page 106
GetUserConnection page 116
ReconnectToServer page 136
SetUserConnection page 141
Server Information
Once the application is connected to the server, these methods access information about the
servers.
Method Page
GetAccessInfo page 48
GetAliasPath page 49
GetFoxAPIVersion page 61
GetHostID page 88
GetIAVersion page 89
GetMaxEntries page 90
GetPackageUsers page 98
GetPathAlias page 99
GetServerID page 102
12
3. Using the NetAPI MFC Class B0400BJ – Rev B
Method Page
GetServerName page 105
GetServerTimeout page 107
GetServerType page 108
GetTimeUsage page 115
BOOL IPAddress page 117
UINT IPAddress page 117
IsOffPlatform page 121
IsServerOK page 122
SetServerTimeout page 140
Method Page
GetAllBlocks page 50
GetAllCompounds page 51
GetBlkDescription page 52
GetBlockCompounds page 53
GetBlockParams page 54
GetCompBlockAndType page 55
GetCompoundBlocks page 56
GetStationCompounds page 111
GetStations page 112
13
B0400BJ – Rev B 3. Using the NetAPI MFC Class
Method Page
AddMultipleObjects page 19
AddObject page 23
dqObjectChange page 37
EngUnits page 38
FetchObjectIndex page 41
FetchObjectName page 42
FormatData page 45
FormatDataAndTimeStamp page 46
GetObjectCount page 97
MultipleObjectWrite page 124
ObjectRange page 125
ObjectRead page 126
ObjectReadAll page 128
ObjectType page 129
ObjectWrite page 130
RemoveObject page 137
RemoveObjects page 138
Method Page
IsDir page 118
GetDirList page 58
FileRead page 43
GetFile page 59
PutFile page 132
FileStat page 44
GetServerDir page 101
GetServerBinDir page 100
GetServerInstDir page 104
MakeSystemCall page 123
14
3. Using the NetAPI MFC Class B0400BJ – Rev B
Method Page
CloseFoxAPISet page 25
GetMaxSet page 91
GetSetItemNames page 109
GetSetNames page 110
OpenFoxAPISet page 131
Method Page
EnumServerHistorians page 40
GetHistArchiveGroups page 77
I/A Series Historian only
GetHistData page 78
GetHistGroups page 82
GetHistGrpMembers page 83
GetHistItemList page 85
GetHistOperations page 86
GetMessageData page 92
GetMessageGroup page 95
GetTimeLinearData page 113
IsFoxHistory page 119
IsInHistorian page 120
WriteMDEData page 143
15
B0400BJ – Rev B 3. Using the NetAPI MFC Class
Method Page
ConfigureFoxHistory page 26
CreateEventMsgDef page 35
FoxHistSystem page 47
GetFoxHistGroups page 62
GetFoxHistMessageColumns page 63
GetFoxHistMessageData page 64
GetFoxHistMessageGroupKeys page 68
GetFoxHistoryConfigSessionRTPNames page 69
GetFoxHistRTPDefinition page 70
GetFoxHistRTPValues page 74
GetHistVersion page 87
GetMsgGroupAndName page 96
PutFoxHistRTPValue page 134
SearchFoxHistRTPNames page 139
WriteEventMsgData page 142
16
3. Using the NetAPI MFC Class B0400BJ – Rev B
Chapter 2 “Installation and Configuration” provides detail on initially setting up these files.
If an AIM*AT application such as AIM*Explorer is already installed on the application host
machine, be sure not to overwrite its an_init.cfg.
17
B0400BJ – Rev B 3. Using the NetAPI MFC Class
18
4. CFoxAPIServer Class Methods
Reference
This chapter provides a reference guide to the methods available with I/A Series NetAPI MFC
Class CFoxAPIServer. The methods are listed in alphabetical order.
NOTE
The descriptions included in this section refer to AIM*Historian names of compo-
nents, attributes and other elements, for example, FH_COLLECTOR_NSIZ.
AddMultipleObjects
Synopsis
BOOL AddMultipleObjects(int nument, char * name_array, int * acctyp_array,
float * delta_array, int * rsr_array, float * wdelta_array, int * index_array,
int * error_array, int * reterr);
19
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
int * rsr_array Specifies an array of read scan rates, one per object.
A read scan rate indicates the frequency at which
the server checks the object for changes. Read scan
rates are positive integers, in half-second incre-
ments; for example, a read scan rate of 1 means 0.5
seconds; a read scan rate of 2 means 1.0 seconds,
and so on. These read scan rates can differ from the
read scan rates specified by other methods
float * wdelta_array Specifies an array of positive floating point write
change deltas in engineering units, one per object.
The Class writes a value to the server for an object
when you call AddMultipleObjects and when:
♦ A character, integer, boolean, or long integer
object changes “write value”
or
♦ The difference between a float object's “write
value” and “read value” is greater than or equal
to the wdelta_array element for the object. A
write delta of zero (0) causes the value to be
written to the server if there is any difference.
If the acctyp_array element for the object is set to
read-only (1), the wdelta_array element is ignored.
Each wdelta_array element must be greater than or
equal to its corresponding delta_array element,
unless the wdelta_array element is zero (0).
int * index_array Returns an array of object indexes, unique per
server, one per object. If the name_array element is
$ALL_AIS_OBJS, the corresponding index_array
element is MaxEnt +1, where MaxEnt is the value
returned by the GetMaxEntries function; this index
is unusable as an object index.
int * error_array Returns an array of error codes, one per object
(see “Errors” below).
int * reterr Returns an error code (see Appendix A “Error
Messages”)
20
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Description
The method AddMultipleObjects adds objects to the CDX for the current server. You specify the
number of objects, and a name, access type, read delta, read scan rate, and write delta for each
object. AddMultipleObjects returns an overall error code (reterr) and an index and error code
(in error_array) for each object.
The object name $ALL_AIS_OBJS has special significance. When this name is in the CDX, the
server scans for changes in all objects by looking for a difference in an object's change count
between subsequent scans. The change counts are not incremental. The change for an object
whose data set has been closed with CloseFoxAPISet is not sent. Note that $ALL_AIS_OBJS can
co-exist with other objects in the CDX. When $ALL_AIS_OBJS is in the CDX, however, all
other objects have no effect on the scanning for changes, and change-driven writes using the CDX
are not supported.
By default, AddMultipleObjects filters out duplicate object names, returning an error code for
each duplicate. To allow duplicate objects, specify Multiples in the an_init.cfg initialization file.
See Figure 2-4, “Sample an_init.cfg File” on page 8, and Table 2-1“AISnet Keywords” on page 9.
This feature can be useful when doing performance testing.
The AddMultipleObjects method adds an object for read-only access and returns error_array
element nowriteob even though the passed acctyp_array element is read/write, if one of the
following conditions exists:
♦ The object is opened for read-only access in the database on the server.
♦ The object's set has a zero (0) write scan rate (wsr).
♦ MaxWriteObjects is exceeded.
The maximum number of objects in a CDX is maxobj, that is, the maximum number of objects
that can be open concurrently. Different servers can have different maxobj limits.
Errors
21
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
NOTE
When you do not configure Multiples in the an_init.cfg initialization file and you
call the AddMultipleObjects method to add multiple objects with the same name,
AddMultipleObjects uses the first instance of the object and filters out the rest;
all instances of the object in subsequent AddMultipleObjects calls are also
filtered out.
NOTE
When you configure Multiples in the an_init.cfg initialization file and call the
AddMultipleObjects method to add multiple objects with the same name,
multiple instances of an object can have different access types, deltas and read scan
rates.
Return Values
Adds objects to the CDX for the current server if successful.
False if error; look at reterr and error_array for more detail.
See Also
♦ AddObject
♦ GetObjectCount
♦ ObjectReadAll
♦ RemoveObjects
♦ RemoveObject
22
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
AddObject
Synopsis
BOOL AddObject(LPCTSTR szName, int * nIndex, int accessType = 1,
int rsr = 1, float fDeadband = 0.001);
LPCTSTR szName Specifies the object name for which you want
changes. Each object name contains 32 characters,
left-justified with trailing blanks or nulls.
int * nIndex Returns an object index, unique per server,
one per object. If the name_array element is
$ALL_AIS_OBJS, the corresponding index_array
element is MaxEnt +1, where MaxEnt is the value
returned by the GetMaxEntries function; this index
is unusable as an object index.
int accessType = 1 Specifies an access type, one per object:
1 = read only
2 = read/write
The default is 1.
int rsr = 1 Specifies a read scan rate, one per object. A read
scan rate indicates the frequency at which the server
checks the object for changes. Read scan rates are
positive integers, in half-second increments; for
example, a read scan rate of 1 means 0.5 seconds; a
read scan rate of 2 means 1.0 seconds, and so on.
The default is set to 1 (0.5 seconds).
This read scan rate can differ from the read scan rate
specified by other methods.
float fDeadband = 0.001 Specifies a positive Deadband value in engineering
units, one for each object. The default is set to
0.001.
The server sends a change for an object to the client
when:
♦ An object changes value by an amount greater
than or equal to the deadband element,
or
♦ An object changes status. Zero deadbands
result in a change on every scan, regardless of
the object's value type. These deadbands can
differ from the deltas specified for other
methods.
23
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
Description
The AddObject method establishes a link with the server for the specified data object. This
linkage is required for the following methods:
♦ FetchObjectIndex
♦ ObjectReadAll
♦ dqObjectChange
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if successful.
False if error.
See Also
♦ AddMultipleObjects
♦ GetObjectCount
♦ RemoveObjects
♦ RemoveObject
♦ FetchObjectIndex
♦ ObjectReadAll
♦ dqObjectChange
24
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
CloseFoxAPISet
Synopsis
BOOL CloseFoxAPISet(LPCTSTR set_name);
Description
The CloseFoxAPISet method closes a FoxAPI data set.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if successful.
False if error.
See Also
♦ GetMaxSet
♦ GetSetNames
♦ GetSetItemNames
♦ OpenFoxAPISet
25
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
ConfigureFoxHistory
AIM*Historian instances only
Synopsis
BOOL ConfigureFoxHistory(int nFhsd, LPCTSTR szAction, LPCTSTR szComponent,
LPCTSTR szComponentName, LPCTSTR szAttribute, LPTSTR szValue, int &
nIndicator);
26
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Description
The ConfigureFoxHistory method creates and configures an AIM*Historian instance.
ConfigureFoxHistory is the only API required to configure an AIM*Historian instance, although
there are other APIs that simplify and speed up retrieval of certain commonly used configuration
information; those other APIs are listed in the AIM*API User’s Guide (B0193YN) and the
AIM*Historian User’s Guide (B0193YL).
In general, configuring AIM*Historian applications consists of specifying values that fit into a
three-tier hierarchy:
♦ AIM*Historian instance
♦ Components within an AIM*Historian instance
♦ Attributes of components.
In the ConfigureFoxHistory method, elements of this hierarchy are identified as follows:
♦ To create an instance and open a configuration session to the instance, an
AIM*Historian instance is identified by its instance name.
Once created and a session is open, an AIM*Historian instance is identified by the
AIM*Historian Session Descriptor (fhsd).
♦ A component is identified by its type (component) and its name (component name).
♦ An attribute is identified by its name (attribute) and its value (value).
Most configuration actions fit into this model. However, to support certain features of
AIM*Historian software without defining many additional arguments to ConfigureFoxHistory,
some components and attributes require more than a single name or value, or use the arguments
in a unique way. These special definitions are explained in Appendix E “AIM*Historian Compo-
nent Attributes” in the AIM*Historian User’s Guide (B0193YL).
You can modify the configuration of an AIM*Historian instance while the instance is running.
You do not need to stop the instance at any time to modify the instance. However,
modifying certain attributes that govern the maximum number of items of something requires the
AIM*Historian instance to be restarted for changes to take effect.
Some components cannot be deleted. To delete an AIM*Historian instance, refer to the AIM*His-
torian User’s Guide (B0193YL).
27
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
The aimhistorian.h header file has two types of #defines for attribute values:
♦ Numeric:
#define FH_FLOAT 3 /* Specifies the numeric value type for a float */
Use the numeric version when checking the result of getting an attribute value
in indicator.
♦ ASCII:
#define FH_A_FLOAT “FLOAT” /*Specifies the float value type as an ASCII string */
The ASCII version is indicated by the _A in the name. Use this version when putting
in an attribute value and when checking the result of getting an attribute value in
value.
28
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
NOTE
If the station is an I/A Series station, creating an instance automatically results in
the creation of an RTP collector station of the same name – you do not need to
create the RTP collector station. Remote I/A Series real-time collectors and
I/O Gate Data collectors must be explicitly created and configured.
You can create another instance like an existing one. See the description of
the LIKE attribute in Appendix E “AIM*Historian Component
Attributes” in the AIM*Historian User’s Guide (B0193YL).
♦ FH_COMP_POINT represents a real-time point object (RTP).
The FH_COMP_POINT component is the only component that can be
deleted, then undeleted. While deleted, an RTP:
Is not modifiable.
Is not collected.
Returns no data upon a retrieval request.
Does use up an RTP slot, but does not count against the total number of
licensed RTPs authorized for your server.
A limited number of attributes for RTPs cannot be changed under
certain circumstances.
For example, you cannot change the NAMEINCOL of an RTP once the
RTP has a value in the AIM*Historian database. These cases are noted in
Appendix E “AIM*Historian Component Attributes” in the
AIM*Historian User’s Guide (B0193YL).
♦ FH_COMP_MSG represents an event message group or event
message name.
If the component is FH_COMP_MSG and you are creating, deleting or
otherwise referencing a message group, component_name is NULL,
attribute is FH_ATTR_GROUP and value is the name of the message
group.
If the component is FH_COMP_MSG, and you are creating,
deleting, or otherwise referencing a message name within a message
group, component_name is message group and message name. Specify the
message group name, a space character, and the message name, followed
by the NULL terminator.
To define the format of a message type, add message field definitions
to the message component: action is FH_ACT_PUT, component
is FH_COMP_MSG, component_name is “<message_group>
<message_name>”, attribute is FH_ATTR_DEFN, and value is as defined
in Appendix E “AIM*Historian Component Attributes” in the AIM*His-
torian User’s Guide (B0193YL). Message definition attributes
act somewhat like components, because you add, and can retrieve,
<n> definitions (rather than just one attribute value).
29
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
NOTE
Message group “AIM*Historian” is reserved for use by AIM*Historian programs.
30
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
31
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
Return Values
True if successful.
False if error; look at reterr for more detail.
See Also
♦ GetFoxHistoryConfigSessionRTPNames
♦ GetFoxHistRTPValues
♦ GetFoxHistRTPDefinition
♦ WriteEventMsgData
32
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
ConnectToServer
Synopsis
int ConnectToServer(LPCTSTR APAlias, LPCTSTR szPackage = NULL);
LPCTSTR APAlias Specifies the server by the path alias defined in the
local an_init.cfg file and EnumServerAlias.
LPCTSTR szPackage = NULL Identifies an AIM*AT client application that is
making the connection. Use the default NULL.
NOTE
szPackage is reserved for Invensys use. Do not pass this variable.
Description
The ConnectToServer method adds and establishes a connection to the server defined in the
an_init.cfg file to this class. Use EnumServerAlias to get a list of AP aliases.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if connection successful.
False if the connection attempt failed or package access was denied.
Use GetServerInfo or GetServerStatus to determine the reason for the failure. GetServerInfo
responds with a message, while GetServerStatus responds with a code.
See Also
♦ ConnectToServerByName
♦ ReconnectToServer
♦ GetServerInfo
♦ GetServerStatus
33
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
ConnectToServerByName
Synopsis
Bool ConnectToServerByName(LPCTSTR NetworkName);
Description
The ConnectToServer method adds and establishes a connection to the server defined in the
TCPIP section of the an_init.cfg file to this class.
Return Values
True if successful.
False if the connection attempt failed or package access was denied.
Use GetServerInfo or GetServerStatus to determine the reason for the failure. GetServerInfo
responds with a message, while GetServerStatus responds with a code.
See Also
♦ ConnectToServer
♦ GetServerInfo
♦ GetServerStatus
♦ ReconnectToServer
34
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
CreateEventMsgDef
AIM*Historian instances only
Synopsis
BOOL CreateEventMsgDef(LPCTSTR Historian, LPCTSTR MessageTable, CStringArray
& ColumnList, CStringArray & ColDataTypes, CDWordArray & ColLengths);
Description
CreateEventMsgDef adds a message definition to the event message configuration in the named
AIM*Historian instance. Each message definition consists of three required keywords or column
names, and optional user-defined keywords. Refer to Chapter 2, “AIM*Historian Configuration”
and Appendix E, “AIM*Historian Component Attributes” in the AIM*Historian User’s Guide
(B0193YL) for additional information on the event message configuration.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The message is added to the message configuration file, hist_message.cfg, if successful.
False if error.
See Also
♦ WriteEventMsgData
35
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
DisconnectFromServer
Synopsis
Void DisconnectFromServer(void);
Description
The DisconnectFromServer method disconnects this class instance from the current server.
Checks to see if the server connection is OK. If OK, it closes this server_id, and sets this server_id
to 0.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
No return.
! CAUTION
DisconnectFromServer causes the CDX to be lost. After reestablishing a
connection to the server with ConnectToServer, call AddMultipleObjects to re-add
objects to the CDX.
NOTE
If you close the connection to the current server, there is no current server until you
call ConnectToServer. DisconnectFromServer does not choose another server to be
the current server. Methods that expect a connected server that are called while
there is no current server return an error code.
See Also
♦ ConnectToServer
♦ ReconnectToServer
♦ ConnectToServerByName
36
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
dqObjectChange
Synopsis
BOOL dqObjectChange(CObArray & ChangedData);
Description
The dqObjectChange method queries the current server for changed data in the Change Data
Extension since the last query. Fills the CObArray with changed objects of CDataElement type
(see Table 5-1).
NOTE
It is the programmer’s responsibility to release (delete) the array elements
(CDataElements).
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if successful.
False if error.
See Also
♦ ObjectRead
♦ ObjectReadAll
37
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
EngUnits
Synopsis
BOOL EngUnits(LPCTSTR szName, CString & szEngUnits);
LPCTSTR szName Specifies the full path name of the object on the
server.
CString szEngUnits Engineering units as configured for the parameter
in the server.
Description
The EngUnits method finds the Engineering Units for a defined object name.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if object found and values passed to szEngUnits.
False if Error.
See Also
♦ ObjectRange
♦ ObjectType
38
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
EnumServerAlias
Synopsis
BOOL EnumServerAlias(CStringList & szServerEntry);
Description
The EnumServerAlias method fills the supplied buffer with server alias names.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if servers found and passed to szServerEntry.
False if no servers found.
39
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
EnumServerHistorians
Synopsis
BOOL EnumServerHistorians(CStringList & histlist);
Description
The EnumServerHistorian method fills the supplied buffer with available historian names.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if historian names request completed.
False if error.
See Also
♦ IsFoxHistory
♦ IsInHistorian
40
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
FetchObjectIndex
Synopsis
BOOL FetchObjectIndex(LPCTSTR szName, int * nIndex);
LPCTSTR szName Specifies the full path name of the object on the
server.
int * nIndex Object index for the specified name.
Description
When an object is added, an index is created for that object. FetchObjectIndex gets the index
number for specified object name.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if index to object is found.
False if error.
See Also
♦ FetchObjectName
♦ AddMultipleObjects
♦ Remove Objects
♦ Remove Object
♦ ObjectReadAll
41
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
FetchObjectName
Synopsis
BOOL FetchObjectName(CString &szName, int nIndex);
Description
When an object is added, an index is created for that object. FetchObjectName finds the Object
Name for the specified index number.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if object found for specified index.
False if error.
See Also
♦ AddMultipleObjects
♦ Remove Objects
♦ Remove Object
♦ FetchObjectIndex
♦ ObjectReadAll
42
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
FileRead
Synopsis
BOOL FileRead(LPCTSTR iafile, long offset, long numchar, char * buffer,
long * nRetLen);
LPCTSTR iafile Specify the iafile name of the file on the server.
Specify the complete I/A Series path and file name.
long offset Specify the byte position in the file from which to
start reading.
long numchar Specify the number of characters to be read. This
value should be no larger than the size of the buffer.
char * buffer The destination buffer.
long * nRetLen How much of the buffer is used.
Description
The FileRead method retrieves data about the specified file.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The contents of the buffer and how much of the buffer is used if successful.
False if error.
See Also
♦ GetFile
43
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
FileStat
Synopsis
BOOL FileStat(LPCTSTR szIAFile, long & filesize, CTime & modtime,
CTime & createtime);
Description
The FileStat method returns the file size, modification time, and the creation time for the
specified file.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Returns the file size, modification time, and the creation time if successful.
False if error.
See Also
♦ GetDirList
♦ IsDir
44
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
FormatData
Synopsis
BOOL FormatData(LPCTSTR szName, Cstring & szItemValue, long value,
int status);
LPCTSTR szName Specifies the full path name of the object on the
server.
CString szItemValue Returns the value and status of the specified object
separated by a tab character.
long value Current object value.
int status Object status word. See Appendix B “Object Status
and Value Types” for a definition of the I/A Series
status word and AIM*Historian status word.
Description
The FormatData method formats the specified object’s value and status into a string. The value
and status are separated by a tab character. The format of the value is determined by the data type
found in the status. For I/A Series string data type, the complete string is obtained. Refer to
Appendix B “Object Status and Value Types”.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if successful.
False if error.
45
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
FormatDataAndTimeStamp
Synopsis
BOOL FormatDataAndTimeStamp(LPCTSTR szName, CString & szItemName, long value,
int status, time_t * ts_utc, int * ts_msec, CString & szTimeStamp, int *
nSource);
LPCTSTR szName Specifies the full path name of the object on the
server.
CString szItemValue Returns the value and status of the specified object
separated by a tab character.
long value Current object value.
int status Object status word. See Appendix B “Object Status
and Value Types” for a definition of the I/A Series
status word and AIM*Historian status word.
time_t * ts_utc UTC time associated with object value in seconds,
from CDataElement.
int * ts_msec Millisecond associated with object value, from
CDataElement.
CString szTimeStamp Returns the time stamp, adjusted for local time, in
the form MM/DD/YY_hh:mm:ss.ddd where:
MM = month
DD = day
YY = year
hh = hour
mm = minute
ss = second
ddd = millisecond.
int * nSource Source of the time stamp:
1 = from the I/A Series system
2 = from the API
3 = from the client application.
Description
The FormatDataAndTimeStamp method formats the specified object’s value and status into one
string and the object’s time stamp into another string. The format of the value is determined by
the data type found in the status. For I/A Series string data type, the complete string is obtained.
Refer to Appendix B “Object Status and Value Types”.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if successful.
False if error.
46
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
FoxHistSystem
AIM*Historian instances only
Synopsis
BOOL FoxHistSystem(LPCTSTR szAction, LPCTSTR szAttribute,
CString &sValue, UINT maxLen = 512);
Description
For Invensys use only.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
47
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetAccessInfo
Synopsis
WORD GetAccessInfo(void);
Description
The GetAccessInfo method reads the access privileges configured in the server API for the current
user. User access privileges are configured with the API Admin utility for various AIM*AT
packages such as AIM*Explorer™ software and AIM*DataLink software. Table 4-1 lists the
security access levels that are defined in the Networked FoxAPI and AIM*API configurations for
various packages. If the current user is connected with no package, then user security access level
is overridden and access level is 16.
Code Description
0 NO_ACCESS Access denied
1 READ_ACCESS User can only read objects
2 WOBJ_ACCESS User can read write objects
4 WFILE_ACCESS User can write files.
8 OPEN_ACCESS User can open FoxAPI data sets.
16 SYSTEM_ACCESS User has full privileges.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Access code is successful.
False if error.
48
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetAliasPath
Synopsis
CString GetAliasPath(void);
Description
The GetAliasPath returns the directory path of the currently connected server. This path is used as
a root entry point for file access (rfs_path). (Generally, the top level of server.)
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A string with the Path Alias directory entry point if successful.
False if error.
49
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetAllBlocks
Synopsis
BOOL GetAllBlocks(CStringList * slStations, CStringList & slBlocks,
BOOL bType = FALSE);
Description
The GetAllBlocks method fills the supplied CStringList with all block names or block types in the
specified stations depending upon the bType specified.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Block names or block types if successful.
False if error.
See Also
♦ GetAllCompounds
♦ GetBlkDescription
♦ GetBlockCompounds
♦ GetBlockParams
♦ GetCompBlockAndType
♦ GetCompoundBlocks
50
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetAllCompounds
Synopsis
BOOL GetAllCompounds(CStringList * slStations, CStringList & slCompounds);
Description
The GetAllCompounds method fills the specified CStringList with a list of all of the
compound names in the specified I/A Series stations.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Compound names if successful.
False if error.
See Also
♦ GetAllBlocks
♦ GetBlkDescription
♦ GetBlockCompounds
♦ GetBlockParams
♦ GetCompBlockAndType
♦ GetCompoundBlocks
♦ GetStationCompounds
51
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetBlkDescription
Synopsis
BOOL GetBlkDescription(LPCTSTR ianame, Cstring & szDescrp);
Description
The GetBlkDescription method gets the description of the specified block.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Description of specified block if successful.
False if error.
See Also
♦ GetAllBlocks
♦ GetAllCompounds
♦ GetBlockCompounds
♦ GetBlockParams
♦ GetCompBlockAndType
♦ GetCompoundBlocks
52
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetBlockCompounds
Synopsis
BOOL GetBlockCompounds(LPCTSTR szBlock, CStringList * slStations,
CStringList & slCompounds);
Description
The GetBlockCompounds method retrieves all the compounds and stations that hold the
specified block.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Compounds and stations for the specified block if successful.
False if error.
See Also
♦ GetAllBlocks
♦ GetAllCompounds
♦ GetBlkDescription
♦ GetBlockParams
♦ GetCompBlockAndType
♦ GetCompoundBlocks
53
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetBlockParams
Synopsis
BOOL GetBlockParams(LPCTSTR szBlockType, CStringList & slParams);
LPCTSTR szBlockType Specifies the type of block for which you want to
retrieve information.
CStringList slParams Returns a list of parameters.
Description
The GetBlockParams method retrieves a list of parameters for a specified block type.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of parameters for specified block type if successful.
False if error.
See Also
♦ GetAllBlocks
♦ GetAllCompounds
♦ GetBlkDescription
♦ GetBlockCompounds
♦ GetCompBlockAndType
♦ GetCompoundBlocks
54
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetCompBlockAndType
Synopsis
BOOL GetCompBlockAndType(LPCTSTR szCompound, CStringList & slNameType);
Description
The GetCompBlockAndType method retrieves the name and type of each block in the specified
compound. The block name and type are separated by a tab character.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list containing the name and type of each block, separated by a tab character, if successful.
False if error.
See Also
♦ GetAllBlocks
♦ GetAllCompounds
♦ GetBlkDescription
♦ GetBlockCompounds
♦ GetBlockParams
♦ GetCompoundBlocks
55
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetCompoundBlocks
Synopsis
BOOL GetCompoundBlocks(LPCTSTR szCompound, CStringList & slBlocks,
BOOL bType = FALSE);
Description
The GetCompoundBlocks method retrieves a list of block name or block type depending upon
the bType specified, for the specified compound.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of block names or block types if successful.
False if error.
See Also
♦ GetAllBlocks
♦ GetAllCompounds
♦ GetBlkDescription
♦ GetBlockCompounds
♦ GetBlockParams
♦ GetCompBlockAndType
56
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetConfigFile
Synopsis
CString GetConfigFile(void);
Description
The CString GetConfigFile method returns the contents of the Registry setting
HKEY_LOCAL_MACHINE\Software\SimSci\Aim\Settings\an_init =
<drive:>\<path>\an_init.cfg.
Refer to “Development Configuration” on page 8 for a description of the an_init.cfg file.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Contents of the Registry setting if successful.
False if error.
57
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetDirList
Synopsis
BOOL GetDirList(LPCTSTR szPath, CStringList & slDirList,
CStringList & slIsDir);
LPCTSTR szPath Specify the path for which you want to list directory
information.
CStringList slDirList Returns the directory list.
CStringList slIsDir Checks to see if entry found is a directory.
Description
The GetDirList method retrieves the directory list information for the specified path.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Single-level directory list if successful.
False if error.
See Also
♦ IsDir
♦ FileStat
58
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetFile
Synopsis
BOOL GetFile(LPCTSTR szIAFile, CString & szFileName, BOOL bAscii,
UINT nSkip = 0);
LPCTSTR szIAFile Specify the full path and file name of the file on
the server.
CString szFileName The application host full path and file name, or if
not specified, a created temporary file name. This
method overwrites any file with the same path and
name on the application host.
BOOL bAscii Set to TRUE to indicate the file should be
converted from UNIX® ASCII to DOS ASCII.
UINT nSkip = 0 Specify number of bytes to skip when copying file.
The default value is 0.
Description
The GetFile method copies a file on the connected server to a named file, or temporary file if not
named, on the application host. This method overwrites any file with the same path and name on
the application host.
Errors
59
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
NOTE
You can access UNIX “regular” files in an I/A Series AP, but not directory, special,
or FIFO files.
NOTE
To restrict access through DNBI gateways to an AP with UIDs and GIDs, you need
to modify the dsamap file in the AP. The dsamap file is: /etc/dsamap for AP10 and
AP20; /etc/fox/dsamap for 50 Series systems.
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A copy of the file is created on the application host if successful.
False if error.
See Also
♦ PutFile
♦ FileRead
60
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetFoxAPIVersion
Synopsis
CString GetFoxAPIVersion(void);
Description
The GetFoxAPIVersion method retrieves the version of the current API server.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The API server version if successful.
False if error.
See Also
♦ GetIAVersion
♦ IsOffPlatform
61
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetFoxHistGroups
AIM*Historian instances only
Synopsis
BOOL GetFoxHistGroups(LPCTSTR Historian, int nGrpType,
CStringList & GroupList, CStringList & GroupDescrp);
Description
The GetFoxHistGroups method retrieves the Group type, list and description for all groups
included in the specified AIM*Historian instance. The only valid input for group type is 11
(Historian Messages, Optional Errors).
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Group type, list and description if successful.
False if error.
See Also
♦ GetMsgGroupAndName
62
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetFoxHistMessageColumns
AIM*Historian instances only
Synopsis
BOOL GetFoxHistMessageColumns(LPCTSTR Historian, LPCTSTR MessageTable,
CStringArray & ColumnList, CStringArray & ColDescList, CDWordArray &
ColDataTypes, CDWordArray & ColPrecisions);
Description
The GetFoxHistMessageColumns method retrieves the configurations of a message group for the
specified AIM*Historian instance.
Refer to Chapter 2, “AIM*Historian Configuration” and Appendix E, “AIM*Historian
Component Attributes” in the AIM*Historian User’s Guide (B0193YL) to review the elements of a
message configuration.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Four arrays for the specified instance if successful.
False if error.
See Also
♦ GetFoxHistMessageGroupKeys
63
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetFoxHistMessageData
AIM*Historian instances only
There are two methods provided to retrieve AIM*Historian Message Data. The first method
listed provides filtering based upon a time span using start and end times, and a filter on the mes-
sage string for the specified instance. The second method listed also provides filtering based upon
a time span and adds filtering on message group and message name, as well as complex filtering
using an SQL-like string.
Method 1
Synopsis
BOOL GetFoxHistMessageData(LPCTSTR Historian, time_t start, time_t finish,
LPCTSTR filter, char **msg_hdr, char **msg_body, int *more, BOOL new_request);
64
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Method 2
BOOL GetFoxHistMessageData(LPCTSTR Historian, time_t start, time_t finish,
LPCTSTR mgroup, LPCTSTR mname, char **header, char **body, int *more, BOOL
new_request, LPCTSTR filterCriteria, CStringArray & mFields);
65
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
Description
The GetFoxHistMessageData method retrieves event messages for a specified time frame. Use of
either method depends upon the complexity of the filtering you need to fulfill the requirements.
NOTE
The caller must delete the memory returned through the **header and **body
pointer arguments to avoid a memory leak.
} USR_FH_MSG_DBS_REC;
66
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Event messages if successful.
False if error.
See Also
♦ GetMessageData
67
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetFoxHistMessageGroupKeys
AIM*Historian instances only
Synopsis
BOOL GetFoxHistMessageGroupKeys(LPCTSTR Historian, LPCTSTR MessageTable,
CDWordArray & MessageTypes, CStringArray & MessageKeys, CString & KeyTypes,
CDWordArray & KeyNumbers, CDWordArray & KeyLengths);
Description
The GetFoxHistMessageGroupKeys method retrieves the information for a specified Historian’s
message using the message group and name combination (<messagegroup>_<messagename>).
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if successful.
False if error.
See Also
♦ GetFoxHistMessageColumns
68
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetFoxHistConfigSessionRTPNames
AIM*Historian instances only
Synopsis
BOOL GetFoxHistConfigSessionRTPNames(LPCTSTR szHistorian, int nMaxnum,
int & nMore, CDWordArray & IndexArray, CStringArray & TagArray);
Description
The GetFoxHistoryConfigSessionRTPNames method retrieves RTP names specified in the latest
AIM*Historian configuration session. It allows you to view RTP names before configuration is
committed.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The Index and Tag arrays for the specified RTP names if successful.
False if error.
69
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetFoxHistRTPDefinition
AIM*Historian instances only
Synopsis
BOOL GetFoxHistRTPDefinition(LPCTSTR szHistorian, LPCTSTR szRTPName,
CRtpDef & RTPDefinition);
Description
The GetFoxHistRTPDefinition method retrieves the configuration of an AIM*Historian
Real-time Point (RTP) object. For detailed information on RTP configuration see Appendix E,
“AIM*Historian Component Attributes” in the AIM*Historian User’s Guide (B0193YL). The
RTP definition includes the following elements:
70
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
int ScanRateUnits The fast scan rate units. Scan rate units are defined
in aimhistorian.h, and are included here for
reference:
#define FH_SCAN_UNIT_MILLI 1
/* milliseconds */
#define FH_SCAN_UNIT_SEC 2 /* seconds */
#define FH_SCAN_UNIT_MIN 3 /* minutes */
#define FH_SCAN_UNIT_HOUR 4 /* hours */
#define FH_SCAN_UNIT_DAY 5 /* days */
int ScanRate The fast scan rate, the frequency at which the
collector checks the RTP for a change, when the
FastRate is 1.
int SlowScanUnits The slow scan rate units. Scan rate units are defined
in aimhistorian.h, and are also included above in
the description of ScanRateUnits.
int SlowScanRate The slow scan rate, the frequency at which the
collector checks the RTP for a change, when the
FastRate is 0.
int Method The collection method, defined in aimhistorian.h
and included here for reference:
#define FH_HTYPE_MDE 1 /* Manual Data
Entry */
#define FH_HTYPE_CONNECTED 2
/* Connected, change-driven access */
#define FH_HTYPE_GETVAL 3 /* Unconnected,
on demand access */
int OnOff The ON/OFF state of the RTP:
1 = on
0 = off
int Bad The BAD/OK state of the RTP:
1 = bad
0 = OK
int Type The value type of the RTP, defined in
aimhistorian.h and included at the end of this
listing for reference.
int ValueInserted The UTC or I/A Series time stamp, per the
IATIME attribute of the AIM*Historian instance,
of the first value in the AIM*Historian database for
this RTP; 0 if no values yet.
71
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
72
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
RTP configuration for the specified object if successful.
False if error.
73
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetFoxHistRTPValues
AIM*Historian instances only
Synopsis
BOOL GetFoxHistRTPValues(LPCTSTR szHistorian, long lPointIndex, LPCTSTR
szPointName, time_t tStartTime, time_t tEndTime, int nDirection, long
lNumPoints, long lMaxNum, int & nMore, long & lActNum, void * pValueArray,
time_t * pSecArray, int * pMsecArray, int * pStatusArray, long * pQualArray);
74
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Description
The GetFoxHistRTPValues method retrieves collected values for the specified RTP within a spec-
ified time span.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
An array of values for the specified RTP and time span if successful.
False if error.
75
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
See Also
♦ IsFoxHistory
♦ GetHistData
♦ GetTimeLinearData
♦ IsInHistorian
♦ PutFoxHistRTPValue
76
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetHistArchiveGroups
I/A Series Historian only
Synopsis
BOOL GetHistArchiveGroups(int nGrpType, CStringList & GroupList);
Description
The GetHistArchiveGroups method fills the GroupList with Historian Sample and/or Archive
Group names.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of sample or archive group names if successful.
False if error.
77
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetHistData
Three methods have been created to retrieve history data. The first method listed can be used for
AIM*Historian instances only. The other two methods can be used for all Historian instances. The
first method returns only numeric data, that is, the milliseconds and quality data for the specified
instance. The second and third methods listed can be used for all historian types. The second
method also returns only numeric data, that is, the milliseconds and status data for the specified
instance. The third method listed is the same as the second except that for an AIM*Historian
instance it can return string values using the 500 values maximum call.
Method 1
Synopsis
(This first method is used for AIM*Historian instances only.)
BOOL GetHistData(LPCTSTR Historian, LPCTSTR arch_name, LPCTSTR grp_name,
LPCTSTR col_name, LPCTSTR pntid, time_t start, time_t finish, int flags, int
numpts, int maxnum, int *more, int *actnum, long * timebuffer, int
*msecsbuffer, int * statusbuffer, long *qualbuffer, float * valuebuffer);
78
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Method 2
(This method applies to I/A Series and AIM*Historian instances.)
BOOL GetHistData(LPCTSTR Historian, LPCTSTR arch_name, LPCTSTR grp_name,
LPCTSTR col_name, LPCTSTR pntid, time_t start, time_t finish, int flags,
int numpts, int maxnum, int *more, int *actnum, long * timebuffer,
int * statusbuffer, float * valuebuffer);
79
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
Method 3
(This method applies to I/A Series and AIM*Historian instances.)
BOOL GetHistData(LPCTSTR Historian, LPCTSTR arch_name, LPCTSTR grp_name,
LPCTSTR col_name, LPCTSTR pntid, time_t start, time_t finish, int flags,
int *num_entries, long * timebuffer, int * statusbuffer, float * valuebuffer,
int *more);
80
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
time_t finish Specifies the upper limit of the requested time span,
in I/A UTC time for retrieval. Zero (0) specifies the
end of the database.
int flags When 0 indicates data retrieval in an ascending
time manner, and descending when 1.
int * num_entries Specifies the maximum number of array elements
the caller can receive in this call. maxnum can be
any positive integer. If maxnum is greater than
MaxEnt in the initialization file, an_init.cfg, this
call returns information for up to MaxEnt elements.
long * timebuffer Data buffer to store the time stamp. Represented in
date, hour, minute, and second.
int * statusbuffer Data buffer to store the retrieved status code.
float * valuebuffer Data buffer to store the value.
int * more Returns whether or not there are more elements
to get:
0 = no more
1 = more
Description
The GetHistData method retrieves historical data from the specified Historian Sample,
Reduction or Manual Data Entry database.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Historical data if successful.
False if error.
See Also
♦ GetFoxHistRTPValues
♦ IsInHistorian
81
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetHistGroups
Synopsis
BOOL GetHistGroups(LPCTSTR Historian, int nGrpType, CStringList & GroupList,
CStringList & GroupDescrp);
Description
The GetHistGroups method fills the GroupList with the specified I/A Series Historian’s Collec-
tion point list and the GroupDescrp list with the point description for the specified database. The
nGrpType parameter selects the database (Sample, Archive, Reduction, Message, ManualData).
Group
Types
1 Sample Raw samples (RTPs)
2 Reduction Reduced data files
4 Archive Archive files
5 Message Collected messages
8 MDE Manual Data Entry
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The point list and description if successful.
False if error.
82
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetHistGrpMembers
There are two methods to retrieve History Group Members. The first method retrieves the
member list and description from the specified database, the second method also retrieves
member units.
Method 1
Synopsis
BOOL GetHistGrpMembers(LPCTSTR Historian, LPCTSTR Group, int nGrpType,
CStringList & MemberList, CStringList & MemberDescrp);
Method 2
BOOL GetHistGrpMembers(LPCTSTR Historian, LPCTSTR Group, int nGrpType,
CStringList & MemberList, CStringList & MemberDescrp, CStringList &
MemberUnits);
Description
The GetHistGrpMembers method retrieves the I/A Series Historian Group Member list informa-
tion for the nGrpType database. For the Sample database, only the MemberList is returned. For
the Reduction database, the MemberList and MemberDescrp list are returned. For the MDE
database, the MemberList and MemberDescrp list are returned.
When the second call interface form is used, the MemberUnits list is returned.
83
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The member list and description, and units if second call is used, if successful.
False if error.
84
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetHistItemList
Synopsis
BOOL GetHistItemList(LPCTSTR szHistorian, CStringList & szCollectionList);
Description
The GetHistItemList method retrieves the sample collection from the specified I/A Series
Historian or a list of RTP names in the named AIM*Historian instance.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
List of collection points for the specified historian instance if successful.
False if error.
See Also
♦ SearchFoxHistRTPNames
85
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetHistOperations
Synopsis
BOOL GetHistOperations(LPCTSTR Historian, LPCTSTR szGroup, CWordArray &
nOprList, CStringList & OprDescrp);
Description
The GetHistOperations method retrieves the specified Historian Reduction Group
Operations list information.
The nOprList array contains the operation type code, which can be any of those listed in
Table 4-2.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of operation descriptions for the specified reduction group if successful.
False if error.
86
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetHistVersion
AIM*Historian instances only
Synopsis
BOOL GetHistVersion(LPCTSTR Historian, CString & HistVersion);
Description
The GetHistVersion method returns the Historian software version.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The software version if successful.
False if error.
87
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetHostID
Synopsis
long GetHostID(void);
Description
The GetHostID method returns the id of the host machine.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
HostID if successful.
False if error.
88
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetIAVersion
Synopsis
CString GetIAVersion(void);
Description
The GetIAVersion method determines if the station is an I/A Series station and if so, returns the
station’s I/A Series version string.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The I/A Series version string if successful.
False if error.
See Also
♦ GetFoxAPIVersion
89
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetMaxEntries
Synopsis
int GetMaxEntries(void);
Description
The GetMaxEntries method gets the maximum array size (MaxEnt in the an_init.cfg) that can be
used with the methods, such as GetHistData and AddMultipleObjects, that return object arrays.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
An integer, typically set to 500, if successful.
False if error.
See Also
♦ GetHistData
♦ AddMultipleObjects
90
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetMaxSet
Synopsis
int GetMaxSet(void);
Description
The GetMaxSet method gets the maximum number of data sets that can be opened
concurrently by the connected server. The limit is specified in the FoxAPI or AIM*API
configuration. This limit can be useful to dynamically allocate arrays.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Maximum number of sets that can be opened concurrently.
False if error.
See Also
♦ GetSetNames
91
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetMessageData
There are two methods to retrieve message data. The first method retrieves the message data for
the specified time period; the second also returns the message time stamps.
Method 1
Synopsis
BOOL GetMessageData(LPCTSTR historian, LPCTSTR group, time_t finish,
time_t start, int * num_entries, CStringArray & MsgData, CStringArray &
MsgIdData, CStringArray & StationData);
92
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Method 2
Synopsis
BOOL GetMessageData(LPCTSTR historian, LPCTSTR group, time_t finish,
time_t start, int * num_entries, time_t *time_buffer, CStringArray & MsgData,
CStringArray & MsgIdData, CStringArray & StationData, int * more);
93
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
Description
The GetMessageData method retrieves the specified I/A Series Historian message group
database data, such as System Monitor messages, for the specified time period. The second form
of the call interface is used to return the message time stamps in addition to the message data. If
the specified historian is an AIM*Historian instance, this method only returns the I/A Series
message types and only if they are configured in the instance.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The number of messages retrieved is returned in the num_entries parameter.
True if successful.
False if error.
See Also
♦ GetFoxHistMessageData
94
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetMessageGroup
Synopsis
BOOL GetMessageGroup(LPCTSTR Historian, LPCTSTR & msgTable);
Description
The GetMessageGroup method retrieves a list of message groups for the specified historian
instance.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
List of message groups that have been defined if successful.
False if error.
95
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetMsgGroupAndName
AIM*Historian instances only
Synopsis
BOOL GetMsgGroupAndName(CString msgTable, CString & msgGroup,
CString & msgName);
Description
The GetMsgGroupAndName method returns a list of message groups and message names for the
specified AIM*Historian message table.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
List of message names and message group names if successful.
False if error.
See Also
♦ GetFoxHistGroups
96
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetObjectCount
Synopsis
int GetObjectCount(void);
Description
The GetObjectCount method gets the number of Data Object links this connection has
established with the server and returns the value in nobj.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The number of object links if successful.
False if error.
See Also
♦ AddObject
♦ AddMultipleObjects
97
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetPackageUsers
Synopsis
BOOL GetPackageUsers(LPCTSTR strPackage, int nMaxNum, int &nMore,
int &nActnum, CStringList &slUsers, CStringList &slIPAddr, CWordArray &
aUserTypes);
Description
The GetPackageUsers method gets the active users of a specified package.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of active users of the package if successful.
False if error.
98
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetPathAlias
Synopsis
CString GetPathAlias(void);
Description
The GetPathAlias method gets the current server path alias connection name, that is the name of
the server currently connected to.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
FoxAPI Server Path Alias name if successful.
False if error.
99
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetServerBinDir
Synopsis
CString GetServerBinDir();
Description
The GetServerBinDir method returns the directory where server-side executables are located.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The server bin directory path if successful.
False if error.
See Also
♦ GetServerDir
♦ GetServerInstDir
100
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetServerDir
Synopsis
CString GetServerDir();
Description
The GetServerDir method returns the server installation directory.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The server installation directory if successful.
False if error.
See Also
♦ GetServerBinDir
♦ GetServerInstDir
101
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetServerID
Synopsis
WORD GetServerID(void);
Description
Each time you connect to a server, a unique connection identification number is generated.
The GetServerID method returns the current server connection number.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A unique connection identification number if successful.
False if error.
See Also
♦ GetServerName
♦ IsOffPlatform
102
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetServerInfo
Synopsis
CString GetServerInfo(void);
Description
The GetServerInfo method gets the most recent error string in the form of a message or returns
empty if the last call made was successfully completed.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Error message resulting from the last operation performed.
Empty string if last call was successful.
False if error.
See Also
♦ GetServerStatus
♦ IsServerOK
♦ ReconnectToServer
103
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetServerInstDir
AIM*Historian instances only
Synopsis
CString GetServerInstDir();
Description
The GetServerInstDir method returns the directory where AIM*Historian instances are located
on the server.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The instance directory if successful.
False if error.
See Also
♦ GetServerBinDir
♦ GetServerDir
104
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetServerName
Synopsis
CString GetServerName(void);
Description
The GetServerName method retrieves the current server network connection name.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Server name if successful.
False if error.
See Also
♦ GetServerID
♦ IsOffPlatform
105
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetServerStatus
Synopsis
WORD GetServerStatus(void);
Description
The GetServerStatus method gets the most recent error string in the form of a code or returns
empty if last call was successfully completed.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
If successful, returns the error code resulting from the last operation performed or 0 if last call was
successful.
False if error.
See Also
♦ GetServerInfo
♦ IsServerOK
♦ ReconnectToServer
106
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetServerTimeout
Synopsis
BOOL GetServerTimeout(int & ServerTimeout);
Description
The GetServerTimeout method returns the time in minutes the current server connection
stays alive with no activity. The value can be set in the ServerTimeout parameter in the [AISnet]
section of the server initialization file, an_init.tcp. If no value is set, the default is one minute. You
can also set the value in the MFC class using SetServerTimeout.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The timeout value if successful.
False if error.
See Also
♦ SetServerTimeout
107
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetServerType
Synopsis
int GetServerType(void);
Description
The GetServerType method returns the server type.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
If true, returns the server type. Possible values are:
False if error.
108
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetSetItemNames
Synopsis
BOOL GetSetItemNames(LPCTSTR set_name, CStringList &setlist);
Description
The GetSetItemNames method fills the supplied CStringList with the I/A Series block
parameters in the specified FoxAPI set. The parameters are identified by the compound, block,
and parameter name (for example, TANKS_001:AIN_37.PNT).
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of objects in the specified set if successful.
False if error.
109
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetSetNames
Synopsis
BOOL GetSetNames(CStringList & setnames);
Description
The GetSetNames method fills the supplied CStringList with the FoxAPI set names “defined” on
the server.
The server is configured to allow a maximum number of sets that can be opened concurrently. For
each of these that is not defined, the method returns the name “Not Available.”
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
List of set names if successful.
False if error.
See Also
♦ GetMaxSet
110
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetStationCompounds
Synopsis
BOOL GetStationCompounds(LPCTSTR szStation, CStringList & slCompounds);
Description
The GetStationCompounds method fills the supplied CStringList with compound names found
in the specified I/A Series station.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of compound names if successful.
False if error.
See Also
♦ GetStations
♦ GetAllCompounds
111
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetStations
Synopsis
BOOL GetStations(CStringList & slStations);
Description
The GetStations method fills the supplied CStringList with the letterbugs of the stations on the
I/A Series node to which the server is connected.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of letterbugs if successful.
False if error.
See Also
♦ GetStationCompounds
112
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetTimeLinearData
Synopsis
BOOL GetTimeLinearData(LPCTSTR Historian, LPCTSTR arch_name, LPCTSTR point,
time_t start, time_t finish, int SortOrder, int MaxEntries, int SampFreq,
int * numpts, long * timebuffer, int * statusbuffer, float * valuebuffer,
int operation = 0, int PercentValid = 60);
113
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
Description
The GetTimeLinearData method retrieves time linearized historical data from the specified His-
torian Sample database.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The time linearized historical data if successful.
False if error.
114
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
GetTimeUsage
Synopsis
BOOL GetTimeUsage(LPCTSTR Historian);
Description
The GetTimeUsage method determines whether the specified historian is using I/A or UTC time.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if historian is using I/A Time.
False if historian is using UTC time.
See Also
♦ GetFoxHistRTPValues
♦ IsFoxHistory
115
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
GetUserConnection
Synopsis
CString GetUserConnection(void);
Description
The GetUserConnection method retrieves the user named in the connection.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
User named in the connection if successful.
False if error.
See Also
♦ SetUserConnection
116
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
IPAddress
There are two methods available to access the IP address. The first method listed returns the
IP address as a string. The second method returns the IP address as a number.
Method 1
BOOL IPAddress
Synopsis
BOOL IPAddress(CString ServerName, CString & IPaddress);
Method 2
UINT IPAddress
Synopsis
UINT IPAddress(CString ServerName);
Description
The BOOL IPAddress method returns the string value of the TCP/IP address of the specified
server.
The UINT IPAddress method returns the unsigned, 32-bit integer representation of the
TCP/IP address for the specified server.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
For BOOL IPAddress, the string value of the TCP/IP address if successful.
For UINT IPAddress, the unsigned, 32-bit integer representation of the TCP/IP address if
successful.
False if error.
117
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
IsDir
Synopsis
BOOL IsDir(LPCTSTR szPath, int * nIsDir);
Description
The IsDir method verifies the specified directory path from a specified server is a directory and
not a file.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if function completed.
False if function fails or if string does not exist.
See Also
♦ FileStat
♦ GetDirList
118
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
IsFoxHistory
Synopsis
BOOL IsFoxHistory(LPCTSTR Historian);
Description
The IsFoxHistory method determines if the supplied name is an AIM*Historian instance.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if the name is an AIM*Historian instance.
False if the name is a not an AIM*Historian instance.
See Also
♦ GetFoxHistRTPValues
♦ GetTimeUsage
♦ IsInHistorian
119
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
IsInHistorian
Synopsis
BOOL IsInHistorian(LPCTSTR szCollectionPoint, CString & szHistorian);
Description
The IsInHistorian method identifies if this collection point is in a historian instance and returns
the first one it finds.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Historian instance name if successful.
False if error.
See Also
♦ GetFoxHistRTPValues
♦ GetHistData
♦ IsFoxHistory
120
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
IsOffPlatform
Synopsis
BOOL IsOffPlatform();
Description
The IsOffPlatform method determines if the connected server is an I/A Series server.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if the server is not an I/A Series server.
False if the server is an I/A Series server.
See Also
♦ GetFoxAPIVersion
♦ GetServerID
♦ GetServerName
121
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
IsServerOK
Synopsis
BOOL IsServerOK(void);
Description
The IsServerOK method checks the status of the connected server.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if the server is OK.
False if a problem is detected.
See Also
♦ GetServerInfo
♦ GetServerStatus
122
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
MakeSystemCall
Synopsis
BOOL MakeSystemCall(LPCTSTR szCommand, BOOL wait = 0);
Description
The MakeSystemCall method executes a command (specified in szCommand) on the I/A Series
systems. When wait = 1, the client waits for the operation to complete.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Command executes if successful.
False if error.
123
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
MultipleObjectWrite
Synopsis
BOOL MultipleObjectWrite(int accessType, int nument, char * nameArray,
int * valTypeArray, long * valueArray, int * objIndexArray, int * errorArray,
int * reterr);
Description
The MultipleObjectWrite method allows the application to do multiple writes in a single call for
efficient performance for non-string data types.
NOTE
This method does not support bit position writes. The item names in nameArray
must use the <Compound>:<Block>.<Parameter> syntax with all characters in
uppercase.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if write call was successful.
False if error.
See Also
♦ ObjectWrite
124
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
ObjectRange
Synopsis
BOOL ObjectRange(LPCTSTR szName, float * HighScale, float * LoScale,
float * Delta);
LPCTSTR szName Specifies the full path name of the object on the
server.
float * HighScale Returns the maximum value configured for the
specified object.
float * LoScale Returns the minimum value configured for the
specified object.
float * Delta Returns the change value configured for the
specified object.
Description
The ObjectRange method gets the range information for a specified object.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The range information if successful.
False if error.
See Also
♦ ObjectType
125
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
ObjectRead
Method 1
Synopsis
BOOL ObjectRead(LPCTSTR szName, CString & szItemValue, int * nDataType);
LPCTSTR szName Specifies the full path name of the object on the
server.
CString szItemValue Returns the value and status of the specified object
separated by a tab character.
int * nDataType Returns the data type used to format the value
(see Appendix B “Object Status and Value Types”).
Method 2
Synopsis
BOOL ObjectRead(LPCTSTR szName, CString & szItemValue, int * nDataType CString
& szTimeStamp, int * nSource);
LPCTSTR szName Specifies the full path name of the object on the
server.
CString szItemValue Returns the value and status of the specified object
separated by a tab character.
int * nDataType Returns the data type used to format the value
(see Appendix B “Object Status and Value Types”).
CString szTimeStamp Returns the time stamp adjusted for local time,
in the form MM/DD/YY_hh:mm:ss:ddd where:
MM = month
DD = day
YY = year
hh = hour
mm = minute
ss = second
ddd = millisecond
int * nSource Returns an integer indicating the source of the
timestamp:
1 = from the I/A Series system
2 = from the API
3 = from the client
126
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Description
The ObjectRead method reads the specified I/A Series data object, and formats the value and
status into a string. The value and status are separated by a tab character. The format of the value
is determined by the data type found. The complete string is obtained for I/A Series string data
types. Method 2 also returns the time and date, and the time source.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The value and status of the specified object if successful.
False if error.
See Also
♦ ObjectReadAll
♦ dqObjectChange
127
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
ObjectReadAll
Synopsis
BOOL ObjectReadAll(CObArray & ChangedData);
Description
The ObjectReadAll method queries the server for current values in the Change Data Extension,
and fills an array of objects of CDataElement type (see Table 5-1) for all items defined with
AddObject and AddMultiple Objects.
NOTE
It is the programmers responsibility to release (delete) the array elements
(CDataElements).
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
An array of objects of CDataElement type if successful.
False if error.
See Also
♦ AddMultiple Objects
♦ AddObject
♦ dqObjectChange
♦ ObjectRead
128
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
ObjectType
Synopsis
BOOL ObjectType(LPCTSTR szName, int & nDataType, int & nConnType);
LPCTSTR szName Specifies the full path name of the object on the
server.
int nDataType Returns the data type used to format the value
(see Appendix B “Object Status and Value Types”).
int nConnType Returns the connection type.
Description
The ObjectType method returns the data type and information about its connection, that is, how
you can write to the object if write is allowed. Connection types are:
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The specified object’s data and connection types if successful.
False if error.
See Also
♦ ObjectRange
129
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
ObjectWrite
Synopsis
BOOL ObjectWrite(LPCTSTR szName, char * szItemValue, int nDataType,
BOOL bBinaryMode, int accessType = 1, int objIndex = 0);
Description
The ObjectWrite method writes the ItemValue to the named I/A Series data object on the con-
nected server. The data object must be ‘settable’ and ‘not secured’. The data type is derived from
the value status. The ItemValue is assumed to be a string representation unless the binary_mode
flag is set to TRUE.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if write call was successful.
False if error.
See Also
♦ MultipleObjectWrite
130
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
OpenFoxAPISet
Synopsis
BOOL OpenFoxAPISet(LPCTSTR set_name, CStringList &setlist, float fRDelta);
Description
The OpenFoxAPISet method creates a FoxAPI set on the connected server.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Opens a set on the server if successful.
False if error.
See Also
♦ CloseFoxAPISet
131
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
PutFile
Synopsis
BOOL PutFile(LPCTSTR szIAFile, CString & szFileName, BOOL bAscii);
LPCTSTR szIAFile Specify the complete path and file name of the new
file on the connected sever. This method overwrites
any file with the same path and file name.
CString szFileName Specify the file on the application host to be copied
to the server.
BOOL bAscii When set to TRUE indicates that the file should be
converted from DOS ASCII to UNIX ASCII.
Description
The PutFile method copies a file on the Windows application host to an I/A Series station,
overwriting a file with the same path and name on the target machine. Set the bAscii flag to
FALSE when the destination server is an I/A Series AW70.
Errors
NOTE
1. You can access UNIX “regular” files in an I/A Series AP, but not directory, special,
or FIFO files.
2. To restrict access through DNBI gateways to an AP with UIDs and GIDs, you
need to modify the dsamap file in the AP. The dsamap file is: /etc/dsamap for AP10
and AP20; /etc/fox/dsamap for 50 Series systems.
132
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Return Values
A file is created on the server if successful.
False if error.
See Also
♦ GetFile
133
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
PutFoxHistRTPValue
AIM*Historian instances only
Synopsis
BOOL PutFoxHistRTPValue(LPCTSTR szHistorian, long lIndex, LPCTSTR szRTP,
int nType, long lValSize, long lNumElements, void * pValue, time_t tSeconds,
int tMsecs, int nStatus, long lQuality);
134
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
Description
The PutFoxHistRTPValue method adds an RTP value to the AIM*Historian database.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Adds a sample to the RTP database if successful.
False if error.
See Also
♦ WriteMDEData
♦ GetFoxHistRTPValues
135
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
ReconnectToServer
Synopsis
int ReconnectToServer(LPCTSTR APAlias, LPCTSTR szPackage = NULL);
LPCTSTR APAlias Specifies the server by the path alias defined in the
local an_init.cfg file.
LPCTSTR szPackage = NULL Identifies an AIM*AT client application that is
making the connection. Use the default NULL.
NOTE
szPackage is reserved for Invensys use only. Do not pass this variable.
Description
The ReconnectToServer method attempts a connection to a server. Use this method if a
previous attempt to connect to a server failed.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if connection successful.
False if the connection attempt failed or package access was denied.
Use GetServerInfo or GetServerStatus to determine the reason for the failure. GetServerInfo
responds with a message, while GetServerStatus responds with a code.
See Also
♦ ConnectToServerByName
♦ GetServerInfo
♦ GetServerStatus
136
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
RemoveObject
Synopsis
BOOL RemoveObject(LPCTSTR szName);
LPCTSTR szName Specifies the full path name of the object on the
server.
Description
The RemoveObject method removes the link with the FoxAPI server for the specified Data
Object.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if successful.
False if error.
See Also
♦ RemoveObjects
137
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
RemoveObjects
Synopsis
BOOL RemoveObjects(int nument, char* name_array, int * error_array,
int * reterr);
Description
The RemoveObjects method removes objects from the CDX for the current server.
If no objects remain in the CDX for the current server, RemoveObjects forces the state of the
current server to “inactive” and returns the error “noobjects” as a warning.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if Object found and removed.
False if not found.
See Also
♦ RemoveObject
138
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
SearchFoxHistRTPNames
AIM*Historian instances only
Synopsis
BOOL SearchFoxHistRTPNames(LPCTSTR historian, LPCTSTR wildcard,
CStringList & slRTP);
Description
The SearchFoxHistRTPNames method searches the RTP configuration instance for RTP names
containing a specific string. The method returns a list of the full RTP names based upon the filter
criteria.
This method is successful when the target historian is an AIM*Historian application.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of RTP names if successful.
False if error.
See Also
♦ GetHistItemList
139
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
SetServerTimeout
Synopsis
BOOL SetServerTimeout(int ServerTimeout);
Description
The SetServerTimeout method sets the time in minutes that the current server connection stays
alive with no activity. This action overrides the value set in the ServerTimeout parameter in the
[AISnet] section of the server initialization file, an_init.tcp.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
True if successful.
False if error.
See Also
♦ GetServerTimeout
140
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
SetUserConnection
Synopsis
void SetUserConnection(LPCTSTR szUserID);
Description
The SetUserConnection method overrides the default (logged in) client user name. Changes the
user name for the connection to a FoxAPI Server.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
None.
See Also
♦ GetUserConnection
141
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
WriteEventMsgData
AIM*Historian instances only
Synopsis
BOOL WriteEventMsgData(LPCTSTR Historian, LPCTSTR TableName, int mode,
CStringArray & ColumnNames, CPtrArray & ColumnValues, CDWordArray & ValSizes);
Description
The WriteEventMsgData method puts an event message into the AIM*Historian message
database. Event message types are components of an AIM*Historian Instance and must be
configured using ConfigureFoxHistory before messages of those types can be put in the
message database.
NOTE
There is no specific method to change a message. To change a message, add another
message with the same time stamp as the one you want to change. A message cannot
be deleted.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
An Event Message is written if successful.
False if error.
See Also
♦ ConfigureFoxHistory
♦ GetFoxHistConfigSessionRTPNames
142
4. CFoxAPIServer Class Methods Reference B0400BJ – Rev B
WriteMDEData
Synopsis
BOOL WriteMDEData(LPCTSTR historian, LPCTSTR group. LPCTSTR point, int mode,
float * value, time_t timestamp, int status);
Description
The WriteMDEData method writes the specified values to the RTPs that are configured for Man-
ual Data Entry (MDE). Use this method when the target historian is an I/A Series Historian. Use
PutFoxHistRTPValue when writing MDE values to an AIM*Historian database.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
143
B0400BJ – Rev B 4. CFoxAPIServer Class Methods Reference
Return Values
The values are written to the RTPs if successful.
False if error.
See Also
♦ PutFoxHistRTPValue
144
5. CDataElement Class Methods
Reference
This chapter provides a reference guide to the methods available with I/A Series NetAPI MFC
Class CDataElement.
The following CDataElement Class methods are described in this chapter:
♦ “Format()” on page 146
♦ “Getmsec()” on page 147
♦ “Getsource” on page 148
♦ “GetStations” on page 149
♦ “GetStrValue” on page 150
♦ “GetTimeDiff” on page 151
♦ “GetUseServerTime” on page 152
♦ “Getutc()” on page 153
♦ “LoadValueFromString” on page 154
♦ “SetType” on page 155
♦ “SetUseServerTime” on page 156
♦ “Type()” on page 157
♦ “Type(CString &s)” on page 158
145
B0400BJ – Rev B 5. CDataElement Class Methods Reference
Format()
Synopsis
CString Format();
Description
The Format() method takes the internal representation of the datatype and returns it as a string.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Provides the string representation of the value if true.
False if error.
146
5. CDataElement Class Methods Reference B0400BJ – Rev B
Getmsec()
Synopsis
time_t Getmsec():
Description
The Getmsec() method returns the millisecond portion of the time associated with the value.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Returns the millisecond portion of the time.
See Also
♦ Getsource()
♦ Getutc()
147
B0400BJ – Rev B 5. CDataElement Class Methods Reference
Getsource
Synopsis
int Getsource();
Description
The Getsource() method returns the source of the time stamp: 1 = from the I/A Series system,
2 = from the API server, 3 = from the client.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Returns the source of the time stamp.
See Also
♦ Getmsec()
♦ Getutc()
148
5. CDataElement Class Methods Reference B0400BJ – Rev B
GetStations
Synopsis
BOOL GetStations(CStringList & slStations, unsigned long stationmask);
Description
The GetStations method fills the supplied CStringList with the letterbugs of the stations on the
I/A Series node to which the server is connected based on a bit mask of desired station types
(stationmask). A stationmask of zero returns all.
Station type bit definitions:
Communication Server bit 0 0x00000001 1
Unit Controller bit 1 0x00000002 2
File Server bit 2 0x00000004 4
Graphics Controllers bit 3 0x00000008 8
FOXNET Slave Gateway bit 4 0x00000010 16
LAN INTERFACE bit 5 0x00000020 32
SiteWide Lan Interface bit 6 0x00000040 64
Gateway Processor bit 7 0x00000080 128
Gateway 30 bit 8 0x00000100 256
PC station bit 9 0x00000200 512
Alan Bradley Gateway bit 16 0x00010000 65536
Modbus Gateway bit 17 0x00020000 131072
760/761 Gateway bit 18 0x00040000 262144
Foreign Device Gateway bit 19 0x00080000 524288
X.25 INI Interface types bit 20 0x00100000 1048576
Display Station ECB 28 Type bit 21 0x00200000 2097152
Hydro Tank Station Type bit 22 0x00400000 4194304
Spectrum Interface Processor bit 23 0x00800000 8388608
Interspec Gateway bit 24 0x01000000 16777216
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
A list of letterbugs if successful.
False if error.
149
B0400BJ – Rev B 5. CDataElement Class Methods Reference
GetStrValue
Synopsis
const CString &GetStrValue();
Description
The GetStrValue method checks the type. If type is a string, it returns the stored value (or nothing
if it is empty).
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Returns the stored value of a string (or nothing) if true.
False if error.
150
5. CDataElement Class Methods Reference B0400BJ – Rev B
GetTimeDiff
Synopsis
long GetTimeDiff(void);
Description
The GetTimeDiff method returns a long signed integer that represents the difference between the
client computer clock and the server computer clock.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The time difference in seconds.
151
B0400BJ – Rev B 5. CDataElement Class Methods Reference
GetUseServerTime
Synopsis
BOOL GetUseServerTime(void);
Description
The GetUseServerTime method returns a Boolean indicator of how historian time stamps are to
be expressed. When false (default), the client adjusts the time relative to the difference between
the client computer clock and the server computers clock. When true, the client does not adjust
the time relative to the difference between the clocks. This value is taken from the following entry
in the client computer’s registry:
HKEY_LOCAL_MACHINE\Software\SimSci\Aim\Settings\UseServerTime
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The time usage indicator.
152
5. CDataElement Class Methods Reference B0400BJ – Rev B
Getutc()
Synopsis
time_t Getutc();
Description
The Getutc() method returns the UTC time, in seconds associated with the value.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Returns the UTC time (seconds since January 1, 1970).
See Also
♦ Getmsec()
♦ Getsource()
153
B0400BJ – Rev B 5. CDataElement Class Methods Reference
LoadValueFromString
Synopsis
BOOL LoadValueFromString(const CString &str, IADataType dataType);
Description
The LoadValueFromString method when given the ASCII string value and a valid datatype, will
fill in status and data value member of the class of the internal structure. Table 5-1 at the end of
this chapter provides the CDataElement class data types.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Provides the status if true.
False if error.
154
5. CDataElement Class Methods Reference B0400BJ – Rev B
SetType
Synopsis
void SetType (IADataType type);
Description
The SetType method tells which data type to set internally in the class.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Sets the datatype if true.
False if error.
155
B0400BJ – Rev B 5. CDataElement Class Methods Reference
SetUseServerTime
Synopsis
BOOL SetUseServerTime(BOOL value);
BOOL value Indicates whether time is adjusted for a difference between the
client and server clocks:
0 = time is adjusted
1= time is not adjusted
Description
The SetUseServerTime method sets and returns a Boolean indicator of how historian time stamps
are to be expressed. When false (default), the client adjusts the time relative to the difference
between the client computer clock and the server computer’s clock. When true, the client does
not adjust the time relative to the difference between the clocks. This value is set/taken from the
following entry in the client computer’s registry:
HKEY_LOCAL_MACHINE\Software\SimSci\Aim\Settings\UseServerTime
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
The time usage indicator.
156
5. CDataElement Class Methods Reference B0400BJ – Rev B
Type()
Synopsis
IADataType Type();
Description
The Type() method returns the numeric data type of the value in the class.
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Provides the numeric datatypes if true.
False if error.
157
B0400BJ – Rev B 5. CDataElement Class Methods Reference
Type(CString &s)
Synopsis
void Type(CString &s);
Description
The Type(CString &s) method, when passed a string reference, takes the type and returns a string
representation of the datatype (that is, “character”).
Errors
See Appendix A “Error Messages” for error codes and corresponding messages.
Return Values
Provides the string representation of the type if true.
False if error.
158
5. CDataElement Class Methods Reference B0400BJ – Rev B
159
B0400BJ – Rev B 5. CDataElement Class Methods Reference
160
Appendix A. Error Messages
This appendix lists error codes and strings issued by the I/A Series NetAPI MFC Class.
Table A-1. Error Codes and Strings Returned by NetAPI MFC Class
Code String
-2 Invalid state for request
-3 CSA authorization code
-4 Cmpd or block name already used
-5 Required element not found
-6 Block not part of compound
-7 Invalid Informix reference
-8 User filter rejected
-9 Location is not defined in system
-10 Missing compound or block name
-11 process not set-up for CSA IPC
-13 name used in another domain
-12 user list is too large for IPC
-20 unrecognized CSA request
-30 CSA server is unavailable
-50 File I/O error detected
-100 Thought-to-never-occur condition
-30000 Unknown error
#
-3004 Function not supported.
0 Success
1 Invalid number of entries (call-level error)
2 Invalid access type.
3 Unable to allocate resources.
4 All datasets are used.
5 Not longer used.
6 All change queues are used.
7 Out of resources
8 Out of resources (rw when gws specified)
9 I/O error on request file.
10 I/O error on rebuild file.
11 AIM*API Task is unable to open this INI-10 list.
161
B0400BJ – Rev B Appendix A. Error Messages
Table A-1. Error Codes and Strings Returned by NetAPI MFC Class (Continued)
Code String
12 AIM*API Task is unable to close this INI-10 list
13 At least one of the value types does not match.
14 Data set is not within range.
15 Data set not currently opened.
16 System dependent error. (General routines).
17 File I/O error. (General routines)
18 X.25 I/O error. (General routines)
19 Not locked. (General routines)
20 Reassign in progress. (General routines).
21 Invalid queue number.
22 Queue is empty.
23 Queue not empty.
24 Fewer changes returned than requested.
25 Invalid gateway.
26 At least one of the entries has an error.
27 Too many entries invalid size or value
28 Type mismatch (uread only).
29 Write to read-only data set.
30 Unconfigured gateway (‘node’
31 Invalid circuit type.
32 Have already specified ‘keep’ with GETCIR.
33 Have NOT specified ‘keep’ with GETCIR.
34 No string to get
35 Invalid group for load levelling.
36 Invalid value type
37 Invalid write delta
38 Invalid read scan rate
39 Invalid write scan rate
40 Invalid match of read and write scan rate
41 Invalid match of read and write delta
42 Invalid match of read and write delta
46 Remote directory not writable
47 HOSTNAM not found
48 HOSTNAM or HOSTDIR not found directory invalid etc
49 No Read or Read/Write access
50 Host I/O error
51 Host file cannot be opened and/or created
52 Host file cannot be opened
162
Appendix A. Error Messages B0400BJ – Rev B
Table A-1. Error Codes and Strings Returned by NetAPI MFC Class (Continued)
Code String
53 Unable to assign channel
54 Unable to set up the circuit
55 IA file cannot be opened
56 IA file cannot be read
57 Host file cannot be written
58 Host file cannot be read
59 Unable to set pointer to IA file
60 IA file cannot be written
61 IA file cannot be closed
62 Unable to clear circuit
63 Unable to deassign channel
64 Not in range ‘0’ to ‘9’
65 No null terminator found
66 Offset and/or numchr not valid
67 Unable to specify conversion files
68 Unable to specify convert qualifiers
69 Unable to perform conversion of file
70 Unable to open strmfile.tmp after conversion
71 Unable to close strmfile.tmp after conversion
72 Unconfigured remote file system logical name
73 Unable to rmount remote file system
74 Host file cannot be closed
75 pfwrit numchr > 1000
76 Invalid argument like a NULL pointer.
80 invalid gateway
81 unconfigured gateway
82 unable to assign a channel
83 unable to set up a circuit
84 unable to read x.25 channel
85 unable to access terminal characteristics
86 unable to modify terminal characteristics
87 unable to restore terminal characteristics
88 unable to read character from keyboard
89 unable to write to INI
90 unable to release circuit
91 unable to deassign channel
92 invalid letterbug
93 invalid login name
163
B0400BJ – Rev B Appendix A. Error Messages
Table A-1. Error Codes and Strings Returned by NetAPI MFC Class (Continued)
Code String
94 invalid password or primary prompt string
95 I/O error opening VENIX command line file
96 I/O error opening VENIX response file
97 no letterbug prompt returned from INI
98 login name character not echoed
99 command line character not echoed
100 not able to logoff of VENIX
101 response_buffer is not large enough
102 I/O error on write to VENIX response file
103 INI only
104 auxiliary_buffer is not large enough
105 Mapping a file to virtual SUN memory failed
110 CBP not found in CSA.
111 CBP or Shared variable is secured.
112 CBP is not an input parameter.
113 CBP or Shared variable is not found.
114 om_getval or getval failed.
115 Station not found in station table.
128 Bit for bad value returned from Collector
200 Object not opened in Fox API database
201 Object not added to change-driven extension
202 an_dq_changes() allowed NOT an_poll_changes()
203 No active servers with objects in CD extension
204 Unable to access object (object-level error)
205 Object already added multiples not allowed
206 Invalid delta value (negative)
207 No current server
208 Object not added for read/write access
209 Some object has warning error
210 nument is bigger then g_maxent
211 No objects in CD extension
212 Not enough access for client at server
230 Illegal number of variables in omopen()
231 List does not exist
232 List not in legal range
233 More changes in the list
234 No changes in the list
235 Index outside range of data set
164
Appendix A. Error Messages B0400BJ – Rev B
Table A-1. Error Codes and Strings Returned by NetAPI MFC Class (Continued)
Code String
1001 Memory Allocation error
1002 Protocol not specified
1003 Invalid message type
1004 Invalid opocode
1005 Hostname not specified
1006 All server entries were use.
1007 Unable to communicate with server
1008 Server ID is out of range
1010 Max number of no connection reach
1011 Server are connected but not selected
1012 Maximum number of servers running
1013 Null pointer as argument
1014 available for use
1015 Compound Name too long
1016 Block Name to long
1017 Parameter Name to long
1018 CSA error encountered see errno
1019 ICC error encountered see errno
1020 Historian error encountered see errno
1021 Informix error encountered see errno
1022 Buffer size less than minimum required
1023 OM error encountered see errno
1099 WinSock blocking call in progress; retry required
165
B0400BJ – Rev B Appendix A. Error Messages
166
Appendix B. Object Status and
Value Types
This appendix describes the status words and value types of I/A Series objects and
AIM*Historian real-time points (RTPs) and reduction RTPs.
The I/A Series Object Manager defines the object status as a 16-bit word. The network API repre-
sents it as a thirty-two bit integer. Bit 31 is the most significant bit.
An AIM*Historian RTP status has the same format as the status of an I/A Series object, except
that AIM*Historian software supports additional value types. The software represents object sta-
tus as a 32-bit integer, with bit 31 being the most significant bit (MSB).
The status word for an AIM*Historian Reduced RTP is described on page 170.
Table B-1 and the notes that follow define the object status when a process point is read from the
I/A Series Object Manager (Version 4.2 and later) or an RTP is read from the AIM*Historian
instance.
Table B-1. Status Definition with I/A Series Object Manager and AIM*Historian
31 (MSB) to 16 15 14 13 12 11 10 9 8 7 to 5 4 3 to 0 (LSB)
OM Connect Status
Ack/uncond. init
Limited High
Limited Low
Bad/Dis/Ok
Value Type
Sec/Unsec
Reserved
Shadow
Change
Error
00S
Bits 0 to 3 Object Manager or AIM*Historian value type per Table B-2. Value types
1 to 10 are I/A Series value types. Each of the I/A Series value types 1, 2,
3, 5, 6, 8, 9, and 10 are contained within 4 bytes.
167
B0400BJ – Rev B Appendix B. Object Status and Value Types
Table B-2. I/A Series Object and AIM*Historian RTP Value Types
Non I/A Series types (21 and greater) exceed the four-bit field allotted for
the value type. If you use any of these value types, you must retrieve the
value type from the RTP configuration using GetFoxHistRTPValues or
GetFoxHistRTPDefinition to be sure of the value type.
For user-defined value types, the value type field is considered to be bits 0
to 7. For array type value types (21 to 31), the value type field is
considered to be bits 0 to 4.
168
Appendix B. Object Status and Value Types B0400BJ – Rev B
Bit 12 The point is a shadow parameter (1) or not a shadow parameter (0).
Bits 16 to 31 Reserved.
169
B0400BJ – Rev B Appendix B. Object Status and Value Types
Table B-3 and the notes that follow define the status returned by these APIs.
31 (msb) to 10 9 8 7 6 to 5 4 to 0 (lsb)
FH_OUT_OF_COLLECTED_RANGE
FH_PARTIAL_INTERVAL
Value Type
UNAVAIL
Reserved
Reserved
170
Appendix B. Object Status and Value Types B0400BJ – Rev B
Bits 0 to 4 define the value type of the reduced data as shown in Table B-4.
If the reduction request was for peaks, the quality word has bit 30 (the next to the most
significant bit) set. In addition, if the peak was a minimum, bit 31 (the most significant bit) is set.
Otherwise, quality is zero.
171
B0400BJ – Rev B Appendix B. Object Status and Value Types
172
Index
A
AddMultipleObjects 19
AddObject 23
AIM*Historian only access methods 16
AIM*Historian reduction status and quality 170
AISnet keywords 9
C
CDataElement class data types 159
CDataElement class methods 16
CDataElement class methods reference 145
CFoxAPIServer class methods 12
CFoxAPIServer class methods reference 19
CloseFoxAPISet 25
Compound Summary Access (CSA) methods 13
ConfigureFoxHistory 26
ConnectToServer 33
ConnectToServerByName 34
CreateEventMsgDef 35
Creating a project 11
Creating instances of the CFoxAPIServer class 11
D
Data object access methods 14
Development configuration 8
Development machine installation procedure 5
DisconnectFromServer 36
dqObjectChange 37
E
EngUnits 38
EnumServerHistorians 40
F
FetchObjectIndex 41
FetchObjectName 42
File access methods 14
FileRead 43
FileStat 44
Format() 146
FormatData 45
FormatDataAndTimeStamp 46
FoxAPI Data Sets Methods 15
173
B0400BJ – Rev B Index
FoxHistSystem 47
G
GetAccessInfo 48
GetAliasPath 49
GetAllBlocks 50
GetAllCompounds 51
GetBlkDescription 52
GetBlockCompounds 53
GetBlockParams 54
GetCompBlockAndType 55
GetCompoundBlocks 56
GetConfigFile 57
GetDirList 58
GetFile 59
GetFoxAPIVersion 61
GetFoxHistGroups 62
GetFoxHistMessageColumns 63
GetFoxHistMessageData 64
GetFoxHistMessageGroupKeys 68
GetFoxHistoryConfigSessionRTPNames 69
GetFoxHistRTPDefinition 70
GetFoxHistRTPValues 74
GetHistArchiveGroups 77
GetHistData 78
GetHistGroups 82
GetHistGrpMembers 83
GetHistItemList 85
GetHistOperations 86
GetHistVersion 87
GetHostID 88
GetIAVersion 89
GetMaxEntries 90
GetMaxSet 91
GetMessageData 92
GetMessageGroup 95
Getmsec() 147
GetMsgGroupAndName 96
GetObjectCount 97
GetPackageUsers 98
GetPathAlias 99
GetServerBinDir 100
GetServerDir 101
GetServerID 102
GetServerInfo 103
GetServerInstDir 104
GetServerName 105
GetServerStatus 106
GetServerTimeout 107
GetServerType 108
GetSetItemNames 109
174
Index B0400BJ – Rev B
GetSetNames 110
Getsource 148
GetStationCompounds 111
GetStations 112, 149
GetStrValue 150
GetTimeDiff 151
GetTimeLinearData 113
GetTimeUsage 115
GetUserConnection 116
GetUseServerTime 152
Getutc() 153
H
Historian access methods 15
I
I/A Series NetAPI MFC interface 1
Install I/A Series NetAPI MFC software 5
IPAddress 117
IsDir 118
IsFoxHistory 119
IsInHistorian 120
IsOffPlatform 121
IsServerOK 122
L
LoadValueFromString 154
M
MakeSystemCall 123
MaxEnt 9
MaxLog 9
MultipleObjectWrite 124
N
NetAPI MFC Methods 2
O
ObjectRange 125
ObjectRead 126
ObjectReadAll 128
ObjectType 129
ObjectWrite 130
OpenFoxAPISet 131
175
B0400BJ – Rev B Index
P
PrintErr 9
PutFile 132
PutFoxHistRTPValue 134
Putting the Application into Production 17
R
ReconnectToServer 136
RemoveObject 137
RemoveObjects 138
S
SearchFoxHistRTPNames 139
Server Connection Method 12
Server Information 12
SetServerTimeout 140
SetType 155
SetUserConnection 141
SetUseServerTime 156
System Requirements 4
T
TraceLevel 9
Type() 157
Type(CString &s) 158
W
WriteEventMsgData 142
WriteMDEData 143
33 Commercial Street
Foxboro, Massachusetts 02035-2099
United States of America
www.foxboro.com
Inside U.S.: 1-866-PHON-IPS (1-866-746-6477)
Outside U.S.: 1-508-549-2424 or contact your local Foxboro representative.
Facsimile: 1-508-549-4999
Printed in U.S.A. 0303