DataPoint

class DataPoint : public std::enable_shared_from_this<DataPoint>

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::uint_fast32_t getRelatedInformationObjectAddress() const

Get the information object address of a related monitoring point.

Returns:

IOA

void setRelatedInformationObjectAddress(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::uint_fast8_t getSelectedByOriginatorAddress() const

Get select-and-execute lock originator address.

Returns:

client originator address or zero if no active selection lock exists

void setSelectedByOriginatorAddress(std::uint_fast8_t originatorAddress)

Configure select-and-execute lock originator address.

Throws:

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

std::uint_fast32_t getReportInterval_ms() const

Get automatic report transmission interval of this point.

Returns:

interval in milliseconds, 0 if disabled

void setReportInterval_ms(std::uint_fast32_t interval_ms)

Configure automatic report transmission interval of this monitoring point.

Throws:

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

Quality getQuality() const

Get quality restriction bitset for the current value.

Returns:

qualit restrictions

void setQuality(const Quality &new_quality)

Set quality restriction bitset for the current value.

double getValue() const

Get point value.

Returns:

value

std::int32_t getValueAsInt32() const

Get point value.

Returns:

value converted to signed integer

float getValueAsFloat() const

Get point value.

Returns:

value converted to signed float

std::uint32_t getValueAsUInt32() const

Get point value.

Returns:

value converted to unsigned integer

void setValue(double new_value)

Set point value.

void setValueEx(double new_value, const Quality new_quality = Quality::None, std::uint_fast64_t timestamp_ms = 0)

Set point value with quality restriction bitset and updated at timestamp.

Parameters:
  • new_value – the value to be assigned to the point

  • new_quality – value quality information

  • timestamp_ms – value updated at timestamp in milliseconds

std::uint64_t getUpdatedAt_ms() const

get timestamp of last value update

Returns:

seconds since unix-epoch

std::uint64_t getReportedAt_ms() const

get timestamp of last cyclic report (server-only)

Returns:

seconds since unix-epoch

std::uint64_t getReceivedAt_ms() const

get timestamp of last incoming transmission

Returns:

seconds since unix-epoch

std::uint64_t getSentAt_ms() const

get timestamp of last non-cyclic transmission

Returns:

seconds since unix-epoch

void setReportedAt_ms(std::uint_fast64_t timestamp_ms)

set timestamp of last outgoing transmission from server to client

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

handle remote point update, execute python callback

Parameters:

message – incoming messsage 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

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, CS101_QualifierOfCommand qualifier = CS101_QualifierOfCommand::NONE)

transmit point

Parameters:
  • cause – cause of transmission

  • qualifier – parameter for command duration

Throws:

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

Returns:

success information

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_fast32_t dp_report_ms = 0, std::uint_fast32_t dp_related_ioa = 0, bool dp_related_auto_return = false, CommandTransmissionMode dp_cmd_mode = DIRECT_COMMAND)

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

  • dp_related_auto_return – auto transmit related point on command

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

Throws:

std::invalid_argument – if type is invalid