use of com.ge.dspmicro.machinegateway.types.ITransferable in project predix-machine-template-adapter-edison by PredixDev.
the class WorkshopDataSubscription method run.
/**
* Thread to generate random data for the nodes in this subscription.
*/
@Override
public void run() {
if (!this.threadRunning.get() && this.adapter.getNodes().size() > 0) {
this.threadRunning.set(true);
while (this.threadRunning.get()) {
// Generate random data for each node and push data update.
List<ITransferable> dataList = new ArrayList<ITransferable>();
for (PDataNode node : this.adapter.getNodes()) {
WorkshopDataNodeIntel wNode = (WorkshopDataNodeIntel) node;
if ("IN".equals(wNode.getNodePinDir())) {
//$NON-NLS-1$
dataList.add(this.adapter.readData(node.getNodeId()));
}
}
spillway.processAndTransferData(dataList);
try {
// Wait for an updateInterval period before pushing next
// data update.
Thread.sleep(this.updateInterval);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}
Aggregations