opendnp3  3.1.0
Reference implementation of DNP3 (IEEE-1815)
opendnp3::DefaultOutstationApplication Class Reference

A singleton with default setting useful for examples. More...

#include <opendnp3/outstation/DefaultOutstationApplication.h>

Public Member Functions

 DefaultOutstationApplication (TimeDuration timeSyncRefreshRate=TimeDuration::Minutes(1))
 
virtual ~DefaultOutstationApplication ()=default
 
virtual uint16_t ColdRestart () override
 The outstation should perform a complete restart. More...
 
virtual RestartMode ColdRestartSupport () const override
 Query the outstation for the cold restart mode it supports. More...
 
virtual ApplicationIIN GetApplicationIIN () const override
 Returns the application-controlled IIN field. More...
 
virtual DNPTime Now () override
 Returns a DNPTime of the current time. More...
 
virtual void RecordClassAssignment (AssignClassType type, PointClass clazz, uint16_t start, uint16_t stop) override
 Called if SupportsAssignClass returns true The type and range are pre-validated against the outstation's database and class assignments are automatically applied internally. More...
 
virtual bool SupportsAssignClass () override
 True if the outstation supports the assign class function code If this function returns false, the assign class callbacks will never be called and the outstation will return IIN 2.1 (FUNC_NOT_SUPPORTED) when it receives this function code. More...
 
virtual bool SupportsWriteAbsoluteTime () override
 Queries whether the the outstation supports absolute time writes If this function returns false, WriteAbsoluteTime will never be called and the outstation will return IIN 2.1 (FUNC_NOT_SUPPORTED) More...
 
virtual bool SupportsWriteTimeAndInterval () override
 Queries whether the outstation supports the writing of TimeAndInterval If this function returns false, WriteTimeAndInterval will never be called and the outstation will return IIN 2.1 (FUNC_NOT_SUPPORTED) when it receives this request. More...
 
virtual uint16_t WarmRestart () override
 The outstation should perform a partial restart of only the DNP3 application. More...
 
virtual RestartMode WarmRestartSupport () const override
 Query the outstation for the warm restart mode it supports. More...
 
virtual bool WriteAbsoluteTime (const UTCTimestamp &timestamp) override
 Write the time to outstation, only called if SupportsWriteAbsoluteTime return true. More...
 
virtual bool WriteTimeAndInterval (const ICollection< Indexed< TimeAndInterval >> &values) override
 Write one or more TimeAndInterval values. More...
 
- Public Member Functions inherited from opendnp3::IOutstationApplication
virtual ~IOutstationApplication ()=default
 
virtual void OnConfirmProcessed (bool is_unsolicited, uint32_t num_class1, uint32_t num_class2, uint32_t num_class3)
 This method notifies that application code that an expected CONFIRM has been received, and events may have cleared from the event buffer. More...
 

Static Public Member Functions

static std::shared_ptr< IOutstationApplicationCreate (TimeDuration timeSyncRefreshRate=TimeDuration::Minutes(1))
 

Private Member Functions

bool IsTimeValid () const
 
bool NeedsTime () const
 

Private Attributes

UTCTimestamp last_timestamp = UTCTimestamp()
 
std::chrono::system_clock::time_point last_update = std::chrono::system_clock::time_point(std::chrono::milliseconds(0))
 
TimeDuration refresh_rate
 

Detailed Description

A singleton with default setting useful for examples.

Definition at line 35 of file DefaultOutstationApplication.h.

Constructor & Destructor Documentation

◆ DefaultOutstationApplication()

opendnp3::DefaultOutstationApplication::DefaultOutstationApplication ( TimeDuration  timeSyncRefreshRate = TimeDuration::Minutes(1))

◆ ~DefaultOutstationApplication()

virtual opendnp3::DefaultOutstationApplication::~DefaultOutstationApplication ( )
virtualdefault

Member Function Documentation

◆ ColdRestart()

virtual uint16_t opendnp3::DefaultOutstationApplication::ColdRestart ( )
inlineoverridevirtual

The outstation should perform a complete restart.

See the DNP3 specification for a complete descripton of normal behavior

Returns
number of seconds or milliseconds until restart is complete. The value is interpreted based on the Restart Mode returned from ColdRestartSupport()

Reimplemented from opendnp3::IOutstationApplication.

Definition at line 83 of file DefaultOutstationApplication.h.

◆ ColdRestartSupport()

virtual RestartMode opendnp3::DefaultOutstationApplication::ColdRestartSupport ( ) const
inlineoverridevirtual

Query the outstation for the cold restart mode it supports.

Reimplemented from opendnp3::IOutstationApplication.

Definition at line 75 of file DefaultOutstationApplication.h.

References opendnp3::UNSUPPORTED.

◆ Create()

static std::shared_ptr<IOutstationApplication> opendnp3::DefaultOutstationApplication::Create ( TimeDuration  timeSyncRefreshRate = TimeDuration::Minutes(1))
inlinestatic

Definition at line 38 of file DefaultOutstationApplication.h.

◆ GetApplicationIIN()

virtual ApplicationIIN opendnp3::DefaultOutstationApplication::GetApplicationIIN ( ) const
overridevirtual

Returns the application-controlled IIN field.

Reimplemented from opendnp3::IOutstationApplication.

