ControlHandler Interface
The ControlHandler
interface allows application code to receive control requests. Each request begins with a call to beginFragment
and ends
with a call to endFragment
. These two callbacks are useful if the application wishes to handle operations atomically or in batches of some sort.
#
Handling SELECTThe select*
methods of ControlHandler
are invoked when a properly formatted SELECT
function code is received from the master. Selecting a control
point should never cause the point to operate. Implementors should think of this request from the master as meaning "Do you support this?".
DNP3 masters may optionally use a "select-before-operate" strategy for executing controls. The rules for how outstations are required to process these two-pass control messages are complex. The library transparently handles all of the rules for you.
#
Handling OPERATEThe operate*
methods of ControlHandler are invoked when the outstation receives either:
OPERATE
function code preceded by a matchingSELECT
.DIRECT_OPERATE
function code (single-pass control with response).DIRECT_OPERATE_NO_RESPONSE
function code (single-pass control without a response).
A reference to the Database
is provided so that the outstation may update point values in response to a control request. This would
typically be used to update BinaryOutputStatus
and AnalogOutputStatus
values but could be used to update other types if required by the application.
note
The OperateType enum is provided which allows the user to tell which of the three operate function codes caused the method to be invoked. Most users should ignore this value. The specification requires that all three functions be supported and that the action the outstation takes be the same.