DataPoint

class DataPoint : public std::enable_shared_from_this<DataPoint>

Disallow copying of the DataPoint instance.

Public Functions

~DataPoint()

Remove DataPoint and owned references.

std::shared_ptr<Station> getStation()

Get the NetworkStation that owns this DataPoint.

Returns:

Pointer to NetworkStation or nullptr

std::uint_fast32_t getInformationObjectAddress() const

Get the information object address.

Returns:

IOA

std::optional<std::uint_fast32_t> getRelatedInformationObjectAddress() const

Get the information object address of a related monitoring point.

Returns:

IOA

void setRelatedInformationObjectAddress(std::optional<std::uint_fast32_t> related_io_address)

Set the information object address of a related monitoring point.

Throws:

std::invalid_argument – if not a server-sided control point or invalid IOA

bool getRelatedInformationObjectAutoReturn() const

Test if a related monitoring point should be auto-transmitted on incoming update of this control point.

Returns:

if auto-transmit of related point is enabled

void setRelatedInformationObjectAutoReturn(bool auto_return)

Configure if the related monitoring point should be auto-transmitted on incoming update of this control point.

Throws:

std::invalid_argument – if not a server-sided control point or invalid IOA

CommandTransmissionMode getCommandMode() const

Get command transmission mode.

Returns:

direct or select-and-execute

void setCommandMode(CommandTransmissionMode mode)

Configure command transmission mode to direct or select-and-execute.

std::optional<std::uint_fast8_t> getSelectedByOriginatorAddress()

Get select-and-execute lock originator address.

Returns:

client originator address or zero if no active selection lock exists

IEC60870_5_TypeID getType() const

Get the IEC60870-5-104 information type of the DataPoint.

Returns:

The IEC60870_5_TypeID associated with this DataPoint

std::uint_fast16_t getReportInterval_ms() const

Get automatic report transmission interval of this point.

Returns:

interval in milliseconds, 0 if disabled

void setReportInterval_ms(std::uint_fast16_t interval_ms)

Configure automatic report transmission interval of this monitoring point.

Throws:

std::invalid_argument – if not a server-sided monitoring point

std::uint_fast16_t getTimerInterval_ms() const

Get automatic timer interval of this point.

Returns:

interval in milliseconds, 0 if disabled

std::shared_ptr<Information> getInfo() const

Retrieve the associated Information instance for the DataPoint.

Returns:

shared pointer to the Information instance associated with the DataPoint

void setInfo(std::shared_ptr<Information> new_info)

Sets a new information object for the DataPoint.

Parameters:

new_info – A shared pointer to the new Information object.

Throws:

std::invalid_argument – if the type of the DataPoint is unsupported or does not match the provided information object.

InfoValue getValue()

Retrieve the value associated with the DataPoint object.

The value is just the primary value property of the related Information object

Returns:

InfoValue containing the current value of the DataPoint, using a variant type that can represent various data models

void setValue(InfoValue new_value)

Sets a new value for the DataPoint instance.

Parameters:

new_value – The new value to be assigned to the Information object related to this DataPoint

InfoQuality getQuality()

Retrieves the quality information associated with the DataPoint.

The value is just the primary quality property of the related Information object

Returns:

The quality information as an instance of InfoQuality.

void setQuality(InfoQuality new_quality)

Sets the quality of the DataPoint instance.

This method updates the quality of the associated information object. Depending on the DataPoint type, a timestamp may also be injected.

Parameters:

new_quality – The new quality value to be set for the DataPoint.

std::optional<std::chrono::system_clock::time_point> getRecordedAt() const

get timestamp bundled with value

Returns:

milliseconds since unix-epoch

std::chrono::system_clock::time_point getProcessedAt() const

get timestamp of last local processing operation (receiving/sending)

Returns:

milliseconds since unix-epoch

void setProcessedAt(std::chrono::system_clock::time_point val)

set timestamp of last local processing operation (receiving/sending)

std::optional<std::chrono::steady_clock::time_point> nextReportAt() const

get next timer event point

Returns:

seconds since unix-epoch

std::optional<std::chrono::steady_clock::time_point> nextTimerAt() const

get next timer event point

Returns:

seconds since unix-epoch

CommandResponseState onReceive(std::shared_ptr<Remote::Message::IncomingMessage> message)

handle remote point update, execute python callback

Parameters:

message – incoming message information

Returns:

response handling information (success, failure or none)

void setOnReceiveCallback(py::object &callable)

set python callback that will be executed on every incoming message

Throws:

std::invalid_argument – if callable signature does not match

void onBeforeRead()

handle point value request before automatic read-command response, execute python callback

void setOnBeforeReadCallback(py::object &callable)

set python callback that will be called on incoming interrogation or read commands to support polling

Throws:

std::invalid_argument – if callable signature does not match, parent station reference is invalid or function is called from client context

void onBeforeAutoTransmit()

handle point value request before automatic transmission, execute python callback

void setOnBeforeAutoTransmitCallback(py::object &callable)

set python callback that will be called before server reports a measured value interval-based

Throws:

std::invalid_argument – if callable signature does not match, parent station reference is invalid or function is called from client context

void onTimer()

handle timer event, execute python callback

void setOnTimerCallback(py::object &callable, std::uint_fast16_t interval_ms = 0)

set python callback that will be called at a fixed interval

Throws:

std::invalid_argument – if callable signature does not match

bool read()

send read command to update the points value

Throws:

std::invalid_argument – if parent station or connection reference is invalid or function is called from server context

bool transmit(CS101_CauseOfTransmission cause = CS101_COT_UNKNOWN_COT)

transmit point

Parameters:

cause – cause of transmission

Throws:

std::invalid_argument – if parent station or connection reference is invalid

Returns:

success information

void detach()

Remove reference to station, do not call this method, this is called by Station::removePoint.

inline std::string toString() const

Converts the current DataPoint object to a string representation, including its various properties.

Returns:

A string representation of the DataPoint object containing detailed information such as its IO address, type, report interval, related IO address, and additional attributes.

Public Static Functions

static inline std::shared_ptr<DataPoint> create(std::uint_fast32_t dp_ioa, IEC60870_5_TypeID dp_type, std::shared_ptr<Station> dp_station, std::uint_fast16_t dp_report_ms = 0, std::optional<std::uint_fast32_t> dp_related_ioa = std::nullopt, bool dp_related_auto_return = false, CommandTransmissionMode dp_cmd_mode = DIRECT_COMMAND, std::uint_fast16_t tick_rate_ms = 0)

create a new DataPoint instance

Parameters:
  • dp_ioa – information object address

  • dp_type – iec60870-5-104 information type

  • dp_station – station object reference

  • dp_report_ms – auto reporting interval

  • dp_related_ioa – related information object address, if any

  • dp_related_auto_return – auto transmit related point on command

  • dp_cmd_mode – command transmission mode (direct or select-and-execute)

  • tick_rate_ms – outer tick rate

Throws:

std::invalid_argument – if type is invalid