• 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

  • Doc
  • Why CDP
    • Software developers
    • Automation engineers
    • Managers
  • Products
    • Automation Designer
    • HMI Designer
    • CDP Linux
  • Services
  • Use cases
  • Pricing
  • Try CDP

CDP Studio Documentation

  • Framework - CDP Core
  • CDPParameterTimerMs
  • 5.1.0

CDPParameterTimerMs Class

CDPTimerMs with timeout specified as CDPParameter parameter. This object behaves as a CDPParameter and a CDPTimerMs at the same time. It should be used as a CDPTimerMs object except that the timeout value should be set in the configuration instead of being hardcoded. More...

Header: #include <CDPParameterTimerMs>
Inherits: CDPParameter
  • List of all members, including inherited members

Public Functions

CDPParameterTimerMs()
virtual void Configure(const char *xml) override
void Configure(XMLElementEx *pParameterElement) override
virtual void Create(const char *shortName, CDPComponent *pParent) override
double Delay()
double DeltaTime()
virtual void Destroy() override
virtual void FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const override
double Frequency()
bool IsRunning()
double LastTime()
void Reset(double delay)
void Reset()
void Restart()
void Set()
virtual void Start()
bool State()
double TimeElapsed()
bool TimedOut()

Reimplemented Public Functions

virtual void SetValue(double newValue) override
  • 24 public functions inherited from CDPParameter
  • 9 public functions inherited from ValueNode
  • 8 public functions inherited from CDP::StudioAPI::AbstractValueListener

Detailed Description

CDPTimerMs with timeout specified as CDPParameter parameter. This object behaves as a CDPParameter and a CDPTimerMs at the same time. It should be used as a CDPTimerMs object except that the timeout value should be set in the configuration instead of being hardcoded.

If the timer is used in a CDPComponent based class, the timer and it's values may show up in CDP Studio under the component's Timers section if Create() is called. In component's Create(), call myCDPParameterTimerMs.Create("MyCDPParameterTimerMs",this), and in component's Destroy(), call myCDPParameterTimerMs.Destroy().

Usage

Use as CDPTimerMs, but specify timeout in configuration as parameter.

The easiest way to add a CDPParameterTimerMs is to:

  • Add a CDPParameter using the CodeGenerator
  • Change the type in the header file from CDPParameter to CDPParameterTimerMs (and change the #include from CDPParameter.h to CDPTimerMs.h)
  • Use the variable as a CDPTimerMs. The timeout value will be read from configuration.

Example

// In header file
CDPParameterTimerMs myCDPParameterTimerMs;

// In Create()
myCDPParameterTimerMs.Create("MyCDPParameterTimerMs", this);

// In end of Configure() or Activate()
myCDPParameterTimerMs.Restart();      // Will start timing from now

// In ProcessSomething()
if (myCDPParameterTimerMs.TimedOut())
{
  myCDPParameterTimerMs.Restart();    // Start new timing cycle
  CDPMessage("Will be written every time the period specified in the parameter times out.\n")
}

See also CDPTimerMs, CDPParameter, CDPParameterTimer, CDPTimer, OSAPIPeriodicTimer, OSAPIOneShotTimer, CDPTimerCounting, and CDPRampTimer.

Member Function Documentation

CDPParameterTimerMs::CDPParameterTimerMs()

Default constructs an instance of CDPParameterTimerMs.

[override virtual] void CDPParameterTimerMs::Configure(const char *xml)

Configures CDPParameter from an xml-string and sets up the timer.

void CDPParameterTimerMs::Configure(XMLElementEx *pParameterElement)

Configures CDPParameter from an xml element and sets up the timer.

[override virtual] void CDPParameterTimerMs::Create(const char *shortName, CDPComponent *pParent)

Calls CDPParameter::Create(), m_cTimer.Create() and sets up callback when m_timeoutDelay changes.

CDPParameter::Create() will be called with shortName, while m_cTimer.Create() will be called with shortName+"Timer" (to avoid same name for these objects).

double CDPParameterTimerMs::Delay()

Returns the delay set by Reset(delay).

double CDPParameterTimerMs::DeltaTime()

Returns time [s] between last two TimedOut() calls.

[override virtual] void CDPParameterTimerMs::Destroy()

Destroys the CDPParameter and timer instance.

[override virtual] void CDPParameterTimerMs::FillNodeChildren(CDP::StudioAPI::NodeStream &stream) const

Writes its CDPSettings to stream.

double CDPParameterTimerMs::Frequency()

Returns frequency in Hz of time interval between last two TimedOut() calls (equals 1.0/DeltaTime()).

bool CDPParameterTimerMs::IsRunning()

Returns true if timer is running.

double CDPParameterTimerMs::LastTime()

Returns time [s] (since application startup), as calculated by the previous TimedOut() call.

void CDPParameterTimerMs::Reset(double delay)

Resets and sets specified delay timeout in seconds.

Stores the parameter-value and resets the timer.

void CDPParameterTimerMs::Reset()

Resets and sets delay timeout in seconds with value from CDPParameter.

Will call m_cTimer.Reset(Value()).

void CDPParameterTimerMs::Restart()

Resets and starts the timer with value from CDPParameter

void CDPParameterTimerMs::Set()

Sets the timeout flag state to true.

[override virtual] void CDPParameterTimerMs::SetValue(double newValue)

Reimplemented from CDPParameter::SetValue().

Sets the parameter-value and resets the timer with the new timeout. If the timer was running, it is started again.

[virtual] void CDPParameterTimerMs::Start()

Deprecated, use Restart() instead.

bool CDPParameterTimerMs::State()

Returns the state of the timeout flag as calculated by the previous TimedOut() call.

double CDPParameterTimerMs::TimeElapsed()

Returns time [s] elapsed since Start() or Restart() was called.

bool CDPParameterTimerMs::TimedOut()

Updates delta time, checks if timeout and returns true if timeout.

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

My account

Follow CDP

  • LinkedIn
  • YouTube
  • GitHub

© Copyright 2026 CDP Technologies. Privacy and cookie policy.

Return to top