AssociationInformation
The AssociationInformation
interface is a set of informational callbacks useful to assess the health of the connection.
- Rust
- C
- C++
- Java
- C#
#[derive(Copy, Clone)]
pub struct ExampleAssociationInformation;
impl AssociationInformation for ExampleAssociationInformation {}
note
Rust's 'AssociationInformation' trait has a default void implementation of all callbacks.
void task_start(dnp3_task_type_t task_type, dnp3_function_code_t fc, uint8_t seq, void *arg)
{
}
void task_success(dnp3_task_type_t task_type, dnp3_function_code_t fc, uint8_t seq, void *arg)
{
}
void task_fail(dnp3_task_type_t task_type, dnp3_task_error_t error, void *arg)
{
}
void unsolicited_response(bool is_duplicate, uint8_t seq, void *arg)
{
}
dnp3_association_information_t get_association_information()
{
return (dnp3_association_information_t){
.task_start = task_start,
.task_success = task_success,
.task_fail = task_fail,
.unsolicited_response = unsolicited_response,
.on_destroy = NULL,
.ctx = NULL,
};
}
class AssociationInformation : public dnp3::AssociationInformation {
void task_start(dnp3::TaskType task_type, dnp3::FunctionCode function_code, uint8_t seq) override
{
}
void task_success(dnp3::TaskType task_type, dnp3::FunctionCode function_code, uint8_t seq) override
{
}
void task_fail(dnp3::TaskType task_type, dnp3::TaskError error) override
{
}
void unsolicited_response(bool is_duplicate, uint8_t seq) override
{
}
};
class TestAssociationInformation implements AssociationInformation {
@Override
public void taskStart(TaskType taskType, FunctionCode fc, UByte seq) {}
@Override
public void taskSuccess(TaskType taskType, FunctionCode fc, UByte seq) {}
@Override
public void taskFail(TaskType taskType, TaskError error) {}
@Override
public void unsolicitedResponse(boolean isDuplicate, UByte seq) {}
}
class TestAssociationInformation : IAssociationInformation
{
public void TaskStart(TaskType taskType, FunctionCode fc, byte seq) { }
public void TaskSuccess(TaskType taskType, FunctionCode fc, byte seq) { }
public void TaskFail(TaskType taskType, TaskError error) { }
public void UnsolicitedResponse(bool isDuplicate, byte seq) { }
}