The write response is typically a very simple class to develop. Most driver protocols return back a small amount of data, just enough to indicate whether the field-device accepted the write request. Many drivers can get away with essentially having an empty implementation for the write response.
Please note that in our examples for the previous chapters in today's lesson, we coded the processReceive method of our hypothetical write request to throw a DdfResponseException if the field-device denied the driver's request to write data values. If the field device accepted the driver's request, then we return an empty instance of BYourDriverWriteResponse.
Create your driver's write response as follows:
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 BYourDriverWriteResponse.java in the jarFileName/src/com/yourCompany/yourDriver/comm/rsp folder. Inside the text file, start with the following text:
package com.yourCompany.yourDriver.comm.rsp; import com.tridium.ddf.comm.rsp.*; import javax.baja.sys.*; public class BYourDriverWriteResponse extends BDdfResponse { /*- class BYourDriverWriteResponse { } -*/ }
NOTE: If you do not define any constructors at all then Java automatically creates an empty constructor for you. By not defining any constructors for BYourDriverWriteResponse in this example, we implicitly create an empty constructor with full, public access.
Copyright © 2000-2014 Tridium Inc. All rights reserved.