• Skip to main content
  • Skip to header right navigation
  • Skip to site footer
CDP Studio logo

CDP Studio

The no-code and full-code software development tool for distributed control systems and HMI

  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Product
    • Design UI
    • Develop
    • Analyze and test
    • Deploy
    • Framework and toolbox
    • Compatibility
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - CDP Core
  • ApplicationConnector
  • 4.11.3

ApplicationConnector Class

Connected application list item with message sending capability. This class is used by Messenger. More...

Header: #include <CDPSystem/Messenger/ApplicationConnector.h>
Inherits: CDP::StudioAPI::CDPNode
  • List of all members, including inherited members

Public Functions

ApplicationConnector()
virtual ~ApplicationConnector()
int CDPversion_Major() const
int CDPversion_Minor() const
void Clear()
double GetBlockingTimer()
double GetMaxBlockingTimer()
void Init(const char *name, const IpAddress &ipRemote, const IpAddress &ipLocal, int _appHandle, unsigned short brPort, const IpAddress &ipStudioAPI, int CDPversionMajor, int CDPversionMinor, CDP::StudioAPI::ICDPNode *ownerNode = NULL)
IpAddress &Ip()
IpAddress &IpLocal()
bool IsFree() const
unsigned short LargestBroadcastPort() const
bool Matches(unsigned int ipAddress1, unsigned short port1)
char *Name()
void ResetMaxBlockingTimer()
bool ResetTimeoutAndUpdateSendFlag()
int SendBroadcastMessage(MessageTransportPacket *message)
int SendMessage(MessageTransportPacket *message, int bufferIndex)
void SetName(const char *name)
void SetStudioAPIIpAddress(const IpAddress &addr)
const IpAddress &StudioAPIIpAddress() const
bool Timeout()
bool VerifyIPAddress(int32_t otherAppIpAddress, unsigned short _port)

Reimplemented Public Functions

virtual unsigned int GetNodeID() const override
virtual const std::string GetNodeName() const override
virtual ICDPNode *GetNodeOwner() const override
virtual CDP::StudioAPI::CDPNodeType GetNodeType() const override
virtual std::string GetNodeTypeName() const override
virtual bool IsNodeLocal() const override
  • 26 public functions inherited from CDP::StudioAPI::CDPNode
  • 22 public functions inherited from CDP::StudioAPI::ICDPNode

Static Public Members

void CloseStaticSendSockets()

Additional Inherited Members

  • 1 protected function inherited from CDP::StudioAPI::CDPNode

Detailed Description

Connected application list item with message sending capability. This class is used by Messenger.

See also Messenger.

Member Function Documentation

ApplicationConnector::ApplicationConnector()

Default constructs an instance of ApplicationConnector.

[virtual] ApplicationConnector::~ApplicationConnector()

Destroys the instance of ApplicationConnector. The destructor is virtual.

int ApplicationConnector::CDPversion_Major() const

Returns the CDP version major number

int ApplicationConnector::CDPversion_Minor() const

Returns the CDP version minor number

void ApplicationConnector::Clear()

Close connection to remote application.

[static] void ApplicationConnector::CloseStaticSendSockets()

Will call Close() on udpSend and udpBroadcast. Called from Messenger::Destroy().

double ApplicationConnector::GetBlockingTimer()

Get the last measured BlockingTimeout.

double ApplicationConnector::GetMaxBlockingTimer()

Get the last max BlockingTimeout.

[s] dMaxBlockingTimer filtered like this: no filtereng when value increases, decreasing with 1% of difference when value decreases.

Returns the time of the highest blocking time since last ResetMaxBlockingTimner [s].

[override virtual] unsigned int ApplicationConnector::GetNodeID() const

Reimplemented from ICDPNode::GetNodeID().

Returns the application handle

[override virtual] const std::string ApplicationConnector::GetNodeName() const

Reimplemented from ICDPNode::GetNodeName().

Returns the name of the application

[override virtual] ICDPNode *ApplicationConnector::GetNodeOwner() const

Reimplemented from ICDPNode::GetNodeOwner().

[override virtual] CDP::StudioAPI::CDPNodeType ApplicationConnector::GetNodeType() const

Reimplemented from ICDPNode::GetNodeType().

Returns e_CDP_APPLICATION_NODE

[override virtual] std::string ApplicationConnector::GetNodeTypeName() const

Reimplemented from ICDPNode::GetNodeTypeName().

Returns APPLICATION_CLASS_NAME

