In the previous chapters of today's lesson, you defined a point discovery parameters object, point discovery leaf, point discovery request, and a point discovery response. This chapter will tie all of these classes together so that the developer driver's point manager can use them to discover the data points available on a field-device.
NOTE: This class is similar to the device discovery preferences class from yesterday's lesson.
To do this, create a text file named BYourDriverPointDiscoveryPreferences.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.auto.*; import com.yourCompany.yourDriver.identify.*; import javax.baja.sys.*; public class BYourDriverPointDiscoveryPreferences extends BDdfAutoDiscoveryPreferences { /*- class BYourDriverPointDiscoveryPreferences { properties { } } -*/ }
timeOut
Specify the default amount of time that your driver should wait after transmitting your point discovery request before timing out.
retryCount
Specify the default number of retries that your driver should attempt after a request times-out (before giving up on that particular request).
NOTE: Sometimes during a discovery process it could be helpful to specify shorter time-outs and less retries so that the entire point discovery process can complete sooner.
min
Specify the default to be a copy of whatever your point discovery parameters class returns from its getFirst method (or whatever your read request parameters class returns from its getFirst method, if you chose to have it serve in the discovery process).
max
Specify the default to be a copy of whatever your point discovery params class returns from its getLast method (or whatever your read request parameters class returns from its getLast method, if you chose to have it serve in the discovery process).
NOTE: Your min and max properties will be instances of the read request id if you re-use your read request as the discovery request. If not, your min and max will be instances of the BYourDriverPointDiscoverParams object that you created during today's lesson.
doNotAskAgain (optional)
Declare the default value as True if you do not want the integrator to receive a special prompt when he or she clicks the Discover button on the device manager. If you set this to true then the discovery process will automatically loop from the min to the max that you also specify here. Once you finish today's lesson, we encourage you to try this both ways and decide which way makes the most sense for your driver.
package com.yourCompany.yourDriver.discover; import com.tridium.ddf.identify.*; import com.tridium.ddf.discover.auto.*; import com.yourCompany.yourDriver.identify.*; import javax.baja.sys.*; public class BYourDriverPointDiscoveryPreferences extends BDdfAutoDiscoveryPreferences { /*- class BYourDriverPointDiscoveryPreferences { properties { timeout : BRelTime -- This is the amount of time to wait per field-bus request before timing out default{[BRelTime.makeSeconds(3)]} slotfacets{[BFacets.make(BFacets.make(BFacets.SHOW_MILLISECONDS,BBoolean.TRUE), BFacets.MIN,BRelTime.make(0))]} retryCount : int -- This is the number of discovery field-message retransmissions -- per request. default{[1]} slotfacets{[BFacets.make(BFacets.MIN,BInteger.make(0))]} min : BDdfIdParams -- This is the id of the lowest data point for your driver to attempt to -- learn by default default{[(BDdfIdParams)new BTestDriverReadParams().getFirst()]} max : BDdfIdParams -- This is the id of the highest point for your driver to attempt to -- learn by default default{[(BDdfIdParams)new BTestDriverReadParams().getLast()]} } } -*/ }
NOTE: Please also add statements to import com.yourCompany.yourDriver.discover.*; and com.tridium.ddf.discover.*;
package com.yourCompany.yourDriver; import javax.baja.sys.*; import javax.baja.util.*; import com.tridium.ddf.*; import com.tridium.ddf.discover.*; import com.yourCompany.yourDriver.point.*; import com.yourCompany.yourDriver.discover.*; public class BYourDriverPointDeviceExt extends BDdfPointDeviceExt { /*- class BYourDriverPointDeviceExt { properties { discoveryPreferences : BDdfDiscoveryPreferences -- This saves the last set of discovery parameters that the user provided. -- It also allows the dev driver framework to automatically learn points flags{hidden} default{[ new BYourDriverPointDiscoveryPreferences()]} } } -*/ }
Copyright © 2000-2016 Tridium Inc. All rights reserved.