Using a set Operation to Change the Value of a Property

Earlier we used a get operation to retrieve the value of the AlarmActive property. If you want to change the value of the AlarmActive property, you use a set operation. This is done by using the DOFObject.set method.

Using a set Operation

In a set operation, a requestor can set the value of a writeable interface property for a provider. A set operation can be initiated by the requestor as a synchronous operation using the DOFObject.set method or as an asynchronous operation using DOFObject.beginSet.

How It Works

The property parameter specifies the interface property that you want to change.

There are several versions of the DOFObject.set() method; however, DOFObject.set(DOFInterface.Property property, DOFValue value, int timeout) is the simplest.

The timeout parameter specifies how long to wait for a response before the operation fails. If you don't want it to time out, use DOF.TIMEOUT_NEVER.