◆ IsTimeValid()

bool opendnp3::DefaultOutstationApplication::IsTimeValid ( ) const
private

◆ NeedsTime()

bool opendnp3::DefaultOutstationApplication::NeedsTime ( ) const
private

◆ Now()

virtual DNPTime opendnp3::DefaultOutstationApplication::Now ( )
overridevirtual

Returns a DNPTime of the current time.

This value is used when freezing counters.

Reimplemented from opendnp3::IDnpTimeSource.

◆ RecordClassAssignment()

virtual void opendnp3::DefaultOutstationApplication::RecordClassAssignment ( AssignClassType  type,
PointClass  clazz,
uint16_t  start,
uint16_t  stop 
)
inlineoverridevirtual

Called if SupportsAssignClass returns true The type and range are pre-validated against the outstation's database and class assignments are automatically applied internally.

This callback allows user code to persist the changes to non-volatile memory

Reimplemented from opendnp3::IOutstationApplication.

Definition at line 69 of file DefaultOutstationApplication.h.

◆ SupportsAssignClass()

virtual bool opendnp3::DefaultOutstationApplication::SupportsAssignClass ( )
inlineoverridevirtual

True if the outstation supports the assign class function code If this function returns false, the assign class callbacks will never be called and the outstation will return IIN 2.1 (FUNC_NOT_SUPPORTED) when it receives this function code.

Reimplemented from opendnp3::IOutstationApplication.

Definition at line 65 of file DefaultOutstationApplication.h.

◆ SupportsWriteAbsoluteTime()

virtual bool opendnp3::DefaultOutstationApplication::SupportsWriteAbsoluteTime ( )
inlineoverridevirtual

Queries whether the the outstation supports absolute time writes If this function returns false, WriteAbsoluteTime will never be called and the outstation will return IIN 2.1 (FUNC_NOT_SUPPORTED)

Reimplemented from opendnp3::IOutstationApplication.

Definition at line 50 of file DefaultOutstationApplication.h.

◆ SupportsWriteTimeAndInterval()

virtual bool opendnp3::DefaultOutstationApplication::SupportsWriteTimeAndInterval ( )
inlineoverridevirtual

Queries whether the outstation supports the writing of TimeAndInterval If this function returns false, WriteTimeAndInterval will never be called and the outstation will return IIN 2.1 (FUNC_NOT_SUPPORTED) when it receives this request.

Reimplemented from opendnp3::IOutstationApplication.

Definition at line 56 of file DefaultOutstationApplication.h.

◆ WarmRestart()

virtual uint16_t opendnp3::DefaultOutstationApplication::WarmRestart ( )
inlineoverridevirtual

The outstation should perform a partial restart of only the DNP3 application.

See the DNP3 specification for a complete descripton of normal behavior

Returns
number of seconds or milliseconds until restart is complete. The value is interpreted based on the Restart Mode returned from WarmRestartSupport()

Reimplemented from opendnp3::IOutstationApplication.

Definition at line 87 of file DefaultOutstationApplication.h.

◆ WarmRestartSupport()

virtual RestartMode opendnp3::DefaultOutstationApplication::WarmRestartSupport ( ) const
inlineoverridevirtual

Query the outstation for the warm restart mode it supports.

Reimplemented from opendnp3::IOutstationApplication.

Definition at line 79 of file DefaultOutstationApplication.h.

References opendnp3::UNSUPPORTED.

◆ WriteAbsoluteTime()

virtual bool opendnp3::DefaultOutstationApplication::WriteAbsoluteTime ( const UTCTimestamp timestamp)
overridevirtual

Write the time to outstation, only called if SupportsWriteAbsoluteTime return true.

Returns
boolean value indicating if the time value supplied was accepted. Returning false will cause the outstation to set IIN 2.3 (PARAM_ERROR) in its response. The outstation should clear its NEED_TIME field when handling this response

Reimplemented from opendnp3::IOutstationApplication.

◆ WriteTimeAndInterval()

virtual bool opendnp3::DefaultOutstationApplication::WriteTimeAndInterval ( const ICollection< Indexed< TimeAndInterval >> &  values)
inlineoverridevirtual

Write one or more TimeAndInterval values.

Only called if SupportsWriteTimeAndInterval returns true. The outstation application code is reponsible for updating TimeAndInterval values in the database if this behavior is desired

Returns
boolean value indicating if the values supplied were accepted. Returning false will cause the outstation to set IIN 2.3 (PARAM_ERROR) in its response.

Reimplemented from opendnp3::IOutstationApplication.

Definition at line 60 of file DefaultOutstationApplication.h.

Member Data Documentation

◆ last_timestamp

UTCTimestamp opendnp3::DefaultOutstationApplication::last_timestamp = UTCTimestamp()
private

Definition at line 97 of file DefaultOutstationApplication.h.

◆ last_update

std::chrono::system_clock::time_point opendnp3::DefaultOutstationApplication::last_update = std::chrono::system_clock::time_point(std::chrono::milliseconds(0))
private

Definition at line 99 of file DefaultOutstationApplication.h.

◆ refresh_rate

TimeDuration opendnp3::DefaultOutstationApplication::refresh_rate
private

Definition at line 96 of file DefaultOutstationApplication.h.


The documentation for this class was generated from the following file: