The developer driver framework tries its best to automatically coalesce all control points under that same device, that need written, and that have equivalent write parameters into a single write request. In a previous chapter of today's lesson, you created your write request. We asked you to assume that you had already created the write request and added any data that you needed to construct the write request itself, not including the information needed to specify the values of individual points.
Please create your write parameters structure following these steps as a guide:
While following the examples in this chapter, please replace the text jarFileName, yourDriver and yourCompany as previously described in the Preparation section):
To do this, create a text file named BYourDriverWriteParams.java in the jarFileName/src/com/yourCompany/yourDriver/identify folder. Inside the text file, start with the following text:
package com.yourCompany.yourDriver.identify; import com.tridium.ddf.identify.*; import javax.baja.sys.*; public class BYourDriverWriteParams extends BDdfIdParams implements BIDdfWriteParams { /*- class BYourDriverWriteParams { } -*/ }
In our hypothetical example, we required one boolean property named "forceWrite". In the example toByteArray method, we accessed this by calling the getForceWrite method. We coded the toByteArray like this because we knew that in this chapter, we would add this property to our hypothetical write parameters structure. We knew that by naming the properties forceWrite that the Niagara AX slotomatic utility would automatically generate a getForceWrite method.
Please make the slotomatic statement on your read parameters structure look something like this:
/*- class BYourDriverWriteParams { properties { forceWrite : boolean -- This property has nothing to with the dev -- driver framework itself. Instead, we need -- to construct the toByteArray method of the -- driver's write request in following the -- driver's protocol to write data values. -- In this hypothetical protocol, if we do not -- forceWrite then the equipment's internal -- program could overwrite any change that -- Niagara might make to a data value. default{[true]} } } -*/
Add the following code to BYourDriverWriteParams.java:
public Type getWriteRequestType(){return BYourDriverWriteRequest.TYPE;}
NOTE: Providing the slotfacet of MGR_INCLUDE on each of these structured properties will cause any of their properties that are flagged with MGR_INCLUDE to automatically appear in your point manager for your driver.
class BYourDriverProxyExt { properties { readParameters : BDdfIdParams -- This hooks your driver's read parameters structure into the -- proxy extension that is placed on control points that are -- under devices in your driver. The read parameter's structure -- tells the dev driver framework which read request to use to -- read the control point. It also tells your read request's -- toByteArray method how to construct the bytes for the request. default{[new BYourDriverReadParams()]} slotfacets{[MGR_INCLUDE]} pointId : BDdfIdParams -- This tells your read response's parseReadValue method how to -- extract the data value for a particular control point. default{[new BYourDriverPointId()]} slotfacets{[MGR_INCLUDE]} writeParameters : BDdfIdParams -- This hooks your driver's write parameters structure into the -- proxy extension that is placed on control points that are -- under devices in your driver. The write parameter's structure -- tells the dev driver framework which write request to use to -- write the control point. It also tells your write request's -- toByteArray method how to construct the bytes for the request. default{[new BYourDriverWriteParams()]} slotfacets{[MGR_INCLUDE]} } } -*/
Copyright © 2000-2014 Tridium Inc. All rights reserved.