public class Sample5 extends SampleBase implements java.util.Observer
DataItem class.
The example shows how to create a new connection, connect, and listen for
events coming using the DataItem class which simplifies some parts of
receiving events from Eclipse SCADA. The DataItem class performs all the merging
and cache value handling for us. It extends the common Observable
class and therefore simplifies that handling a little bit. You do not get the
much more detailed event information since you only get the information
object changed
. On the other side you have an instance which always
has the latest value merged up for you. So you can access it using
DataItem.getSnapshotValue(), DataItem.getAttributes() and
DataItem.getSubscriptionState() at any time.
We will listen to the
time
data item of the test server. The item is an input item and will
provided the current unix timestamp every second.
connection, uri| Constructor and Description |
|---|
Sample5(java.lang.String uri,
java.lang.String className) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect() |
static void |
main(java.lang.String[] args) |
void |
subscribe() |
void |
unsubscribe() |
void |
update(java.util.Observable o,
java.lang.Object arg) |
dispose, sleeppublic Sample5(java.lang.String uri,
java.lang.String className)
throws java.lang.Exception
java.lang.Exceptionpublic void connect()
throws java.lang.Exception
connect in class SampleBasejava.lang.Exceptionpublic void subscribe()
public void unsubscribe()
public void update(java.util.Observable o,
java.lang.Object arg)
update in interface java.util.Observerpublic static void main(java.lang.String[] args)
throws java.lang.Exception
java.lang.Exception
Copyright (c) IBH SYSTEMS GmbH and others 2010, 2013.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0