In this chapter you will create a class to serve as the discovery leaf for your driver's Point Manager.
Discovery Leaf - The discovery leaf is part of the developer driver framework that defines the contents of a row in the Discovered list of the Device Manager or Point Manager.
Device Id - In yesterday's lesson, you updated the class, BYourDriverDeviceId, to allow it serve as the discovery leaf for your driver's Device Manager. In today's lesson, you will create a dedicated class to serve as the discovery leaf for your driver's Point Manager.
Point Manager - The Point Manager appears in the Workbench when the point device extension, usually named "points" under a driver device component is double-clicked from within the Nav Tree of the Niagara AX Workbench. The Discovered list shows a spreadsheet-like listing of all data points in the field-device. This listing is really a list of all data points that an installation professional may (at his or option) import into the station to use with Niagara logic, web pages, etc.
Point Discovery Leaf - For point discovery, you will create a new class to serve as the discovery leaf.
As you may recall from the lesson on days 2 and 3, developer driver control points feature a point id, read parameters, and write parameters structure. Since developer driver control points feature three structures that define how to read, write, and p parse the particular data point value, implementing the point discovery leaf is not quite as simple as re-using any one class (as was the case for re-using the device id as the device discovery leaf).
To do this, create a text file named BYourDriverPointDiscoveryLeaf.java in the jarFileName/src/com/yourCompany/yourDriver/discover folder. Inside the text file, start with the following text:
package com.yourCompany.yourDriver.discover; import com.tridium.ddf.identify.*; import com.tridium.ddf.discover.*; import com.yourCompany.yourDriver.identify.*; import javax.baja.sys.*; public class BYourDriverPointDiscoveryLeaf extends BDdfPointDiscoveryLeaf { /*- class BYourDriverPointDiscoveryLeaf { properties { } } -*/ }
Use the following example as a guide:
package com.yourCompany.yourDriver.discover; import com.tridium.ddf.identify.*; import com.tridium.ddf.discover.*; import com.yourCompany.yourDriver.identify.*; import javax.baja.sys.*; public class BYourDriverPointDiscoveryLeaf extends BDdfPointDiscoveryLeaf { /*- class BYourDriverPointDiscoveryLeaf { properties { pointId : BDdfIdParams default{[new BYourDriverPointId()]} slotfacets{[MGR_INCLUDE]} readParameters : BDdfIdParams default{[new BYourDriverReadParams()]} slotfacets{[MGR_INCLUDE]} writeParameters : BDdfIdParams default{[new BYourDriverWriteParams()]} slotfacets{[MGR_INCLUDE]} } } -*/ }
Please note that Niagara AX installation professionals will see an instance of BYourDriverPointDiscoveryLeaf in the Discovered spreadsheet-like list for each data point that your driver finds. If the installation professional chooses to work further with a particular data point, then he or she will click the Add button to add that data point to the database and thereby create a fully-qualified driver control point for the item. The string that you return from this method will be assigned to the newly created driver control point, by default. The framework will automatically add suffixes, as necessary, to ensure unique names in the database. You may return a simple, static, string or you may compute the return string based on other information about the discovered point, as the following example shows:
/** * When a control point is added to the station from the * Point Manager, it is given this name by default (possibly * with a suffix to make it unique). */ public String getDiscoveryName() { // For the test driver, let's return a rather descriptive name String typeString = ((BYourDriverReadParams)getReadParameters()).getTypeString(); String directionString = ((BYourDriverReadParams)getReadParameters()).getDirection(); int offset = ((BYourDriverPointId)getPointId()).getOffset(); // Capitalize the first letter of the typeString and the directionString typeString = Character.toUpperCase(typeString.charAt(0)) + typeString.substring(1); directionString = Character.toUpperCase(directionString.charAt(0)) + directionString.substring(1); // Concatenates everything together and returns the result, for example, // AnalogOutputs_1 return typeString + directionString + '_'+offset; }
Copyright © 2000-2014 Tridium Inc. All rights reserved.