Determining when values are out-of-sync – Echelon LNS User Manual
Page 253
LNS Programmer's Guide
239
The DownloadConfigProperties() and UploadConfigProperties() generally
affect all the configuration properties on a device. You can also use
DataPoint
objects
to synchronize a single configuration property value in the LNS database with the value
of the configuration property on the physical device. To do so, follow these steps:
1. Create
a
DataPoint
object for the configuration property you want to
update. Specify
lcaDataSourceOptionsfromDevice
as the
options
element when you call GetDataPoint(). The value returned for such a
data point will always match the value of the source configuration
property in the physical device.
Set MyDataPoint = MyCP.GetDataPoint(0, _
lcaDataSourceOptionsfromDevice)
2. Call
the
Read()
method to read the value of a data point created with
this option set.
MyDataPoint.Read()
3. Set
the
DataPoint
object’s
DataSourceOptions
property to
lcaDataSourceOptionsDatabaseOnly
. Now, when you write to the
data point, the value will be written to the
ConfigProperty
object in
the LNS database.
MyDataPoint.DataSourceOptions =lcaDataSourceOptionsDatabaseOnly
4. Call
the
Write()
method. The value of the source
ConfigProperty
in
the LNS database will then be updated to match the value of the
configuration property on the physical device.
MyDataPoint.Write()
Determining When Values Are Out-Of-Sync
If you need to keep the configuration property values displayed by your application up-to-
date at all times, you can use the OnCommission event to do so. When a configuration
property is modified via an LNS application such as a device plug-in, the OnCommission
event will be generated, and the device’s CommissionStatus property will be set to
lcaCommissionUpdatesPending. Once the configuration property value has been
propagated to the device, another OnCommission will be generated and the device’s
CommissionStatus property will be set to lcaCommissionUpdatesCurrent
.
You should note that this event can be generated for a variety of other reasons, such as
the creation of network variable connections, and does not necessarily indicate that a
configuration property value has been modified. You should also note that the
OnCommission event is only generated when the value of the CommissionStatus
property changes. Thus, if the device’s CommissionStatus property is already set to
lcaCommissionUpdatesPending, no OnCommission event will be generated until the
value is propagated to the device.
You can also read the ValueStatus property of a ConfigProperty object to determine
if there are any pending updates to the configuration property value stored on the
physical device. If the configuration property value stored in the database has been
modified by an LNS application but has not yet been written to the device, the
ValueStatus property will be set to
lcaConfigPropertyValueMgmtStatusPendingUpdate.