epics-base / pva2pva

PV Access gateway/proxy and EPICS Process Database integration
https://epics-base.github.io/pva2pva/
Other
4 stars 13 forks source link

info() to mark waveform w/ FTVL=CHAR as "long string" #17

Open mdavidsaver opened 6 years ago

mdavidsaver commented 6 years ago

Need a way to mark to a waveform of characters as being a "string".

mdavidsaver commented 6 years ago

Also, a flag info() or server side filter to treat DBF_LONG as DBF_ULONG as existing drivers have been storing unsigned as signed (cf. longinRecord).

mdavidsaver commented 5 years ago

Should also handle DBF_*LINK automatically as long strings.

anjohnson commented 5 years ago

Just spotted "waveform of characters" — please don't use the word "waveform" to mean "array"…

Good points, but please discuss your proposed solution(s) before completing any implementation. I'm not looking to bike-shed this, but I think we should get agreement between the core dev's about how to handle this extra metadata.

mdavidsaver commented 5 years ago

I'm not looking to bike-shed this

Now don't disappoint me Andrew! I expect you to bike-shed this ... once.

As a starting point, how about:

info(Q:format, "String")

Where Q:format would have to be one of the defined enumerations of the "display.format" field. Which I realize haven't been recorded in #19.

coretl commented 1 year ago

5 years later I'm in need of this. I tried Q:form but it doesn't seem to change anything apart from display.form:

record(waveform, "STRING:PLEASE")
{
    field(NELM, 6500)
    field(FTVL, "CHAR")
    field(INP, {const:"A very long label, longer than 40 characters, that needs a waveform"})
    info(Q:form, "String")
}
$ caget -S STRING:PLEASE
STRING:PLEASE A very long label, longer than 40 characters, that needs a waveform
$ pvget -v STRING:PLEASE
STRING:PLEASE epics:nt/NTScalarArray:1.0 
    byte[] value [65,32,118,101,114,121,32,108,111,110,103,32,108,97,98,101,108,44,32,108,111,110,103,101,114,32,116,104,97,110,32,52,48,32,99,104,97,114,97,99,116,101,114,115,44,32,116,104,97,116,32,110,101,101,100,115,32,97,32,119,97,118,101,102,111,114,109,0]
    alarm_t alarm INVALID DRIVER UDF 
        int severity 3
        int status 2
        string message UDF
    time_t timeStamp <undefined>              
        long secondsPastEpoch 631152000
        int nanoseconds 0
        int userTag 0
    structure display
        double limitLow 0
        double limitHigh 0
        string description 
        string units 
        int precision 0
        enum_t form (1) String
            int index 1
            string[] choices [Default, String, Binary, Decimal, Hex, Exponential, Engineering]
    control_t control
        double limitLow 0
        double limitHigh 0
        double minStep 0
    valueAlarm_t valueAlarm
        boolean active false
        double lowAlarmLimit nan
        double lowWarningLimit nan
        double highWarningLimit nan
        double highAlarmLimit nan
        int lowAlarmSeverity 0
        int lowWarningSeverity 0
        int highWarningSeverity 0
        int highAlarmSeverity 0
        byte hysteresis 0

Is there a way to make this work?

coretl commented 1 year ago

An lsi record very nearly does what I want...

record(lsi, "STRING:PLEASE")
{
    field(SIZV, 6500)
    field(INP, {const:"A very long label, longer than 40 characters, that needs a waveform"})
}
$ caget -S STRING:PLEASE.VAL$
STRING:PLEASE.VAL$ A very long label, longer than 40 characters, that needs a waveform
$ pvget -v STRING:PLEASE
STRING:PLEASE epics:nt/NTScalar:1.0 
    string value "A very long label, longer than 40 chara"
    alarm_t alarm INVALID DRIVER UDF 
        int severity 3
        int status 2
        string message UDF
    time_t timeStamp <undefined>              
        long secondsPastEpoch 631152000
        int nanoseconds 0
        int userTag 0
    structure display
        double limitLow 0
        double limitHigh 0
        string description 
        string units 
        int precision 0
        enum_t form (0) Default
            int index 0
            string[] choices [Default, String, Binary, Decimal, Hex, Exponential, Engineering]
    control_t control
        double limitLow 0
        double limitHigh 0
        double minStep 0

I may have missed something though, I've never used an lsi record before...