void ApplicationConnector::Init(const char *name, const IpAddress &ipRemote, const IpAddress &ipLocal, int _appHandle, unsigned short brPort, const IpAddress &ipStudioAPI, int CDPversionMajor, int CDPversionMinor, CDP::StudioAPI::ICDPNode *ownerNode = NULL)

Initialise remote application connection.

Parameter name (char*)Remote name.
Parameter ipRemote (const IpAddress&)Remote ip address.
Parameter ipLocal (const IpAddress&)Local ip address. Identifies which adapter which should be used as sender. Important for VPN solutions.
Parameter _appHandle (int)The application unique handle.
Parameter brPort (unsigned short)Remote largest broadcast port used.
Parameter ipStudioAPI (const IpAddress&)Remote StudioAPI's IP Address (and Port).
Parameter CDPversionMajor (int)Remote CDP_VERSION_MAJOR (value 2 if unknown).
Parameter CDPversionMinor (int)Remote CDP_VERSION_MINOR (value 3 if unknown).
Parameter ownerNode (CDP::StudioAPI::ICDPNode*)Owner (pointer to Messenger instance).

IpAddress &ApplicationConnector::Ip()

Returns ApplicationConnector's ipRemote.

IpAddress contain both address and port information for remote application.

IpAddress &ApplicationConnector::IpLocal()

Returns ApplicationConnector's ipLocal. IpAddress contain both address and port information for local application.

bool ApplicationConnector::IsFree() const

Returns true if this ApplicationConnector is unused.

[override virtual] bool ApplicationConnector::IsNodeLocal() const

Reimplemented from ICDPNode::IsNodeLocal().

Returns false

unsigned short ApplicationConnector::LargestBroadcastPort() const

Returns ApplicationConnector's remote largest broadcast portnumber used.

bool ApplicationConnector::Matches(unsigned int ipAddress1, unsigned short port1)

Returns true if this ApplicationConnector matches the info provided otherAppName is the Application name to compare with. ipAddress1 is the first IPAddress to compare with. port1 is the first port to compare with. ipAddress2 is the second IPAddress to compare with. port2 is the second port to compare with.

char *ApplicationConnector::Name()

Read remote application name.

void ApplicationConnector::ResetMaxBlockingTimer()

Reset the last max BlockingTimeout.

bool ApplicationConnector::ResetTimeoutAndUpdateSendFlag()

m_dTimeout is reset to new value (CDPTime::GetGlobalTimeFromHardware() + m_dDisconnectTimeout).

  • sendIpPair is set to true (indicating that we can send on specified interface).
  • Returns true if was timed out previous (sendIpPair was false).

int ApplicationConnector::SendBroadcastMessage(MessageTransportPacket *message)

Broadcast a message.

This method is called by Messenger::GetInstance()->ProcessSend(). Return values

  • 0: Message sent OK
  • -1: Message not sent (an error occurred, usually a socket-error)
Parameter messageThe message to be sent.

int ApplicationConnector::SendMessage(MessageTransportPacket *message, int bufferIndex)

Send message to remote application.

Return-values:

  • 0: Message sent OK
  • -1: Message not sent (an error occurred, usually a socket-error)

void ApplicationConnector::SetName(const char *name)

Set the name of remote application.

void ApplicationConnector::SetStudioAPIIpAddress(const IpAddress &addr)

const IpAddress &ApplicationConnector::StudioAPIIpAddress() const

Returns ApplicationConnector's remote StudioAPI ip address. IpAddress contain both address and port information.

bool ApplicationConnector::Timeout()

Returns true if ApplicationConnector to remote application has timed out (not received notify for a period). If this ApplicationConnector is not used/occupied, false is returned.

bool ApplicationConnector::VerifyIPAddress(int32_t otherAppIpAddress, unsigned short _port)

Verifies if registered information about IP address(es) and port(s) in this connector matches info in received MessageApplicationNotify.

Returns true if information matches (OK).

The content of this document is confidential information not to be published without the consent of CDP Technologies AS.

CDP Technologies AS, www.cdpstudio.com

Get started with CDP Studio today

Let us help you take your great ideas and turn them into the products your customer will love.

Try CDP Studio for free
Why CDP Studio?

CDP Technologies AS
Hundsværgata 8,
P.O. Box 144
6001 Ålesund, Norway

Tel: +47 990 80 900
E-mail: info@cdptech.com

Company

About CDP

Contact us

Services

Partners

Blog

Developers

Get started

User manuals

Support

Document download

Release notes

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

    © Copyright 2022 CDP Technologies. Privacy and cookie policy.

    Return to top