[etherlab-dev] PdServ library

Richard Hacker ha at igh.de
Thu May 19 00:25:14 CEST 2016


On 11.04.2016 11:04, Philippe Leuba wrote:
> Hi,
>
> First, I want to congratulate you for this very good  and efficient
> library and the accompanying Test Manager and DLS.
Thank you :)

>
> But I face some issues:
> - pdserv_parameter allows defining an access mode, but I did not see any
> effect in Test Manager
At the moment the access mode is not used. It is reserved for future use.

> -  pdserv_parameter allows defining a callback to have a chance to
> modify data before copying it, is the updated value  expected to be
> reported back to Test Manager ?
Test Manager will always get the updated value.

> - pdserv_event_set allows setting and resetting an event, like a state.
> How to deal with a punctual event, if we set it and reset it
> immediately, it seems not to be sent ?
pdserv_event_set() is used to report "process errors", such as 
monitoring whether a value exceeds a limit or a timer has timed out 
waiting for something to occur. It converts a signal, aka a stream of 
values, into an event with a time stamp.

The event's state is managed internally for every element of the vector. 
A change from false (the default state) from a previous call to true in 
the current call will set the event. Likewise a change from true to 
false will reset the event. Any change is logged to syslog, as well as 
notifying clients such as dls, TestManager and pdcom clients.

Calling pdserv_event_set() with no change in the "state" parameter from 
one call to another has no effect.

A typical use is inside your cyclic loop:

<code>
while (true) {
    // ...
    // read pressure from sensor
    // ..
    pdserv_event_set(overpressure_event, 0, pressure > 5, current_time);
    // ...

    pdserv_update_statistics(...);
    pdserv_update(...);
    sleep(delay);
}
</code>

 From the description above, two consecutive calls in the same 
calculation cycle, once with true and once with false, does not make 
much sense and the result thereof is not guaranteed. There can only be 
one change in one calculation cycle.

>
> Best regards
>
> Philippe Leuba


More information about the etherlab-dev mailing list