Using the getdatapoint method – Echelon LNS User Manual
Page 249

LNS Programmer's Guide
235
property values to the device, call the
DownloadConfigProperties()
method with the
lcaConfigPropOptLoadValues
and
lcaConfigPropOptExcludeDeviceSpecific
options set.
For more information on the
UploadConfigProperties()
and
DownloadConfigProperties()
methods, see Downloading and Uploading
Configuration Properties on page 126.
Using the GetDataPoint Method
You can use a
DataPoint
object to read and write to the value of a configuration
property. Each data point has three properties you can use to read and write to the data
point’s value: the
FormattedValue
property, the
RawValue
property, and the
Value
property. Each of these properties represents the same value, but each one is formatted
differently:
• The
Value
property formats the data as a scaled, double float value. The
configuration property’s type file must be available in order to read the
Value
property.
• The
FormattedValue
property formats the data based on the LNS
Object Server’s
CurrentFormatLocale
setting. The data stored in the
FormattedValue
property is scaled and unit-converted based on the
FormatSpec
the data point is using. The configuration property’s type
and formats file must be available in order to read the FormattedValue
property. For more information on
FormatSpec
objects, see Data
• The
RawValue
property formats the data as a raw byte array.
Depending on how you set the options element when you call
GetDataPoint()
to
create a
DataPoint
object for a configuration property, LNS may read or write the LNS
database, the configuration property on the physical device, or both when you read or
write the value of the
DataPoint
. This is described in more detail later in this section.
To acquire a
DataPoint
to use to read and write the value of a configuration property,
follow these steps:
1. Access
the
ConfigProperty
you want to monitor and control. In this
example, the configuration property “cpCalibration” applies to the device
as a whole. Some configuration properties apply to a LonMark
Functional Block or network variable, in which case they are accessed via
the ConfigProperties collection of the parent LonMarkObject or
NetworkVariable.
Set MyInterface = myAppDevice.Interface
Set MyConfigProperties = MyInterface.ConfigProperties
Set MyCP = MyConfigProperties.Item(“cpCalibration”)
2. Call
the
GetDataPoint()
method to create a
DataPoint
object for the
ConfigProperty
.
Set MyDataPoint=MyCP.GetDataPoint(0,lcaDataSourceOptionsNormal)
Some configuration properties are arrays of elements. In this case, you
need to create a separate data point to read and write to each element in
the array. The first parameter passed to the
GetDataPoint()
method is
the index parameter. This specifies which element of the array you want
this data point to apply to. These arrays are 0-based. If the